Nodes/ComfyUI-JDCN/JDCN_BatchCounter
ComfyUI Node

JDCN_BatchCounter

A lap counter for batch jobs that's really just multiplication

By daxcayΒ·Created 2 years agoΒ·Updated about a year agoΒ· 159
JDCN_BatchCounter
    • result
    • lap
    • range
    β—„Lap0β–Ί
    β—„Range0β–Ί
    β—„LapChangeβ–Ύβ–Ί
    β—„LogLogβ–Ί

    JDCN_BatchCounter is a tiny arithmetic helper aimed at batch jobs: you give it a Lap and a Range, and it hands you back Lap Γ— Range as result, along with the raw lap and range values. If you're processing a long sequence in chunks - animation frames, video passes, batch img2img - this is the node that answers "how far through am I?"

    How it works

    Inputs:

    • Lap - which pass/lap you're on.
    • Range - how many frames (or items) each lap covers.
    • LapChange - fixed, increment, or decrement. The honest version: the node itself just computes Lap * Range; it does not advance the lap for you. LapChange is a label for how you intend the lap to move between runs, and you're the one who has to move it - by editing the widget, or by driving Lap from an upstream source.
    • Log - a free-text string field that's essentially a scratchpad/label (the math ignores it).

    Outputs: result (Lap Γ— Range), lap, and range. The result is the useful one: with Range = 12 frames per lap, lap 3 gives you 36 - the frame where this lap starts.

    Where it fits

    Think of it as the simple sibling of JDCN_BatchCounterAdvance, which does the same idea with overlap and skip math for animation. If you're just tracking "which chunk am I on," this is plenty. Combine it with the pack's ConvertAny2String to turn the number into a filename prefix, or with a swap/logic node to change behavior mid-batch.

    Installing it

    Part of ComfyUI-JDCN:

    • ComfyUI Manager β†’ Install Custom Node β†’ search JDCN β†’ install ComfyUI-JDCN β†’ restart.
    • Or:
    cd ComfyUI/custom_nodes
    git clone https://github.com/daxcay/ComfyUI-JDCN.git
    cd ComfyUI-JDCN
    pip install -r requirements.txt
    

    Restart; under πŸ”΅ JDCN πŸ”΅. Only dependency is piexif, no models.

    Common issues

    The trap is expecting automation where there isn't any. LapChange says "increment," but the node won't bump your lap between queue runs - that's on you. If your counters keep returning the same result, check that Lap is actually changing. Also note the inputs are plain INT widgets, so if you want the counter to respond to an upstream value, wire it; otherwise ComfyUI uses the stored widget value. For genuinely automatic iteration (lap advances every run), you'll want a loop construct or a different counter pack - this one is a calculator, not a state machine.

    CategoryπŸ”΅ JDCN πŸ”΅

    Inputs (4)

    NameTypeDefaultDescription
    LapINT00–18446744073709550000β€”
    RangeINT00–18446744073709550000β€”
    LapChangeCOMBO3 options: fixed, increment, decrement
    LogSTRINGLogβ€”

    Outputs (3)

    NameTypeDescription
    resultINTβ€”
    lapINTβ€”
    rangeINTβ€”