From b2a2b71b925f0e0bfa9eb38032076f7074f23c34 Mon Sep 17 00:00:00 2001 From: Kiss Lorand <50251547+kisslorand@users.noreply.github.com> Date: Mon, 22 Dec 2025 18:18:41 +0200 Subject: [PATCH] Fix filament preset undo tracking (#11693) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix filament preset undo/dirty tracking to match Bambu behavior Use deep compare for filament presets so vector options report #idx keys. Align undo/dirty mapping with indexed fields and Bambu’s filter_diff_option. Pass explicit indices for filament override fields. Add missing filament variant keys (retract lift bounds, ironing overrides) to filament_options_with_variant so per‑filament undo works. --- src/libslic3r/PrintConfig.cpp | 9 ++++++++- src/slic3r/GUI/Tab.cpp | 17 +++++++++-------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 6287e77ceb..2fb29fc2cd 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -7646,6 +7646,9 @@ std::set filament_options_with_variant = { "filament_retraction_length", "filament_z_hop", "filament_z_hop_types", + "filament_retract_lift_above", + "filament_retract_lift_below", + "filament_retract_lift_enforce", "filament_retract_restart_extra", "filament_retraction_speed", "filament_deretraction_speed", @@ -7664,7 +7667,11 @@ std::set filament_options_with_variant = { "filament_flush_volumetric_speed", "filament_flush_temp", "volumetric_speed_coefficients", - "filament_adaptive_volumetric_speed" + "filament_adaptive_volumetric_speed", + "filament_ironing_flow", + "filament_ironing_spacing", + "filament_ironing_inset", + "filament_ironing_speed" }; // Parameters that are the same as the number of extruders diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index b016327b2a..ab3a43ab4e 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -892,7 +892,8 @@ void Tab::decorate() void Tab::filter_diff_option(std::vector &options) { for (auto &opt : options) { - if (opt.find_last_of('#') == std::string::npos) continue; + const auto hash_pos = opt.find_last_of('#'); + if (hash_pos == std::string::npos) continue; bool found = false; for (auto page : m_pages) { if (auto iter = page->m_opt_id_map.find(opt); iter != page->m_opt_id_map.end()) { @@ -901,7 +902,7 @@ void Tab::filter_diff_option(std::vector &options) break; } } - if (!found) opt.clear(); + if (!found) opt = opt.substr(0, hash_pos); } options.erase(std::remove(options.begin(), options.end(), ""), options.end()); } @@ -912,7 +913,7 @@ void Tab::update_changed_ui() if (m_postpone_update_ui) return; - const bool deep_compare = (m_type == Preset::TYPE_PRINTER || m_type == Preset::TYPE_PRINT + const bool deep_compare = (m_type == Preset::TYPE_PRINTER || m_type == Preset::TYPE_PRINT || m_type == Preset::TYPE_FILAMENT || m_type == Preset::TYPE_SLA_MATERIAL || m_type == Preset::TYPE_MODEL); auto dirty_options = m_presets->current_dirty_options(deep_compare); auto nonsys_options = m_presets->current_different_from_parent_options(deep_compare); @@ -3559,7 +3560,7 @@ void TabFilament::add_filament_overrides_page() auto append_retraction_option = [this, retraction_optgroup](const std::string& opt_key, int opt_index) { Line line {"",""}; - line = retraction_optgroup->create_single_option_line(retraction_optgroup->get_option(opt_key)); + line = retraction_optgroup->create_single_option_line(retraction_optgroup->get_option(opt_key, opt_index)); line.near_label_widget = [this, optgroup_wk = ConfigOptionsGroupWkp(retraction_optgroup), opt_key, opt_index](wxWindow* parent) { auto check_box = new ::CheckBox(parent); // ORCA modernize checkboxes @@ -3617,7 +3618,7 @@ void TabFilament::add_filament_overrides_page() auto append_ironing_option = [this, ironing_optgroup](const std::string& opt_key, int opt_index) { Line line {"",""}; - line = ironing_optgroup->create_single_option_line(ironing_optgroup->get_option(opt_key)); + line = ironing_optgroup->create_single_option_line(ironing_optgroup->get_option(opt_key, opt_index)); line.near_label_widget = [this, optgroup_wk = ConfigOptionsGroupWkp(ironing_optgroup), opt_key, opt_index](wxWindow* parent) { auto check_box = new ::CheckBox(parent); // ORCA modernize checkboxes @@ -3890,8 +3891,8 @@ void TabFilament::build() optgroup = page->new_optgroup(L("Print temperature"), L"param_extruder_temp"); line = { L("Nozzle"), L("Nozzle temperature when printing") }; line.label_path = "material_temperatures#nozzle"; - line.append_option(optgroup->get_option("nozzle_temperature_initial_layer")); - line.append_option(optgroup->get_option("nozzle_temperature")); + line.append_option(optgroup->get_option("nozzle_temperature_initial_layer", 0)); + line.append_option(optgroup->get_option("nozzle_temperature", 0)); optgroup->append_line(line); optgroup = page->new_optgroup(L("Bed temperature"), L"param_bed_temp"); @@ -3970,7 +3971,7 @@ void TabFilament::build() //BBS optgroup = page->new_optgroup(L("Volumetric speed limitation"), L"param_volumetric_speed"); optgroup->append_single_option_line("filament_adaptive_volumetric_speed", "material_volumetric_speed_limitation#adaptive-volumetric-speed", 0); - optgroup->append_single_option_line("filament_max_volumetric_speed", "material_volumetric_speed_limitation#max-volumetric-speed"); + optgroup->append_single_option_line("filament_max_volumetric_speed", "material_volumetric_speed_limitation#max-volumetric-speed", 0); //line = { "", "" }; //line.full_width = 1;