diff options
Diffstat (limited to 'core/object/object.h')
-rw-r--r-- | core/object/object.h | 33 |
1 files changed, 9 insertions, 24 deletions
diff --git a/core/object/object.h b/core/object/object.h index 6b4f1c81e6..c3e3c68b59 100644 --- a/core/object/object.h +++ b/core/object/object.h @@ -39,6 +39,7 @@ #include "core/templates/hash_map.h" #include "core/templates/list.h" #include "core/templates/map.h" +#include "core/templates/ordered_hash_map.h" #include "core/templates/safe_refcount.h" #include "core/templates/set.h" #include "core/templates/vmap.h" @@ -343,16 +344,6 @@ public: m_inherits::get_inheritance_list_static(p_inheritance_list); \ p_inheritance_list->push_back(String(#m_class)); \ } \ - static String get_category_static() { \ - String category = m_inherits::get_category_static(); \ - if (_get_category != m_inherits::_get_category) { \ - if (!category.is_empty()) { \ - category += "/"; \ - } \ - category += _get_category(); \ - } \ - return category; \ - } \ virtual bool is_class(const String &p_class) const override { \ if (_get_extension() && _get_extension()->is_class(p_class)) { \ return true; \ @@ -453,12 +444,6 @@ protected: \ private: -#define OBJ_CATEGORY(m_category) \ -protected: \ - _FORCE_INLINE_ static String _get_category() { return m_category; } \ - \ -private: - #define OBJ_SAVE_TYPE(m_class) \ public: \ virtual String get_save_class() const override { return #m_class; } \ @@ -530,13 +515,14 @@ private: #endif ScriptInstance *script_instance = nullptr; Variant script; // Reference does not exist yet, store it in a Variant. - Dictionary metadata; + OrderedHashMap<StringName, Variant> metadata; + HashMap<StringName, OrderedHashMap<StringName, Variant>::Element> metadata_properties; mutable StringName _class_name; mutable const StringName *_class_ptr = nullptr; void _add_user_signal(const String &p_name, const Array &p_args = Array()); bool _has_user_signal(const StringName &p_name) const; - Variant _emit_signal(const Variant **p_args, int p_argcount, Callable::CallError &r_error); + Error _emit_signal(const Variant **p_args, int p_argcount, Callable::CallError &r_error); Array _get_signal_list() const; Array _get_signal_connection_list(const String &p_signal) const; Array _get_incoming_connections() const; @@ -552,8 +538,8 @@ private: std::mutex _instance_binding_mutex; struct InstanceBinding { - void *binding; - void *token; + void *binding = nullptr; + void *token = nullptr; GDNativeInstanceBindingFreeCallback free_callback = nullptr; GDNativeInstanceBindingReferenceCallback reference_callback = nullptr; }; @@ -588,7 +574,6 @@ protected: virtual void _get_property_listv(List<PropertyInfo> *p_list, bool p_reversed) const {}; virtual void _notificationv(int p_notification, bool p_reversed) {} - static String _get_category() { return ""; } static void _bind_methods(); bool _set(const StringName &p_name, const Variant &p_property) { return false; }; bool _get(const StringName &p_name, Variant &r_property) const { return false; }; @@ -648,6 +633,7 @@ public: bool _is_gpl_reversed() const { return false; } + void detach_from_objectdb(); _FORCE_INLINE_ ObjectID get_instance_id() const { return _instance_id; } template <class T> @@ -692,7 +678,6 @@ public: static String get_class_static() { return "Object"; } static String get_parent_class_static() { return String(); } - static String get_category_static() { return String(); } virtual String get_class() const { if (_extension) { @@ -761,7 +746,7 @@ public: bool has_meta(const StringName &p_name) const; void set_meta(const StringName &p_name, const Variant &p_value); void remove_meta(const StringName &p_name); - Variant get_meta(const StringName &p_name) const; + Variant get_meta(const StringName &p_name, const Variant &p_default = Variant()) const; void get_meta_list(List<StringName> *p_list) const; #ifdef TOOLS_ENABLED @@ -865,7 +850,7 @@ class ObjectDB { uint64_t validator : OBJECTDB_VALIDATOR_BITS; uint64_t next_free : OBJECTDB_SLOT_MAX_COUNT_BITS; uint64_t is_ref_counted : 1; - Object *object; + Object *object = nullptr; }; static SpinLock spin_lock; |