Files
facok 25e7d953d5 Register sys.modules alias so other plugins can import ComfyUI_LCS
ComfyUI loads custom_nodes by directory name (ComfyUI-LCS) but Python
cannot import module names with hyphens. Register ComfyUI_LCS as a
sys.modules alias so SubspaceLab and other plugins can use
`from ComfyUI_LCS.core.xxx import ...` regardless of load order.
2026-03-23 03:01:19 +08:00

54 lines
1.6 KiB
Python

"""ComfyUI-LCS: The Latent Color Subspace — training-free color control for FLUX.
Paper: "The Latent Color Subspace" (arXiv:2603.12261v1, ICML 2026)
"""
# Register as ComfyUI_LCS so other plugins can `from ComfyUI_LCS.core.xxx import ...`
import sys as _sys
_sys.modules.setdefault("ComfyUI_LCS", _sys.modules[__name__])
# V3 ComfyExtension entry point
from comfy_api.latest import ComfyExtension, io
from .nodes.calibrate import LCSLoadData
from .nodes.intervene import LCSColorIntervene, LCSColorBatch, LCSToneAdjust
from .nodes.observe import LCSPreviewColors, LCSStepObserver
from .nodes.sharpen import LCSSharpnessCalibrate, LCSSharpnessIntervene
from .nodes.anchor import LCSColorAnchor
class LCSExtension(ComfyExtension):
"""V3 ComfyExtension providing all LCS nodes to ComfyUI."""
async def get_node_list(self) -> list[type[io.ComfyNode]]:
"""Return all LCS node classes."""
return [
LCSLoadData,
LCSColorIntervene,
LCSColorBatch,
LCSToneAdjust,
LCSPreviewColors,
LCSStepObserver,
LCSSharpnessCalibrate,
LCSSharpnessIntervene,
LCSColorAnchor,
]
async def comfy_entrypoint() -> LCSExtension:
"""V3 async entry point called by ComfyUI on startup."""
return LCSExtension()
# V2 backward compatibility
from .nodes import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS
WEB_DIRECTORY = "./web"
__all__ = [
"NODE_CLASS_MAPPINGS",
"NODE_DISPLAY_NAME_MAPPINGS",
"WEB_DIRECTORY",
"LCSExtension",
"comfy_entrypoint",
]