summaryrefslogtreecommitdiff
path: root/core/class_db.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/class_db.cpp')
-rw-r--r--core/class_db.cpp33
1 files changed, 28 insertions, 5 deletions
diff --git a/core/class_db.cpp b/core/class_db.cpp
index 8800f51778..35e216a58f 100644
--- a/core/class_db.cpp
+++ b/core/class_db.cpp
@@ -335,6 +335,19 @@ StringName ClassDB::get_parent_class_nocheck(const StringName &p_class) {
return ti->inherits;
}
+StringName ClassDB::get_compatibility_remapped_class(const StringName &p_class) {
+
+ if (classes.has(p_class)) {
+ return p_class;
+ }
+
+ if (compat_classes.has(p_class)) {
+ return compat_classes[p_class];
+ }
+
+ return p_class;
+}
+
StringName ClassDB::get_parent_class(const StringName &p_class) {
OBJTYPE_RLOCK;
@@ -1020,7 +1033,7 @@ bool ClassDB::set_property(Object *p_object, const StringName &p_property, const
return true; //return true but do nothing
}
- Variant::CallError ce;
+ Callable::CallError ce;
if (psg->index >= 0) {
Variant index = psg->index;
@@ -1042,7 +1055,7 @@ bool ClassDB::set_property(Object *p_object, const StringName &p_property, const
}
if (r_valid)
- *r_valid = ce.error == Variant::CallError::CALL_OK;
+ *r_valid = ce.error == Callable::CallError::CALL_OK;
return true;
}
@@ -1065,12 +1078,12 @@ bool ClassDB::get_property(Object *p_object, const StringName &p_property, Varia
if (psg->index >= 0) {
Variant index = psg->index;
const Variant *arg[1] = { &index };
- Variant::CallError ce;
+ Callable::CallError ce;
r_value = p_object->call(psg->getter, arg, 1, ce);
} else {
- Variant::CallError ce;
+ Callable::CallError ce;
if (psg->_getptr) {
r_value = psg->_getptr->call(p_object, NULL, 0, ce);
@@ -1081,13 +1094,23 @@ bool ClassDB::get_property(Object *p_object, const StringName &p_property, Varia
return true;
}
- const int *c = check->constant_map.getptr(p_property);
+ const int *c = check->constant_map.getptr(p_property); //constants count
if (c) {
r_value = *c;
return true;
}
+ if (check->method_map.has(p_property)) { //methods count
+ r_value = Callable(p_object, p_property);
+ return true;
+ }
+
+ if (check->signal_map.has(p_property)) { //signals count
+ r_value = Signal(p_object, p_property);
+ return true;
+ }
+
check = check->inherits_ptr;
}