Nodes/ComfyUI-Simple-Selector/最后有效节点序号选择器
ComfyUI Node

最后有效节点序号选择器

Mute to switch, never rewire

By StarIICraft·Created 10 months ago·Updated 10 months ago· 0
最后有效节点序号选择器
  • input_1
  • input_2
  • input_3
  • input_4
  • input_5
  • selected_index

The name is a small lie, and that's fine

Despite the "selector" in the title, SimpleSelectorInt doesn't select anything. It's a pure logic node: you wire things into its five inputs, it looks at which wires are actually alive, and it hands you back a single integer - the number of the first live input. That number then drives an Index Switch-class node downstream, which is what actually does the selecting.

Its whole reason to exist is so you can switch configurations by muting nodes instead of rewiring. If you've ever kept two prompt setups or two sampler chains around and swapped them by dragging wires back and forth, this is aimed squarely at you.

How it works

The node checks its inputs in reverse order - input_5 first, then 4, 3, 2, 1 - and returns the index of the first one that's connected and active. Wire up both input_2 and input_4, and you get 4. That reverse-priority detail matters more than it looks: higher-numbered inputs always win, so order your alternatives accordingly.

Two implementation tricks make it behave the way it does:

  • Universal inputs. Every input is typed *, via a small AnyType class that overrides Python's equality checks so ComfyUI's type checker never rejects a wire. You can plug in an image, a model, a latent, a CLIP, a float, whatever. The node never touches the values anyway - it only checks presence.
  • Mute support. If an upstream node is muted (Ctrl+M), ComfyUI either doesn't pass its value through at all or passes None, and the code handles both cases. So a muted upstream reads as "no connection" and the node skips ahead to the next live input. Mute input_4's node in the example above and the output flips to 2.

The inputs and outputs that matter

There are no widgets here - nothing to type. All five optional inputs (input_1 through input_5) are just places to park wires. The one output is selected_index (an INT), which you feed straight into an index-driven switch - ComfyUI's built-in Image Switch, Latent Switch, CLIP Switch, or any of the router-style nodes from bigger packs.

One sentinel to remember: if nothing is connected, or every upstream is muted, the node outputs 0. So whatever switch you're driving should have a sensible option at index 0, because that's what "nothing selected" produces.

Where it earns its keep

A/B testing is the classic case. Park two prompt sources, two LoRA stacks, or two sampler configs on separate inputs, then flip between them by muting - no disconnected wires, no broken-looking graphs, and the switch downstream follows along automatically. It's the same impulse that made rgthree's Fast Groups Muter a staple for people with big graphs: whole-config alternatives, zero re-plumbing.

Installing it

ComfyUI Manager: search "ComfyUI-Simple-Selector" and install. Or do it by hand:

cd ComfyUI/custom_nodes
git clone https://github.com/StarIICraft/ComfyUI-Simple-Selector

Restart ComfyUI. That's the whole install - there's no requirements.txt, no model downloads, nothing but one small Python file. This is the rare pack that's genuinely dependency-free.

Gotchas worth knowing

  • Bypass is not mute. A bypassed node passes its input straight through, so to this node it still counts as "connected". Only Mute (Ctrl+M) reads as inactive. People hit this constantly, and the README's own example assumes mute.
  • Type-* inputs cut both ways. The universal typing is the feature, but it also means ComfyUI won't warn you when you wire something wrong. Debug by sight.
  • It's wire-driven, not widget-driven. There's no "select index" box; the node can only ever be controlled by what's connected.
  • It's an obscure micro-pack. Single commit, Chinese-language README, no community footprint to speak of. It does exactly one job and does it fine, but don't expect a roadmap. If you want muting at workflow scale - groups, bookmarks, a dashboard - rgthree-comfy is the heavier, battle-tested option.
CategoryMyCustomNodes/Utils

Inputs (5)

NameTypeDefaultDescription
input_1opt*
input_2opt*
input_3opt*
input_4opt*
input_5opt*

Outputs (1)

NameTypeDescription
selected_indexINT