mirror of
https://github.com/godotengine/godot.git
synced 2024-11-25 21:52:51 +00:00
Fix GDExtension classes derived from abstract GDExtension classes always being registered as abstract
This commit is contained in:
parent
8e0346bade
commit
acf9d4e4de
@ -1661,7 +1661,15 @@ void ClassDB::register_extension_class(ObjectGDExtension *p_extension) {
|
||||
c.name = p_extension->class_name;
|
||||
c.is_virtual = p_extension->is_virtual;
|
||||
if (!p_extension->is_abstract) {
|
||||
c.creation_func = parent->creation_func;
|
||||
// Find the closest ancestor which is either non-abstract or native (or both).
|
||||
ClassInfo *concrete_ancestor = parent;
|
||||
while (concrete_ancestor->creation_func == nullptr &&
|
||||
concrete_ancestor->inherits_ptr != nullptr &&
|
||||
concrete_ancestor->gdextension != nullptr) {
|
||||
concrete_ancestor = concrete_ancestor->inherits_ptr;
|
||||
}
|
||||
ERR_FAIL_NULL_MSG(concrete_ancestor->creation_func, "Extension class " + String(p_extension->class_name) + " cannot extend native abstract class " + String(concrete_ancestor->name));
|
||||
c.creation_func = concrete_ancestor->creation_func;
|
||||
}
|
||||
c.inherits = parent->name;
|
||||
c.class_ptr = parent->class_ptr;
|
||||
|
Loading…
Reference in New Issue
Block a user