From 40dbba3269d96160af77dd027e95d940f02744f2 Mon Sep 17 00:00:00 2001 From: Andrea Pozzetti Date: Thu, 12 Feb 2026 21:32:40 +0100 Subject: [PATCH] handle voxel input --- nodes/visualization/preview_mesh_vtk.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/nodes/visualization/preview_mesh_vtk.py b/nodes/visualization/preview_mesh_vtk.py index f13b0c01..9d99556d 100644 --- a/nodes/visualization/preview_mesh_vtk.py +++ b/nodes/visualization/preview_mesh_vtk.py @@ -60,12 +60,18 @@ class PreviewMeshVTKNode: - texture: Textured mesh visualization with materials (GLB export) Args: - trimesh: Input trimesh_module.Trimesh object + trimesh: Input trimesh_module.Trimesh object or VOXEL_GRID tensor mode: Visualization mode - "fields" or "texture" Returns: dict: UI data for frontend widget """ + # Handle VOXEL_GRID input (trimesh.VoxelGrid from MeshToVoxel node) + if hasattr(trimesh, 'as_boxes'): # It's a trimesh.VoxelGrid + voxel_shape = trimesh.matrix.shape + trimesh = trimesh.as_boxes() + print(f"[PreviewMeshVTK] Converted voxel grid {voxel_shape} to box mesh: {len(trimesh.vertices)} vertices") + print(f"[PreviewMeshVTK] Preparing preview: {get_geometry_type(trimesh)} - {len(trimesh.vertices)} vertices, {get_face_count(trimesh)} faces") # Check for scalar fields (vertex/face attributes)