diff options
Diffstat (limited to 'core/object/class_db.cpp')
-rw-r--r-- | core/object/class_db.cpp | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/core/object/class_db.cpp b/core/object/class_db.cpp index 08e12dfcaa..e09c6cb97c 100644 --- a/core/object/class_db.cpp +++ b/core/object/class_db.cpp @@ -1606,7 +1606,7 @@ Variant ClassDB::class_get_default_property_value(const StringName &p_class, con if (Engine::get_singleton()->has_singleton(p_class)) { c = Engine::get_singleton()->get_singleton_object(p_class); cleanup_c = false; - } else if (ClassDB::can_instantiate(p_class)) { + } else if (ClassDB::can_instantiate(p_class) && !ClassDB::is_virtual(p_class)) { c = ClassDB::instantiate(p_class); cleanup_c = true; } @@ -1694,6 +1694,30 @@ void ClassDB::unregister_extension_class(const StringName &p_class) { classes.erase(p_class); } +Map<StringName, ClassDB::NativeStruct> ClassDB::native_structs; +void ClassDB::register_native_struct(const StringName &p_name, const String &p_code, uint64_t p_current_size) { + NativeStruct ns; + ns.ccode = p_code; + ns.struct_size = p_current_size; + native_structs[p_name] = ns; +} + +void ClassDB::get_native_struct_list(List<StringName> *r_names) { + for (const KeyValue<StringName, NativeStruct> &E : native_structs) { + r_names->push_back(E.key); + } +} + +String ClassDB::get_native_struct_code(const StringName &p_name) { + ERR_FAIL_COND_V(!native_structs.has(p_name), String()); + return native_structs[p_name].ccode; +} + +uint64_t ClassDB::get_native_struct_size(const StringName &p_name) { + ERR_FAIL_COND_V(!native_structs.has(p_name), 0); + return native_structs[p_name].struct_size; +} + RWLock ClassDB::lock; void ClassDB::cleanup_defaults() { @@ -1717,6 +1741,7 @@ void ClassDB::cleanup() { classes.clear(); resource_base_extensions.clear(); compat_classes.clear(); + native_structs.clear(); } // |