diff --git a/README.md b/README.md index c9106ac..3fe7dd0 100644 --- a/README.md +++ b/README.md @@ -97,6 +97,14 @@ roots for the current ComfyUI process so the DUMAS picker can discover them. For persistence across restarts, add the folder to ComfyUI's `refmods` mapping in `extra_model_paths.yaml`. +### DUMAS H3 RefMod Create + +`DUMAS H3 RefMod Create (upstream)` is a DUMAS-labelled compatibility entry +for the maintained `ComfyUI-MiniMaxH3Mod` creator. It delegates to that pack's +current implementation, so new extraction modes, masks, folder bundles, and +token-budget improvements remain available without creating a stale DUMAS fork. +The maintained MiniMax H3 RefMod pack must still be installed and loaded. + ### DUMAS H3 RefMod Visual Picker `DUMAS H3 RefMod Visual Picker` provides a small browser button for selecting diff --git a/dumas_h3_refmod_nodes.py b/dumas_h3_refmod_nodes.py index 45e7fae..85592b0 100644 --- a/dumas_h3_refmod_nodes.py +++ b/dumas_h3_refmod_nodes.py @@ -85,6 +85,34 @@ def _continuum_reference_bundle_type(): ) +def _upstream_refmod_creator_type(): + """Find the maintained creator already loaded by ComfyUI.""" + for module in list(sys.modules.values()): + creator = getattr(module, "MiniMaxH3RefModExtract", None) if module is not None else None + if creator is not None and hasattr(creator, "define_schema") and hasattr(creator, "execute"): + return creator + raise RuntimeError( + "DUMAS H3 RefMod Create requires the maintained " + "ComfyUI-MiniMaxH3Mod pack to be installed and loaded." + ) + + +class DumasH3RefModCreate: + """DUMAS-labelled compatibility entry for the maintained RefMod creator. + + The extraction implementation remains upstream-owned so improvements to + modes, masks, folder bundles, and token budgeting are not forked here. + """ + + @classmethod + def define_schema(cls): + return _upstream_refmod_creator_type().define_schema() + + @classmethod + def execute(cls, *args, **kwargs): + return _upstream_refmod_creator_type().execute(*args, **kwargs) + + def _decode_refmod_image(video_vae, mod): if torch is None: raise RuntimeError("DUMAS RefMod-to-Continuum requires PyTorch/ComfyUI.") @@ -315,11 +343,13 @@ class DumasH3RefModsToContinuum: NODE_CLASS_MAPPINGS = { + "DumasH3RefModCreate": DumasH3RefModCreate, "DumasH3RefModSave": DumasH3RefModSave, "DumasH3RefModsToContinuum": DumasH3RefModsToContinuum, } NODE_DISPLAY_NAME_MAPPINGS = { + "DumasH3RefModCreate": "DUMAS H3 RefMod Create (upstream)", "DumasH3RefModSave": "DUMAS H3 RefMod Save", "DumasH3RefModsToContinuum": "DUMAS H3 RefMods to Continuum", } diff --git a/tests/test_dumas_h3_refmod_nodes.py b/tests/test_dumas_h3_refmod_nodes.py index 7b227ad..7913fb1 100644 --- a/tests/test_dumas_h3_refmod_nodes.py +++ b/tests/test_dumas_h3_refmod_nodes.py @@ -78,6 +78,27 @@ class DumasRefModSaveTests(unittest.TestCase): with self.assertRaisesRegex(ValueError, "input_folder"): node.save([ (FakeMod("hero"), 1.0) ], save_location="Input folder") + def test_creator_entry_delegates_to_loaded_upstream_class(self): + upstream = types.ModuleType("fake_minimax_refmod_nodes") + + class Creator: + @classmethod + def define_schema(cls): + return "schema" + + @classmethod + def execute(cls, *args, **kwargs): + return (args, kwargs) + + upstream.MiniMaxH3RefModExtract = Creator + sys.modules[upstream.__name__] = upstream + try: + node = self.module.DumasH3RefModCreate + self.assertEqual(node.define_schema(), "schema") + self.assertEqual(node.execute("x", name="hero")[1]["name"], "hero") + finally: + sys.modules.pop(upstream.__name__, None) + @unittest.skipUnless(torch is not None, "PyTorch is only available in the ComfyUI runtime") def test_refmods_to_continuum_decodes_and_routes_prompt_tags(self): bundle_module = types.SimpleNamespace(