godotengine / godotengine/godot-cpp

[GDExtensions] Classes inheriting from VisualInstance3D don't register

Open
#713 0 comments 0 reactions 0 assignees View on GitHub
bug topic:gdextension
Dominant language
C++
Stars
2.7k
Forks
809
Avg merge
1d 3h
Merged PRs (30d)
8

Description

(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.)

```cpp
#include

#include

#include
#include
#include

#include

#include

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();
}

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();
}
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.