Size painted segmentation from the filament count, not the color palette (#15998)

multi_material_segmentation_by_painting sized its per-filament output from filament_colour, but apply_mm_segmentation reads one entry per filament_diameter. When the palette was shorter than the filament list, slicing an object painted with a filament that had no color read past the end and crashed. Size it from filament_diameter instead.

Adds a regression test that paints one side of a cube with filament 2 while filament_colour has one entry.
This commit is contained in:
Andrew Gribben authored and GitHub committed 2026-10-26 13:36:37 -05:00
1 parent ab24043937
commit 21d2856429
2 files changed
+33 -1

No files matched your search

+2 -1
View File
@@ -2469,7 +2469,8 @@ std::vector<std::vector<ExPolygons>> segmentation_by_painting(const PrintObject
// Returns multi-material segmentation based on painting in multi-material segmentation gizmo
std::vector<std::vector<ExPolygons>> multi_material_segmentation_by_painting(const PrintObject &print_object, const std::function<void()> &throw_on_cancel_callback) {
const size_t num_facets_states = print_object.print()->config().filament_colour.size() + 1;
// apply_mm_segmentation() reads one entry per filament_diameter, and filament_colour can be shorter.
const size_t num_facets_states = print_object.print()->config().filament_diameter.size() + 1;
const float max_width = float(print_object.config().mmu_segmented_region_max_width.value);
const float interlocking_depth = float(print_object.config().mmu_segmented_region_interlocking_depth.value);
const bool interlocking_beam = print_object.config().interlocking_beam.value;