Nodes/ComfyUI-ZML-Image/ZML_任意切换_五
ComfyUI Node

ZML_任意切换_五

Five inputs, one index, one output — the switch for 'which one this run'

By zml-w·Created about a year ago·Updated 2 months ago· 218
ZML_任意切换_五
  • 输入值1
  • 输入值2
  • 输入值3
  • 输入值4
  • 输入值5
  • 选择的输出
索引1

Two options aren't enough anymore. ZML_AnyTypeSwitchFive (ZML_任意切换_五) is the five-slot version of the pack's any-type switch: five wildcard inputs, one integer index, one output. Set the index to 3 and the node passes whatever's wired into 输入值3 - a model, an image, a prompt, a LoRA - without caring what type it is. This is the node you reach for when a workflow has several "modes" and you want a single control that picks which one runs.

What it is

The "five" in the name means five inputs, not a new type system. The sockets are all * (any type), so it can't be picky about what you feed it, and it shouldn't be - a switch is plumbing, not a consumer. It's the A/B concept from ZML_AnyTypeSwitch grown up to a five-way selector, and like that node it's lazy: it only asks ComfyUI to compute the branch you actually selected. Five model loaders, five different LoRA stacks, five prompt presets - you point at one with the index and the other four upstream branches don't execute at all.

The inputs that matter:

  • 索引 (INT, 1–5, default 1) - the selector. Here's the subtle bit, and it's straight from the author's own tooltip: "starting from the index value, if that input isn't connected it increments to find the next one." So index 3 with 输入值3 left unwired will try 4, then 5 - it falls forward to the first connected input. That's a genuinely useful behavior for keeping a workflow robust when you haven't wired all five branches.
  • 输入值1 … 输入值5 (any type, all optional) - the candidates.

Output is 选择的输出 (any type), ready to feed whatever consumes it.

How it works

Same engine facts as the whole switch family: unconnected optional inputs arrive as nothing, and the node's check_lazy_status tells the executor exactly which input key it wants, so ComfyUI skips the rest of the graph behind it. That's the difference between a switch that routes data and a switch that also wastes data - this one only pulls the wire you're pointing at.

Install and gotchas

Pack install, nothing node-specific:

cd ComfyUI/custom_nodes
git clone https://github.com/zml-w/ComfyUI-ZML-Image

or ComfyUI Manager → ComfyUI-ZML-Image, restart.

Two practical notes. First, the UI is Chinese-first - English users should grab the translation patch from github.com/zml-w/ZZZ_ZML_English_Patch or they'll be decoding 索引 on faith. Second, remember the forward-fallback means an empty slot silently passes a different input through; if you expect a specific branch and get another one, check whether your intended input is actually connected. The index is 1-based, which trips people who think in arrays. It's a small, honest node in a one-person pack with no English community - when it confuses you, GitHub issues are the actual support channel.

Categoryimage/ZML_图像/逻辑

Inputs (6)

NameTypeDefaultDescription
索引INT11–5从索引值开始查找,索引值没有输入则递增寻找其它输入
输入值1opt*
输入值2opt*
输入值3opt*
输入值4opt*
输入值5opt*

Outputs (1)

NameTypeDescription
选择的输出*