Fix sidebar combobox behavior for support routing

"support_buildplate_only" was toggled only for default supports
This commit is contained in:
tamasmeszaros 2023-01-09 12:40:09 +01:00
parent 32e323c64c
commit aec0c4a0dc
4 changed files with 29 additions and 4 deletions

View File

@ -4802,6 +4802,23 @@ Points get_bed_shape(const PrintConfig &cfg)
Points get_bed_shape(const SLAPrinterConfig &cfg) { return to_points(cfg.bed_shape.values); } Points get_bed_shape(const SLAPrinterConfig &cfg) { return to_points(cfg.bed_shape.values); }
std::string get_sla_suptree_prefix(const DynamicPrintConfig &config)
{
const auto *suptreetype = config.option<ConfigOptionEnum<sla::SupportTreeType>>("support_tree_type");
std::string slatree = "";
if (suptreetype) {
auto ttype = static_cast<sla::SupportTreeType>(suptreetype->getInt());
switch (ttype) {
case sla::SupportTreeType::Branching: slatree = "branching"; break;
case sla::SupportTreeType::Organic: slatree = "organic"; break;
default:
;
}
}
return slatree;
}
} // namespace Slic3r } // namespace Slic3r
#include <cereal/types/polymorphic.hpp> #include <cereal/types/polymorphic.hpp>

View File

@ -1167,6 +1167,8 @@ Points get_bed_shape(const DynamicPrintConfig &cfg);
Points get_bed_shape(const PrintConfig &cfg); Points get_bed_shape(const PrintConfig &cfg);
Points get_bed_shape(const SLAPrinterConfig &cfg); Points get_bed_shape(const SLAPrinterConfig &cfg);
std::string get_sla_suptree_prefix(const DynamicPrintConfig &config);
// ModelConfig is a wrapper around DynamicPrintConfig with an addition of a timestamp. // ModelConfig is a wrapper around DynamicPrintConfig with an addition of a timestamp.
// Each change of ModelConfig is tracked by assigning a new timestamp from a global counter. // Each change of ModelConfig is tracked by assigning a new timestamp from a global counter.
// The counter is used for faster synchronization of the background slicing thread // The counter is used for faster synchronization of the background slicing thread

View File

@ -553,10 +553,13 @@ FreqChangedParams::FreqChangedParams(wxWindow* parent) :
const bool supports_enable = selection == _("None") ? false : true; const bool supports_enable = selection == _("None") ? false : true;
new_conf.set_key_value("supports_enable", new ConfigOptionBool(supports_enable)); new_conf.set_key_value("supports_enable", new ConfigOptionBool(supports_enable));
std::string treetype = get_sla_suptree_prefix(new_conf);
if (selection == _("Everywhere")) if (selection == _("Everywhere"))
new_conf.set_key_value("support_buildplate_only", new ConfigOptionBool(false)); new_conf.set_key_value(treetype + "support_buildplate_only", new ConfigOptionBool(false));
else if (selection == _("Support on build plate only")) else if (selection == _("Support on build plate only"))
new_conf.set_key_value("support_buildplate_only", new ConfigOptionBool(true)); new_conf.set_key_value(treetype + "support_buildplate_only", new ConfigOptionBool(true));
} }
tab->load_config(new_conf); tab->load_config(new_conf);

View File

@ -1038,8 +1038,11 @@ void Tab::load_key_value(const std::string& opt_key, const boost::any& value, bo
static wxString support_combo_value_for_config(const DynamicPrintConfig &config, bool is_fff) static wxString support_combo_value_for_config(const DynamicPrintConfig &config, bool is_fff)
{ {
std::string slatree = is_fff ? "" : get_sla_suptree_prefix(config);
const std::string support = is_fff ? "support_material" : "supports_enable"; const std::string support = is_fff ? "support_material" : "supports_enable";
const std::string buildplate_only = is_fff ? "support_material_buildplate_only" : "support_buildplate_only"; const std::string buildplate_only = is_fff ? "support_material_buildplate_only" : slatree + "support_buildplate_only";
return return
! config.opt_bool(support) ? ! config.opt_bool(support) ?
_("None") : _("None") :
@ -1082,7 +1085,7 @@ void Tab::on_value_change(const std::string& opt_key, const boost::any& value)
if (is_fff ? if (is_fff ?
(opt_key == "support_material" || opt_key == "support_material_auto" || opt_key == "support_material_buildplate_only") : (opt_key == "support_material" || opt_key == "support_material_auto" || opt_key == "support_material_buildplate_only") :
(opt_key == "supports_enable" || opt_key == "support_buildplate_only")) (opt_key == "supports_enable" || opt_key == "support_tree_type" || opt_key == get_sla_suptree_prefix(*m_config) + "support_buildplate_only"))
og_freq_chng_params->set_value("support", support_combo_value_for_config(*m_config, is_fff)); og_freq_chng_params->set_value("support", support_combo_value_for_config(*m_config, is_fff));
if (! is_fff && (opt_key == "pad_enable" || opt_key == "pad_around_object")) if (! is_fff && (opt_key == "pad_enable" || opt_key == "pad_around_object"))