mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-11-30 08:55:26 -05:00
Fix filament slot editor desync across multi-material presets (#15896)
On printers where a filament slot's edit button opens the editor directly (IDEX, toolchanger, multi-extruder), cancelling the unsaved-changes dialog wrote the preset still open in the editor into the clicked slot. - `switch_to_tab()` now compares the slot's assigned preset with the one open in the editor to decide whether to reload. - The edit button sets `editing_filament` only after `switch_to_tab()` succeeds, as `Sidebar::edit_filament()` does. - `UnsavedChangesDialog::build()` checks the `find_preset()` result for null. Fixes #15767
This commit is contained in:
1 parent
97e6c71793
commit
5897d95d4d
3 files changed
+16
-12
No files matched your search
@@ -1070,16 +1070,15 @@ bool PlaterPresetComboBox::switch_to_tab()
|
||||
const Preset* selected_filament_preset = nullptr;
|
||||
if (m_type == Preset::TYPE_FILAMENT)
|
||||
{
|
||||
const std::string& selected_preset = GetString(GetSelection()).ToUTF8().data();
|
||||
if (!boost::algorithm::starts_with(selected_preset, Preset::suffix_modified()))
|
||||
// Reload the editor only when it has a different preset open than this slot.
|
||||
const std::string& slot_preset_name = wxGetApp().preset_bundle->filament_presets[m_filament_idx];
|
||||
if (slot_preset_name != wxGetApp().preset_bundle->filaments.get_selected_preset_name())
|
||||
{
|
||||
const std::string& preset_name = wxGetApp().preset_bundle->filaments.get_preset_name_by_alias(selected_preset);
|
||||
if (wxGetApp().get_tab(m_type)->select_preset(preset_name))
|
||||
wxGetApp().get_tab(m_type)->get_combo_box()->set_filament_idx(m_filament_idx);
|
||||
else {
|
||||
if (!wxGetApp().get_tab(m_type)->select_preset(slot_preset_name))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// Bind the editor to this slot even when its preset is already open.
|
||||
wxGetApp().get_tab(m_type)->get_combo_box()->set_filament_idx(m_filament_idx);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in new issue
Block a user