Skip to content

Commit 9086b5c

Browse files
committed
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.
1 parent 4ebf67c commit 9086b5c

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

editor/export/editor_export_platform.cpp

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,7 @@ bool EditorExportPlatform::_export_customize_dictionary(Dictionary &dict, LocalV
677677
}
678678

679679
// If it was not replaced, go through and see if there is something to replace.
680-
if (res.is_valid() && !res->get_path().is_resource_file() && _export_customize_object(res.ptr(), customize_resources_plugins), true) {
680+
if (res.is_valid() && !res->get_path().is_resource_file() && _export_customize_object(res.ptr(), customize_resources_plugins)) {
681681
changed = true;
682682
}
683683
}
@@ -724,7 +724,7 @@ bool EditorExportPlatform::_export_customize_array(Array &arr, LocalVector<Ref<E
724724
}
725725

726726
// If it was not replaced, go through and see if there is something to replace.
727-
if (res.is_valid() && !res->get_path().is_resource_file() && _export_customize_object(res.ptr(), customize_resources_plugins), true) {
727+
if (res.is_valid() && !res->get_path().is_resource_file() && _export_customize_object(res.ptr(), customize_resources_plugins)) {
728728
changed = true;
729729
}
730730
}
@@ -771,7 +771,7 @@ bool EditorExportPlatform::_export_customize_object(Object *p_object, LocalVecto
771771
}
772772

773773
// If it was not replaced, go through and see if there is something to replace.
774-
if (res.is_valid() && !res->get_path().is_resource_file() && _export_customize_object(res.ptr(), customize_resources_plugins), true) {
774+
if (res.is_valid() && !res->get_path().is_resource_file() && _export_customize_object(res.ptr(), customize_resources_plugins)) {
775775
changed = true;
776776
}
777777
}
@@ -780,16 +780,20 @@ bool EditorExportPlatform::_export_customize_object(Object *p_object, LocalVecto
780780
case Variant::DICTIONARY: {
781781
Dictionary d = p_object->get(E.name);
782782
if (_export_customize_dictionary(d, customize_resources_plugins)) {
783-
// May have been generated, so set back just in case
784-
p_object->set(E.name, d);
783+
if (p_object->get(E.name) != d) {
784+
p_object->set(E.name, d);
785+
}
786+
785787
changed = true;
786788
}
787789
} break;
788790
case Variant::ARRAY: {
789791
Array a = p_object->get(E.name);
790792
if (_export_customize_array(a, customize_resources_plugins)) {
791-
// May have been generated, so set back just in case
792-
p_object->set(E.name, a);
793+
if (p_object->get(E.name) != a) {
794+
p_object->set(E.name, a);
795+
}
796+
793797
changed = true;
794798
}
795799
} break;

0 commit comments

Comments
 (0)