Nodes/SDVN_Comfy_node/πŸ”„ Auto Switch
ComfyUI Node

πŸ”„ Auto Switch

Pass through the first input that's actually connected

By StableDiffusionVNΒ·Created 2 years agoΒ·Updated about a month agoΒ· 118
πŸ”„ Auto Switch
  • input1
  • input2
  • input3
  • input4
  • input5
  • input6
  • output

Auto Switch is the "whichever one has a value, use that" node. It has several input slots and a single output, and it passes through the first input that's actually present - no manual selector, no boolean to flip. That's the "auto" part. Compared to the pack's regular Switch or Logic Switch, where you pick or a condition picks, this one just takes the first slot that isn't empty and forwards it.

It's built for optional branches. Say your graph has an optional img2img input: if an image is wired in, use it; if not, fall through to the next source. Auto Switch handles that fallthrough cleanly instead of you rewiring the graph depending on the case. The pack groups it with the other flow-switching nodes for "automating workflows," and this is the most hands-off of the bunch.

How it works

It checks the inputs in order - input1, then input2, and so on - and outputs the first one that has a value (isn't None/unconnected). Everything after the first hit is ignored. So the slot order is really a priority order: slot 1 wins if it's present, otherwise slot 2, and down the line.

The inputs and outputs that matter

  • input1-input6 (all optional, any type) - your candidate sources, in priority order. Wire in as many as the situation needs.

The single output is output - the first connected input, passed through at its own type.

How to install it

Comes with the SDVN pack. ComfyUI Manager, search SDVN_Comfy_node; or:

cd ComfyUI/custom_nodes
git clone https://github.com/StableDiffusionVN/SDVN_Comfy_node
pip install -r custom_nodes/SDVN_Comfy_node/requirements.txt

from the ComfyUI root, then restart. No models, no dependencies.

Common issues & troubleshooting

Order is priority. If two inputs are connected, the lower-numbered slot wins and the other is dropped. If it's forwarding the "wrong" one, check which slot each source is plugged into - rearrange so your preferred source sits in an earlier slot.

Nothing came through. If every slot is empty/unconnected, there's nothing to pass. Make sure at least one candidate actually carries a value.

"Present" vs "empty." The selection is about whether a slot has a value at all. An input that's connected but carrying an empty or zero value still counts as present - this isn't a "skip falsy things" node. If you need logic based on the content of a value (is it greater than X, does it contain Y), that's the pack's Boolean plus Logic Switch, not Auto Switch.

You wanted a manual pick. If the whole point is that you choose which branch runs by hand, use the plain Switch instead. Auto Switch deliberately takes the choice out of your hands.

CategoryπŸ“‚ SDVN/πŸ’‘ Creative

Inputs (6)

NameTypeDefaultDescription
input1opt*β€”
input2opt*β€”
input3opt*β€”
input4opt*β€”
input5opt*β€”
input6opt*β€”

Outputs (1)

NameTypeDescription
output*β€”