JDCN_BatchCounter
A lap counter for batch jobs that's really just multiplication
- result
- lap
- range
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, ordecrement. The honest version: the node itself just computesLap * Range; it does not advance the lap for you.LapChangeis 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 drivingLapfrom 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.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| Lap | INT | 00β18446744073709550000 | β |
| Range | INT | 00β18446744073709550000 | β |
| LapChange | COMBO | 3 options: fixed, increment, decrement | |
| Log | STRING | Log | β |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| result | INT | β |
| lap | INT | β |
| range | INT | β |