From 965d2f9b8f254d72a8838412a79428e6c1505af1 Mon Sep 17 00:00:00 2001 From: bigcat88 Date: Thu, 10 Jul 2025 06:46:07 +0300 Subject: [PATCH] use options key, remove get_io_type_V1 serialization --- comfy_api/v3/io.py | 16 ---------------- comfy_extras/v3/nodes_images.py | 9 ++++++++- 2 files changed, 8 insertions(+), 17 deletions(-) diff --git a/comfy_api/v3/io.py b/comfy_api/v3/io.py index ce6ac4f70..f85b59253 100644 --- a/comfy_api/v3/io.py +++ b/comfy_api/v3/io.py @@ -20,8 +20,6 @@ from comfy.clip_vision import ClipVisionModel from comfy.clip_vision import Output as ClipVisionOutput_ from comfy_api.input import VideoInput from comfy.hooks import HookGroup, HookKeyframeGroup -import folder_paths -import os # from comfy_extras.nodes_images import SVG as SVG_ # NOTE: needs to be moved before can be imported due to circular reference @@ -408,20 +406,6 @@ class Combo(ComfyType): self.remote = remote self.default: str - def get_io_type_V1(self): - if getattr(self, "image_folder"): - if self.image_folder == FolderType.input: - target_dir = folder_paths.get_input_directory() - elif self.image_folder == FolderType.output: - target_dir = folder_paths.get_output_directory() - else: - target_dir = folder_paths.get_temp_directory() - files = [f for f in os.listdir(target_dir) if os.path.isfile(os.path.join(target_dir, f))] - if self.content_types is None: - return files - return sorted(folder_paths.filter_files_content_types(files, self.content_types)) - return super().get_io_type_V1() - def as_dict_V1(self): return super().as_dict_V1() | prune_dict({ "multiselect": self.multiselect, diff --git a/comfy_extras/v3/nodes_images.py b/comfy_extras/v3/nodes_images.py index 839622d40..bebabb967 100644 --- a/comfy_extras/v3/nodes_images.py +++ b/comfy_extras/v3/nodes_images.py @@ -40,7 +40,7 @@ class SaveImage(io.ComfyNodeV3): @classmethod def execute(cls, images, filename_prefix="ComfyUI"): full_output_folder, filename, counter, subfolder, filename_prefix = folder_paths.get_save_image_path( - "", folder_paths.get_output_directory(), images[0].shape[1], images[0].shape[0] + filename_prefix, folder_paths.get_output_directory(), images[0].shape[1], images[0].shape[0] ) results = [] for (batch_number, image) in enumerate(images): @@ -106,6 +106,7 @@ class LoadImage(io.ComfyNodeV3): image_upload=True, image_folder=io.FolderType.input, content_types=["image"], + options=cls.get_files_options(), ), ], outputs=[ @@ -118,6 +119,12 @@ class LoadImage(io.ComfyNodeV3): ], ) + @classmethod + def get_files_options(cls) -> list[str]: + target_dir = folder_paths.get_input_directory() + files = [f for f in os.listdir(target_dir) if os.path.isfile(os.path.join(target_dir, f))] + return sorted(folder_paths.filter_files_content_types(files, ["image"])) + @classmethod def execute(cls, image) -> io.NodeOutput: img = node_helpers.pillow(Image.open, folder_paths.get_annotated_filepath(image))