From fb7e9dd65184d95d3663c2387ec5a4b908eb2814 Mon Sep 17 00:00:00 2001 From: YuSanka Date: Tue, 31 Jan 2023 10:08:57 +0100 Subject: [PATCH] Hot fix following-up https://github.com/Prusa-Development/PrusaSlicerPrivate/commit/b3469b8cd51a71940d7bc8a3b4deebb27a32204e --- src/slic3r/GUI/Field.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/slic3r/GUI/Field.cpp b/src/slic3r/GUI/Field.cpp index 9280865b0..de61488ef 100644 --- a/src/slic3r/GUI/Field.cpp +++ b/src/slic3r/GUI/Field.cpp @@ -1200,7 +1200,7 @@ void Choice::set_value(const boost::any& value, bool change_event) } case coEnum: { int val = boost::any_cast(value); - if (m_opt_id == "top_fill_pattern" || m_opt_id == "bottom_fill_pattern" || m_opt_id == "fill_pattern" || m_opt_id == "support_material_style") + if (m_opt_id == "top_fill_pattern" || m_opt_id == "bottom_fill_pattern" || m_opt_id == "fill_pattern") { std::string key; const t_config_enum_values& map_names = ConfigOptionEnum::get_enum_values(); @@ -1214,6 +1214,20 @@ void Choice::set_value(const boost::any& value, bool change_event) auto it = std::find(values.begin(), values.end(), key); val = it == values.end() ? 0 : it - values.begin(); } + else if (m_opt_id == "support_material_style") + { + std::string key; + const t_config_enum_values& map_names = ConfigOptionEnum::get_enum_values(); + for (auto it : map_names) + if (val == it.second) { + key = it.first; + break; + } + + const std::vector& values = m_opt.enum_values; + auto it = std::find(values.begin(), values.end(), key); + val = it == values.end() ? 0 : it - values.begin(); + } field->SetSelection(val); break; }