mirror of
https://git.datalinker.icu/comfyanonymous/ComfyUI
synced 2026-11-20 21:57:05 +08:00
#3783 Extra Models Configuration with subfolders If you want to use web ui models in Comfy Ui and for structural reasons have structured the checkpoints, VAE etc in the Web Ui models folder in subfolders, these are not recognized by Comfy Ui. It would be desirable if ComfyUI would also recognize subfolders
f.e. Extra Models Folder -> Checkpoints -> SD 1.5, SD 2.1, SD 3 Medium
This commit is contained in:
parent
55f0dc124e
commit
0a9feb3f90
@ -126,10 +126,20 @@ def exists_annotated_filepath(name):
|
||||
def add_model_folder_path(folder_name, full_folder_path):
|
||||
global folder_names_and_paths
|
||||
if folder_name in folder_names_and_paths:
|
||||
folder_names_and_paths[folder_name][0].append(full_folder_path)
|
||||
subdirs = list_files(full_folder_path)
|
||||
if len(subdirs) == 0:
|
||||
folder_names_and_paths[folder_name][0].append(full_folder_path)
|
||||
else:
|
||||
for subdir in subdirs:
|
||||
folder_names_and_paths[folder_name][0].append(subdir)
|
||||
|
||||
else:
|
||||
folder_names_and_paths[folder_name] = ([full_folder_path], set())
|
||||
|
||||
def list_files(dir):
|
||||
r = []
|
||||
return [x[0] for x in os.walk(dir)]
|
||||
|
||||
def get_folder_paths(folder_name):
|
||||
return folder_names_and_paths[folder_name][0][:]
|
||||
|
||||
|
||||
2
main.py
2
main.py
@ -184,6 +184,8 @@ def load_extra_path_config(yaml_path):
|
||||
if base_path is not None:
|
||||
full_path = os.path.join(base_path, full_path)
|
||||
logging.info("Adding extra search path {} {}".format(x, full_path))
|
||||
full_path = full_path.replace("\\", "\\")
|
||||
full_path = full_path.replace("\\", "/")
|
||||
folder_paths.add_model_folder_path(x, full_path)
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user