From a1746e3e660cc54f1e26ff33f007525767648a49 Mon Sep 17 00:00:00 2001 From: YuSanka Date: Mon, 7 Feb 2022 11:58:22 +0100 Subject: [PATCH] Fix for #7849 - "Save Project" command doesn't work properly Don't update saved presets on * preset selection * initialization of PresetCollection , but update them on * load another project * initialization of an application --- src/libslic3r/Preset.cpp | 3 +-- src/slic3r/GUI/GUI_App.cpp | 3 +++ src/slic3r/GUI/Plater.cpp | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/libslic3r/Preset.cpp b/src/libslic3r/Preset.cpp index 5ab3142e6..95211ca4f 100644 --- a/src/libslic3r/Preset.cpp +++ b/src/libslic3r/Preset.cpp @@ -612,7 +612,7 @@ PresetCollection::PresetCollection(Preset::Type type, const std::vectoradd_default_preset(keys, defaults, default_name); m_edited_preset.config.apply(m_presets.front().config); - update_saved_preset_from_current_preset(); +//? update_saved_preset_from_current_preset(); } void PresetCollection::reset(bool delete_files) @@ -1228,7 +1228,6 @@ Preset& PresetCollection::select_preset(size_t idx) idx = first_visible_idx(); m_idx_selected = idx; m_edited_preset = m_presets[idx]; - update_saved_preset_from_current_preset(); bool default_visible = ! m_default_suppressed || m_idx_selected < m_num_default_presets; for (size_t i = 0; i < m_num_default_presets; ++i) m_presets[i].is_visible = default_visible; diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index 68080cd6b..fe3de3909 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -1283,6 +1283,9 @@ bool GUI_App::on_init_inner() else load_current_presets(); + // set saved presets for initial project + update_saved_preset_from_current_preset(); + if (plater_ != nullptr) { plater_->reset_project_dirty_initial_presets(); plater_->update_project_dirty_from_presets(); diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index c9a55e2b2..90b67432b 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -5106,6 +5106,7 @@ void Plater::load_project(const wxString& filename) // At least one file was loaded. p->set_project_filename(filename); reset_project_dirty_initial_presets(); + wxGetApp().update_saved_preset_from_current_preset(); update_project_dirty_from_presets(); } }