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
This commit is contained in:
YuSanka 2022-02-07 11:58:22 +01:00
parent e20d041fc9
commit a1746e3e66
3 changed files with 5 additions and 2 deletions

View File

@ -612,7 +612,7 @@ PresetCollection::PresetCollection(Preset::Type type, const std::vector<std::str
// Insert just the default preset. // Insert just the default preset.
this->add_default_preset(keys, defaults, default_name); this->add_default_preset(keys, defaults, default_name);
m_edited_preset.config.apply(m_presets.front().config); 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) void PresetCollection::reset(bool delete_files)
@ -1228,7 +1228,6 @@ Preset& PresetCollection::select_preset(size_t idx)
idx = first_visible_idx(); idx = first_visible_idx();
m_idx_selected = idx; m_idx_selected = idx;
m_edited_preset = m_presets[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; bool default_visible = ! m_default_suppressed || m_idx_selected < m_num_default_presets;
for (size_t i = 0; i < m_num_default_presets; ++i) for (size_t i = 0; i < m_num_default_presets; ++i)
m_presets[i].is_visible = default_visible; m_presets[i].is_visible = default_visible;

View File

@ -1283,6 +1283,9 @@ bool GUI_App::on_init_inner()
else else
load_current_presets(); load_current_presets();
// set saved presets for initial project
update_saved_preset_from_current_preset();
if (plater_ != nullptr) { if (plater_ != nullptr) {
plater_->reset_project_dirty_initial_presets(); plater_->reset_project_dirty_initial_presets();
plater_->update_project_dirty_from_presets(); plater_->update_project_dirty_from_presets();

View File

@ -5106,6 +5106,7 @@ void Plater::load_project(const wxString& filename)
// At least one file was loaded. // At least one file was loaded.
p->set_project_filename(filename); p->set_project_filename(filename);
reset_project_dirty_initial_presets(); reset_project_dirty_initial_presets();
wxGetApp().update_saved_preset_from_current_preset();
update_project_dirty_from_presets(); update_project_dirty_from_presets();
} }
} }