From 1d5aa74ac3a3967401dd4028d846403ce6c2011c Mon Sep 17 00:00:00 2001 From: Ricardo Buring Date: Sat, 15 Oct 2022 12:01:04 +0200 Subject: GDExtension: add support for abstract and virtual classes --- core/object/class_db.cpp | 5 ++++- core/object/object.h | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'core/object') diff --git a/core/object/class_db.cpp b/core/object/class_db.cpp index ca56add2ab..41585943b3 100644 --- a/core/object/class_db.cpp +++ b/core/object/class_db.cpp @@ -1528,7 +1528,10 @@ void ClassDB::register_extension_class(ObjectNativeExtension *p_extension) { c.api = p_extension->editor_class ? API_EDITOR_EXTENSION : API_EXTENSION; c.native_extension = p_extension; c.name = p_extension->class_name; - c.creation_func = parent->creation_func; + c.is_virtual = p_extension->is_virtual; + if (!p_extension->is_abstract) { + c.creation_func = parent->creation_func; + } c.inherits = parent->name; c.class_ptr = parent->class_ptr; c.inherits_ptr = parent; diff --git a/core/object/object.h b/core/object/object.h index 5ba5453b31..359ab0f211 100644 --- a/core/object/object.h +++ b/core/object/object.h @@ -295,6 +295,8 @@ struct ObjectNativeExtension { StringName parent_class_name; StringName class_name; bool editor_class = false; + bool is_virtual = false; + bool is_abstract = false; GDNativeExtensionClassSet set; GDNativeExtensionClassGet get; GDNativeExtensionClassGetPropertyList get_property_list; -- cgit v1.2.3