You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-16 14:00:40 +00:00
Fix GDExtension classes derived from abstract GDExtension classes always being registered as abstract
This commit is contained in:
@@ -1661,7 +1661,15 @@ void ClassDB::register_extension_class(ObjectGDExtension *p_extension) {
|
|||||||
c.name = p_extension->class_name;
|
c.name = p_extension->class_name;
|
||||||
c.is_virtual = p_extension->is_virtual;
|
c.is_virtual = p_extension->is_virtual;
|
||||||
if (!p_extension->is_abstract) {
|
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.inherits = parent->name;
|
||||||
c.class_ptr = parent->class_ptr;
|
c.class_ptr = parent->class_ptr;
|
||||||
|
|||||||
Reference in New Issue
Block a user