diff options
author | Juan Linietsky <juan@godotengine.org> | 2020-02-19 16:27:19 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2020-02-20 08:24:50 +0100 |
commit | 69c95f4b4c128a22777af1e155bc24c7033decca (patch) | |
tree | 0add52fc270f808b4b2ad0bf7c970d72338c667e /core/class_db.cpp | |
parent | 1a4be2cd8fdd9ba26f016f3e2d83febfe8ae141c (diff) |
Reworked signal connection system, added support for Callable and Signal objects and made them default.
Diffstat (limited to 'core/class_db.cpp')
-rw-r--r-- | core/class_db.cpp | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/core/class_db.cpp b/core/class_db.cpp index a2941d70f6..35e216a58f 100644 --- a/core/class_db.cpp +++ b/core/class_db.cpp @@ -1033,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; @@ -1055,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; } @@ -1078,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); @@ -1094,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; } |