mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-07-29 22:02:10 +00:00
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
This commit is contained in:
committed by
GitHub
parent
9f1bc75c70
commit
1ec574bcbb
@@ -9549,6 +9549,12 @@ void Plater::priv::on_select_preset(wxCommandEvent &evt)
|
|||||||
wxGetApp().get_tab(preset_type)->select_preset(preset_name);
|
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
|
// update plater with new config
|
||||||
q->on_config_change(wxGetApp().preset_bundle->full_config());
|
q->on_config_change(wxGetApp().preset_bundle->full_config());
|
||||||
if (preset_type == Preset::TYPE_PRINTER) {
|
if (preset_type == Preset::TYPE_PRINTER) {
|
||||||
|
|||||||
@@ -234,7 +234,19 @@ int PresetComboBox::update_ams_color()
|
|||||||
std::string ctype;
|
std::string ctype;
|
||||||
std::vector<std::string> colors;
|
std::vector<std::string> colors;
|
||||||
if (idx < 0) {
|
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);
|
auto *preset = m_collection->find_preset(name);
|
||||||
if (preset)
|
if (preset)
|
||||||
color = preset->config.opt_string("default_filament_colour", 0u);
|
color = preset->config.opt_string("default_filament_colour", 0u);
|
||||||
|
|||||||
Reference in New Issue
Block a user