diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2023-10-05 10:09:45 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2023-10-05 10:09:45 +0200 |
commit | 5cee7b02640f1223f478504ca136d1cc0806e5b9 (patch) | |
tree | 91a8477350bfe7c4c4be2f3bd48f7608da4b7ac7 /core/object/object.cpp | |
parent | 5c26550b862da9c03dfda3f5994ccc480fcac44a (diff) | |
parent | ed0b3c08e15ee6345ece4b135a5e99870a8fc79f (diff) | |
download | redot-engine-5cee7b02640f1223f478504ca136d1cc0806e5b9.tar.gz |
Merge pull request #82767 from dalexeev/core-make-object-has-method-virtual
Core: Fix `Object::has_method()` for script static methods
Diffstat (limited to 'core/object/object.cpp')
-rw-r--r-- | core/object/object.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/core/object/object.cpp b/core/object/object.cpp index f62b93d0ff..eb645b3a92 100644 --- a/core/object/object.cpp +++ b/core/object/object.cpp @@ -666,8 +666,16 @@ bool Object::has_method(const StringName &p_method) const { } MethodBind *method = ClassDB::get_method(get_class_name(), p_method); + if (method != nullptr) { + return true; + } - return method != nullptr; + const Script *scr = Object::cast_to<Script>(this); + if (scr != nullptr) { + return scr->has_static_method(p_method); + } + + return false; } Variant Object::getvar(const Variant &p_key, bool *r_valid) const { |