diff options
author | ocean (they/them) <anvilfolk@gmail.com> | 2022-11-06 23:21:43 -0500 |
---|---|---|
committer | ocean (they/them) <anvilfolk@gmail.com> | 2022-11-21 19:43:46 -0500 |
commit | 9187f5c849fc6c7832ab5c1defd1ecc854e8271f (patch) | |
tree | dbe6fe6baf61e90bc20e1ae67ebf5bd795b7b335 /core/object | |
parent | 98da707df5a40d37e85070cec6babfee4fae5765 (diff) | |
download | redot-engine-9187f5c849fc6c7832ab5c1defd1ecc854e8271f.tar.gz |
Fixes inability to assign script after clearing
Diffstat (limited to 'core/object')
-rw-r--r-- | core/object/script_language.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/core/object/script_language.cpp b/core/object/script_language.cpp index 056c57a5f1..36a0d03aaf 100644 --- a/core/object/script_language.cpp +++ b/core/object/script_language.cpp @@ -409,7 +409,9 @@ bool PlaceHolderScriptInstance::set(const StringName &p_name, const Variant &p_v if (values.has(p_name)) { Variant defval; if (script->get_property_default_value(p_name, defval)) { - if (defval == p_value) { + // The evaluate function ensures that a NIL variant is equal to e.g. an empty Resource. + // Simply doing defval == p_value does not do this. + if (Variant::evaluate(Variant::OP_EQUAL, defval, p_value)) { values.erase(p_name); return true; } @@ -419,7 +421,7 @@ bool PlaceHolderScriptInstance::set(const StringName &p_name, const Variant &p_v } else { Variant defval; if (script->get_property_default_value(p_name, defval)) { - if (defval != p_value) { + if (Variant::evaluate(Variant::OP_NOT_EQUAL, defval, p_value)) { values[p_name] = p_value; } return true; |