diff options
Diffstat (limited to 'core/variant/callable.cpp')
-rw-r--r-- | core/variant/callable.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/core/variant/callable.cpp b/core/variant/callable.cpp index 2f2acc55a6..630873ec2e 100644 --- a/core/variant/callable.cpp +++ b/core/variant/callable.cpp @@ -122,7 +122,11 @@ Callable Callable::unbind(int p_argcount) const { } bool Callable::is_valid() const { - return get_object() && (is_custom() || get_object()->has_method(get_method())); + if (is_custom()) { + return get_custom()->is_valid(); + } else { + return get_object() && get_object()->has_method(get_method()); + } } Object *Callable::get_object() const { @@ -373,6 +377,11 @@ Callable::~Callable() { } } +bool CallableCustom::is_valid() const { + // Sensible default implementation so most custom callables don't need their own. + return ObjectDB::get_instance(get_object()); +} + StringName CallableCustom::get_method() const { ERR_FAIL_V_MSG(StringName(), vformat("Can't get method on CallableCustom \"%s\".", get_as_text())); } |