diff options
Diffstat (limited to 'core')
| -rw-r--r-- | core/object_type_db.cpp | 14 | ||||
| -rw-r--r-- | core/object_type_db.h | 1 |
2 files changed, 14 insertions, 1 deletions
diff --git a/core/object_type_db.cpp b/core/object_type_db.cpp index 7432c09563..f3bb37421f 100644 --- a/core/object_type_db.cpp +++ b/core/object_type_db.cpp @@ -258,12 +258,23 @@ void ClassDB::get_inheriters_from_class( const StringName& p_class,List<StringNa } +StringName ClassDB::get_parent_class_nocheck(const StringName& p_class) { + + OBJTYPE_RLOCK; + + ClassInfo *ti = classes.getptr(p_class); + if (!ti) + return StringName(); + return ti->inherits; + +} + StringName ClassDB::get_parent_class(const StringName& p_class) { OBJTYPE_RLOCK; ClassInfo *ti = classes.getptr(p_class); - ERR_FAIL_COND_V(!ti,""); + ERR_FAIL_COND_V(!ti,StringName()); return ti->inherits; } @@ -272,6 +283,7 @@ ClassDB::APIType ClassDB::get_api_type(const StringName &p_class) { OBJTYPE_RLOCK; ClassInfo *ti = classes.getptr(p_class); + ERR_FAIL_COND_V(!ti,API_NONE); return ti->api; } diff --git a/core/object_type_db.h b/core/object_type_db.h index 158a4dae23..f745e3d5fd 100644 --- a/core/object_type_db.h +++ b/core/object_type_db.h @@ -239,6 +239,7 @@ public: static void get_class_list( List<StringName> *p_classes); static void get_inheriters_from_class( const StringName& p_class,List<StringName> *p_classes); + static StringName get_parent_class_nocheck(const StringName& p_class); static StringName get_parent_class(const StringName& p_class); static bool class_exists(const StringName &p_class); static bool is_parent_class(const StringName &p_class,const StringName& p_inherits); |