From c900f2e04f447c23bf79dc399e1b1648896b2d85 Mon Sep 17 00:00:00 2001 From: YuSanka Date: Thu, 25 Aug 2022 16:42:29 +0200 Subject: [PATCH] Fix for SPE-1271 - The profile is displayed as modified even after reverting all changes --- src/libslic3r/Preset.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/libslic3r/Preset.cpp b/src/libslic3r/Preset.cpp index 72cf59527d..52d44ca483 100644 --- a/src/libslic3r/Preset.cpp +++ b/src/libslic3r/Preset.cpp @@ -748,7 +748,7 @@ std::pair PresetCollection::load_external_preset( { // Load the preset over a default preset, so that the missing fields are filled in from the default preset. DynamicPrintConfig cfg(this->default_preset_for(combined_config).config); - const auto &keys = cfg.keys(); + t_config_option_keys keys = std::move(cfg.keys()); cfg.apply_only(combined_config, keys, true); std::string &inherits = Preset::inherits(cfg); if (select == LoadAndSelect::Never) { @@ -792,6 +792,13 @@ std::pair PresetCollection::load_external_preset( // the differences will be shown in the preset editor against the referenced profile. this->select_preset(it - m_presets.begin()); // The source config may contain keys from many possible preset types. Just copy those that relate to this preset. + + // Following keys are not used neither by the UI nor by the slicing core, therefore they are not important + // Erase them from config appl to avoid redundant "dirty" parameter in loaded preset. + for (const char* key : { "print_settings_id", "filament_settings_id", "sla_print_settings_id", "sla_material_settings_id", "printer_settings_id", + "printer_model", "printer_variant", "default_print_profile", "default_filament_profile", "default_sla_print_profile", "default_sla_material_profile" }) + keys.erase(std::remove(keys.begin(), keys.end(), key), keys.end()); + this->get_edited_preset().config.apply_only(combined_config, keys, true); this->update_dirty(); // Don't save the newly loaded project as a "saved into project" state.