From 1ec574bcbbbbd2b328492f9e9b02255f31f342e4 Mon Sep 17 00:00:00 2001 From: Ioannis Giannakas <59056762+igiannakas@users.noreply.github.com> Date: Fri, 5 Jun 2026 21:01:51 +0300 Subject: [PATCH] Fix color swatch not updating when a different coloured filament is selected. (#14038) * Fix color swatch not updating when a different coloured filament is selected. * Address review comment --- src/slic3r/GUI/Plater.cpp | 6 ++++++ src/slic3r/GUI/PresetComboBoxes.cpp | 14 +++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 197c90787c..66f8481bce 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -9549,6 +9549,12 @@ void Plater::priv::on_select_preset(wxCommandEvent &evt) wxGetApp().get_tab(preset_type)->select_preset(preset_name); } + // ORCA: Always refresh the selected filament combo so its color swatch (clr_picker) + // matches the chosen preset. update_ams_color() (in OnSelect) updates the project + // filament color when the preset defines one; this repaints the swatch to match. + if (preset_type == Preset::TYPE_FILAMENT) + combo->update(); + // update plater with new config q->on_config_change(wxGetApp().preset_bundle->full_config()); if (preset_type == Preset::TYPE_PRINTER) { diff --git a/src/slic3r/GUI/PresetComboBoxes.cpp b/src/slic3r/GUI/PresetComboBoxes.cpp index 439f7dc1eb..edec9f903d 100644 --- a/src/slic3r/GUI/PresetComboBoxes.cpp +++ b/src/slic3r/GUI/PresetComboBoxes.cpp @@ -234,7 +234,19 @@ int PresetComboBox::update_ams_color() std::string ctype; std::vector colors; if (idx < 0) { - auto name = Preset::remove_suffix_modified(GetValue().ToUTF8().data()); + // ORCA: The combo displays the preset alias while + // the stored preset name usually carries a printer suffix. Resolving with the raw display + // value via find_preset() fails for such presets, so this returned early and the + // filament color swatch (clr_picker) kept showing the previous color. Prefer the + // internal preset name stored per item, then fall back to alias resolution. + std::string name; + if (m_last_selected >= 0) { + wxString stored = GetItemAlias(m_last_selected); + if (!stored.empty()) + name = Preset::remove_suffix_modified(stored.ToUTF8().data()); + } + if (name.empty()) + name = m_collection->get_preset_name_by_alias(Preset::remove_suffix_modified(GetValue().ToUTF8().data())); auto *preset = m_collection->find_preset(name); if (preset) color = preset->config.opt_string("default_filament_colour", 0u);