Keep height ranges and per-feature filament assignments on their mixed slots (#17729)

Adding a physical filament inserts it ahead of the mixed filaments. Height ranges and the per-feature filament settings (outer and inner walls, sparse and internal solid infill, top and bottom surfaces) kept their old slot numbers, so an assignment to a mix printed with the new physical filament instead.

Shift those assignments with the mixes when a filament is added, and move them with the deleted or merged slot when a filament is removed. This covers the process preset, objects, parts, modifiers and height ranges. Inherited (Default) assignments are unchanged.

When a published 3MF import moves mixed filaments, imported parts and published process settings follow the author's slot moves, and process settings kept from the receiver follow the receiver's own mixes. A receiver mix that moved no longer redirects the author's references to the physical filament in that slot.

Fixes #17727
This commit is contained in:
Noisyfox authored and GitHub committed 2026-11-23 15:56:49 -06:00
1 parent d0c70bef7b
commit 821b602c4d
9 files changed
+188 -65

No files matched your search

+2 -4
View File
@@ -9,6 +9,7 @@
#include "libslic3r/MaterialType.hpp"
#include "MsgDialog.hpp"
#include "libslic3r/PrintConfig.hpp"
#include "libslic3r/FilamentMixer.hpp"
#include "libslic3r/GCode/AdaptivePAProcessor.hpp"
#include "Plater.hpp"
@@ -638,9 +639,6 @@ void ConfigManipulation::update_print_fff_config(DynamicPrintConfig* config, con
// tower additionally reject mixed slots: the engine consumes those keys directly, so a virtual
// slot would reach the G-code unresolved, while the per-feature keys are resolved per layer.
static const char* physical_only_keys[] = { "support_filament", "support_interface_filament", "brim_filament_id", "wipe_tower_filament" };
static const char* feature_keys[] = { "outer_wall_filament_id", "inner_wall_filament_id",
"sparse_infill_filament_id", "internal_solid_filament_id",
"top_surface_filament_id", "bottom_surface_filament_id" };
auto reset_invalid_filament = [this, config, filament_cnt](const char* key, bool allow_mixed) {
auto* opt = dynamic_cast<ConfigOptionInt*>(config->option(key, false));
if (opt == nullptr)
@@ -663,7 +661,7 @@ void ConfigManipulation::update_print_fff_config(DynamicPrintConfig* config, con
};
for (const char* key : physical_only_keys)
reset_invalid_filament(key, false);
for (const char* key : feature_keys)
for (const char* key : feature_filament_keys)
reset_invalid_filament(key, true);
// Sub-layer splitting divides each layer by the mix ratio; an adaptive layer profile makes