ComfyUI Node

Combiner

Prompt grid-walking without rebuilding your workflow

By ilia-zykov·Created 4 months ago·Updated 4 months ago· 2
Combiner
    • prompt
    • step
    • total
    • status
    charactersTohru Kanna Lucoa
    clothingmaid outfit school uniform casual clothes bikini
    posesstanding sitting lying down jumping
    separator,
    iterate_characterfalse
    iterate_clothingfalse
    iterate_posefalse
    random_characterfalse
    random_clothingfalse
    random_posefalse
    character_index0
    clothing_index0
    pose_index0
    resetfalse
    workflow_iddefault

    Combiner is the "generate variations without thinking" node. You give it three lists - characters, clothing, poses - and every time you hit Queue Prompt it hands you the next combination: Tohru, maid outfit, sitting, then Tohru, maid outfit, standing, and so on until it has walked the whole grid and wraps around. It's the structured, stateful cousin of the old {a|b|c} wildcard trick from the A1111 days, except it lives entirely inside one ComfyUI node, needs zero external tools, and remembers where it left off.

    No API calls, no models to download, no pip install. It's a single pure-Python file. The only infrastructure it needs is a ComfyUI session to hold a counter in memory.

    How it works

    The node keeps one global counter in memory, keyed by a workflow_id string (default "default"). Each execution reads the counter, computes which item from each list to use, builds the prompt, then bumps the counter by one. It returns IS_CHANGED = NaN, which is ComfyUI's way of saying "never cache me" - that's how it forces a fresh combination on every queue run even if your inputs didn't change.

    The three lists form a nested loop, and this is the one mechanic worth internalizing: the first category changes slowest, the last changes fastest. With characters = [A, B], clothing = [X, Y], poses = [1, 2] you get A-X-1, A-X-2, A-Y-1, A-Y-2, B-X-1… - a full Cartesian product, every combination exactly once. total tells you how many steps that is, and when the counter hits it, it wraps to step 1.

    The inputs that matter

    Required are just the three multiline lists and a separator (default ", "). The rest is mode control, and there are only two rules you need:

    • Per category, priority is Random > Iterate > manual index. So random_character overrides iterate_character if you flip both on.
    • If any category is on Random, total becomes 0 - there's no end to the sequence, which the total output signals by reading 0.

    The *_index inputs are for the boring fixed case (both toggles off). reset shoves the counter back to zero on the next run. And if you have several Combiner nodes that should advance independently, give each a distinct workflow_id - this is the single most common footgun.

    The four outputs are prompt (wire it into any text input, typically CLIP Text Encode), step (1-based), total, and a human-readable status string. The status output is genuinely handy: it's exactly what you want shown in a preview node so you can tell which combo you're looking at.

    Installing it

    Either path works, and neither pulls dependencies:

    cd ComfyUI/custom_nodes
    git clone https://github.com/ilia-zykov/ComfyUI-iterationNode.git
    

    then restart ComfyUI. Or search for "iterationNode" in ComfyUI Manager and install via Git URL. You'll find it under iteration → Combiner in the node menu. It ships a small line_numbers.js that adds line numbers to the multiline fields - the parser strips those [n] prefixes automatically, so don't bother cleaning them out of your lists.

    Common issues

    • Always the same prompt. At least one iterate_* or random_* toggle has to be on; with all of them off it's intentionally static and uses *_index.
    • Two Combiner nodes stepping in lockstep. They share the "default" workflow_id. Change it on one of them.
    • The counter reset itself. State lives in memory and dies with a ComfyUI restart. That's by design, not a bug.
    • Old inputs linger after you edit the list. ComfyUI caches node definitions; delete the node and re-add it.
    • Queueing the whole grid: set your queue size to total, or use Auto Queue: instant.

    The author's defaults are, shall we say, enthusiastic (Tohru, maid outfit, bikini) - swap them for your own. For building a quick character reference library - same person, many outfits and poses - it's the cheapest tool that does the job without scripting.

    Categoryiteration

    Inputs (15)

    NameTypeDefaultDescription
    charactersSTRINGTohru Kanna Lucoa
    clothingSTRINGmaid outfit school uniform casual clothes bikini
    posesSTRINGstanding sitting lying down jumping
    separatorSTRING,
    iterate_characteroptBOOLEANfalse
    iterate_clothingoptBOOLEANfalse
    iterate_poseoptBOOLEANfalse
    random_characteroptBOOLEANfalse
    random_clothingoptBOOLEANfalse
    random_poseoptBOOLEANfalse
    character_indexoptINT00–999
    clothing_indexoptINT00–999
    pose_indexoptINT00–999
    resetoptBOOLEANfalse
    workflow_idoptSTRINGdefault

    Outputs (4)

    NameTypeDescription
    promptSTRING
    stepINT
    totalINT
    statusSTRING