fix multi buffer regression

This commit is contained in:
Nicolas Predella 2026-05-21 11:12:55 +03:00
parent d14266b10b
commit 5b07110895

View file

@ -487,23 +487,39 @@ class SLICENODE_BufferShellsMultiple(SliceNode):
else:
prepared_paths = paths
all_res_paths = []
all_res_groups = []
all_buffers: list[SlicePaths] = []
for i in range(count):
dist = base_distance + (i * width_step)
res_paths, res_groups = slice.buffer_slice(prepared_paths, dist, miter=self.shape_option)
all_res_paths.extend(res_paths)
all_res_groups.extend(res_groups)
all_buffers.append(SlicePaths(res_paths, res_groups))
# Zip Logic: Interleave paths by group (Z-layer)
all_groups = set()
grouped_inputs = []
for p_list in all_buffers:
d = {}
for i, g in enumerate(p_list.groups):
all_groups.add(g)
d.setdefault(g, []).append(p_list[i])
grouped_inputs.append(d)
sorted_groups = sorted(list(all_groups))
merged = SlicePaths()
for g in sorted_groups:
for d in grouped_inputs:
group_paths = d.get(g, [])
for p in group_paths:
merged.append_with_group(p, g)
if any(rotation):
mat_inv = Euler(rotation).to_matrix()
mat_inv_np = np.array(mat_inv)
final_paths = [s @ mat_inv_np.T for s in all_res_paths]
else:
final_paths = all_res_paths
final_paths = [s @ mat_inv_np.T for s in merged]
return SlicePaths(final_paths, merged.groups)
return SlicePaths(final_paths, all_res_groups)
return merged
@register_class
class SLICENODE_Infill(SliceNode):