Tree Supports: Patching "support_material_style" enum to support

incomplete UI selection.
This patch will be removed after first alpha.
This commit is contained in:
Vojtech Bubnik 2023-01-31 09:38:52 +01:00
parent 2a1e12131b
commit b3469b8cd5
3 changed files with 8 additions and 4 deletions

View File

@ -1200,7 +1200,7 @@ void Choice::set_value(const boost::any& value, bool change_event)
}
case coEnum: {
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")
if (m_opt_id == "top_fill_pattern" || m_opt_id == "bottom_fill_pattern" || m_opt_id == "fill_pattern" || m_opt_id == "support_material_style")
{
std::string key;
const t_config_enum_values& map_names = ConfigOptionEnum<InfillPattern>::get_enum_values();
@ -1281,7 +1281,9 @@ boost::any& Choice::get_value()
if (m_opt_id == "top_fill_pattern" || m_opt_id == "bottom_fill_pattern" || m_opt_id == "fill_pattern") {
const std::string& key = m_opt.enum_values[field->GetSelection()];
m_value = int(ConfigOptionEnum<InfillPattern>::get_enum_values().at(key));
}
} else if (m_opt_id == "support_material_style") {
m_value = int(ConfigOptionEnum<SupportMaterialStyle>::get_enum_values().at(m_opt.enum_values[field->GetSelection()]));
}
else
m_value = field->GetSelection();
}

View File

@ -286,7 +286,8 @@ static void add_config_substitutions(const ConfigSubstitutions& conf_substitutio
bool is_infill = def->opt_key == "top_fill_pattern" ||
def->opt_key == "bottom_fill_pattern" ||
def->opt_key == "fill_pattern";
def->opt_key == "fill_pattern" ||
def->opt_key == "support_material_style";
// Each infill doesn't use all list of infill declared in PrintConfig.hpp.
// So we should "convert" val to the correct one

View File

@ -1217,7 +1217,8 @@ static wxString get_string_value(std::string opt_key, const DynamicPrintConfig&
return get_string_from_enum(opt_key, config,
opt_key == "top_fill_pattern" ||
opt_key == "bottom_fill_pattern" ||
opt_key == "fill_pattern");
opt_key == "fill_pattern" ||
opt_key == "support_material_style");
}
case coPoints: {
if (opt_key == "bed_shape") {