VRGDG_GetRunIndexFromJson
Your run number, straight out of the workflow's JSON state
- any
- index
The VRGameDevGirl workflows are chatty. They write state - prompts, scene data, run numbers - out to JSON files as they go, so the two halves of a pipeline can hand off to each other. VRGDG_GetRunIndexFromJson is how the second half reads back: wire in just about anything and it digs the current run index out of that JSON state.
How it works. The input is a single any port - type * - which is the tell that this node is a dependency more than a data consumer. ComfyUI executes nodes only when their inputs are ready, so you connect whatever the workflow was just doing (the node that wrote the JSON, or anything that finishes after it) and this node waits for that to complete, then pulls the index out of the saved JSON state and hands it to you as an INT. It's the "read back what the other workflow half wrote" step, and the any input is just the trigger that guarantees ordering - the actual value comes from the file, not from the wire.
Why you'd use it. The music video workflow is split into pieces: a prompt/planning half that writes scene prompts and metadata to JSON, and a generation half that needs to know which run it's on so it can label its outputs and pick the right batch. Hard-coding the run number means editing the workflow for every run. Reading it from the JSON the planning half just wrote means the whole thing stays automatic - and it stays in sync when you bump the run count upstream.
The inputs. One: any, the execution-order trigger. There's nothing to configure.
The output. index (INT) - the run index, ready for filenames, seeds, or whatever else wants a number.
Where it lives. It's in the pack's general node set, alongside the other state and index helpers - GetAudioFilePath for audio references, GetIndexNumber for folder-derived counters, the JSON update nodes the planning half uses to write state in the first place. This node is the read half of that write/read pair.
Installing. Same pack, same drill:
cd ComfyUI/custom_nodes
git clone https://github.com/vrgamegirl19/comfyui-vrgamedevgirl
or grab vrgamedev via ComfyUI Manager and restart.
Troubleshooting. Because the value comes from a JSON file, the failure modes are all "stale or missing state." If index comes back wrong, the JSON wasn't written the way the node expects - run the planning half first, or check that the state file actually updated. And don't try to find a use for the any input as a data channel; it's purely an ordering trigger, so wiring meaningful data into it does nothing except force correct execution order. If the number seems stuck, it usually means the JSON state is stuck, not the node.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| any | * | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| index | INT | — |