Nodes/ComfyUI Impact Pack/ImpactConditionalStopIteration
ComfyUI Node Runs on cloud

ImpactConditionalStopIteration

Break an Impact Pack loop when a condition is met

By ltdrdata·Created 3 years ago·Updated 4 months ago· 3,242
ImpactConditionalStopIteration
      cond

      This is the break statement for Impact Pack's experimental loops. ComfyUI doesn't natively loop - it runs a graph once - so the pack layers looping on top by re-queuing the prompt, and a loop that re-queues forever is useless. ImpactConditionalStopIteration is the exit: feed it a boolean, and when that boolean is true, it stops the loop from queuing another pass. When it's false, the loop keeps going.

      It's a small node with an outsized role. Whatever your loop's termination logic is - "stop once the detector finds a clean face," "stop after the count hits zero," "stop when quality clears a bar" - it funnels down to a single true/false, and this node is what that flag connects to.

      How it works

      It's an output-style node that takes one boolean condition and acts on it: true means halt the iteration, false means allow the next queue. It produces no data output - its entire effect is the control-flow decision, stopping the re-queue cycle that drives Impact's loops. You generate the boolean it reads with the rest of the logic family: ImpactCompare (is A past some threshold?), ImpactIsNotEmptySEGS or ImpactIfNone (did we get a result yet?), or a count from Count Elts in SEGS run through a comparison. This node is only the stop trigger; the deciding happens upstream.

      The input

      • cond (BOOLEAN, required) - the stop condition. True stops the loop; false lets it continue. That's the only input, and there are no outputs - the node's job is the control action, not passing a value on.

      How to install it

      Comes with Impact Pack. ComfyUI Manager: search ComfyUI Impact Pack, Install, restart. Manually:

      cd ComfyUI/custom_nodes
      git clone https://github.com/ltdrdata/ComfyUI-Impact-Pack
      

      then pip install -r requirements.txt in ComfyUI's Python environment (portable: python_embeded\python.exe -m pip ...), restart. Pack's by ltdrdata, the ComfyUI-Manager author - mainstream and trusted. No models needed.

      Common issues & troubleshooting

      Fair warning up front: the whole loop/logic family in Impact Pack is explicitly experimental, and ComfyUI looping is genuinely finicky because it works by re-queuing prompts rather than iterating inside a single run. So the failure people hit isn't usually this node handing over the wrong flag - it's the loop plumbing around it: execution order, when the condition gets evaluated relative to the re-queue, state that doesn't carry the way you'd expect. If a loop never stops, first confirm the boolean you're feeding actually becomes true (log it with ImpactLogger); if it never starts, your condition is probably true from the first pass. Because there's no widely-documented tutorial for these loop nodes yet, the pack's own test/loop-test.json example workflow is the most reliable reference for wiring one correctly - start from that rather than from scratch.

      CategoryImpactPack/Logic

      Inputs (1)

      NameTypeDefaultDescription
      condBOOLEAN

      Outputs (0)

      No outputs