summaryrefslogtreecommitdiffstats
path: root/core/object
diff options
context:
space:
mode:
authorocean (they/them) <anvilfolk@gmail.com>2022-11-06 23:21:43 -0500
committerocean (they/them) <anvilfolk@gmail.com>2022-11-21 19:43:46 -0500
commit9187f5c849fc6c7832ab5c1defd1ecc854e8271f (patch)
treedbe6fe6baf61e90bc20e1ae67ebf5bd795b7b335 /core/object
parent98da707df5a40d37e85070cec6babfee4fae5765 (diff)
downloadredot-engine-9187f5c849fc6c7832ab5c1defd1ecc854e8271f.tar.gz
Fixes inability to assign script after clearing
Diffstat (limited to 'core/object')
-rw-r--r--core/object/script_language.cpp6
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;