FIX: STUDIO-395
update the filament preset parameter dirty logic Change-Id: Iaca29d397f7395f71a5f17007ab2341f8d4ceeeb
This commit is contained in:
parent
10c152c40d
commit
e80c6f8935
|
@ -4750,6 +4750,7 @@ void Plater::priv::on_select_preset(wxCommandEvent &evt)
|
||||||
|
|
||||||
if (preset_type == Preset::TYPE_FILAMENT) {
|
if (preset_type == Preset::TYPE_FILAMENT) {
|
||||||
wxGetApp().preset_bundle->set_filament_preset(idx, preset_name);
|
wxGetApp().preset_bundle->set_filament_preset(idx, preset_name);
|
||||||
|
wxGetApp().get_tab(preset_type)->select_preset(preset_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool select_preset = !combo->selection_is_changed_according_to_physical_printers();
|
bool select_preset = !combo->selection_is_changed_according_to_physical_printers();
|
||||||
|
|
|
@ -28,9 +28,15 @@ void ProjectDirtyStateManager::update_from_presets()
|
||||||
// check switching of the presets only for exist/loaded project, but not for new
|
// check switching of the presets only for exist/loaded project, but not for new
|
||||||
GUI_App &app = wxGetApp();
|
GUI_App &app = wxGetApp();
|
||||||
if (!app.plater()->get_project_filename().IsEmpty()) {
|
if (!app.plater()->get_project_filename().IsEmpty()) {
|
||||||
for (const auto& [type, name] : app.get_selected_presets())
|
for (const auto &[type, name] : app.get_selected_presets()) {
|
||||||
|
if (type == Preset::Type::TYPE_FILAMENT) {
|
||||||
|
m_presets_dirty |= m_initial_filament_presets != wxGetApp().preset_bundle->filament_presets;
|
||||||
|
} else {
|
||||||
m_presets_dirty |= !m_initial_presets[type].empty() && m_initial_presets[type] != name;
|
m_presets_dirty |= !m_initial_presets[type].empty() && m_initial_presets[type] != name;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
m_presets_dirty |= app.has_unsaved_preset_changes();
|
m_presets_dirty |= app.has_unsaved_preset_changes();
|
||||||
m_project_config_dirty = m_initial_project_config != app.preset_bundle->project_config;
|
m_project_config_dirty = m_initial_project_config != app.preset_bundle->project_config;
|
||||||
app.mainframe->update_title();
|
app.mainframe->update_title();
|
||||||
|
@ -49,8 +55,13 @@ void ProjectDirtyStateManager::reset_initial_presets()
|
||||||
{
|
{
|
||||||
m_initial_presets.fill(std::string{});
|
m_initial_presets.fill(std::string{});
|
||||||
GUI_App &app = wxGetApp();
|
GUI_App &app = wxGetApp();
|
||||||
for (const auto& [type, name] : app.get_selected_presets())
|
for (const auto &[type, name] : app.get_selected_presets()) {
|
||||||
|
if (type == Preset::Type::TYPE_FILAMENT) {
|
||||||
|
m_initial_filament_presets = wxGetApp().preset_bundle->filament_presets;
|
||||||
|
} else {
|
||||||
m_initial_presets[type] = name;
|
m_initial_presets[type] = name;
|
||||||
|
}
|
||||||
|
}
|
||||||
m_initial_project_config = app.preset_bundle->project_config;
|
m_initial_project_config = app.preset_bundle->project_config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,9 @@ private:
|
||||||
// Keeps track of preset names selected at the time of last project save.
|
// Keeps track of preset names selected at the time of last project save.
|
||||||
std::array<std::string, Preset::TYPE_COUNT> m_initial_presets;
|
std::array<std::string, Preset::TYPE_COUNT> m_initial_presets;
|
||||||
DynamicPrintConfig m_initial_project_config;
|
DynamicPrintConfig m_initial_project_config;
|
||||||
|
|
||||||
|
// filament preset independent of the m_initial_presets
|
||||||
|
std::vector<std::string> m_initial_filament_presets;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace GUI
|
} // namespace GUI
|
||||||
|
|
Loading…
Reference in New Issue