mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-08-07 10:07:38 +00:00
Belt brim: offer "Leading edge only" only on belt printers
"Leading edge only" describes where a part meets a moving belt, so it has no meaning on a fixed bed and should not clutter the Brim type dropdown there. Filtered the same way support_style and wipe_tower_wall_type already are a few lines above in TabPrint::toggle_options(): the field holds its own copy of the option definition, and Choice maps the combobox selection straight onto that copy's enum_values, so rewriting the values, the labels and the combobox items together keeps the mapping correct. The entry is kept when it is the current value, so opening a project that uses it on a non-belt printer cannot leave the control displaying an option it does not offer - which would silently rewrite the setting on the next edit. Print::validate() already warns that it prints as an ordinary outer brim there. Matches the scope of the existing precedents: the per-object override panel is not filtered.
This commit is contained in:
@@ -3227,6 +3227,41 @@ void TabPrint::toggle_options()
|
||||
cb->SetValue(n);
|
||||
}
|
||||
|
||||
// "Leading edge only" describes where a part meets a moving belt, so it is offered only
|
||||
// on belt printers. Same pattern as support_style above: the field owns a copy of the
|
||||
// option definition, and Choice maps the combobox selection straight onto that copy's
|
||||
// enum_values, so rewriting both together keeps the mapping correct.
|
||||
field = m_active_page->get_field("brim_type");
|
||||
if (auto choice = dynamic_cast<Choice *>(field)) {
|
||||
bool is_belt_printer = false;
|
||||
if (m_preset_bundle) {
|
||||
const auto *belt_opt = m_preset_bundle->printers.get_edited_preset().config.option<ConfigOptionBool>("belt_printer");
|
||||
if (belt_opt)
|
||||
is_belt_printer = belt_opt->value;
|
||||
}
|
||||
auto def = print_config_def.get("brim_type");
|
||||
const auto current = m_config->opt_enum<BrimType>("brim_type");
|
||||
auto &opt = const_cast<ConfigOptionDef &>(field->m_opt);
|
||||
auto cb = dynamic_cast<ComboBox *>(choice->window);
|
||||
if (cb != nullptr) {
|
||||
auto n = cb->GetValue();
|
||||
opt.enum_values.clear();
|
||||
opt.enum_labels.clear();
|
||||
cb->Clear();
|
||||
for (size_t i = 0; i < def->enum_values.size(); ++ i) {
|
||||
// Keep the entry if it is already selected, so switching to a non-belt
|
||||
// printer cannot leave the control showing a value it does not offer.
|
||||
if (def->enum_values[i] == "leading_edge_only" && ! is_belt_printer
|
||||
&& current != btLeadingEdgeOnly)
|
||||
continue;
|
||||
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->SetValue(n);
|
||||
}
|
||||
}
|
||||
|
||||
// BBL printers do not support cone wipe tower
|
||||
field = m_active_page->get_field("wipe_tower_wall_type");
|
||||
if (auto choice = dynamic_cast<Choice*>(field)) {
|
||||
|
||||
Reference in New Issue
Block a user