From f61087df02e950e4843c4e5af2251d83f978923b Mon Sep 17 00:00:00 2001 From: supermerill Date: Fri, 23 Aug 2019 23:55:41 +0200 Subject: [PATCH] infill pattern: gui field to enum conversion fixed. Scattered rectilinear now is really scat recti. --- src/libslic3r/PrintConfig.cpp | 2 +- src/slic3r/GUI/Field.cpp | 60 +++++++++++++++++------------------ 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 92c8f687f..33913b111 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -1043,7 +1043,7 @@ void PrintConfigDef::init_fff_params() def->enum_values.push_back("hilbertcurve"); def->enum_values.push_back("archimedeanchords"); def->enum_values.push_back("octagramspiral"); - def->enum_values.push_back("rectilineargapfill"); + def->enum_values.push_back("scatteredrectilinear"); def->enum_labels.push_back(L("Rectilinear")); def->enum_labels.push_back(L("Grid")); def->enum_labels.push_back(L("Triangles")); diff --git a/src/slic3r/GUI/Field.cpp b/src/slic3r/GUI/Field.cpp index 7f558eb63..d416104fb 100644 --- a/src/slic3r/GUI/Field.cpp +++ b/src/slic3r/GUI/Field.cpp @@ -838,35 +838,36 @@ void Choice::set_value(const boost::any& value, bool change_event) field->SetValue(text_value); } else - field->SetSelection(idx); - break; - } - case coEnum: { - int val = boost::any_cast(value); - if (m_opt_id == "top_fill_pattern" || m_opt_id == "bottom_fill_pattern" || m_opt_id == "solid_fill_pattern") - { - if (!m_opt.enum_values.empty()) { - std::string key; - t_config_enum_values map_names = ConfigOptionEnum::get_enum_values(); - for (auto it : map_names) { - if (val == it.second) { - key = it.first; - break; - } - } + field->SetSelection(idx); + break; + } + case coEnum: { + int val = boost::any_cast(value); + if (m_opt_id == "top_fill_pattern" || m_opt_id == "bottom_fill_pattern" || m_opt_id == "solid_fill_pattern" + || m_opt_id == "fill_pattern" || m_opt_id == "support_fill_pattern") + { + if (!m_opt.enum_values.empty()) { + std::string key; + t_config_enum_values map_names = ConfigOptionEnum::get_enum_values(); + for (auto it : map_names) { + if (val == it.second) { + key = it.first; + break; + } + } - size_t idx = 0; - for (auto el : m_opt.enum_values) - { - if (el.compare(key) == 0) - break; - ++idx; - } + size_t idx = 0; + for (auto el : m_opt.enum_values) + { + if (el.compare(key) == 0) + break; + ++idx; + } - val = idx == m_opt.enum_values.size() ? 0 : idx; - } - else - val = 0; + val = idx == m_opt.enum_values.size() ? 0 : idx; + } + else + val = 0; } else if (m_opt_id.compare("perimeter_loop_seam") == 0) { if (!m_opt.enum_values.empty()) { std::string key; @@ -934,7 +935,8 @@ boost::any& Choice::get_value() if (m_opt.type == coEnum) { int ret_enum = field->GetSelection(); - 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") + 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") { if (!m_opt.enum_values.empty()) { std::string key = m_opt.enum_values[ret_enum]; @@ -946,8 +948,6 @@ boost::any& Choice::get_value() else m_value = static_cast(0); } - if (m_opt_id.compare("fill_pattern") == 0) - m_value = static_cast(ret_enum); else if (m_opt_id.compare("gcode_flavor") == 0) m_value = static_cast(ret_enum); else if (m_opt_id.compare("support_material_pattern") == 0)