Skip to content

Commit e8d4ea4

Browse files
committed
P4 fix: register MaskRefineMEC + UnifiedSegmentation in NODE_CLASS_MAPPINGS
- MaskRefineMEC class existed but mask_matting/__init__.py never imported it - UnifiedSegmentation class existed but had no NODE_CLASS_MAPPINGS at module level - Both are now properly registered; verified via /object_info (200) + visual sweep (6/6 PASS) - Functional smoke tests (compute_integrity, roto_quality erosion, SeC fallback markers): 5/5 PASS
1 parent 57b0ba7 commit e8d4ea4

3 files changed

Lines changed: 36 additions & 3 deletions

File tree

__init__.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,18 @@
7272
NODE_CLASS_MAPPINGS as _MASKMATTE_MAPPINGS,
7373
NODE_DISPLAY_NAME_MAPPINGS as _MASKMATTE_DISPLAY,
7474
)
75+
# Unified Segmentation (SAM2/SAM3/SeC, single node)
76+
try:
77+
from .nodes.unified_segmentation import (
78+
NODE_CLASS_MAPPINGS as _USEG_MAPPINGS,
79+
NODE_DISPLAY_NAME_MAPPINGS as _USEG_DISPLAY,
80+
)
81+
except Exception as _exc: # pragma: no cover
82+
import logging
83+
logging.getLogger("MEC.UnifiedSeg").warning(
84+
"UnifiedSegmentation unavailable: %s", _exc
85+
)
86+
_USEG_MAPPINGS, _USEG_DISPLAY = {}, {}
7587

7688
# ── NukeNodeMax suite (P0..F7) ────────────────────────────────────────
7789
# ── ProPainter unified dispatcher (absorbs Temporal/Remove/Stitch/StitchRefine/FlowRefine) ──
@@ -168,6 +180,7 @@
168180
**_PAINT_MAPPINGS,
169181
**_FACE_FIXER_MAPPINGS,
170182
**_MASKMATTE_MAPPINGS,
183+
**_USEG_MAPPINGS,
171184
**_NUKEMAX_MAPPINGS,
172185
**_STABILIZER_MAPPINGS,
173186
}
@@ -178,6 +191,7 @@
178191
**_PAINT_DISPLAY,
179192
**_FACE_FIXER_DISPLAY,
180193
**_MASKMATTE_DISPLAY,
194+
**_USEG_DISPLAY,
181195
**_NUKEMAX_DISPLAY,
182196
**_STABILIZER_DISPLAY,
183197
}

nodes/mask_matting/__init__.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,24 @@
4444
MaskTemporalMEC = None # type: ignore
4545
_MT_MAPPINGS, _MT_DISPLAY = {}, {}
4646

47-
NODE_CLASS_MAPPINGS = {**_MO_MAPPINGS, **_MT_MAPPINGS}
48-
NODE_DISPLAY_NAME_MAPPINGS = {**_MO_DISPLAY, **_MT_DISPLAY}
47+
try:
48+
from .refine_node import (
49+
MaskRefineMEC,
50+
NODE_CLASS_MAPPINGS as _MR_MAPPINGS,
51+
NODE_DISPLAY_NAME_MAPPINGS as _MR_DISPLAY,
52+
)
53+
except Exception as _exc: # pragma: no cover
54+
import logging
55+
logging.getLogger("MEC.MaskMatting").warning(
56+
"MaskRefineMEC unavailable: %s", _exc
57+
)
58+
MaskRefineMEC = None # type: ignore
59+
_MR_MAPPINGS, _MR_DISPLAY = {}, {}
60+
61+
NODE_CLASS_MAPPINGS = {**_MO_MAPPINGS, **_MT_MAPPINGS, **_MR_MAPPINGS}
62+
NODE_DISPLAY_NAME_MAPPINGS = {**_MO_DISPLAY, **_MT_DISPLAY, **_MR_DISPLAY}
4963

5064
__all__ = [
51-
"MaskOpsMEC", "MaskTemporalMEC",
65+
"MaskOpsMEC", "MaskTemporalMEC", "MaskRefineMEC",
5266
"NODE_CLASS_MAPPINGS", "NODE_DISPLAY_NAME_MAPPINGS",
5367
]

nodes/unified_segmentation.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -737,3 +737,8 @@ def _sam_video(
737737

738738
finally:
739739
shutil.rmtree(tmp, ignore_errors=True)
740+
741+
742+
NODE_CLASS_MAPPINGS = {"UnifiedSegmentation": UnifiedSegmentation}
743+
NODE_DISPLAY_NAME_MAPPINGS = {"UnifiedSegmentation": "Unified Segmentation (SAM2/SAM3/SeC)"}
744+

0 commit comments

Comments
 (0)