FIX: can not save file when ams filament changed
Change-Id: Ie7c567f819211cfa34c7bfeebbb415d5b880c4a8 (cherry picked from commit 1f7458b7e0ff23f664e834455dfcc4cb3773f960)
This commit is contained in:
parent
6a96bc17c6
commit
bfca09c7b2
|
@ -4747,7 +4747,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);
|
wxGetApp().plater()->update_project_dirty_from_presets();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool select_preset = !combo->selection_is_changed_according_to_physical_printers();
|
bool select_preset = !combo->selection_is_changed_according_to_physical_printers();
|
||||||
|
|
|
@ -30,7 +30,11 @@ void ProjectDirtyStateManager::update_from_presets()
|
||||||
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) {
|
if (type == Preset::Type::TYPE_FILAMENT) {
|
||||||
m_presets_dirty |= m_initial_filament_presets != wxGetApp().preset_bundle->filament_presets;
|
m_presets_dirty |= m_initial_filament_presets_names != wxGetApp().preset_bundle->filament_presets;
|
||||||
|
if (ConfigOption *color_option = wxGetApp().preset_bundle->project_config.option("filament_colour")) {
|
||||||
|
auto colors = static_cast<ConfigOptionStrings *>(color_option->clone());
|
||||||
|
m_presets_dirty |= m_initial_filament_presets_colors != colors->values;
|
||||||
|
}
|
||||||
} else {
|
} 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;
|
||||||
}
|
}
|
||||||
|
@ -57,7 +61,11 @@ void ProjectDirtyStateManager::reset_initial_presets()
|
||||||
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) {
|
if (type == Preset::Type::TYPE_FILAMENT) {
|
||||||
m_initial_filament_presets = wxGetApp().preset_bundle->filament_presets;
|
m_initial_filament_presets_names = wxGetApp().preset_bundle->filament_presets;
|
||||||
|
if (ConfigOption *color_option = wxGetApp().preset_bundle->project_config.option("filament_colour")) {
|
||||||
|
auto colors = static_cast<ConfigOptionStrings *>(color_option->clone());
|
||||||
|
m_initial_filament_presets_colors = colors->values;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
m_initial_presets[type] = name;
|
m_initial_presets[type] = name;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,8 @@ private:
|
||||||
DynamicPrintConfig m_initial_project_config;
|
DynamicPrintConfig m_initial_project_config;
|
||||||
|
|
||||||
// filament preset independent of the m_initial_presets
|
// filament preset independent of the m_initial_presets
|
||||||
std::vector<std::string> m_initial_filament_presets;
|
std::vector<std::string> m_initial_filament_presets_names; // all filament preset type name
|
||||||
|
std::vector<std::string> m_initial_filament_presets_colors; // all filament preset color
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace GUI
|
} // namespace GUI
|
||||||
|
|
Loading…
Reference in New Issue