From 4a7311bf0160e54aa9d912a1d92f06beda8ccb61 Mon Sep 17 00:00:00 2001 From: Hanif Koh Date: Fri, 11 Sep 2026 15:57:58 +0800 Subject: [PATCH] Rebuild the Brim Type Combobox Only When Its Entries Change toggle_options() now runs on every value change and mode switch; rebuild the brim_type choices only when the leading-edge entry has to be added or removed. --- src/slic3r/GUI/Tab.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 1c03ddf88a..2c1247edb5 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -3230,16 +3230,17 @@ void TabPrint::toggle_options() const auto current = m_config->opt_enum("brim_type"); auto &opt = const_cast(field->m_opt); auto cb = dynamic_cast(choice->window); - if (cb != nullptr) { + // 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. + const bool offer_leading_edge = is_belt_printer || current == btLeadingEdgeOnly; + const bool offered = std::find(opt.enum_values.begin(), opt.enum_values.end(), "leading_edge_only") != opt.enum_values.end(); + if (cb != nullptr && offer_leading_edge != offered) { 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) + if (def->enum_values[i] == "leading_edge_only" && ! offer_leading_edge) continue; opt.enum_values.push_back(def->enum_values[i]); opt.enum_labels.push_back(def->enum_labels[i]);