summaryrefslogtreecommitdiff
path: root/core/variant_call.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/variant_call.cpp')
-rw-r--r--core/variant_call.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/core/variant_call.cpp b/core/variant_call.cpp
index 5fd970c8e1..6ee63e1610 100644
--- a/core/variant_call.cpp
+++ b/core/variant_call.cpp
@@ -586,6 +586,7 @@ struct _VariantCall {
VCALL_LOCALMEM0(Callable, get_object_id);
VCALL_LOCALMEM0(Callable, get_method);
VCALL_LOCALMEM0(Callable, hash);
+ VCALL_LOCALMEM1R(Callable, unbind);
VCALL_LOCALMEM0R(Signal, is_null);
VCALL_LOCALMEM0R(Signal, get_object);
@@ -1347,11 +1348,14 @@ void Variant::call_ptr(const StringName &p_method, const Variant **p_args, int p
if (p_method == CoreStringNames::get_singleton()->call) {
reinterpret_cast<const Callable *>(_data._mem)->call(p_args, p_argcount, ret, r_error);
valid = true;
- }
- if (p_method == CoreStringNames::get_singleton()->call_deferred) {
+ } else if (p_method == CoreStringNames::get_singleton()->call_deferred) {
reinterpret_cast<const Callable *>(_data._mem)->call_deferred(p_args, p_argcount);
valid = true;
+ } else if (p_method == CoreStringNames::get_singleton()->bind) {
+ ret = reinterpret_cast<const Callable *>(_data._mem)->bind(p_args, p_argcount);
+ valid = true;
}
+
} else if (type == SIGNAL) {
if (p_method == CoreStringNames::get_singleton()->emit) {
if (r_ret) {
@@ -1696,9 +1700,13 @@ void Variant::get_method_list(List<MethodInfo> *p_list) const {
if (type == CALLABLE) {
MethodInfo mi;
+
+ mi.name = "bind";
+ mi.flags |= METHOD_FLAG_VARARG;
+ p_list->push_back(mi);
+
mi.name = "call";
mi.return_val.usage = PROPERTY_USAGE_NIL_IS_VARIANT;
- mi.flags |= METHOD_FLAG_VARARG;
p_list->push_back(mi);
@@ -2130,6 +2138,7 @@ void register_variant_methods() {
ADDFUNC0R(CALLABLE, INT, Callable, get_object_id, varray());
ADDFUNC0R(CALLABLE, STRING_NAME, Callable, get_method, varray());
ADDFUNC0R(CALLABLE, INT, Callable, hash, varray());
+ ADDFUNC1R(CALLABLE, CALLABLE, Callable, unbind, INT, "argcount", varray());
ADDFUNC0R(SIGNAL, BOOL, Signal, is_null, varray());
ADDFUNC0R(SIGNAL, OBJECT, Signal, get_object, varray());