Files
Daniel Vilela ef45050ad5 feat: ComfyUI node pack for TRELLIS.2 image-to-3D on Apple Silicon
Three nodes that wrap trellis-mac's proven generate.py path:
  - TrellisMacLoader: loads TRELLIS.2-4B pipeline on MPS (session-cached)
  - TrellisMacGenerate: image → MeshWithVoxel via stock pipeline.run()
  - TrellisMacExport: Metal o_voxel bake → KDTree fallback → GLB/OBJ/PLY

No CUDA deps. Metal bake with KDTree CPU fallback. macOS GPU watchdog
detection with actionable error messages. Portable path resolution
(env var / config.json / heuristic / fallback).

Includes example workflow wiring LoadImage → Loader → Generate → Export → Preview3D.
2026-06-19 16:20:48 -03:00

39 lines
1.4 KiB
Python

"""
ComfyUI-TrellisMac — TRELLIS.2 image-to-3D on Apple Silicon.
A 3-node pack that wraps the proven trellis-mac pipeline (no CUDA deps):
LoadImage → TrellisMacLoader → TrellisMacGenerate → TrellisMacExport → Preview3D
ComfyUI discovers NODE_CLASS_MAPPINGS / NODE_DISPLAY_NAME_MAPPINGS from this
module on import. The pipeline + MeshWithVoxel object are passed between
nodes as custom types (TRELLIS_PIPELINE, MESHWITHVOXEL).
"""
from .nodes import (
NODE_CLASS_MAPPINGS,
NODE_DISPLAY_NAME_MAPPINGS,
TYPE_PIPELINE,
TYPE_MESH,
)
# Register custom data types with ComfyUI's validation layer so links
# between our nodes type-check. ComfyUI treats any string type name it
# hasn't seen as a generic passthrough, but declaring it explicitly avoids
# "unknown type" warnings and makes links non-connectable to mismatched
# inputs (e.g. you can't plug an IMAGE into a TRELLIS_PIPELINE socket).
try:
import comfy_extras.nodes_custom_base as _custom_base # noqa: F401
except Exception:
pass
# ComfyUI reads this dict (if present) to learn each type's category/icon.
# Both our types are opaque Python objects, not tensors, so we declare them
# with the generic "*" (any) validation. This matches how the reference
# ComfyUI-Trellis2 wrapper treats TRELLIS2PIPELINE / MESHWITHVOXEL.
__all__ = [
"NODE_CLASS_MAPPINGS",
"NODE_DISPLAY_NAME_MAPPINGS",
"TYPE_PIPELINE",
"TYPE_MESH",
]