Nodes/ComfyUI-Practical-Tools/Any Switch Simple
ComfyUI Node

Any Switch Simple

The five-input fallback switch that stays legible

By wenchengxiang·Created 2 months ago·Updated 9 days ago· 3
Any Switch Simple
  • any_1
  • any_2
  • any_3
  • any_4
  • any_5
  • *

Any Switch Simple is the compact member of the Any Switch family in this pack - five inputs instead of fifteen, same behavior. It walks any_1 through any_5 in order and outputs the first one that isn't empty; no selector, the node just decides by which upstream branch is actually live. The output is a single wildcard value (named * in the schema) carrying whatever type won.

It's the fallback-switch pattern the node-plumbing layer calls canonical - the same "first non-null wins" shape rgthree's Any Switch made famous, just at a friendlier size. You keep several optional branches feeding one downstream consumer: use this generated image, or fall back to a loaded file; use this conditioning if it produced output, otherwise the base one. Whatever is live flows through, hands off.

Why pick the five-slot version over the fifteen? Legibility, mostly. A fallback switch's ordering is its logic - first in the list wins when several are live - and a five-slot node communicates that ordering at a glance. With fifteen ports the priority is easy to lose. If your workflow has two or three alternatives, Simple is the version that reads well and stays out of the way; that's genuinely the right call, not a compromise.

The mechanism details carry over from the big node, including the smart bit: the source treats a dict with model and clip keys as "empty" if either value is None, so a half-built model/CLIP context doesn't count as a valid branch. And the same gotchas apply:

  • First connected live input wins, silently - order matters, and nothing tells you when two branches are both live.
  • Unconnected inputs are skipped, not errors. Output None means every connected branch was empty.

Install is pack standard: ComfyUI Manager → search ComfyUI-Practical-Tools → install → restart, or git clone https://github.com/wenchengxiang/ComfyUI-Practical-Tools into ComfyUI/custom_nodes. No dependencies, no models. Outgrow five slots and it's a drop-in swap to the fifteen-slot Any Switch - same sockets, same semantics.

CategoryPractical-Tools/utils

Inputs (5)

NameTypeDefaultDescription
any_1opt*—
any_2opt*—
any_3opt*—
any_4opt*—
any_5opt*—

Outputs (1)

NameTypeDescription
**—