mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2025-07-27 16:26:39 +00:00
use options key, remove get_io_type_V1 serialization
This commit is contained in:
parent
e1975567a3
commit
965d2f9b8f
@ -20,8 +20,6 @@ from comfy.clip_vision import ClipVisionModel
|
|||||||
from comfy.clip_vision import Output as ClipVisionOutput_
|
from comfy.clip_vision import Output as ClipVisionOutput_
|
||||||
from comfy_api.input import VideoInput
|
from comfy_api.input import VideoInput
|
||||||
from comfy.hooks import HookGroup, HookKeyframeGroup
|
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
|
# 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.remote = remote
|
||||||
self.default: str
|
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):
|
def as_dict_V1(self):
|
||||||
return super().as_dict_V1() | prune_dict({
|
return super().as_dict_V1() | prune_dict({
|
||||||
"multiselect": self.multiselect,
|
"multiselect": self.multiselect,
|
||||||
|
@ -40,7 +40,7 @@ class SaveImage(io.ComfyNodeV3):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def execute(cls, images, filename_prefix="ComfyUI"):
|
def execute(cls, images, filename_prefix="ComfyUI"):
|
||||||
full_output_folder, filename, counter, subfolder, filename_prefix = folder_paths.get_save_image_path(
|
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 = []
|
results = []
|
||||||
for (batch_number, image) in enumerate(images):
|
for (batch_number, image) in enumerate(images):
|
||||||
@ -106,6 +106,7 @@ class LoadImage(io.ComfyNodeV3):
|
|||||||
image_upload=True,
|
image_upload=True,
|
||||||
image_folder=io.FolderType.input,
|
image_folder=io.FolderType.input,
|
||||||
content_types=["image"],
|
content_types=["image"],
|
||||||
|
options=cls.get_files_options(),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
outputs=[
|
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
|
@classmethod
|
||||||
def execute(cls, image) -> io.NodeOutput:
|
def execute(cls, image) -> io.NodeOutput:
|
||||||
img = node_helpers.pillow(Image.open, folder_paths.get_annotated_filepath(image))
|
img = node_helpers.pillow(Image.open, folder_paths.get_annotated_filepath(image))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user