diff --git a/__init__.py b/__init__.py index ec600fc..b571766 100644 --- a/__init__.py +++ b/__init__.py @@ -12,6 +12,7 @@ from custom_nodes.Comfy_KepListStuff.nodes.list_utils import ( JoinImageLists, StringList, ReverseList, + RepeatList, ) from custom_nodes.Comfy_KepListStuff.nodes.range_nodes import ( IntRangeNode, @@ -37,7 +38,8 @@ NODE_CLASS_MAPPINGS = { "ImageListLoader": ImageListLoader, "KepStringList": StringList, "Kep_VariableImageBuilder": VariableImageBuilder, - "Kep_ReverseList": ReverseList + "Kep_ReverseList": ReverseList, + "Kep_RepeatList": RepeatList } NODE_DISPLAY_NAME_MAPPINGS = { @@ -45,5 +47,6 @@ NODE_DISPLAY_NAME_MAPPINGS = { "ImageListLoader": "Image List Loader", "KepStringList": "String List", "Kep_VariableImageBuilder": "Variable Image Builder", - "Kep_ReverseList": "Reverse List" + "Kep_ReverseList": "Reverse List", + "Kep_RepeatList": "Repeat List" } diff --git a/nodes/list_utils.py b/nodes/list_utils.py index 3c31ad7..6ebaaec 100644 --- a/nodes/list_utils.py +++ b/nodes/list_utils.py @@ -28,6 +28,32 @@ class ListLengthNode: def get_len(self, In: List[Any]) -> Tuple[int]: return (len(In),) +class RepeatList: + def __init__(self) -> None: + pass + + @classmethod + def INPUT_TYPES(self) -> Dict[str, Dict[str, Any]]: + return { + "required": { + "In": (any_type, {}), + "Count": ("INT", {"default": 0, "min": 0, "max": 99999, "step": 1}), + }, + } + + RETURN_TYPES = (any_type,) + RETURN_NAMES = ("Extended",) + INPUT_IS_LIST = True + OUTPUT_IS_LIST = (True,) + FUNCTION = "repeat_list" + + CATEGORY = "List Stuff" + + def repeat_list(self, In: List[Any], Count: List[int]) -> Tuple[List[Any]]: + if len(Count) != 1: + raise ValueError("Count does not support multiple values") + return (In * Count[0],) + class ReverseList: def __init__(self) -> None: pass