Nodes/comfyui_AcademiaSD/AcademiaSD Switch Any ๐Ÿ”€
ComfyUI Node

AcademiaSD Switch Any ๐Ÿ”€

One switch for any cable, and it only runs the branch you picked

By AcademiaSDยทCreated about a year agoยทUpdated about 16 hours agoยท 88
AcademiaSD Switch Any ๐Ÿ”€
  • input_1
  • input_2
  • input_3
  • input_4
  • input_5
  • input_6
  • input_7
  • input_8
  • input_9
  • input_10
  • output
  • selected
  • value_text
โ—„select_1โ€”โ–บ
โ—„select_2โ€”โ–บ
โ—„select_3โ€”โ–บ

ComfyUI's type system is why you end up with four different switch nodes. A switch that routes a MODEL can't route a LATENT, so every pack ships a MODEL switch, a LATENT switch, a CONDITIONING switch. Switch Any takes the type out of the question: feed it latents, models, images, integers, and it passes one of them through.

The pack's README calls it a replacement for the Impact Pack switch, which is where most people's existing one lives - install Impact Pack for FaceDetailer (kg/entities/impact-pack.json) and you already have a switch. This one is smaller, lazier, and tells you what it did.

Why it exists

The wildcard type "*" is ComfyUI's one escape hatch: a socket declaring it accepts any wire, and the node then has to make sense of what arrives (docs/knowledge/comfyui-node-plumbing.md lays this out properly). What makes this one pleasant is that it doesn't merely pass a value, it decides which input to read.

Worth being clear on, because people conflate them. rgthree's Any Switch is a fallback switch - no selector, it walks its inputs and hands you the first non-null one, and the graph chooses for you (kg/entities/rgthree-comfy.json). Switch Any is a selector: you say which input, it obeys, it reports the choice. Different tools. "Whichever branch is live wins, don't touch anything" is rgthree's job. "Run variant B this time" is this one.

How the choosing works

The rule is one line: the largest select that arrives wins, and if none arrives you get input 1. No priority ladder, no last-one-set state.

Three selects instead of one looks like over-engineering until you hit the reason. A select fed by a bypassed node doesn't arrive at all - an unconnected optional input simply isn't passed to the function - so a bypassed source goes quiet instead of pushing a stale zero. That lets a group switch raise the choice to 2 without a second branch having to lower it back. It also pairs neatly with the pack's own Fast Switch nodes if you're flipping whole branches.

The sockets grow themselves: two on the canvas, always one free socket after the last wired one, up to ten. No menu, no "add input" click.

The inputs are lazy. Only the chosen branch is computed - if input 3 is an expensive upscale pass, it costs nothing on runs where you pick input 1. That's not a nicety, it's the main reason to prefer this over a switch that evaluates everything and throws three results away.

It's also forgiving about a wrong number. Ask for input 4 with nothing plugged in and it drops to the highest connected input below four, printing which one it used in the console. Ask below everything connected and it takes the lowest. No error, no silent garbage.

Inputs and outputs

Nothing here is required. select_1โ€“select_3 each take an INT; input_1 through input_10 are all wildcard.

Three outputs. output is the chosen value, wildcard-typed, so it plugs into any socket - the receiving node is what actually has to agree with the payload. selected is an INT of the input number really used; wire it to a filename prefix or a save-metadata node to keep a record of which branch rendered this. value_text is the value as a string when it's an int or a float, empty otherwise, which makes it a debugging output: park a Preview Any on it while wiring and stop guessing.

After each run the node prints its verdict in green at the bottom-right, like input_2 โ†’ 8. Small thing, saves squinting.

Install

ComfyUI Manager โ†’ search AcademiaSD (Comfy Registry: comfyui_AcademiaSD), or:

cd ComfyUI/custom_nodes
git clone https://github.com/AcademiaSD/comfyui_AcademiaSD

Restart; it's at Academia SD/Utilities. No dependencies - no requirements file in the repo, and the nodes use what ComfyUI already bundles.

Traps

Nothing connected raises an error. Queue it with no inputs and you get Switch Any: no input is connected rather than a graceful nothing.

A wildcard output tells the downstream node nothing. The frontend will let you draw a line from output into a MODEL input because * matches everything. That doesn't make the value a model. Switch between a LATENT and an IMAGE on one node and expect the complaint from whoever receives it, not from here.

The fallback is quiet by convention only. It prints to the console, and in the usual wall of logging you'll miss it - then wonder why input 4's model isn't what rendered. selected is the honest answer.

Young, single-author pack. AcademiaSD is one person with a YouTube channel and a fast stream of new nodes; the utilities are small and readable, but this isn't the decade-old infrastructure rgthree is. Pin a working version mid-project.

CategoryAcademia SD/Utilities

Inputs (13)

NameTypeDefaultDescription
select_1optINTThe largest select that arrives picks the input; with none, input 1.
select_2optINTThe largest select that arrives picks the input; with none, input 1.
select_3optINTThe largest select that arrives picks the input; with none, input 1.
input_1opt*โ€”
input_2opt*โ€”
input_3opt*โ€”
input_4opt*โ€”
input_5opt*โ€”
input_6opt*โ€”
input_7opt*โ€”
input_8opt*โ€”
input_9opt*โ€”
input_10opt*โ€”

Outputs (3)

NameTypeDescription
output*โ€”
selectedINTโ€”
value_textSTRINGโ€”