Move web/ to javascript/ and declare it via [tool.comfy] web. Rename the seven third-party bundles (playcanvas, spark, three.js, gsplat, OrbitControls, TrackballControls) to .mjs. Every reference to them is inside the HTML viewers, but ComfyUI auto-imports **/*.js under the web dir into the shared browser realm, so ~8MB of vendor code was being evaluated in the main page on every startup -- and with it 36 collision errors: document.body injection, document-level listeners, unguarded message listeners and self.onmessage writes. The importmap values, script srcs and three.module's internal ./three.core ref are rewritten to match. DisplayName becomes "GaussianPack": the namespace enforced on registerExtension names is derived from it, and "ComfyUI-GaussianPack" made that prefix invalid. The analysis extension is renamed to match. js/gaussian_preview.js hooked "PlyPreviewLoadGaussianPLYEnhance", a node id that appears nowhere in this repo, so the PLY dropdown auto-refresh had never run; it now targets LoadPLY and LoadPLYOutput, the two nodes that actually carry the ply_file widget. Guard its message listener on event.source. Asset seeding resolves the input directory through folder_paths.get_input_directory(), so it follows ComfyUI Desktop and --input-directory instead of writing into the code tree. comfy-test.toml moves to the current schema: [test.workflows] cuda (there is no "gpu" key -- the accelerator is named by backend, and the old spelling parsed to an empty list, so CUDA runners silently ran the full unfiltered set), an explicit [test.platforms] platforms allowlist (per-platform booleans are no longer supported), and the javascript level.
47 lines
1.6 KiB
Python
47 lines
1.6 KiB
Python
"""ComfyUI-GaussianPack Prestartup Script."""
|
|
|
|
import shutil
|
|
from pathlib import Path
|
|
|
|
import folder_paths
|
|
|
|
SCRIPT_DIR = Path(__file__).resolve().parent
|
|
ASSETS_DIR = SCRIPT_DIR / "assets"
|
|
|
|
# The CONFIGURED input directory, never the code-tree one. ComfyUI Desktop
|
|
# (--base-directory) and --input-directory both relocate it, and the load
|
|
# nodes only ever scan folder_paths.get_input_directory(). main.py runs
|
|
# apply_custom_paths() before prestartup scripts, so this is already resolved.
|
|
INPUT = Path(folder_paths.get_input_directory())
|
|
|
|
|
|
def copy_files(src: Path, dst: Path, pattern: str = "*") -> int:
|
|
"""Copy bundled assets into a directory. Returns files written.
|
|
|
|
Seeds rather than syncs: an existing file is left alone, so a user's
|
|
edited demo asset survives every relaunch. Raises if `src` is missing --
|
|
a typo'd asset directory is a packaging bug, and silence is how it stays
|
|
one.
|
|
"""
|
|
src, dst = Path(src), Path(dst)
|
|
if not src.is_dir():
|
|
raise FileNotFoundError(f"asset directory not found: {src}")
|
|
written = 0
|
|
for f in src.glob(pattern):
|
|
if not f.is_file():
|
|
continue
|
|
target = dst / f.relative_to(src)
|
|
if target.exists():
|
|
continue
|
|
target.parent.mkdir(parents=True, exist_ok=True)
|
|
shutil.copy2(f, target)
|
|
written += 1
|
|
return written
|
|
|
|
|
|
# Seed bundled example assets (apple.ply, ...) so workflows that reference
|
|
# them by basename work on a fresh install. Top-level files only --
|
|
# subdirectories like .ipynb_checkpoints/ are skipped by the "*" pattern.
|
|
if ASSETS_DIR.is_dir():
|
|
copy_files(ASSETS_DIR, INPUT, "*")
|