diff options
author | Rémi Verschelde <remi@verschelde.fr> | 2023-04-12 23:19:27 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-12 23:19:27 +0200 |
commit | 5860b02b63943bd5c75c14244cb6b92fd4382ccc (patch) | |
tree | 6168ce65a1292dcdf1790a8e13d83b185b04f0f9 /core/variant/callable.cpp | |
parent | d4dad2b2f88968ff329145f3dab5290478bae886 (diff) | |
parent | 33f674d0f7e94b768cd957a920fed8a215760ee2 (diff) | |
download | redot-engine-5860b02b63943bd5c75c14244cb6b92fd4382ccc.tar.gz |
Merge pull request #71644 from RandomShaper/mq_call_static
Complete support of callables of static methods
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())); } |