Files
PozzettiAndrea-ComfyUI-Geom…/prestartup_script.py
T
PozzettiAndreaandClaude Opus 4.8 892626791a Load Mesh drag-n-drop upload + inline View 3D; add Render Mesh Batch node
- Load Mesh: drop/upload meshes (reuses /upload/image, subfolder=3d, like
  the official Load Image) + a "view 3d" toggle that mounts the shared
  vtk.js viewer inline. Frontend source in tracked web_src/, copied to the
  generated web/js at prestartup.
- Render Mesh Batch: offscreen pyvista render per mesh, titled by name.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-16 14:01:02 +02:00

52 lines
1.5 KiB
Python

"""ComfyUI-GeometryPack Prestartup Script."""
import logging
import os
import sys
log = logging.getLogger("geometrypack")
from pathlib import Path
from comfy_env import setup_env, copy_files
from comfy_3d_viewers import copy_viewer
setup_env()
SCRIPT_DIR = Path(__file__).resolve().parent
COMFYUI_DIR = SCRIPT_DIR.parent.parent
# Copy viewers (GeometryPack uses many viewer types)
viewers = [
"viewer", "vtk", "vtk_batch", "vtk_textured", "pointcloud_vtk",
"multi", "dual", "dual_slider", "dual_textured",
"uv", "pbr", "gaussian",
"fbx", "fbx_debug", "fbx_compare",
"bvh", "fbx_animation", "compare_smpl_bvh",
"text_report",
"ultimate_inspection",
]
for viewer in viewers:
try:
copy_viewer(viewer, SCRIPT_DIR / "web")
except Exception as e:
log.warning("Failed to copy viewer %s: %s", viewer, e)
# Copy dynamic widgets
try:
from comfy_dynamic_widgets import get_js_path
import shutil
src = Path(get_js_path())
if src.exists():
dst = SCRIPT_DIR / "web" / "js" / "dynamic_widgets.js"
dst.parent.mkdir(parents=True, exist_ok=True)
if not dst.exists() or src.stat().st_mtime > dst.stat().st_mtime:
shutil.copy2(src, dst)
except ImportError:
pass
# Copy GeometryPack-local frontend JS (tracked source -> served web/js, since web/ is generated)
copy_files(SCRIPT_DIR / "web_src", SCRIPT_DIR / "web" / "js", "*.js")
# Copy assets
copy_files(SCRIPT_DIR / "assets", COMFYUI_DIR / "input" / "3d", "**/*")