mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-10 10:47:16 +00:00
feat(engine): resolve per-variant config columns for raw filament reads on the export path
When a per-layer nozzle grouping migrates a filament across nozzle variants, the write-back turns two groups of config arrays from filament-indexed into column-indexed: the per-variant filament options (one column per variant a filament uses) and the merged extruder retract overrides (resized to the column count by apply_override). Export-path readers that still indexed them with the raw filament id read a neighbor's column for every filament ordered after a migrating one: toolchange/standby temperatures (M104/M109), retraction lengths and feedrates, wipe distance, z-hop types, air-filtration keys, and - through the Extruder's cached flow term - the extrusion E of every move. Now every such read resolves its column through the existing layer-aware resolver (get_filament_config_index -> Print::get_filament_config_indx), which returns the raw filament id whenever no per-layer grouping result is published, so static prints are byte-inert by construction. The Extruder itself has no layer knowledge, so it gains an injected config column (set_config_index, default = filament id) that the generator refreshes at the only two resolution-changing events - layer change and writer toolchange - and that re-syncs the cached e_per_mm3 flow term. Old-filament reads resolve at the current layer, which is safe because the per-layer maps are gap-filled carry-forward. Whole-array placeholder copies (toolchange temperature overrides) are rebuilt in filament order, mirroring the existing per-variant placeholder remap. The resolvers move to the public section so non-friend helpers (ooze prevention) can resolve too. Documented, deliberately unchanged: the wipe tower's per-filament parameter rows (no layer dimension; tower x per-layer grouping is a follow-up), travel_slope's physical-extruder read, estimator pre-heat bookkeeping temps, and index-0 header diagnostics. Verification: new Extruder column-injection scenario (defaults, column follow + flow-cache rescale, filament-indexed reads unaffected, reset semantics) and a migrating write-back case proving the column shift for filaments ordered after a migrator and the resolver tracking it (11 + 14 assertions); suites green (libslic3r 48998/169, fff_print 655/61); 20/20 pinned-slice byte gate bit-identical (incl. sequential repro x2 deterministic).
This commit is contained in:
@@ -29,6 +29,13 @@ public:
|
||||
|
||||
unsigned int id() const { return m_id; }
|
||||
|
||||
// Column of the per-variant filament/override arrays the getters read. Defaults to the
|
||||
// filament id (one column per filament); the g-code generator refreshes it on layer changes
|
||||
// and toolchanges when a per-layer nozzle grouping gives a filament several variant columns.
|
||||
int config_index() const { return m_config_index; }
|
||||
// idx < 0 resets to the filament id. Re-syncs the cached e_per_mm3 flow term.
|
||||
void set_config_index(int idx);
|
||||
|
||||
unsigned int extruder_id() const;
|
||||
double extrude(double dE);
|
||||
double retract(double length, double restart_extra);
|
||||
@@ -86,6 +93,8 @@ private:
|
||||
GCodeConfig *m_config;
|
||||
// Print-wide global ID of this extruder.
|
||||
unsigned int m_id;
|
||||
// Column into the per-variant filament/override arrays; equals m_id unless refreshed.
|
||||
int m_config_index{0};
|
||||
// Current state of the extruder axis, may be resetted if use_relative_e_distances.
|
||||
double m_E;
|
||||
// Current state of the extruder tachometer, used to output the extruded_volume() and used_filament() statistics.
|
||||
|
||||
Reference in New Issue
Block a user