-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path__init__.py
More file actions
70 lines (57 loc) · 2.62 KB
/
Copy path__init__.py
File metadata and controls
70 lines (57 loc) · 2.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
"""
ComfyUI Dazzle Command - DazzleNodes Custom Node
Workflow orchestration node — coordinate seed control and execution gates.
Part of the DazzleNodes collection - standalone ComfyUI custom nodes.
"""
import logging
import os
import sys
# Configure module logger
_logger = logging.getLogger("DazzleCommand")
# Enable debug logging via environment variable: DC_DEBUG=1
if os.environ.get('DC_DEBUG', '').lower() in ('1', 'true', 'yes'):
_logger.setLevel(logging.DEBUG)
if not _logger.handlers:
_handler = logging.StreamHandler()
_handler.setFormatter(logging.Formatter('[%(name)s] %(levelname)s: %(message)s'))
_logger.addHandler(_handler)
# =====================================================
# DUAL-LOADING DETECTION
# Prevents issues when DazzleCommand is installed both
# as a standalone node AND inside DazzleNodes.
# Uses a sys-level sentinel (shared across all module
# namespaces) to detect the second load.
# =====================================================
_DC_SENTINEL = '_dazzle_command_loaded'
_is_duplicate_load = hasattr(sys, _DC_SENTINEL)
if _is_duplicate_load:
_first_path = getattr(sys, _DC_SENTINEL)
_this_path = os.path.dirname(os.path.abspath(__file__))
print(f"[DazzleCommand] WARNING: Duplicate installation detected!")
print(f"[DazzleCommand] Already loaded from: {_first_path}")
print(f"[DazzleCommand] Skipping this copy: {_this_path}")
print(f"[DazzleCommand] Fix: Remove one installation (standalone symlink or DazzleNodes submodule).")
else:
setattr(sys, _DC_SENTINEL, os.path.dirname(os.path.abspath(__file__)))
from .py.dazzle_command import DazzleCommandNode
from .version import __version__
NODE_CLASS_MAPPINGS = {
"DazzleCommand": DazzleCommandNode,
}
NODE_DISPLAY_NAME_MAPPINGS = {
"DazzleCommand": "Dazzle Command (DazzleNodes)",
}
# NOTE: There is intentionally no state API endpoint. Play/pause state is
# JS-owned (node.properties, per workflow tab) and arrives per-prompt via
# the hidden dazzle_state input injected at queue time. A server-side
# registry keyed by node ID was cross-tab-shared (node IDs collide across
# workflow tabs) and caused state contamination between open workflows.
# Tell ComfyUI where to find our JavaScript files
# Disabled on duplicate loads to prevent double JS extension registration
WEB_DIRECTORY = None if _is_duplicate_load else "./web"
__all__ = ['NODE_CLASS_MAPPINGS', 'NODE_DISPLAY_NAME_MAPPINGS', 'WEB_DIRECTORY']
# Display version info on load
if _is_duplicate_load:
print(f"[DazzleCommand] Duplicate skipped v{__version__} (JS disabled)")
else:
print(f"[DazzleCommand] Loaded v{__version__}")