mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-10-20 22:18:30 +00:00
Keep a Disabled Filament Override Off After a Restart (Key List Variant) (#16650)
Keep a Disabled Filament Override Off After a Restart A child preset stores "nil" both for an override the user switched off and for a per-variant column it inherits from its parent, and the loader filled every nil from the parent. Whenever the parent preset sets Retract Before Wipe or another override, switching it off lasted only until the next restart, project open or newer cloud copy. Treat the keys in is_filament_extruder_override_key, now including the ironing overrides, as "nil means off": Preset::save and the project-embedded preset diff write such an option with all its columns, and the loader keeps its nil columns while still mapping them onto the parent's variants by name. Every other nullable option keeps nil as "inherit this column". The cloud diff only force-emits a disabled override whose default is a real value.
This commit is contained in:
1 parent
0d5b3a79d7
commit
74d4392dae
5 files changed
+150
-12
No files matched your search
@@ -119,12 +119,18 @@ const std::vector<std::string> filament_extruder_override_keys = {
|
||||
};
|
||||
|
||||
// Some filament override parameters are generated from filament_extruder_override_keys,
|
||||
// while filament_retract_length_nc is defined separately. Keep the generator list
|
||||
// unchanged and use this helper for behavior checks that need the full override set.
|
||||
// while filament_retract_length_nc and the ironing overrides are defined separately.
|
||||
// Keep the generator list unchanged and use this helper for behavior checks that need
|
||||
// the full override set. A nil in one of these keys means the override is disabled, so
|
||||
// child presets store and load it verbatim instead of treating nil as "inherit".
|
||||
bool is_filament_extruder_override_key(const std::string &opt_key)
|
||||
{
|
||||
return std::find(filament_extruder_override_keys.begin(), filament_extruder_override_keys.end(), opt_key) != filament_extruder_override_keys.end() ||
|
||||
opt_key == "filament_retract_length_nc";
|
||||
opt_key == "filament_retract_length_nc" ||
|
||||
opt_key == "filament_ironing_flow" ||
|
||||
opt_key == "filament_ironing_spacing" ||
|
||||
opt_key == "filament_ironing_inset" ||
|
||||
opt_key == "filament_ironing_speed";
|
||||
}
|
||||
|
||||
size_t get_extruder_index(const GCodeConfig& config, unsigned int filament_id)
|
||||
@@ -12272,7 +12278,8 @@ void DynamicPrintConfig::update_diff_values_to_child_config(DynamicPrintConfig&
|
||||
opt_src->set(opt_target);
|
||||
}
|
||||
else
|
||||
opt_vec_src->set_only_diff(opt_vec_dest, variant_index, stride);
|
||||
// An override's nil means "disabled" and is the child's value; every other nil column inherits.
|
||||
opt_vec_src->set_only_diff(opt_vec_dest, variant_index, stride, is_filament_extruder_override_key(opt));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user