ComfyUI Node

VRGDG_PostRunIndexStepper

Stepping scene-by-scene across runs

By vrgamegirl19·Created about a year ago·Updated about 7 hours ago· 718
VRGDG_PostRunIndexStepper
  • any
  • trigger
  • index
  • next_index
  • trigger
resetfalse
incrementtrue
state_file_namevrgdg_index_state.json

Every long ComfyUI project eventually needs the same thing: a counter that ticks up after each batch and remembers where it left off when you reload the workflow. ComfyUI has no built-in state like that - close the window and every widget resets. VRGDG_PostRunIndexStepper is VRGameDevGirl's fix, and it's one of the genuinely useful utility nodes in the pack.

It lives at the heart of the "unlimited length" music video workflow: render scene 1, save it, step the index, render scene 2, save it, step, and so on for however many scenes the song needs. Without a persistent counter you'd be hand-editing an index widget between every single render, and on a 30-scene music video that's a slow, error-prone afternoon.

How it works

Three things make it work: a trigger, a persisted counter, and a passthrough.

  • trigger - connect the VHS_FILENAMES output from a VideoHelperSuite save node (or anything else). When a run finishes and the filenames come through, the node knows the batch completed and increments.
  • increment - default on. Flip it off to freeze the counter while you iterate on a scene.
  • reset - set it true once (then back to false) to zero the counter.
  • state_file_name - where the counter lives on disk (vrgdg_index_state.json by default, in ComfyUI's working directory). This is the magic: the state survives ComfyUI restarts, so you can pick up a 3-hour render session tomorrow where you left off.
  • any - a spare passthrough input you can use to force the node to evaluate even when the trigger isn't connected.

Outputs: index (the value that just completed), next_index (the one coming up - wire this into your per-scene prompt or seed logic), and trigger (the input passed through untouched, so you can keep chaining nodes off the same signal).

Where it trips people up

The state_file_name bit gets people. Because the state is a file, two copies of the node with the same filename share a counter, and renaming the file is resetting it. If your workflow suddenly starts at scene 50, that's why. Also: the counter only advances when the trigger fires, so if you test a scene and let it run, the index moves - that's by design, not a bug. And if you rerun the same scene on purpose, remember to flip increment off first.

Installing it

It's part of the pack:

cd ComfyUI/custom_nodes
git clone https://github.com/vrgamegirl19/comfyui-vrgamedevgirl

then restart, or use ComfyUI Manager → search vrgamedev. No extra model downloads for this one - it's pure Python bookkeeping. Install the pack requirements (kornia, librosa, imageio) if you're using the rest of the workflow.

The honest take

For one-off generations this node is useless - it's built for multi-hour, multi-session renders, which is exactly what AI music videos are. If that's your project, it'll save you from a lot of manual re-editing. If it's not, you'll never touch it.

CategoryVRGDG/utils

Inputs (5)

NameTypeDefaultDescription
any*
triggerVHS_FILENAMES
resetBOOLEANfalse
incrementBOOLEANtrue
state_file_nameSTRINGvrgdg_index_state.json

Outputs (3)

NameTypeDescription
indexINT
next_indexINT
triggerANY