From a25853982c576f522a77a1c2f92b2d92d9ed18df Mon Sep 17 00:00:00 2001 From: YuSanka Date: Mon, 11 Mar 2019 16:00:13 +0100 Subject: [PATCH] Added "Supports" on Sidebar for SLA mode + Checked scheduling process calling after change Support/Pad parameters from the Sidebar --- src/slic3r/GUI/Plater.cpp | 69 ++++++++++++++++++++++++++------------- src/slic3r/GUI/Tab.cpp | 20 +++++++----- 2 files changed, 59 insertions(+), 30 deletions(-) diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index fa2510394..808ad81c8 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -365,20 +365,20 @@ FreqChangedParams::FreqChangedParams(wxWindow* parent, const int label_width) : Line line = Line { "", "" }; - ConfigOptionDef def; - def.label = L("Supports"); - def.type = coStrings; - def.gui_type = "select_open"; - def.tooltip = L("Select what kind of support do you need"); - def.enum_labels.push_back(L("None")); - def.enum_labels.push_back(L("Support on build plate only")); - def.enum_labels.push_back(L("Everywhere")); - const std::string selection = !config->opt_bool("support_material") ? - "None" : config->opt_bool("support_material_buildplate_only") ? - "Support on build plate only" : - "Everywhere"; - def.default_value = new ConfigOptionStrings{ selection }; - Option option = Option(def, "support"); + ConfigOptionDef support_def; + support_def.label = L("Supports"); + support_def.type = coStrings; + support_def.gui_type = "select_open"; + support_def.tooltip = L("Select what kind of support do you need"); + support_def.enum_labels.push_back(L("None")); + support_def.enum_labels.push_back(L("Support on build plate only")); + support_def.enum_labels.push_back(L("Everywhere")); + std::string selection = !config->opt_bool("support_material") ? + "None" : config->opt_bool("support_material_buildplate_only") ? + "Support on build plate only" : + "Everywhere"; + support_def.default_value = new ConfigOptionStrings{ selection }; + Option option = Option(support_def, "support"); option.opt.full_width = true; line.append_option(option); m_og->append_line(line); @@ -393,6 +393,7 @@ FreqChangedParams::FreqChangedParams(wxWindow* parent, const int label_width) : line.append_option(option); m_brim_width = config->opt_float("brim_width"); + ConfigOptionDef def; def.label = L("Brim"); def.type = coBool; def.tooltip = L("This flag enables the brim that will be printed around each object on the first layer."); @@ -428,6 +429,7 @@ FreqChangedParams::FreqChangedParams(wxWindow* parent, const int label_width) : m_og->append_line(line); + // Frequently changed parameters for SLA_technology m_og_sla = std::make_shared(parent, ""); DynamicPrintConfig* config_sla = &wxGetApp().preset_bundle->sla_prints.get_edited_preset().config; @@ -438,20 +440,43 @@ FreqChangedParams::FreqChangedParams(wxWindow* parent, const int label_width) : Tab* tab = wxGetApp().get_tab(Preset::TYPE_SLA_PRINT); if (!tab) return; - tab->set_value(opt_key, value); + if (opt_key == "pad_enable") { + tab->set_value(opt_key, value); + tab->update(); + } + else //(opt_key == "support") + { + DynamicPrintConfig new_conf = *config_sla; + const wxString& selection = boost::any_cast(value); + + const bool supports_enable = selection == _("None") ? false : true; + new_conf.set_key_value("supports_enable", new ConfigOptionBool(supports_enable)); + + if (selection == _("Everywhere")) + new_conf.set_key_value("support_buildplate_only", new ConfigOptionBool(false)); + else if (selection == _("Support on build plate only")) + new_conf.set_key_value("support_buildplate_only", new ConfigOptionBool(true)); + + tab->load_config(new_conf); + } - DynamicPrintConfig new_conf = *config_sla; - new_conf.set_key_value(opt_key, new ConfigOptionBool(boost::any_cast(value))); - tab->load_config(new_conf); tab->update_dirty(); - }; - + }; line = Line{ "", "" }; - option = m_og_sla->get_option("supports_enable"); - option.opt.sidetext = " "; + selection = !config_sla->opt_bool("supports_enable") ? + "None" : config_sla->opt_bool("support_buildplate_only") ? + "Support on build plate only" : + "Everywhere"; + support_def.default_value = new ConfigOptionStrings{ selection }; + option = Option(support_def, "support"); + option.opt.full_width = true; line.append_option(option); + m_og_sla->append_line(line); + + + line = Line{ "", "" }; option = m_og_sla->get_option("pad_enable"); option.opt.sidetext = " "; diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 060eb1383..0d53c3fd9 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -751,21 +751,25 @@ void Tab::load_key_value(const std::string& opt_key, const boost::any& value, bo void Tab::on_value_change(const std::string& opt_key, const boost::any& value) { - ConfigOptionsGroup* og_freq_chng_params = wxGetApp().sidebar().og_freq_chng_params(supports_printer_technology(ptFFF)); - if (opt_key == "fill_density" || opt_key == "supports_enable" || opt_key == "pad_enable") + const bool is_fff = supports_printer_technology(ptFFF); + ConfigOptionsGroup* og_freq_chng_params = wxGetApp().sidebar().og_freq_chng_params(is_fff); + if (opt_key == "fill_density" || opt_key == "pad_enable") { boost::any val = og_freq_chng_params->get_config_value(*m_config, opt_key); og_freq_chng_params->set_value(opt_key, val); } - if (opt_key == "support_material" || opt_key == "support_material_buildplate_only") + + if ( is_fff && (opt_key == "support_material" || opt_key == "support_material_buildplate_only") || + !is_fff && (opt_key == "supports_enable" || opt_key == "support_buildplate_only")) { - wxString new_selection = !m_config->opt_bool("support_material") ? - _("None") : - m_config->opt_bool("support_material_buildplate_only") ? - _("Support on build plate only") : - _("Everywhere"); + const std::string support = is_fff ? "support_material" : "supports_enable"; + const std::string buildplate_only = is_fff ? "support_material_buildplate_only" : "support_buildplate_only"; + wxString new_selection = !m_config->opt_bool(support) ? _("None") : + m_config->opt_bool(buildplate_only) ? _("Support on build plate only") : + _("Everywhere"); og_freq_chng_params->set_value("support", new_selection); } + if (opt_key == "brim_width") { bool val = m_config->opt_float("brim_width") > 0.0 ? true : false;