From 0fe20a6dc460154af16eb531953c048147ee001c Mon Sep 17 00:00:00 2001 From: supermerill Date: Sun, 22 Nov 2020 14:22:35 +0100 Subject: [PATCH] #680 fix prusa ironing "Topmost surface only" and some cleaning on enum settings conversions --- src/libslic3r/PrintObject.cpp | 5 +- src/slic3r/GUI/Field.cpp | 90 ++++++++++++++----------- src/slic3r/GUI/GUI.cpp | 47 +++++++------ src/slic3r/GUI/OptionsGroup.cpp | 69 +++++++------------ src/slic3r/GUI/UnsavedChangesDialog.cpp | 43 +++++++++--- 5 files changed, 133 insertions(+), 121 deletions(-) diff --git a/src/libslic3r/PrintObject.cpp b/src/libslic3r/PrintObject.cpp index 35958fbd1..66d5acfb2 100644 --- a/src/libslic3r/PrintObject.cpp +++ b/src/libslic3r/PrintObject.cpp @@ -763,6 +763,7 @@ bool PrintObject::invalidate_state_by_config_options(const std::vector(val); - else if (m_opt_id.compare("perimeter_loop_seam") == 0) - val = idx_from_enum_value(val); else if (m_opt_id.compare("complete_objects_sort") == 0) val = idx_from_enum_value(val); - else if (m_opt_id.compare("gcode_flavor") == 0) - val = idx_from_enum_value(val); - else if (m_opt_id.compare("support_material_pattern") == 0) - val = idx_from_enum_value(val); - else if (m_opt_id.compare("seam_position") == 0) - val = idx_from_enum_value(val); - else if (m_opt_id.compare("host_type") == 0) - val = idx_from_enum_value(val); - else if (m_opt_id.compare("infill_dense_algo") == 0) - val = idx_from_enum_value(val); - else if (m_opt_id.compare("no_perimeter_unsupported_algo") == 0) - val = idx_from_enum_value(val); - else if (m_opt_id.compare("infill_connection") == 0) - val = idx_from_enum_value(val); - else if (m_opt_id.compare("wipe_advanced_algo") == 0) - val = idx_from_enum_value(val); - else if (m_opt_id.compare("support_material_contact_distance_type") == 0) - val = idx_from_enum_value(val); else if (m_opt_id.compare("display_orientation") == 0) val = idx_from_enum_value(val); + else if (m_opt_id.compare("gcode_flavor") == 0) + val = idx_from_enum_value(val); + else if (m_opt_id.compare("host_type") == 0) + val = idx_from_enum_value(val); + else if (m_opt_id.compare("infill_connection") == 0) + val = idx_from_enum_value(val); + else if (m_opt_id.compare("infill_dense_algo") == 0) + val = idx_from_enum_value(val); + else if (m_opt_id == "ironing_type") + val = idx_from_enum_value(val); + else if (m_opt_id.compare("machine_limits_usage") == 0) + val = idx_from_enum_value(val); + else if (m_opt_id.compare("no_perimeter_unsupported_algo") == 0) + val = idx_from_enum_value(val); + else if (m_opt_id.compare("perimeter_loop_seam") == 0) + val = idx_from_enum_value(val); + else if (m_opt_id == "printhost_authorization_type") + val = idx_from_enum_value(val); + else if (m_opt_id.compare("seam_position") == 0) + val = idx_from_enum_value(val); + else if (m_opt_id.compare("support_material_contact_distance_type") == 0) + val = idx_from_enum_value(val); + else if (m_opt_id.compare("support_material_pattern") == 0) + val = idx_from_enum_value(val); else if (m_opt_id.compare("support_pillar_connection_mode") == 0) val = idx_from_enum_value(val); + else if (m_opt_id.compare("wipe_advanced_algo") == 0) + val = idx_from_enum_value(val); field->SetSelection(val); break; } @@ -1161,37 +1167,39 @@ boost::any& Choice::get_value() if (m_opt_id == "top_fill_pattern" || m_opt_id == "bottom_fill_pattern" || m_opt_id == "solid_fill_pattern" || m_opt_id == "support_material_interface_pattern" || m_opt_id == "fill_pattern" || m_opt_id == "brim_ears_pattern") convert_to_enum_value(ret_enum); - else if (m_opt_id.compare("gcode_flavor") == 0) - convert_to_enum_value(ret_enum); else if (m_opt_id.compare("complete_objects_sort") == 0) convert_to_enum_value(ret_enum); - else if (m_opt_id.compare("machine_limits_usage") == 0) - m_value = static_cast(ret_enum); - else if (m_opt_id.compare("support_material_pattern") == 0) - convert_to_enum_value(ret_enum); - else if (m_opt_id.compare("seam_position") == 0) - convert_to_enum_value(ret_enum); - else if (m_opt_id.compare("perimeter_loop_seam") == 0) - convert_to_enum_value(ret_enum); + else if (m_opt_id.compare("display_orientation") == 0) + convert_to_enum_value(ret_enum); + else if (m_opt_id.compare("gcode_flavor") == 0) + convert_to_enum_value(ret_enum); else if (m_opt_id.compare("host_type") == 0) convert_to_enum_value(ret_enum); - else if (m_opt_id.compare("infill_dense_algo") == 0) - convert_to_enum_value(ret_enum); - else if (m_opt_id.compare("no_perimeter_unsupported_algo") == 0) - convert_to_enum_value(ret_enum); else if (m_opt_id.compare("infill_connection") == 0) convert_to_enum_value(ret_enum); - else if (m_opt_id.compare("wipe_advanced_algo") == 0) - convert_to_enum_value(ret_enum); + else if (m_opt_id.compare("infill_dense_algo") == 0) + convert_to_enum_value(ret_enum); + else if (m_opt_id == "ironing_type") + convert_to_enum_value(ret_enum); + else if (m_opt_id.compare("machine_limits_usage") == 0) + convert_to_enum_value(ret_enum); + else if (m_opt_id.compare("no_perimeter_unsupported_algo") == 0) + convert_to_enum_value(ret_enum); + else if (m_opt_id.compare("perimeter_loop_seam") == 0) + convert_to_enum_value(ret_enum); + else if (m_opt_id == "printhost_authorization_type") + convert_to_enum_value(ret_enum); + else if (m_opt_id.compare("seam_position") == 0) + convert_to_enum_value(ret_enum); else if (m_opt_id.compare("support_material_contact_distance_type") == 0) convert_to_enum_value(ret_enum); - else if (m_opt_id.compare("display_orientation") == 0) - convert_to_enum_value(ret_enum); + else if (m_opt_id.compare("support_material_pattern") == 0) + convert_to_enum_value(ret_enum); else if (m_opt_id.compare("support_pillar_connection_mode") == 0) convert_to_enum_value(ret_enum); - else if (m_opt_id == "printhost_authorization_type") - m_value = static_cast(ret_enum); - } + else if (m_opt_id.compare("wipe_advanced_algo") == 0) + convert_to_enum_value(ret_enum); + } else if (m_opt.gui_type == "f_enum_open") { const int ret_enum = field->GetSelection(); if (ret_enum < 0 || m_opt.enum_values.empty() || m_opt.type == coStrings || diff --git a/src/slic3r/GUI/GUI.cpp b/src/slic3r/GUI/GUI.cpp index 6cf1ab372..e61e8781a 100644 --- a/src/slic3r/GUI/GUI.cpp +++ b/src/slic3r/GUI/GUI.cpp @@ -180,40 +180,39 @@ void change_opt_value(DynamicPrintConfig& config, const t_config_option_key& opt opt_key == "bottom_fill_pattern" || opt_key == "solid_fill_pattern" || opt_key == "fill_pattern" || - opt_key == "brim_ears_pattern") + opt_key == "brim_ears_pattern" || + opt_key == "support_material_interface_pattern") config.set_key_value(opt_key, new ConfigOptionEnum(boost::any_cast(value))); else if (opt_key.compare("complete_objects_sort") == 0) - config.set_key_value(opt_key, new ConfigOptionEnum(boost::any_cast(value))); - else if (opt_key.compare("ironing_type") == 0) - config.set_key_value(opt_key, new ConfigOptionEnum(boost::any_cast(value))); + config.set_key_value(opt_key, new ConfigOptionEnum(boost::any_cast(value))); + else if (opt_key.compare("display_orientation") == 0) + config.set_key_value(opt_key, new ConfigOptionEnum(boost::any_cast(value))); else if (opt_key.compare("gcode_flavor") == 0) - config.set_key_value(opt_key, new ConfigOptionEnum(boost::any_cast(value))); + config.set_key_value(opt_key, new ConfigOptionEnum(boost::any_cast(value))); + else if (opt_key.compare("host_type") == 0) + config.set_key_value(opt_key, new ConfigOptionEnum(boost::any_cast(value))); + else if (opt_key.compare("infill_connection") == 0) + config.set_key_value(opt_key, new ConfigOptionEnum(boost::any_cast(value))); + else if (opt_key.compare("infill_dense_algo") == 0) + config.set_key_value(opt_key, new ConfigOptionEnum(boost::any_cast(value))); + else if (opt_key.compare("ironing_type") == 0) + config.set_key_value(opt_key, new ConfigOptionEnum(boost::any_cast(value))); else if (opt_key.compare("machine_limits_usage") == 0) - config.set_key_value(opt_key, new ConfigOptionEnum(boost::any_cast(value))); - else if (opt_key.compare("support_material_interface_pattern") == 0) - config.set_key_value(opt_key, new ConfigOptionEnum(boost::any_cast(value))); - else if (opt_key.compare("support_material_pattern") == 0) - config.set_key_value(opt_key, new ConfigOptionEnum(boost::any_cast(value))); + config.set_key_value(opt_key, new ConfigOptionEnum(boost::any_cast(value))); + else if (opt_key.compare("no_perimeter_unsupported_algo") == 0) + config.set_key_value(opt_key, new ConfigOptionEnum(boost::any_cast(value))); + else if (opt_key == "printhost_authorization_type") + config.set_key_value(opt_key, new ConfigOptionEnum(boost::any_cast(value))); else if (opt_key.compare("seam_position") == 0 || opt_key.compare("perimeter_loop_seam") == 0) config.set_key_value(opt_key, new ConfigOptionEnum(boost::any_cast(value))); - else if (opt_key.compare("host_type") == 0) - config.set_key_value(opt_key, new ConfigOptionEnum(boost::any_cast(value))); - else if (opt_key.compare("infill_dense_algo") == 0) - config.set_key_value(opt_key, new ConfigOptionEnum(boost::any_cast(value))); - else if (opt_key.compare("no_perimeter_unsupported_algo") == 0) - config.set_key_value(opt_key, new ConfigOptionEnum(boost::any_cast(value))); - else if (opt_key.compare("infill_connection") == 0) - config.set_key_value(opt_key, new ConfigOptionEnum(boost::any_cast(value))); - else if (opt_key.compare("wipe_advanced_algo") == 0) - config.set_key_value(opt_key, new ConfigOptionEnum(boost::any_cast(value))); else if (opt_key.compare("support_material_contact_distance_type") == 0) config.set_key_value(opt_key, new ConfigOptionEnum(boost::any_cast(value))); - else if (opt_key.compare("display_orientation") == 0) - config.set_key_value(opt_key, new ConfigOptionEnum(boost::any_cast(value))); + else if (opt_key.compare("support_material_pattern") == 0) + config.set_key_value(opt_key, new ConfigOptionEnum(boost::any_cast(value))); else if(opt_key.compare("support_pillar_connection_mode") == 0) config.set_key_value(opt_key, new ConfigOptionEnum(boost::any_cast(value))); - else if(opt_key == "printhost_authorization_type") - config.set_key_value(opt_key, new ConfigOptionEnum(boost::any_cast(value))); + else if (opt_key.compare("wipe_advanced_algo") == 0) + config.set_key_value(opt_key, new ConfigOptionEnum(boost::any_cast(value))); } break; case coPoints:{ diff --git a/src/slic3r/GUI/OptionsGroup.cpp b/src/slic3r/GUI/OptionsGroup.cpp index 56cdc0e7a..a3bceecab 100644 --- a/src/slic3r/GUI/OptionsGroup.cpp +++ b/src/slic3r/GUI/OptionsGroup.cpp @@ -924,56 +924,39 @@ boost::any ConfigOptionsGroup::get_config_value(const DynamicPrintConfig& config opt_key == "bottom_fill_pattern" || opt_key == "solid_fill_pattern" || opt_key == "fill_pattern" || - opt_key == "brim_ears_pattern" ) { + opt_key == "brim_ears_pattern" || + opt_key == "support_material_interface_pattern") { ret = static_cast(config.option>(opt_key)->value); - } - else if (opt_key == "complete_objects_sort") { + } else if (opt_key == "complete_objects_sort") { ret = static_cast(config.option>(opt_key)->value); - } - else if (opt_key == "ironing_type") { - ret = static_cast(config.option>(opt_key)->value); - } - else if (opt_key == "gcode_flavor") { + } else if (opt_key == "display_orientation") { + ret = static_cast(config.option>(opt_key)->value); + } else if (opt_key == "gcode_flavor") { ret = static_cast(config.option>(opt_key)->value); - } - else if (opt_key == "machine_limits_usage") { - ret = static_cast(config.option>(opt_key)->value); - } - else if (opt_key == "support_material_interface_pattern") { - ret = static_cast(config.option>(opt_key)->value); - } - else if (opt_key == "support_material_pattern") { - ret = static_cast(config.option>(opt_key)->value); - } - else if (opt_key.compare("seam_position") == 0 || opt_key.compare("perimeter_loop_seam") == 0) { - ret = static_cast(config.option>(opt_key)->value); - } - else if (opt_key.compare("host_type") == 0) { + } else if (opt_key == "host_type") { ret = static_cast(config.option>(opt_key)->value); - } - else if (opt_key == "infill_dense_algo"){ - ret = static_cast(config.option>(opt_key)->value); - } - else if (opt_key == "no_perimeter_unsupported_algo"){ - ret = static_cast(config.option>(opt_key)->value); - } - else if (opt_key == "infill_connection") { + } else if (opt_key == "infill_connection") { ret = static_cast(config.option>(opt_key)->value); - } - else if (opt_key == "wipe_advanced_algo"){ - ret = static_cast(config.option>(opt_key)->value); - } - else if (opt_key == "support_material_contact_distance_type"){ + } else if (opt_key == "infill_dense_algo") { + ret = static_cast(config.option>(opt_key)->value); + } else if (opt_key == "ironing_type") { + ret = static_cast(config.option>(opt_key)->value); + } else if (opt_key == "machine_limits_usage") { + ret = static_cast(config.option>(opt_key)->value); + } else if (opt_key == "no_perimeter_unsupported_algo") { + ret = static_cast(config.option>(opt_key)->value); + } else if (opt_key == "printhost_authorization_type") { + ret = static_cast(config.option>(opt_key)->value); + } else if (opt_key == "seam_position" || opt_key == "perimeter_loop_seam") { + ret = static_cast(config.option>(opt_key)->value); + } else if (opt_key == "support_material_contact_distance_type"){ ret = static_cast(config.option>(opt_key)->value); - } - else if (opt_key == "display_orientation") { - ret = static_cast(config.option>(opt_key)->value); - } - else if (opt_key == "support_pillar_connection_mode") { + } else if (opt_key == "support_material_pattern") { + ret = static_cast(config.option>(opt_key)->value); + } else if (opt_key == "support_pillar_connection_mode") { ret = static_cast(config.option>(opt_key)->value); - } - else if (opt_key == "printhost_authorization_type") { - ret = static_cast(config.option>(opt_key)->value); + } else if (opt_key == "wipe_advanced_algo") { + ret = static_cast(config.option>(opt_key)->value); } } break; diff --git a/src/slic3r/GUI/UnsavedChangesDialog.cpp b/src/slic3r/GUI/UnsavedChangesDialog.cpp index 364f2fd57..923581241 100644 --- a/src/slic3r/GUI/UnsavedChangesDialog.cpp +++ b/src/slic3r/GUI/UnsavedChangesDialog.cpp @@ -938,22 +938,43 @@ static wxString get_string_value(std::string opt_key, const DynamicPrintConfig& case coEnum: { if (opt_key == "top_fill_pattern" || opt_key == "bottom_fill_pattern" || - opt_key == "fill_pattern") + opt_key == "fill_pattern" || + opt_key == "solid_fill_pattern" || + opt_key == "brim_ears_pattern" || + opt_key == "support_material_interface_pattern") return get_string_from_enum(opt_key, config, true); - if (opt_key == "gcode_flavor") - return get_string_from_enum(opt_key, config); - if (opt_key == "machine_limits_usage") - return get_string_from_enum(opt_key, config); - if (opt_key == "ironing_type") - return get_string_from_enum(opt_key, config); - if (opt_key == "support_material_pattern") - return get_string_from_enum(opt_key, config); - if (opt_key == "seam_position") - return get_string_from_enum(opt_key, config); + if (opt_key == "complete_objects_sort") + return get_string_from_enum(opt_key, config); if (opt_key == "display_orientation") return get_string_from_enum(opt_key, config); + if (opt_key == "gcode_flavor") + return get_string_from_enum(opt_key, config); + if (opt_key == "host_type") + return get_string_from_enum(opt_key, config); + if (opt_key == "infill_connection") + return get_string_from_enum(opt_key, config); + if (opt_key == "infill_dense_algo") + return get_string_from_enum(opt_key, config); + if (opt_key == "ironing_type") + return get_string_from_enum(opt_key, config); + if (opt_key == "machine_limits_usage") + return get_string_from_enum(opt_key, config); + if (opt_key == "no_perimeter_unsupported_algo") + return get_string_from_enum(opt_key, config); + if (opt_key == "perimeter_loop_seam") + return get_string_from_enum(opt_key, config, true); + if (opt_key == "printhost_authorization_type") + return get_string_from_enum(opt_key, config); + if (opt_key == "seam_position") + return get_string_from_enum(opt_key, config); + if (opt_key == "support_material_contact_distance_type") + return get_string_from_enum(opt_key, config); + if (opt_key == "support_material_pattern") + return get_string_from_enum(opt_key, config); if (opt_key == "support_pillar_connection_mode") return get_string_from_enum(opt_key, config); + if (opt_key == "wipe_advanced_algo") + return get_string_from_enum(opt_key, config); break; } case coPoints: {