Files
Maxed-Out-99-ComfyUI-MaxedOut/__init__.py
T
Maxed-Out-99 181e818f66 Make comfy_api optional & guard node registration
Wrap direct comfy_api imports in try/except and introduce HAVE_COMFY_API flags so the package can load without comfy_api present. Update __init__.py to dynamically and safely import node modules and merge NODE_CLASS_MAPPINGS / NODE_DISPLAY_NAME_MAPPINGS. Conditionally define and register nodes that depend on comfy_api (Qwen image-edit nodes, WAN 2.2 video nodes, Combine/Load/Save/Preview video nodes) so they are only available when comfy_api is present. Add helper to auto-add " MXD" aliases for node names and to merge display mappings. Bump package version to 1.6.9 and add diagnostic prints when comfy_api imports fail.
2026-02-07 19:55:19 -08:00

33 lines
907 B
Python

import importlib
WEB_DIRECTORY = "web"
def _safe_import(module_name: str):
try:
return importlib.import_module(f".{module_name}", __name__)
except Exception as e:
print(f"[ComfyUI-MaxedOut] Failed to import '{module_name}': {e}")
return None
def _get_mappings(mod):
if mod is None:
return {}, {}
class_map = getattr(mod, "NODE_CLASS_MAPPINGS", {}) or {}
display_map = getattr(mod, "NODE_DISPLAY_NAME_MAPPINGS", {}) or {}
return class_map, display_map
NODE_CLASS_MAPPINGS = {}
NODE_DISPLAY_NAME_MAPPINGS = {}
for _name in ("maxedoutnodes", "mediacomparers", "wan22nodes"):
_mod = _safe_import(_name)
_class_map, _display_map = _get_mappings(_mod)
NODE_CLASS_MAPPINGS.update(_class_map)
NODE_DISPLAY_NAME_MAPPINGS.update(_display_map)
__all__ = [
"NODE_CLASS_MAPPINGS",
"NODE_DISPLAY_NAME_MAPPINGS",
"WEB_DIRECTORY",
]