Nodes/ComfyUI-Anima-Style-Explorer-Prompt/Anima 2B Dynamic Group Switcher
ComfyUI Node

Anima 2B Dynamic Group Switcher

The 30-way prompt switch that bypasses whole groups for you

By mizukir0418-gif·Created 3 months ago·Updated 13 days ago· 6
Anima 2B Dynamic Group Switcher
    • text
    active_style
    text_1
    text_2
    text_3
    text_4
    text_5
    text_6
    text_7
    text_8
    text_9
    text_10
    text_11
    text_12
    text_13
    text_14
    text_15
    text_16
    text_17
    text_18
    text_19
    text_20
    text_21
    text_22
    text_23
    text_24
    text_25
    text_26
    text_27
    text_28
    text_29
    text_30

    Of the three nodes in this pack, this is the clever one. At first glance AnimaDynamicGroupSwitch looks like a plain text switch - pick one of up to 30 string inputs, get it out of text. But the front end does the part that's actually worth having: it looks at which ComfyUI group each connected input's source node lives in, names the dropdown options after those groups, and when you pick one it greys out (bypasses) every node in the other groups. It's a group switcher disguised as a text router.

    What it's for

    The workflow it's designed around: you've built two or three different style pipelines - say, one painterly chain with one set of artists, one lineart chain with another - and each lives in its own named group on the canvas. The final prompt string from each group wires into text_1, text_2, text_3 here. Flip the dropdown and you swap which prompt feeds your KSampler and bypass the losing groups so their nodes don't burn a frame of compute. For Anima in particular, where you're expected to keep a dozen artist styles in rotation, this is the "A/B my styles without dismantling the graph" node.

    How it works

    The backend is deliberately dumb: it parses the leading integer out of active_style ("2: Lineart Group"2) and returns the matching text_N input. The active_style combo starts with a single placeholder, 1: Unconnected, because the real options are generated by JavaScript at runtime based on what you actually connect - VALIDATE_INPUTS returns True so the backend accepts combo values it never saw at registration. The JS then does the group detective work: for each connected input it finds the source node, figures out which group that node sits inside, and rebuilds the dropdown as N: GroupName. The label on each input slot shows the group name too, so text_3 [Lineart Group] tells you exactly what you're switching between. Change a connection and the whole thing re-labels itself.

    Inputs and output

    • text_1 … text_30 - the channels. Each is a STRING input with forceInput, so they're meant to be wired from prompt-building nodes (this pack's two templates, or any other text output). Unconnected slots show up as "Unconnected" in the dropdown; connect enough and they vanish.
    • active_style - the only required input, and it's the dropdown. Select which channel (and which group) is live.
    • text - the single output: whatever the selected channel contained.

    The catch

    The dropdown is only as good as your group titles. It reads group.title, so the "Lineart" and "Painterly" names you see are whatever you named those groups - call your groups "Group 1" and "Group 2" and that's exactly what the switch will say. Name the groups before you wire things up, or the whole "dynamic" feature just returns two boring numbers. Also note the bypass logic keys off the group the source node lives in, so it only does its thing when the input is actually connected to a node inside a group - a floating unconnected text_2 won't grey anything out (there's nothing to grey).

    Install

    Same pack, same story - no dependencies beyond ComfyUI itself:

    cd ComfyUI/custom_nodes
    git clone https://github.com/mizukir0418-gif/ComfyUI-Anima-Style-Explorer-Prompt.git
    

    Restart ComfyUI and it shows up under Anima2B (the only node in the pack with its own category). Manager users: search the pack title. The ~1.6 GB sidebar database for the style browser is optional and unrelated to this node.

    CategoryAnima2B

    Inputs (31)

    NameTypeDefaultDescription
    active_styleCOMBO1 options: 1: Unconnected
    text_1optSTRING
    text_2optSTRING
    text_3optSTRING
    text_4optSTRING
    text_5optSTRING
    text_6optSTRING
    text_7optSTRING
    text_8optSTRING
    text_9optSTRING
    text_10optSTRING
    text_11optSTRING
    text_12optSTRING
    text_13optSTRING
    text_14optSTRING
    text_15optSTRING
    text_16optSTRING
    text_17optSTRING
    text_18optSTRING
    text_19optSTRING
    text_20optSTRING
    text_21optSTRING
    text_22optSTRING
    text_23optSTRING
    text_24optSTRING
    text_25optSTRING
    text_26optSTRING
    text_27optSTRING
    text_28optSTRING
    text_29optSTRING
    text_30optSTRING

    Outputs (1)

    NameTypeDescription
    textSTRING