fix(preset): don't truncate child variant vectors to parent size on load

update_non_diff_values_to_base_config sizes variant_index to the parent's
(inherits-target's) extruder count, and set_with_restore then replaces
the child's vector with a parent-sized one. When the child preset has
more extruders than the parent (e.g. an IDEX preset inheriting from a
single-nozzle base), every key in printer_options_with_variant_1 is
truncated to the parent's size on project reload, destroying per-extruder
data.

Observable symptoms: objects render with the wrong color (often black)
after reopening the project, and the printer preset shows a permanent
dirty-asterisk that no save/reload cycle can clear.

The child's saved value is authoritative for its own extruder count, so
skip the parent-shaped merge for the variant-keyed branch when cur >
target. Confirmed by loading a 2-extruder IDEX preset inheriting from a
single-nozzle base: all 24 variant-keyed options previously truncated
from child_size=2 -> 1 are now preserved at size 2.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Clifford Garwood
2026-04-22 01:20:29 -04:00
co-authored by Claude Opus 4.7
parent 9d75ea2ebc
commit 135a571379
+7
View File
@@ -9546,6 +9546,13 @@ void DynamicPrintConfig::update_non_diff_values_to_base_config(DynamicPrintConfi
//nothing to do, keep the original one
}
else {
// Guard: set_with_restore is parent-shaped and would truncate the child's
// vector when the child has more extruders than the parent (e.g. an IDEX
// preset inheriting from a single-nozzle base). The child's saved value is
// authoritative for its own extruder count, so skip the merge for this key.
if (cur_variant_count > target_variant_count)
continue;
int stride = 1;
if (key_set2.find(opt) != key_set2.end())
stride = 2;