You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
Fixes inability to assign script after clearing
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user