From dce406d85159f01dd6fa93e00e360b36b48aa6d7 Mon Sep 17 00:00:00 2001 From: "Dr.Lt.Data" Date: Fri, 16 Jun 2023 22:34:44 +0900 Subject: [PATCH] Add InputZip, InputUnzip --- comfy_extras/nodes_loop.py | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) 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, }