You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
Core: Decouple GDCLASS from ClassDB
This commit is contained in:
@@ -840,7 +840,7 @@ use_script:
|
||||
return scr.is_valid() && scr->is_valid() && scr->is_abstract();
|
||||
}
|
||||
|
||||
void ClassDB::_add_class2(const StringName &p_class, const StringName &p_inherits) {
|
||||
void ClassDB::_add_class(const StringName &p_class, const StringName &p_inherits) {
|
||||
Locker::Lock lock(Locker::STATE_WRITE);
|
||||
|
||||
const StringName &name = p_class;
|
||||
|
||||
@@ -78,6 +78,8 @@ MethodDefinition D_METHOD(const char *p_name, const VarArgs... p_args) {
|
||||
#endif
|
||||
|
||||
class ClassDB {
|
||||
friend class Object;
|
||||
|
||||
public:
|
||||
enum APIType {
|
||||
API_CORE,
|
||||
@@ -193,7 +195,7 @@ public:
|
||||
static APIType current_api;
|
||||
static HashMap<APIType, uint32_t> api_hashes_cache;
|
||||
|
||||
static void _add_class2(const StringName &p_class, const StringName &p_inherits);
|
||||
static void _add_class(const StringName &p_class, const StringName &p_inherits);
|
||||
|
||||
static HashMap<StringName, HashMap<StringName, Variant>> default_values;
|
||||
static HashSet<StringName> default_values_cached;
|
||||
@@ -221,12 +223,6 @@ private:
|
||||
static bool _can_instantiate(ClassInfo *p_class_info, bool p_exposed_only = true);
|
||||
|
||||
public:
|
||||
// DO NOT USE THIS!!!!!! NEEDS TO BE PUBLIC BUT DO NOT USE NO MATTER WHAT!!!
|
||||
template <typename T>
|
||||
static void _add_class() {
|
||||
_add_class2(T::get_class_static(), T::get_parent_class_static());
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static void register_class(bool p_virtual = false) {
|
||||
Locker::Lock lock(Locker::STATE_WRITE);
|
||||
|
||||
@@ -1590,7 +1590,7 @@ void Object::initialize_class() {
|
||||
if (initialized) {
|
||||
return;
|
||||
}
|
||||
ClassDB::_add_class<Object>();
|
||||
_add_class_to_classdb(get_class_static(), get_parent_class_static());
|
||||
_bind_methods();
|
||||
_bind_compatibility_methods();
|
||||
initialized = true;
|
||||
@@ -1666,6 +1666,14 @@ void Object::_clear_internal_resource_paths(const Variant &p_var) {
|
||||
}
|
||||
}
|
||||
|
||||
void Object::_add_class_to_classdb(const StringName &p_class, const StringName &p_inherits) {
|
||||
ClassDB::_add_class(p_class, p_inherits);
|
||||
}
|
||||
|
||||
void Object::_get_property_list_from_classdb(const StringName &p_class, List<PropertyInfo> *p_list, bool p_no_inheritance, const Object *p_validator) {
|
||||
ClassDB::get_property_list(p_class, p_list, p_no_inheritance, p_validator);
|
||||
}
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
void Object::editor_set_section_unfold(const String &p_section, bool p_unfolded, bool p_initializing) {
|
||||
if (!p_initializing) {
|
||||
|
||||
@@ -454,7 +454,7 @@ public:
|
||||
return; \
|
||||
} \
|
||||
m_inherits::initialize_class(); \
|
||||
::ClassDB::_add_class<m_class>(); \
|
||||
_add_class_to_classdb(get_class_static(), get_parent_class_static()); \
|
||||
if (m_class::_get_bind_methods() != m_inherits::_get_bind_methods()) { \
|
||||
_bind_methods(); \
|
||||
} \
|
||||
@@ -499,7 +499,7 @@ protected:
|
||||
m_inherits::_get_property_listv(p_list, p_reversed); \
|
||||
} \
|
||||
p_list->push_back(PropertyInfo(Variant::NIL, get_class_static(), PROPERTY_HINT_NONE, get_class_static(), PROPERTY_USAGE_CATEGORY)); \
|
||||
::ClassDB::get_property_list(#m_class, p_list, true, this); \
|
||||
_get_property_list_from_classdb(#m_class, p_list, true, this); \
|
||||
if (m_class::_get_get_property_list() != m_inherits::_get_get_property_list()) { \
|
||||
_get_property_list(p_list); \
|
||||
} \
|
||||
@@ -759,6 +759,9 @@ protected:
|
||||
friend class ClassDB;
|
||||
friend class PlaceholderExtensionInstance;
|
||||
|
||||
static void _add_class_to_classdb(const StringName &p_class, const StringName &p_inherits);
|
||||
static void _get_property_list_from_classdb(const StringName &p_class, List<PropertyInfo> *p_list, bool p_no_inheritance, const Object *p_validator);
|
||||
|
||||
bool _disconnect(const StringName &p_signal, const Callable &p_callable, bool p_force = false);
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
|
||||
Reference in New Issue
Block a user