From 9086b5c05f9f6e17ab71e219b59e1cdd8593cafd Mon Sep 17 00:00:00 2001 From: Dario Date: Thu, 28 Aug 2025 11:21:58 -0300 Subject: [PATCH] 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. --- editor/export/editor_export_platform.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/editor/export/editor_export_platform.cpp b/editor/export/editor_export_platform.cpp index 769c4a99d8..4f29499778 100644 --- a/editor/export/editor_export_platform.cpp +++ b/editor/export/editor_export_platform.cpp @@ -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 (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; } } @@ -724,7 +724,7 @@ bool EditorExportPlatform::_export_customize_array(Array &arr, LocalVectorget_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; } } @@ -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 (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; } } @@ -780,16 +780,20 @@ bool EditorExportPlatform::_export_customize_object(Object *p_object, LocalVecto case Variant::DICTIONARY: { Dictionary d = p_object->get(E.name); if (_export_customize_dictionary(d, customize_resources_plugins)) { - // May have been generated, so set back just in case - p_object->set(E.name, d); + if (p_object->get(E.name) != d) { + p_object->set(E.name, d); + } + changed = true; } } break; case Variant::ARRAY: { Array a = p_object->get(E.name); if (_export_customize_array(a, customize_resources_plugins)) { - // May have been generated, so set back just in case - p_object->set(E.name, a); + if (p_object->get(E.name) != a) { + p_object->set(E.name, a); + } + changed = true; } } break;