diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 1b536baa8..54de6cd56 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -4188,6 +4188,8 @@ void Plater::priv::on_select_preset(wxCommandEvent &evt) wxGetApp().preset_bundle->set_filament_preset(idx, preset_name); } + std::string last_selected_ph_printer_name = combo->get_selected_ph_printer_name(); + bool select_preset = !combo->selection_is_changed_according_to_physical_printers(); // TODO: ? if (preset_type == Preset::TYPE_FILAMENT && sidebar->is_multifilament()) { @@ -4196,7 +4198,7 @@ void Plater::priv::on_select_preset(wxCommandEvent &evt) } else if (select_preset) { wxWindowUpdateLocker noUpdates(sidebar->presets_panel()); - wxGetApp().get_tab(preset_type)->select_preset(preset_name); + wxGetApp().get_tab(preset_type)->select_preset(preset_name, false, last_selected_ph_printer_name); } if (preset_type != Preset::TYPE_PRINTER || select_preset) { diff --git a/src/slic3r/GUI/PresetComboBoxes.cpp b/src/slic3r/GUI/PresetComboBoxes.cpp index 6fcde3bf6..c4d0fc670 100644 --- a/src/slic3r/GUI/PresetComboBoxes.cpp +++ b/src/slic3r/GUI/PresetComboBoxes.cpp @@ -666,6 +666,18 @@ void PlaterPresetComboBox::OnSelect(wxCommandEvent &evt) evt.Skip(); } +std::string PlaterPresetComboBox::get_selected_ph_printer_name() const +{ + if (m_type != Preset::TYPE_PRINTER) + return {}; + + const PhysicalPrinterCollection& physical_printers = m_preset_bundle->physical_printers; + if (physical_printers.has_selection()) + return physical_printers.get_selected_full_printer_name(); + + return {}; +} + void PlaterPresetComboBox::switch_to_tab() { Tab* tab = wxGetApp().get_tab(m_type); diff --git a/src/slic3r/GUI/PresetComboBoxes.hpp b/src/slic3r/GUI/PresetComboBoxes.hpp index d0abbe203..2a477ac11 100644 --- a/src/slic3r/GUI/PresetComboBoxes.hpp +++ b/src/slic3r/GUI/PresetComboBoxes.hpp @@ -164,6 +164,8 @@ public: void sys_color_changed() override; void OnSelect(wxCommandEvent& evt) override; + std::string get_selected_ph_printer_name() const; + private: int m_extruder_idx = -1; }; diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 8a7c41f62..cf3b96d80 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -2978,6 +2978,10 @@ void TabPrinter::activate_selected_page(std::function throw_if_canceled) void TabPrinter::clear_pages() { Tab::clear_pages(); + + m_machine_limits_description_line = nullptr; + m_fff_print_host_upload_description_line = nullptr; + m_sla_print_host_upload_description_line = nullptr; } void TabPrinter::toggle_options() @@ -3402,7 +3406,7 @@ void Tab::select_preset(std::string preset_name, bool delete_current /*=false*/, // If preset selection was canceled and previously was selected physical printer, we should select it back m_preset_bundle->physical_printers.select_printer(last_selected_ph_printer_name); } - if (m_preset_bundle->physical_printers.has_selection()) { + else if (m_preset_bundle->physical_printers.has_selection()) { // If preset selection was canceled and physical printer was selected // we must disable selection marker for the physical printers m_preset_bundle->physical_printers.unselect_printer(); diff --git a/src/slic3r/GUI/UnsavedChangesDialog.cpp b/src/slic3r/GUI/UnsavedChangesDialog.cpp index 158579c70..222a566cd 100644 --- a/src/slic3r/GUI/UnsavedChangesDialog.cpp +++ b/src/slic3r/GUI/UnsavedChangesDialog.cpp @@ -1571,6 +1571,13 @@ void DiffPresetDialog::create_tree() m_tree->GetColumn(DiffModel::colToggle)->SetHidden(true); } +static std::array types_list(PrinterTechnology pt) +{ + if (pt == ptFFF) + return { Preset::TYPE_PRINTER, Preset::TYPE_PRINT, Preset::TYPE_FILAMENT }; + return { Preset::TYPE_PRINTER, Preset::TYPE_SLA_PRINT, Preset::TYPE_SLA_MATERIAL }; +} + void DiffPresetDialog::create_buttons() { wxFont font = this->GetFont().Scaled(1.4f); @@ -1598,8 +1605,7 @@ void DiffPresetDialog::create_buttons() bool enable = m_tree->has_selection(); if (enable) { if (m_view_type == Preset::TYPE_INVALID) { - for (const Preset::Type& type : (m_pr_technology == ptFFF ? std::initializer_list{Preset::TYPE_PRINTER, Preset::TYPE_PRINT, Preset::TYPE_FILAMENT} : - std::initializer_list{ Preset::TYPE_PRINTER, Preset::TYPE_SLA_PRINT, Preset::TYPE_SLA_MATERIAL })) + for (const Preset::Type& type : types_list(m_pr_technology)) if (!enable_transfer(type)) { enable = false; break; @@ -2024,10 +2030,7 @@ bool DiffPresetDialog::is_save_confirmed() std::vector types_for_save; - const auto list = m_pr_technology == ptFFF ? std::initializer_list{Preset::TYPE_PRINTER, Preset::TYPE_PRINT, Preset::TYPE_FILAMENT} : - std::initializer_list{ Preset::TYPE_PRINTER, Preset::TYPE_SLA_PRINT, Preset::TYPE_SLA_MATERIAL }; - - for (const Preset::Type& type : list) { + for (const Preset::Type& type : types_list(m_pr_technology)) { if (!m_tree->options(type, true).empty()) { types_for_save.emplace_back(type); presets_to_save.emplace_back(PresetToSave{ type, get_left_preset_name(type), get_right_preset_name(type), get_right_preset_name(type) });