mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-19 19:33:47 +00:00
Fix filament preset undo tracking (#11693)
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.
This commit is contained in:
@@ -7646,6 +7646,9 @@ std::set<std::string> filament_options_with_variant = {
|
|||||||
"filament_retraction_length",
|
"filament_retraction_length",
|
||||||
"filament_z_hop",
|
"filament_z_hop",
|
||||||
"filament_z_hop_types",
|
"filament_z_hop_types",
|
||||||
|
"filament_retract_lift_above",
|
||||||
|
"filament_retract_lift_below",
|
||||||
|
"filament_retract_lift_enforce",
|
||||||
"filament_retract_restart_extra",
|
"filament_retract_restart_extra",
|
||||||
"filament_retraction_speed",
|
"filament_retraction_speed",
|
||||||
"filament_deretraction_speed",
|
"filament_deretraction_speed",
|
||||||
@@ -7664,7 +7667,11 @@ std::set<std::string> filament_options_with_variant = {
|
|||||||
"filament_flush_volumetric_speed",
|
"filament_flush_volumetric_speed",
|
||||||
"filament_flush_temp",
|
"filament_flush_temp",
|
||||||
"volumetric_speed_coefficients",
|
"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
|
// Parameters that are the same as the number of extruders
|
||||||
|
|||||||
@@ -892,7 +892,8 @@ void Tab::decorate()
|
|||||||
void Tab::filter_diff_option(std::vector<std::string> &options)
|
void Tab::filter_diff_option(std::vector<std::string> &options)
|
||||||
{
|
{
|
||||||
for (auto &opt : 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;
|
bool found = false;
|
||||||
for (auto page : m_pages) {
|
for (auto page : m_pages) {
|
||||||
if (auto iter = page->m_opt_id_map.find(opt); iter != page->m_opt_id_map.end()) {
|
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<std::string> &options)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!found) opt.clear();
|
if (!found) opt = opt.substr(0, hash_pos);
|
||||||
}
|
}
|
||||||
options.erase(std::remove(options.begin(), options.end(), ""), options.end());
|
options.erase(std::remove(options.begin(), options.end(), ""), options.end());
|
||||||
}
|
}
|
||||||
@@ -912,7 +913,7 @@ void Tab::update_changed_ui()
|
|||||||
if (m_postpone_update_ui)
|
if (m_postpone_update_ui)
|
||||||
return;
|
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);
|
|| m_type == Preset::TYPE_SLA_MATERIAL || m_type == Preset::TYPE_MODEL);
|
||||||
auto dirty_options = m_presets->current_dirty_options(deep_compare);
|
auto dirty_options = m_presets->current_dirty_options(deep_compare);
|
||||||
auto nonsys_options = m_presets->current_different_from_parent_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)
|
auto append_retraction_option = [this, retraction_optgroup](const std::string& opt_key, int opt_index)
|
||||||
{
|
{
|
||||||
Line line {"",""};
|
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) {
|
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
|
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)
|
auto append_ironing_option = [this, ironing_optgroup](const std::string& opt_key, int opt_index)
|
||||||
{
|
{
|
||||||
Line line {"",""};
|
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) {
|
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
|
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");
|
optgroup = page->new_optgroup(L("Print temperature"), L"param_extruder_temp");
|
||||||
line = { L("Nozzle"), L("Nozzle temperature when printing") };
|
line = { L("Nozzle"), L("Nozzle temperature when printing") };
|
||||||
line.label_path = "material_temperatures#nozzle";
|
line.label_path = "material_temperatures#nozzle";
|
||||||
line.append_option(optgroup->get_option("nozzle_temperature_initial_layer"));
|
line.append_option(optgroup->get_option("nozzle_temperature_initial_layer", 0));
|
||||||
line.append_option(optgroup->get_option("nozzle_temperature"));
|
line.append_option(optgroup->get_option("nozzle_temperature", 0));
|
||||||
optgroup->append_line(line);
|
optgroup->append_line(line);
|
||||||
|
|
||||||
optgroup = page->new_optgroup(L("Bed temperature"), L"param_bed_temp");
|
optgroup = page->new_optgroup(L("Bed temperature"), L"param_bed_temp");
|
||||||
@@ -3970,7 +3971,7 @@ void TabFilament::build()
|
|||||||
//BBS
|
//BBS
|
||||||
optgroup = page->new_optgroup(L("Volumetric speed limitation"), L"param_volumetric_speed");
|
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_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 = { "", "" };
|
||||||
//line.full_width = 1;
|
//line.full_width = 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user