This commit is contained in:
Haoming 2026-04-22 14:19:25 +08:00
parent 300527686b
commit 549a8cdf4b
3 changed files with 13 additions and 3 deletions

View File

@ -41,12 +41,13 @@ def update_controlnet_filenames():
controlnet_filename_dict = {"None": None}
ext_dirs = (
shared.opts.data.get("control_net_models_path", None),
getattr(shared.opts, "control_net_models_path", None),
getattr(shared.cmd_opts, "controlnet_dir", None),
*getattr(shared.cmd_opts, "controlnet_dirs", []),
)
extra_paths = (extra_path for extra_path in ext_dirs if extra_path is not None and os.path.exists(extra_path))
extra_paths = (extra_path for extra_path in ext_dirs if os.path.isdir(str(extra_path)))
for path in [controlnet_dir, *extra_paths]:
for path in set(extra_paths):
found = get_all_models(path, "name")
controlnet_filename_dict.update(found)

View File

@ -494,6 +494,7 @@ def configure_comfy_reference(comfy_home: Path):
ModelRef(arg_name="--text-encoder-dirs", relative_path="text_encoders"),
ModelRef(arg_name="--lora-dirs", relative_path="loras"),
ModelRef(arg_name="--vae-dirs", relative_path="vae"),
ModelRef(arg_name="--controlnet-dirs", relative_path="controlnet"),
)
for ref in refs:
@ -537,6 +538,7 @@ def configure_comfy_yaml(comfy_yaml: Path):
_configure_yaml(base, config.get("text_encoders", None), "--text-encoder-dirs")
_configure_yaml(base, config.get("loras", None), "--lora-dirs")
_configure_yaml(base, config.get("vae", None), "--vae-dirs")
_configure_yaml(base, config.get("controlnet", None), "--controlnet-dirs")
def start():

View File

@ -9,6 +9,13 @@ parser.add_argument(
help="Path to directory with ControlNet models",
default=os.path.join(models_path, "ControlNet"),
)
parser.add_argument(
"--controlnet-dirs",
type=normalized_filepath,
action="append",
help="Directories for ControlNet model(s)",
default=[],
)
parser.add_argument(
"--controlnet-preprocessor-models-dir",
type=normalized_filepath,