Hot fix following-up b3469b8cd5

This commit is contained in:
YuSanka 2023-01-31 10:08:57 +01:00
parent 60020ce458
commit fb7e9dd651

View File

@ -1200,7 +1200,7 @@ void Choice::set_value(const boost::any& value, bool change_event)
} }
case coEnum: { case coEnum: {
int val = boost::any_cast<int>(value); int val = boost::any_cast<int>(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; std::string key;
const t_config_enum_values& map_names = ConfigOptionEnum<InfillPattern>::get_enum_values(); const t_config_enum_values& map_names = ConfigOptionEnum<InfillPattern>::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); auto it = std::find(values.begin(), values.end(), key);
val = it == values.end() ? 0 : it - values.begin(); 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<SupportMaterialStyle>::get_enum_values();
for (auto it : map_names)
if (val == it.second) {
key = it.first;
break;
}
const std::vector<std::string>& 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); field->SetSelection(val);
break; break;
} }