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 <noreply@anthropic.com>
This commit is contained in:
PozzettiAndrea
2026-06-16 16:08:06 +02:00
co-authored by Claude Opus 4.8
parent ddb0a54126
commit 26e8a432d5
@@ -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: