diff --git a/comfy_extras/nodes_loop.py b/comfy_extras/nodes_loop.py index f4b37ea17..dbf5d50ab 100644 --- a/comfy_extras/nodes_loop.py +++ b/comfy_extras/nodes_loop.py @@ -53,7 +53,42 @@ class LoopCounterCondition: return (CounterCondition(count), ) +# To facilitate the use of multiple inputs as loopback inputs, InputZip and InputUnzip are provided. +class InputZip: + @classmethod + def INPUT_TYPES(s): + return {"required": { + "input1": ("*", ), + "input2": ("*", ), + }, + } + + RETURN_TYPES = ("*", ) + FUNCTION = "doit" + + def doit(s, input1, input2): + return ((input1, input2), ) + + +class InputUnzip: + @classmethod + def INPUT_TYPES(s): + return {"required": { + "zipped_input": ("*", ), + }, + } + + RETURN_TYPES = ("*", "*", ) + FUNCTION = "doit" + + def doit(s, zipped_input): + input1, input2 = zipped_input + return (input1, input2, ) + + NODE_CLASS_MAPPINGS = { "LoopControl": LoopControl, "LoopCounterCondition": LoopCounterCondition, + "InputZip": InputZip, + "InputUnzip": InputUnzip, }