Add native ComfyUI list output converter
This commit is contained in:
@@ -6,6 +6,37 @@ from collections.abc import Mapping
|
||||
from copy import deepcopy
|
||||
|
||||
|
||||
class AnyType(str):
|
||||
"""ComfyUI wildcard socket type for a list whose item type is not fixed."""
|
||||
|
||||
def __ne__(self, other):
|
||||
return False
|
||||
|
||||
|
||||
ANY_TYPE = AnyType("*")
|
||||
|
||||
|
||||
class ETKListToComfyList:
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"items": ("LIST", {"default": []}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = (ANY_TYPE,)
|
||||
RETURN_NAMES = ("items",)
|
||||
OUTPUT_IS_LIST = (True,)
|
||||
FUNCTION = "convert"
|
||||
CATEGORY = "ETK/List"
|
||||
|
||||
def convert(self, items):
|
||||
if not isinstance(items, list):
|
||||
raise TypeError(f"items must be a LIST, got {type(items).__name__}")
|
||||
return (items,)
|
||||
|
||||
|
||||
class ImageFromListIdx:
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
|
||||
Reference in New Issue
Block a user