From 26e8a432d540dcd2f53dca2fc42419a0455d8a80 Mon Sep 17 00:00:00 2001 From: PozzettiAndrea Date: Tue, 16 Jun 2026 16:08:06 +0200 Subject: [PATCH] Preview Mesh Boundaries: fix cell_data length (auto-vert cells) pv.PolyData(points) adds one VERT cell per point, so n_cells became verts+lines+polys and cell_data (lines+polys only) mismatched. Build the PolyData empty then assign points/faces/lines -> no verts. Co-Authored-By: Claude Opus 4.8 --- nodes/visualization/preview_mesh_boundaries.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nodes/visualization/preview_mesh_boundaries.py b/nodes/visualization/preview_mesh_boundaries.py index f9d28f90..f17468ec 100644 --- a/nodes/visualization/preview_mesh_boundaries.py +++ b/nodes/visualization/preview_mesh_boundaries.py @@ -117,7 +117,10 @@ class PreviewMeshBoundaries(io.ComfyNode): faces = np.asarray(getattr(mesh, "faces", np.zeros((0, 3), int)), dtype=np.int64) F = int(len(faces)) if show_surface else 0 - combined = pv.PolyData(points) + # Build explicitly: pv.PolyData(points) alone would add one VERT cell per + # point, throwing off the cell_data length. Start empty -> no verts. + combined = pv.PolyData() + combined.points = points if F: combined.faces = np.hstack([np.full((F, 1), 3, np.int64), faces]).ravel() if K: