diff options
author | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2021-09-22 18:33:29 +0200 |
---|---|---|
committer | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2021-09-22 18:33:29 +0200 |
commit | f9ce9a8e103b4b53ad3de032220c3e8799d52409 (patch) | |
tree | 0c69f4c5ce2ae3f362cf22adaf2b7bab38d03828 /core/object | |
parent | f724bd1880ba9633e3f2dd530775dc0535d9cc17 (diff) |
[ClassDB] Unify construct/extension retrieval.
Diffstat (limited to 'core/object')
-rw-r--r-- | core/object/class_db.cpp | 10 | ||||
-rw-r--r-- | core/object/class_db.h | 2 |
2 files changed, 7 insertions, 5 deletions
diff --git a/core/object/class_db.cpp b/core/object/class_db.cpp index 05b3dde4ed..8ba46e49eb 100644 --- a/core/object/class_db.cpp +++ b/core/object/class_db.cpp @@ -545,10 +545,12 @@ Object *ClassDB::instantiate(const StringName &p_class) { return ti->creation_func(); } -Object *ClassDB::construct_extended(Object *(*p_create_func)(), ObjectNativeExtension *p_extension) { - initializing_with_extension = true; - initializing_extension = p_extension; - initializing_extension_instance = p_extension->create_instance(p_extension->class_userdata); +Object *ClassDB::construct_object(Object *(*p_create_func)(), ObjectNativeExtension *p_extension) { + if (p_extension) { + initializing_with_extension = true; + initializing_extension = p_extension; + initializing_extension_instance = p_extension->create_instance(p_extension->class_userdata); + } return p_create_func(); } diff --git a/core/object/class_db.h b/core/object/class_db.h index 0ba9d5903c..3a1cbf8559 100644 --- a/core/object/class_db.h +++ b/core/object/class_db.h @@ -234,7 +234,7 @@ public: static bool is_parent_class(const StringName &p_class, const StringName &p_inherits); static bool can_instantiate(const StringName &p_class); static Object *instantiate(const StringName &p_class); - static Object *construct_extended(Object *(*p_create_func)(), ObjectNativeExtension *p_extension); + static Object *construct_object(Object *(*p_create_func)(), ObjectNativeExtension *p_extension); static void instance_get_native_extension_data(ObjectNativeExtension **r_extension, GDExtensionClassInstancePtr *r_extension_instance, Object *p_base); static APIType get_api_type(const StringName &p_class); |