π CR XY Index
Turn a flat loop counter into grid column/row coordinates
- x
- y
- show_help
This is the small math node quietly doing the work behind an XY sweep. Say you're comparing 5 samplers against 4 CFG values - that's 20 combinations, and your batch loop is just counting 0, 1, 2, ... 19. CR XY Index is what turns that single flat number into a column position and a row position, so the rest of your graph knows which sampler and which CFG value the current run should actually use.
How it works
Tell it x_columns and y_rows - the shape of your grid - and feed it index, your current position in the loop. It works out which column and row that flat index number lands in, given the grid dimensions you specified, and returns them as two separate integers: x and y.
Those two outputs are what you'd wire into a pair of list-selection nodes - x picks which sampler name to use from your list of samplers, y picks which CFG value from your list of CFG values, that kind of pairing - so each run in your sweep uses a different combination automatically, without you hand-setting parameters for 20 separate queued runs.
Where this sits in the wider XY workflow
CR XY Index is the front half of Comfyroll's XY grid system; CR XY From Folder is the back half. The typical shape: a loop counter (CR Index, with "control after generate" set to Increment) feeds index here, CR XY Index converts that into x/y coordinates that drive which parameters get used for that run, ComfyUI saves each resulting image to a folder, and once the sweep's finished, CR XY From Folder reads that folder back and assembles everything into one labeled grid - using the same x_columns/y_rows-shaped layout this node was working from all along.
The inputs and outputs that matter
x_columns(default 5) - how many columns your grid has.y_rows(default 5) - how many rows your grid has.index- your current flat loop position.
Outputs: x and y (both INT), plus the standard show_help link.
How to install it
ComfyUI Manager - search "Comfyroll Studio", install, restart. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes.git
then restart. No models, no dependencies - pure index arithmetic.
Common issues
x/y don't match what you expect for a given index. Double-check x_columns and y_rows are actually set to your real grid shape - if you're sweeping 5 samplers by 4 CFG values but left x_columns/y_rows at their default of 5 and 5, the math is running against the wrong grid dimensions and every coordinate past the first row will be off.
Total run count doesn't match your grid. x_columns Γ y_rows is your total combination count - if your loop's index doesn't run through that full range, some cells in the eventual grid will be missing when CR XY From Folder tries to assemble it.
Coordinates look right but the final grid from CR XY From Folder doesn't. Make sure max_columns on that node matches the x_columns you used here - the two nodes don't share settings automatically, so a mismatch between them is a real, easy way to get a lopsided grid.
If Comfyroll's nodes don't load at all, check your ComfyUI console for Comfyroll Studio: Failed to load ... nodes - usually a Pillow version conflict from another custom node - and reinstall Pillow or update the pack through Manager.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| x_columns | INT | 50β9999 | β |
| y_rows | INT | 50β9999 | β |
| index | INT | 00β9999 | β |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| x | INT | β |
| y | INT | β |
| show_help | STRING | β |