diff options
author | Rémi Verschelde <remi@verschelde.fr> | 2022-01-27 23:46:37 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-27 23:46:37 +0100 |
commit | e6caaf4c800912517af783e90519cc2a70001e85 (patch) | |
tree | cf0198ec094369e934e5c43d99cfd9196b9a0b74 /core/variant/variant.cpp | |
parent | 46053a1be9cc1bc4957280cc76602aead421884c (diff) | |
parent | 051ef479c93c0c830b60059e3dabed6fc381cdd6 (diff) | |
download | redot-engine-e6caaf4c800912517af783e90519cc2a70001e85.tar.gz |
Merge pull request #57205 from TechnoPorg/variant-template-cast
Allow method binds to take Object subclasses as arguments
Diffstat (limited to 'core/variant/variant.cpp')
-rw-r--r-- | core/variant/variant.cpp | 20 |
1 files changed, 1 insertions, 19 deletions
diff --git a/core/variant/variant.cpp b/core/variant/variant.cpp index 38610c4f29..fcfa530388 100644 --- a/core/variant/variant.cpp +++ b/core/variant/variant.cpp @@ -38,8 +38,6 @@ #include "core/math/math_funcs.h" #include "core/string/print_string.h" #include "core/variant/variant_parser.h" -#include "scene/gui/control.h" -#include "scene/main/node.h" String Variant::get_type_name(Variant::Type p_type) { switch (p_type) { @@ -2004,22 +2002,6 @@ Object *Variant::get_validated_object() const { } } -Variant::operator Node *() const { - if (type == OBJECT) { - return Object::cast_to<Node>(_get_obj().obj); - } else { - return nullptr; - } -} - -Variant::operator Control *() const { - if (type == OBJECT) { - return Object::cast_to<Control>(_get_obj().obj); - } else { - return nullptr; - } -} - Variant::operator Dictionary() const { if (type == DICTIONARY) { return *reinterpret_cast<const Dictionary *>(_data._mem); @@ -3414,7 +3396,7 @@ String Variant::get_call_error_text(Object *p_base, const StringName &p_method, } String class_name = p_base->get_class(); - Ref<Script> script = p_base->get_script(); + Ref<Resource> script = p_base->get_script(); if (script.is_valid() && script->get_path().is_resource_file()) { class_name += "(" + script->get_path().get_file() + ")"; } |