Fix editor export plugins always causing resources to be edited.

- Remove the ', true' which always caused the if statement to be true.
- Add a new comparison before setting again the same array or dictionary back to the object. Not all objects are programmed to take into account that the setter could be called with the exact same Array or Dictionary from the class. This check ensures that scenario doesn't happen since it should be unnecessary.
This commit is contained in:
Dario
2025-08-28 11:21:58 -03:00
parent 4ebf67c12d
commit 9086b5c05f

View File

@@ -677,7 +677,7 @@ bool EditorExportPlatform::_export_customize_dictionary(Dictionary &dict, LocalV
} }
// If it was not replaced, go through and see if there is something to replace. // If it was not replaced, go through and see if there is something to replace.
if (res.is_valid() && !res->get_path().is_resource_file() && _export_customize_object(res.ptr(), customize_resources_plugins), true) { if (res.is_valid() && !res->get_path().is_resource_file() && _export_customize_object(res.ptr(), customize_resources_plugins)) {
changed = true; changed = true;
} }
} }
@@ -724,7 +724,7 @@ bool EditorExportPlatform::_export_customize_array(Array &arr, LocalVector<Ref<E
} }
// If it was not replaced, go through and see if there is something to replace. // If it was not replaced, go through and see if there is something to replace.
if (res.is_valid() && !res->get_path().is_resource_file() && _export_customize_object(res.ptr(), customize_resources_plugins), true) { if (res.is_valid() && !res->get_path().is_resource_file() && _export_customize_object(res.ptr(), customize_resources_plugins)) {
changed = true; changed = true;
} }
} }
@@ -771,7 +771,7 @@ bool EditorExportPlatform::_export_customize_object(Object *p_object, LocalVecto
} }
// If it was not replaced, go through and see if there is something to replace. // If it was not replaced, go through and see if there is something to replace.
if (res.is_valid() && !res->get_path().is_resource_file() && _export_customize_object(res.ptr(), customize_resources_plugins), true) { if (res.is_valid() && !res->get_path().is_resource_file() && _export_customize_object(res.ptr(), customize_resources_plugins)) {
changed = true; changed = true;
} }
} }
@@ -780,16 +780,20 @@ bool EditorExportPlatform::_export_customize_object(Object *p_object, LocalVecto
case Variant::DICTIONARY: { case Variant::DICTIONARY: {
Dictionary d = p_object->get(E.name); Dictionary d = p_object->get(E.name);
if (_export_customize_dictionary(d, customize_resources_plugins)) { if (_export_customize_dictionary(d, customize_resources_plugins)) {
// May have been generated, so set back just in case if (p_object->get(E.name) != d) {
p_object->set(E.name, d); p_object->set(E.name, d);
}
changed = true; changed = true;
} }
} break; } break;
case Variant::ARRAY: { case Variant::ARRAY: {
Array a = p_object->get(E.name); Array a = p_object->get(E.name);
if (_export_customize_array(a, customize_resources_plugins)) { if (_export_customize_array(a, customize_resources_plugins)) {
// May have been generated, so set back just in case if (p_object->get(E.name) != a) {
p_object->set(E.name, a); p_object->set(E.name, a);
}
changed = true; changed = true;
} }
} break; } break;