Skip to content

Commit

Permalink
Latent files saved under Input/Latent but require manual move to Inpu…
Browse files Browse the repository at this point in the history
…t for loading
  • Loading branch information
idealvijay committed Nov 10, 2024
1 parent 6ee066a commit cadadc8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,8 @@ def cleanup_temp():
folder_paths.add_model_folder_path("vae", os.path.join(folder_paths.get_output_directory(), "vae"))
folder_paths.add_model_folder_path("diffusion_models", os.path.join(folder_paths.get_output_directory(), "diffusion_models"))
folder_paths.add_model_folder_path("loras", os.path.join(folder_paths.get_output_directory(), "loras"))
folder_paths.add_model_folder_path("latents", os.path.join(folder_paths.get_output_directory(), "latents"))


if args.input_directory:
input_dir = os.path.abspath(args.input_directory)
Expand Down
7 changes: 5 additions & 2 deletions nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,9 +478,12 @@ def save(self, samples, filename_prefix="ComfyUI", prompt=None, extra_pnginfo=No
class LoadLatent:
@classmethod
def INPUT_TYPES(s):
input_dir = folder_paths.get_input_directory()
input_dir = os.path.join(folder_paths.get_output_directory(), "latents") # Adjusts to "Input/Latent"
if not os.path.exists(input_dir):
os.makedirs(input_dir, exist_ok=True)
files = [f for f in os.listdir(input_dir) if os.path.isfile(os.path.join(input_dir, f)) and f.endswith(".latent")]
return {"required": {"latent": [sorted(files), ]}, }
return {"required": {"latent": (folder_paths.get_filename_list("latents"), {"tooltip": "The name of the latent from output/latents to load."})}}


CATEGORY = "_for_testing"

Expand Down

0 comments on commit cadadc8

Please sign in to comment.