mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-07 23:17:35 -06:00
ENH: support styles to sets
Change-Id: I18d4add12907d4d4a10980c1f1244e287934c34c (cherry picked from commit 8ead53319222a2ab4bd76b434afcd657e5045fc7)
This commit is contained in:
parent
b3c4447191
commit
54e47bba33
3 changed files with 45 additions and 4 deletions
|
@ -1416,6 +1416,13 @@ void Tab::on_value_change(const std::string& opt_key, const boost::any& value)
|
|||
}
|
||||
}
|
||||
|
||||
// BBS set support style to default when support type changes
|
||||
if (opt_key == "support_type") {
|
||||
DynamicPrintConfig new_conf = *m_config;
|
||||
new_conf.set_key_value("support_style", new ConfigOptionEnum<SupportMaterialStyle>(smsDefault));
|
||||
m_config_manipulation.apply(m_config, &new_conf);
|
||||
}
|
||||
|
||||
// BBS popup a message to ask the user to set optimum parameters for tree support
|
||||
if (opt_key == "support_type" || opt_key == "support_style") {
|
||||
if (is_tree_slim(m_config->opt_enum<SupportType>("support_type"), m_config->opt_enum<SupportMaterialStyle>("support_style")) &&
|
||||
|
@ -2061,6 +2068,27 @@ void TabPrint::toggle_options()
|
|||
if (!m_active_page) return;
|
||||
|
||||
m_config_manipulation.toggle_print_fff_options(m_config, m_type < Preset::TYPE_COUNT);
|
||||
|
||||
Field *field = m_active_page->get_field("support_style");
|
||||
auto support_type = m_config->opt_enum<SupportType>("support_type");
|
||||
if (auto choice = dynamic_cast<Choice*>(field)) {
|
||||
auto def = print_config_def.get("support_style");
|
||||
std::vector<int> enum_set_normal = {0, 1, 2};
|
||||
std::vector<int> enum_set_tree = {0, 3, 4, 5};
|
||||
auto & set = is_tree(support_type) ? enum_set_tree : enum_set_normal;
|
||||
auto & opt = const_cast<ConfigOptionDef &>(field->m_opt);
|
||||
auto cb = dynamic_cast<ComboBox *>(choice->window);
|
||||
int n = cb->GetSelection();
|
||||
opt.enum_values.clear();
|
||||
opt.enum_labels.clear();
|
||||
cb->Clear();
|
||||
for (auto i : set) {
|
||||
opt.enum_values.push_back(def->enum_values[i]);
|
||||
opt.enum_labels.push_back(def->enum_labels[i]);
|
||||
cb->Append(def->enum_labels[i]);
|
||||
}
|
||||
cb->SetSelection(n >= cb->GetCount() ? cb->GetCount() - 1 : n);
|
||||
}
|
||||
}
|
||||
|
||||
void TabPrint::update()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue