Nodes/ControlFlowUtils/๐Ÿ”ƒ Loop Open
ComfyUI Node

๐Ÿ”ƒ Loop Open

Loops allow you to automate entire sections of your workflow by repeating the nodes connected to the Loop a specific number of times or until a specific condition no longer applies. To use this node, you must link the Loop Output of the [Loop Open] node to the Loop Input of a [Loop Close] node. If you want to iterate a predefined amount of times (such as when using a For Loop) then set your Start, Step and End parameters accordingly. If you would like the Loop to behave as a While Loop instead, then you may set a Condition which must evaluate to True in order for the loop to execute, and it will continue executing indefinitely until the condition no longer evaluates to True. In order to use the Loop as a pure While Loop, you should set Step to 0. You can also have a combined Loop of both For and While types by having both a Condition and a Step set such that the Loop will continue to execute until the Codition is no longer true OR it fully iterates from Start to End, whichever happens first. You can set the Data and Aux Data Inputs to any Data you wish to iterate on for each execution of the Loop. The data will be preserved so long as you link the Outputs from [Loop Open] node to the relevant Inputs of the [Loop Close] nodes. The LOOP Input is a dictionary containing information about the Loop. It may be intercepted and accessed via [Data Monitor] nodes to extract information about the current Loop, such as the Index, Start, Step, End, Finished status, Condition, and other useful information. You can use the Index_Override Input to manually force the loop to skip to a specific index prematurely. If Condition does not evaluate to True for the [Loop Open] node, Execution will be blocked and any nodes following [Loop Open] will not execute. This node uses the new Execution Inversion mechanics and requires an updated version of ComfyUI. It works by dynamically cloning all the nodes that are connected as children of the [Loop Open] and [Loop Close] nodes, while forwarding the data to the copies on each iteration. This is still a bit of proof of concept, so issues may occur. Please report any bugs on the Issues page of this node pack's Github repo! HOVER OVER THE INPUTS AND OUTPUTS FOR MORE INFO.

By VykosXยทCreated 2 years agoยทUpdated 2 years agoยท 147
๐Ÿ”ƒ Loop Open
  • index_override
  • data
  • aux
  • aux2
  • aux3
  • aux4
  • aux5
  • LOOP
  • data
  • aux
  • aux2
  • aux3
  • aux4
  • aux5
โ—„start1โ–บ
โ—„step1โ–บ
โ—„end10โ–บ
โ—„conditionTrueโ–บ
Category๐Ÿบ VykosX-ControlFlowUtils

Inputs (11)

NameTypeDefaultDescription
startINT1The initial value of the loop counter
stepINT1How much the loop counter gets increased or decreased by on each iteration
endINT10The value at which the loop should stop
conditionSTRINGTrueThe loop will be executed only if the specified condition evaluates to True
index_overrideopt*Manually override the current index of the Cycle. You can use this input to have complex Step calculations or to reset the loop manually
dataopt*Any data you wish to iterate on in the loop
auxopt*Any auxilliary data you wish to iterate on in the loop
aux2opt*Any auxilliary data you wish to iterate on in the loop
aux3opt*Any auxilliary data you wish to iterate on in the loop
aux4opt*Any auxilliary data you wish to iterate on in the loop
aux5opt*Any auxilliary data you wish to iterate on in the loop

Outputs (7)

NameTypeDescription
LOOP*Dictionary with information about the Loop. Connect to the LOOP input of a [Loop Close] node
data*Data to iterate on in the loop. Connect to the relevant Input of a [Loop Close] node to preserve any changes between iterations
aux*Data to iterate on in the loop. Connect to the relevant Input of a [Loop Close] node to preserve any changes between iterations
aux2*Data to iterate on in the loop. Connect to the relevant Input of a [Loop Close] node to preserve any changes between iterations
aux3*Data to iterate on in the loop. Connect to the relevant Input of a [Loop Close] node to preserve any changes between iterations
aux4*Data to iterate on in the loop. Connect to the relevant Input of a [Loop Close] node to preserve any changes between iterations
aux5*Data to iterate on in the loop. Connect to the relevant Input of a [Loop Close] node to preserve any changes between iterations