fix(print): keep derived physical_extruder_map in the original-config snapshot

Print::apply() derives physical_extruder_map from printer_extruder_id and writes
it into new_full_config, but does so after m_ori_full_print_config is snapshotted.
The selector write-back path rebuilds m_full_print_config from that snapshot, so
m_full_print_config kept the unexpanded default while every subsequent apply
re-derived the expanded map. An unchanged config therefore diffed on
physical_extruder_map on every re-apply, and since that key is not handled by
invalidate_state_by_config_options() it fell through to the catch-all and
invalidated every step — forcing a full reslice on each apply.

Mirror the derived map into the snapshot so the two stay consistent.

Caught by the upstream test 'Selector write-back expands migrating filaments and
survives re-apply', which asserts a re-applied unchanged config is not
APPLY_STATUS_INVALIDATED.
This commit is contained in:
Clifford Garwood
2026-07-13 16:22:28 -04:00
parent fdb0e20f36
commit 7e272f0303
+9 -1
View File
@@ -1237,8 +1237,16 @@ Print::ApplyStatus Print::apply(const Model &model, DynamicPrintConfig new_full_
{
auto* pem = new_full_config.option<ConfigOptionInts>("physical_extruder_map", true);
const auto* pei = new_full_config.option<ConfigOptionInts>("printer_extruder_id");
if (pem)
if (pem) {
pem->values = effective_physical_extruder_map(pem, pei).values;
// m_ori_full_print_config was snapshotted above, before this derivation, and the
// selector write-back path rebuilds m_full_print_config from that snapshot. Without
// mirroring the derived map into it, m_full_print_config keeps the unexpanded default
// while every later apply re-derives the expanded one, so an unchanged config diffs
// on physical_extruder_map forever and invalidates all steps on every re-apply.
if (auto* ori_pem = m_ori_full_print_config.option<ConfigOptionInts>("physical_extruder_map", true))
ori_pem->values = pem->values;
}
}
auto opt_filament_map = new_full_config.option<ConfigOptionInts>("filament_map");