Nodes/ComfyUI-EnumCombo/Enum Combo Advanced
ComfyUI Node

Enum Combo Advanced

Same Dropdown Idea, Self-Contained — Plus Name, Index, and Count

By SparknightLLC·Created 5 months ago·Updated 4 months ago· 4
Enum Combo Advanced
    • value
    • name
    • index
    • count
    choiceOPTION_A
    start0
    stricttrue
    enum_definitionOPTION_A OPTION_B

    Enum Combo Advanced is the same trick as its compact sibling - dropdown in, INT out - but it makes the list part of the node itself. No wire from a separate STRING node, no squinting at 0 = TXT2IMG notes. You type the options right into the node, and you get four outputs instead of one. If you only need a single integer, grab Enum Combo instead; this one is for when the list is the source of truth and you want the metadata to go along with it.

    How it works

    The enum_definition field is a plain multiline text box, one member per line. Values are zero-based by default, but the parser is where this node gets interesting. You can pin explicit integers, and an assignment resets the auto-increment:

    TXT2IMG = 3
    IMG2IMG
    INPAINT
    

    That gives you TXT2IMG = 3, IMG2IMG = 4, INPAINT = 5. Labels with spaces go in quotes ("Text to Image" = 0), and it understands #, //, and /* */ comments, which is more comment support than a lot of real programming languages offer their config files. Duplicate names or an empty list raise a clear error rather than failing silently.

    Inputs that matter

    • choice - the dropdown, filled from the definition.
    • enum_definition - the multiline list described above.
    • start (INT, default 0) - the value used for the first unassigned member. This is how you start numbering at 1 instead of 0, or at 100, without writing = 1 on every line.
    • strict (BOOLEAN, default true) - what happens when your saved choice isn't in the current definition. We'll come back to this.

    Outputs

    • value (INT) - the selected member's integer. Wire this to a switch index or lazy input.
    • name (STRING) - the selected member's name, handy for text output or building file names.
    • index (INT) - the member's zero-based position in the list, regardless of what values you assigned.
    • count (INT) - how many members the list has.

    That last pair is the fun one: feed count into a loop and you can iterate every mode in the enum, or use index when you care about position rather than assigned value.

    Install

    Same as the rest of the pack - ComfyUI Manager, search "ComfyUI-EnumCombo", or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/SparknightLLC/ComfyUI-EnumCombo
    

    Then restart ComfyUI, since the dropdown is a frontend extension. No models, no dependencies; the author keeps this one deliberately dependency-free.

    Troubleshooting

    The one real trap is strict. Default on, so if you load a workflow whose saved choice no longer appears in the definition, execution fails and the error lists every available name. That's usually what you want - a stale choice is a bug. But if you're mid-edit and it keeps erroring at you, flip strict off and it will silently pick the first member instead. Just don't leave it off and wonder why a missing option quietly became your first one.

    One honest caveat: this is a small, niche pack from a solo developer, so don't expect a changelog to the moon. For the specific job of turning a named mode into a strongly-typed integer - with the definition self-contained and inspectable - it's the tightest option around.

    Categoryutils/enum

    Inputs (4)

    NameTypeDefaultDescription
    choiceCOMBOOPTION_AThe enum member to select. The dropdown updates from enum_definition.
    startINT0-18446744073709550000–18446744073709550000The integer value used for the first unassigned member.
    strictBOOLEANtrueIf enabled, execution errors when the saved choice is not present in enum_definition.
    enum_definitionSTRINGOPTION_A OPTION_BOne enum member per line. Use NAME or NAME = integer. Unassigned values auto-increment from start or the previous explicit value. Quote labels that contain spaces. Supports #, //, and /* */ comments.

    Outputs (4)

    NameTypeDescription
    valueINTINT: The selected enum member's integer value.
    nameSTRINGSTRING: The selected enum member's name.
    indexINTINT: The selected enum member's zero-based position in the definition.
    countINTINT: The number of enum members in the definition.