XYZ Grid Iterator
A Counter That Bumps Itself, So You Don't Have To
- current_index
- is_complete
The most tedious part of the whole XYZ Grid workflow is remembering to increment the index widget by one before every single queue. XYZ Grid Iterator exists to take that job away: it's a stateful counter that hands you the current index and then bumps itself, so the next run automatically gets the next combination.
Feed it the total_combinations output from XYZ Grid Input, wire its current_index into the Grid Input's index input, and the manual index-widget routine disappears.
How it works
This is the one node in the pack with real internal state. On each execution it looks at its current position, reports it out, and increments - unless it's just hit the last combination, in which case it reports is_complete as true and wraps back to 0 for the next sweep.
Two inputs, both dead simple:
total_combinations- how many steps before you're done. Defaults to 1.reset- set it true to force the counter back to 0.
And two outputs:
current_index- the index for this run; wire it into XYZ Grid Input'sindex.is_complete- true on the final combination. You could drive the Auto Collector's completion logic with it, though the collector already figures that out from its own count.
The honest caveat
The README itself describes this as "advanced automatic index tracking (limited use cases)," and that's the right framing. Because the state lives on the node instance, it's fragile in exactly the ways node state usually is: reload the workflow or restart ComfyUI and it forgets where it was; duplicate the workflow and each copy has its own counter. If total_combinations doesn't match what the Grid Input actually produces, your index silently drifts and you get misaligned grids.
For a beginner, the manual "set index 0, queue, set index 1, queue" routine is honestly more transparent - you can see exactly where you are. The iterator shines when you're running a long sweep and the muscle-memory of bumping the index is what keeps biting you. Just treat it as a convenience, not a source of truth, and keep an eye on that first run after any restart.
Installing
It's part of the same pack, so one install covers it. ComfyUI Manager → search "XYZ Grid", or:
cd ComfyUI/custom_nodes/
git clone https://github.com/psdwizzard/Comfyui-XYZ-stitch.git
Restart ComfyUI. No requirements.txt, no models, nothing extra - it appears under "XYZ Grid" alongside the rest.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| total_combinations | INT | 11–10000 | — |
| reset | BOOLEAN | false | Reset index to 0 |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| current_index | INT | — |
| is_complete | BOOLEAN | — |