Fix Ironing/Support patterns (#10278)

NoisyGoat

Co-authored-by: Rodrigo <162915171+RF47@users.noreply.github.com>
Co-authored-by: Noisyfox <timemanager.rick@gmail.com>
This commit is contained in:
Ian Bassi
2025-08-01 23:59:01 -03:00
committed by GitHub
parent 468c8492b6
commit b16d3a2f4a
6 changed files with 42 additions and 18 deletions

View File

@@ -1549,7 +1549,11 @@ void Choice::set_value(const boost::any& value, bool change_event)
if (m_opt_id.compare("host_type") == 0 && val != 0 &&
m_opt.enum_values.size() > field->GetCount()) // for case, when PrusaLink isn't used as a HostType
val--;
if (m_opt_id == "top_surface_pattern" || m_opt_id == "bottom_surface_pattern" || m_opt_id == "internal_solid_infill_pattern" || m_opt_id == "sparse_infill_pattern" || m_opt_id == "support_style" || m_opt_id == "curr_bed_type")
if (m_opt_id == "top_surface_pattern" || m_opt_id == "bottom_surface_pattern" ||
m_opt_id == "internal_solid_infill_pattern" || m_opt_id == "sparse_infill_pattern" ||
m_opt_id == "support_base_pattern" || m_opt_id == "support_interface_pattern" ||
m_opt_id == "ironing_pattern" || m_opt_id == "support_ironing_pattern" ||
m_opt_id == "support_style" || m_opt_id == "curr_bed_type")
{
std::string key;
const t_config_enum_values& map_names = *m_opt.enum_keys_map;
@@ -1633,21 +1637,27 @@ boost::any& Choice::get_value()
// BBS
if (m_opt.type == coEnum || m_opt.type == coEnums)
{
{
if (m_opt.nullable && field->GetSelection() == -1)
m_value = ConfigOptionEnumsGenericNullable::nil_value();
else if (m_opt_id == "top_surface_pattern" || m_opt_id == "bottom_surface_pattern" || m_opt_id == "internal_solid_infill_pattern" || m_opt_id == "sparse_infill_pattern" ||
m_opt_id == "support_style" || m_opt_id == "curr_bed_type") {
const std::string& key = m_opt.enum_values[field->GetSelection()];
m_value = int(m_opt.enum_keys_map->at(key));
}
else if ( m_opt_id == "top_surface_pattern" || m_opt_id == "bottom_surface_pattern" ||
m_opt_id == "internal_solid_infill_pattern" || m_opt_id == "sparse_infill_pattern" ||
m_opt_id == "support_base_pattern" || m_opt_id == "support_interface_pattern" ||
m_opt_id == "ironing_pattern" || m_opt_id == "support_ironing_pattern" ||
m_opt_id == "support_style" || m_opt_id == "curr_bed_type")
{
const std::string &key = m_opt.enum_values[field->GetSelection()];
m_value = int(m_opt.enum_keys_map->at(key));
}
// Support ThirdPartyPrinter
else if (m_opt_id.compare("host_type") == 0 && m_opt.enum_values.size() > field->GetCount()) {
else if (m_opt_id.compare("host_type") == 0 && m_opt.enum_values.size() > field->GetCount())
{
// for case, when PrusaLink isn't used as a HostType
m_value = field->GetSelection() + 1;
} else
m_value = field->GetSelection();
}
}
else
m_value = field->GetSelection();
}
else if (m_opt.gui_type == ConfigOptionDef::GUIType::f_enum_open || m_opt.gui_type == ConfigOptionDef::GUIType::i_enum_open) {
const int ret_enum = field->GetSelection();
if (m_list) {