Files
BISAM20-ComfyUI-ACES-IO/__init__.py
T
Bishoy SamaanandClaude Sonnet 4.6 5c457cd848 v1.1.2: Fix PyOpenColorIO install, add graceful dependency handling
- Add install.py for ComfyUI Manager: tries pip (opencolorio), then
  conda/mamba, prints manual instructions if both fail
- Remove PyOpenColorIO from requirements.txt and pyproject.toml since
  it is not published to PyPI under that name
- Graceful import in __init__.py: logs a clear error and exports empty
  node mappings instead of crashing ComfyUI when OCIO is missing
- Wrap bare PyOpenColorIO imports in nodes.py, ocio_utils.py, and
  server_routes.py with actionable ImportError messages

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-11 21:45:07 +01:00

58 lines
2.2 KiB
Python

"""
ComfyUI-ACES-IO
OpenColorIO / ACES color-management nodes for ComfyUI.
Supported ACES versions (built-in, no download needed):
• ACES 2.0 — CG Config & Studio Config [OCIO 2.5] ← recommended
• ACES 1.3 — CG Config & Studio Config [OCIO 2.1 / 2.3 / 2.4]
• ACES 1.2 and any other config: supply a path to your .ocio / .ocioz file
via the "Custom path" preset in the Config Loader node.
Download ACES 1.2 config from:
https://github.com/colour-science/OpenColorIO-Configs
Nodes (mirroring Nuke's OCIO set):
ACES IO — Config Loader load / select an OCIO config
ACES IO — ColorSpace OCIOColorSpace (cs → cs conversion)
ACES IO — Display Transform OCIODisplay (full display pipeline)
ACES IO — Viewer Nuke Viewer (exposure + gamma + channel view)
ACES IO — Look Transform OCIOLookTransform
ACES IO — File LUT OCIOFileTransform
ACES IO — Log Convert OCIOLogConvert (log ↔ linear)
ACES IO — Config Info lists colorspaces / displays / views / looks
"""
import os
import importlib.util
import logging
_logger = logging.getLogger(__name__)
# Check for PyOpenColorIO before attempting to import nodes so that a missing
# OCIO installation shows a single, actionable message rather than a traceback.
if importlib.util.find_spec("PyOpenColorIO") is None:
_logger.error(
"\n"
"[ACES IO] PyOpenColorIO is not installed — nodes will not load.\n"
"Install it with one of:\n"
" pip install opencolorio>=2.3.0\n"
" conda install -c conda-forge opencolorio>=2.3.0\n"
"Then restart ComfyUI."
)
NODE_CLASS_MAPPINGS = {}
NODE_DISPLAY_NAME_MAPPINGS = {}
else:
from .nodes import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS
# Serve web/js to the ComfyUI frontend
WEB_DIRECTORY = "web"
# Register REST API routes (colorspace / display / view pickers)
try:
from . import server_routes # noqa: F401
except Exception as _e:
import logging
logging.warning(f"[ACES IO] Could not load server routes: {_e}")
__all__ = ["NODE_CLASS_MAPPINGS", "NODE_DISPLAY_NAME_MAPPINGS", "WEB_DIRECTORY"]