godot-cpp icon indicating copy to clipboard operation
godot-cpp copied to clipboard

[GDExtensions] Classes inheriting from VisualInstance3D don't register

Open codecat opened this issue 3 years ago • 0 comments

(Using godot-cpp 1cbf121 and Godot 4 0393057e36e486b2944e6166e6572327944b2fa7, also tested with 4.0-alpha3.)

I'm trying to register a class that inherits from VisualInstance3D, but it doesn't show up in the "Create.." dialog. Classes like Control, Node3D, Camera3D all work, unless the class ultimately inherits from VisualInstance3D.

Inheriting from it directly or via any other class that inherits from it doesn't make it show up. For example Light3D or CSGCombiner3D.

There is nothing that shows up in the output log. (Though my Godot build is a release build rather than a debug build, so I might be missing some output.)

#include <godot/gdnative_interface.h>

#include <godot_cpp/godot.hpp>

#include <godot_cpp/core/class_db.hpp>
#include <godot_cpp/core/defs.hpp>
#include <godot_cpp/core/binder_common.hpp>

#include <godot_cpp/classes/csg_combiner3d.hpp>

#include <godot_cpp/variant/utility_functions.hpp>

using namespace godot;

class TestClass : public VisualInstance3D
{
	GDCLASS(TestClass, VisualInstance3D);

protected:
	static void _bind_methods() {}

public:
	TestClass() {}
	~TestClass() {}
};

void register_test_types()
{
	ClassDB::register_class<TestClass>();
}

void unregister_test_types()
{
}

extern "C"
{
	GDNativeBool GDN_EXPORT test_init(
		const GDNativeInterface *p_interface,
		const GDNativeExtensionClassLibraryPtr p_library,
		GDNativeInitialization *r_initialization
	) {
		GDExtensionBinding::InitObject init_obj(p_interface, p_library, r_initialization);

		init_obj.register_scene_initializer(register_test_types);
		init_obj.register_scene_terminator(unregister_test_types);

		return init_obj.init();
	}
}

codecat avatar Feb 27 '22 16:02 codecat