Nodes/ComfyUI-Danbooru-Gallery/枚举切换 (Enum Switch)
ComfyUI Node

枚举切换 (Enum Switch)

Route the graph based on a dropdown value from your control panel

By Aaalice233·Created 11 months ago·Updated 24 days ago· 224
枚举切换 (Enum Switch)
    • output
    enum_value

    Think of this as a switch statement for your graph. The author's own description is direct about it: it picks one output from several possible inputs based on an enum value, the number of inputs is determined by how many enum options exist, and the output type is inferred automatically from whatever you wire it to downstream.

    Why you'd want this

    If you've built (or plan to build) an exposed control on this pack's Parameter Control Panel - a dropdown with a fixed set of named options, say "quality preset: draft / standard / high" - you eventually need something in the graph that actually acts on which option is selected, not just displays it. Enum Switch is that piece: it takes the currently-selected value as a string and routes execution to the matching input. Wire a different value (a different LoRA strength, a different resolution, a different prompt suffix) to each option, and whichever one matches the live selection is what flows out - all driven by one dropdown instead of a tangle of manual rewiring every time you want to change presets.

    The enum_value field's own tooltip says it's "usually provided by Parameter Control Panel" - so while nothing stops you from typing a value in directly for testing, this node is clearly designed to be the acting half of a pair, with that panel node as the deciding half.

    How it works

    The declared schema shows just the one required field, enum_value; the actual set of switchable inputs is added dynamically based on how many enum options exist upstream, rather than being a fixed list baked into the node. As the description notes, the output's type isn't fixed either - it adapts to whatever you connect it to, the same wildcard-typing pattern this pack uses elsewhere (Simple Value Switch, Parameter Break).

    The inputs and outputs that matter

    • enum_value (required, STRING, default empty) - the currently-selected option, typically fed from Parameter Control Panel.
    • Additional inputs are added dynamically, one per enum option, holding the value to output when that option is selected.
    • output - a single wildcard-typed (*) output carrying whichever input matched the current enum_value.

    How to install it

    ComfyUI Manager: search "ComfyUI-Danbooru-Gallery", install, restart. Manual:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Aaalice233/ComfyUI-Danbooru-Gallery.git
    cd ComfyUI-Danbooru-Gallery
    pip install -r requirements.txt
    

    Restart ComfyUI. No models or heavy dependencies - pure graph-routing logic.

    Common issues & troubleshooting

    Wrong branch fires, or nothing fires. Since enum_value is a plain string being matched against option names, a mismatch is almost always a typo or case difference between what's selected upstream and what this node expects - double check the exact spelling coming out of Parameter Control Panel matches what you set up on this node's side.

    Output type looks wrong downstream. Because the output type is inferred from your connection rather than fixed, wiring this node's output into two different-typed inputs at once (or leaving it unconnected while testing) can produce inconsistent behavior - keep one clear downstream target per switch while debugging.

    Node doesn't appear in the menu. Standard pack-load check: confirm the repo path, confirm dependencies installed, check the ComfyUI console at startup for an import error.

    Categorydanbooru

    Inputs (1)

    NameTypeDefaultDescription
    enum_valueSTRING当前选中的枚举值,通常由参数控制面板提供

    Outputs (1)

    NameTypeDescription
    output*