Split the three monoliths into nodes/ domain modules:
- maxedoutnodes.py -> nodes/{latents,resolution,prompts,masks,media_io}.py
- wan22nodes.py -> nodes/wan22/{buckets,latent_io,i2v,video_ops}.py
- ltxnodes.py -> nodes/ltx/{latents,samplers,preview}.py
(LTX_Image_Scaler_MXD moved from the Wan file to nodes/ltx/latents.py)
- mediacomparers.py -> nodes/comparers.py
- checkpoint_loader_mxd.py + save_checkpoint_mxd.py -> nodes/checkpoints.py
- combine_materials_ffgo_mxd.py -> nodes/ffgo.py
- video_preview_mxd.py -> system/live_preview.py
- model_paths_autoregister_mxd.py -> system/model_paths.py
(model_storage_config.json still resolved at repo root)
All node mapping keys, display names, categories, inputs, routes, and
events unchanged: scripts/dump_node_schema.py --compare reports 68 nodes
identical to the pre-refactor baseline.
Provably-dead code dropped during the move (verified unreachable):
- _add_mxd_aliases() no-op alias pass (every key already contains MXD)
- unreachable code after return in WAN22_I2V_Image_Scaler_MXD.scale and
Frames_Select_StartEnd_MXD.main, plus the orphaned _pick_bucket method
- unused BUCKETS_480/BUCKETS_720 module constants
- mediacomparers' unused WEB_DIRECTORY/__all__ declarations
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
90 lines
3.0 KiB
Python
90 lines
3.0 KiB
Python
r"""Auto-register every subfolder of a user-configured model storage root
|
|
with folder_paths, the same way ComfyUI/models/<type> works.
|
|
|
|
The root is resolved in this order (first hit wins):
|
|
1. MAXEDOUT_MODEL_STORAGE environment variable
|
|
2. model_storage_config.json at the repo root (gitignored -- copy
|
|
model_storage_config.json.example to create your own, it never gets
|
|
committed)
|
|
3. The "MXD > Model Storage > Root Folder" setting in the ComfyUI
|
|
settings panel (web/model_storage_settings_mxd.js). Takes effect on
|
|
the next server restart since folder registration happens at import
|
|
time.
|
|
|
|
If none of these are set, nothing is registered and ComfyUI behaves as
|
|
usual -- this is entirely opt-in.
|
|
"""
|
|
|
|
import json
|
|
import os
|
|
|
|
try:
|
|
import folder_paths
|
|
except ImportError:
|
|
folder_paths = None
|
|
|
|
# The config lives at the REPO ROOT (one level above this system/ package),
|
|
# where users have always placed it — keep that path stable across refactors.
|
|
_REPO_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
_CONFIG_PATH = os.path.join(_REPO_ROOT, "model_storage_config.json")
|
|
|
|
|
|
def _root_from_env():
|
|
return os.environ.get("MAXEDOUT_MODEL_STORAGE") or None
|
|
|
|
|
|
def _root_from_config_file():
|
|
if not os.path.isfile(_CONFIG_PATH):
|
|
return None
|
|
try:
|
|
with open(_CONFIG_PATH, "r", encoding="utf-8") as f:
|
|
data = json.load(f)
|
|
return data.get("model_storage_root") or None
|
|
except Exception as e:
|
|
print(f"[ComfyUI-MaxedOut] Failed to read {_CONFIG_PATH}: {e}")
|
|
return None
|
|
|
|
|
|
def _root_from_comfyui_settings():
|
|
if folder_paths is None:
|
|
return None
|
|
try:
|
|
settings_path = os.path.join(folder_paths.get_user_directory(), "default", "comfy.settings.json")
|
|
if not os.path.isfile(settings_path):
|
|
return None
|
|
with open(settings_path, "r", encoding="utf-8") as f:
|
|
settings = json.load(f)
|
|
return settings.get("MXD.ModelStorageRoot") or None
|
|
except Exception:
|
|
return None
|
|
|
|
|
|
def _resolve_model_storage_root():
|
|
for source in (_root_from_env, _root_from_config_file, _root_from_comfyui_settings):
|
|
root = source()
|
|
if root:
|
|
return root
|
|
return None
|
|
|
|
|
|
try:
|
|
_root = _resolve_model_storage_root()
|
|
if folder_paths is not None and _root and os.path.isdir(_root):
|
|
count = 0
|
|
for item_name in os.listdir(_root):
|
|
item_path = os.path.join(_root, item_name)
|
|
if os.path.isdir(item_path):
|
|
folder_paths.add_model_folder_path(item_name, item_path)
|
|
count += 1
|
|
|
|
if count > 0:
|
|
print(f"[ComfyUI-MaxedOut] Auto-registered {count} model folders from {_root}")
|
|
elif _root and not os.path.isdir(_root):
|
|
print(f"[ComfyUI-MaxedOut] Model storage root '{_root}' is not a valid directory, skipping auto-register")
|
|
except Exception as e:
|
|
print(f"[ComfyUI-MaxedOut] Failed to auto-register model folders: {e}")
|
|
|
|
|
|
NODE_CLASS_MAPPINGS = {}
|
|
NODE_DISPLAY_NAME_MAPPINGS = {}
|