Nodes/DarkPrompts/Dark Face Index Shuffle
ComfyUI Node

Dark Face Index Shuffle

Shuffle an existing Reactor face index, so friends change seats every generation

By darkpixel·Created 3 years ago·Updated about a year ago· 11
Dark Face Index Shuffle
    • STRING
    faces_index_csv
    seed0

    DarkFaceIndexShuffle is the companion to DarkFaceIndexGenerator, and it answers the other half of the multi-face Reactor problem. The generator builds an index CSV from a count; this node takes an existing CSV and shuffles it. Same seed mechanism, same comma-joined output, one input, one job.

    When you'd use it

    If you already know your face list - maybe you've been typing 0,1,2,3,4,5 into Reactor's input_faces_index by hand and it's working - this node makes the order random without touching anything else. Same scene, same faces, but which detected position each source lands in changes per generation. The README frames it as randomizing "the order of friends in the scene," which is exactly right: the faces are fixed, the seating chart isn't.

    The other natural setup is pairing it with DarkFaceIndexGenerator: generator for the base sequence, then shuffle for variety. That's two nodes doing what the generator alone already does (it has a randomize flag), so honestly the shuffle shines most when your index comes from somewhere else - a saved workflow, a CSV file, or a hand-tuned list with specific positions you want to keep but rotate.

    How it works

    It splits your faces_index_csv on commas, seeds Python's random with the seed input, shuffles the list, and rejoins it with commas. That's the whole implementation - the same random.seed(seed) + random.shuffle() pattern the rest of the pack uses, so reproducibility works exactly like everywhere else in DarkPrompts: same input, same seed, same output.

    Inputs: faces_index_csv (STRING) and seed (INT, wireable). Output: a re-shuffled STRING for Reactor's input_faces_index.

    What to watch

    • It doesn't validate. Give it 0,1,2 and you get a permutation of 0,1,2. Give it 0,1,x and you get a permutation of 0,1,x - garbage in, shuffled garbage out. Reactor's tolerance for invalid indices varies, so keep the CSV well-formed.
    • The seed is everything. Fixed seed, fixed order - which is great for reproducing a batch, and worth knowing when you're debugging "why does the same face keep landing in the same spot."
    • Reactor is the actual dependency. This node only produces a string; without the ComfyUI-Reactor-Nodes pack installed, and its insightface models, there's nothing to feed it into.

    Install

    It ships in the DarkPrompts pack - Manager → "DarkPrompts", or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/darkpixel/darkprompts.git
    

    Restart ComfyUI. No extra dependencies beyond Reactor itself (which is a separate, heavier install). If you only do single-face swaps, you don't need this node at all - it exists for the group-scene crowd, and for them it's genuinely the difference between typing indices by hand and pressing queue.

    CategoryDarkPrompt

    Inputs (2)

    NameTypeDefaultDescription
    faces_index_csvSTRING
    seedINT00–18446744073709550000

    Outputs (1)

    NameTypeDescription
    STRINGSTRING