Nodes/deforum-comfy-nodes/_ForLoopCounter| Deforum
ComfyUI Node

_ForLoopCounter| Deforum

The invisible clock that makes Deforum loops stop

By deforum·Created about a year ago·Updated 3 months ago· 29
_ForLoopCounter| Deforum
    • decremented
    • should_continue
    current_value

    This is a strange article to write, because you are not supposed to see this node. _ForLoopCounter is the internal helper that powers Deforum's For Loop Open / For Loop Close pair - the leading underscore is the pack's way of saying "don't touch, internal wiring." It's deliberately left out of the display-name mappings, so it shows up under a bare class name with an empty category, and in a normal workflow you'll never drag it onto a canvas. It gets created for you the moment you use a Deforum for-loop.

    What it does, since you asked

    It's a one-trick counter with two outputs:

    • current_value - an INT input (marked forceInput, so it must come from a wire, not a widget).
    • decremented - INT: current_value - 1.
    • should_continue - BOOLEAN: true as long as decremented > 0.

    So it's literally a countdown: 10 → 9 → true, ..., 1 → 0 → false. The For Loop Close node wires it between the loop's remaining value and the while-loop condition, and when the counter hits zero the loop stops. No counter, no terminating condition, no loop.

    Why you'll rarely interact with it

    If you load a workflow someone else built and see this node sitting in the graph, it's usually a leftover from a saved/expanded loop - the graph got serialized mid-expansion. You can delete it and re-create the loop cleanly, or just leave it; it does no harm. What you shouldn't do is hand-wire values into it and expect a working for-loop, because the open/close nodes build their own wiring around it every run.

    That's the whole story. It's a private gear in a machine, and the fact that you can see it here is mostly an artifact of ComfyUI loading every registered class. Consider yourself informed, and go back to using the actual loop nodes.

    Installing it

    It arrives with deforum-comfy-nodes, the official Deforum ComfyUI pack - there's no separate install. ComfyUI Manager: search "deforum" (comfyui-deforum), install, restart. Manual:

    cd ComfyUI/custom_nodes
    git clone https://github.com/deforum-art/deforum-comfy-nodes
    

    Restart ComfyUI after. No extra dependencies or models. The usual upgrade hiccup (orphaned deforum pip package causing load errors) applies to the whole pack: pip uninstall deforum and restart.

    Inputs (1)

    NameTypeDefaultDescription
    current_valueINT

    Outputs (2)

    NameTypeDescription
    decrementedINT
    should_continueBOOLEAN