Publish 3MF: support mixed filaments and per-extruder slot selection

- Publish mixed-filament slots as whole units: serialize the filament_mixed_* definition into project_config on import, grow the receiver's parallel arrays in lockstep, and report unappliable definitions as skipped instead of dropping them silently

- Per-extruder printer selection: one inner tab per extruder, rows keyed by full "#N" ids; single-extruder receivers collapse variants onto their slot (first applied, rest skipped), multi-extruder receivers override element-wise

- New per-slot "Enable" toggle gating what gets published; enabling a mix auto-enables + Full Publishes its components

- Mixed page previews: fixed-size ratio bar, ternary triangle (3 components) and Material Ratio vs Model Height graph (gradients), always visible regardless of Enable

- Tab strip shows full swatch compositions with adjustable spacing; barycentric helpers shared via FilamentBitmapUtils
This commit is contained in:
Lam Wei Lun
2026-08-27 13:17:19 +08:00
parent ce277ebbf5
commit 76d9b8bac0
12 changed files with 1474 additions and 236 deletions
+17
View File
@@ -83,6 +83,23 @@ const std::set<std::string>& publish_structural_keys()
return structural_keys;
}
const std::set<std::string>& publish_mixed_keys()
{
// Must match PresetBundle's s_project_options mixed-color group (PresetBundle.cpp): these
// are project-level parallel per-slot arrays, not filament-preset options, so the import
// material pass applies them into project_config instead of a filament preset config.
static const std::set<std::string> mixed_keys = {
"filament_is_mixed",
"filament_mixed_components",
"filament_mixed_sublayer_ratios",
"filament_mixed_gradient",
"filament_mixed_gradient_range",
"filament_mixed_gradient_curve",
"filament_mixed_gradient_per_part"
};
return mixed_keys;
}
// The printer tab's "Retraction" optgroup (TabPrinter::build_fff, Tab.cpp), in tab order.
// KEEP IN SYNC with that optgroup: the published-3MF printer allowlist is built from these
// lists, so any key shown there must be publishable here (and vice versa).