Nodes/ComfyUI-ArchAi3d-Qwen/πŸ”€ Any Index Switch
ComfyUI Node

πŸ”€ Any Index Switch

The any-type switch that only evaluates what you actually pick

By amir84ferdosΒ·Created 11 months agoΒ·Updated 5 months agoΒ· 70
πŸ”€ Any Index Switch
  • value0
  • value1
  • value2
  • value3
  • value4
  • value5
  • value6
  • value7
  • value8
  • value9
  • value
β—„index0β–Ί

The "Any" is doing real work here. This switch accepts any type on all ten inputs - images, latents, models, strings, conditioning - and passes exactly one through based on an integer index. ComfyUI's built-in switches are usually typed to a specific data type, which is a wall you hit the moment you want to swap between two different kinds of things, or swap between types that don't have a dedicated switch node at all.

The genuinely nice part is the lazy evaluation. index (0-9) selects the slot, and thanks to ComfyUI's lazy-execution system, only the selected input's upstream nodes run. Pick value3 and the branch feeding value0 never executes. That's not a micro-optimization - in a big workflow it can mean skipping an entire expensive sampler chain just because it isn't selected this run.

What you set

There's exactly one required input - index, an integer 0-9, default 0. Then ten optional value0 through value9 inputs of any type. It's modeled on ComfyUI-Easy-Use's anythingIndexSwitch, so if you've used that, you know the drill. The output is a single value of whatever type came through.

Typical uses: A/B testing two prompts or two images without duplicating the downstream graph, switching between a handful of LoRA-strength presets, or building a menu where a single integer selects between "input image", "URL image", and "generated placeholder" feeding one node.

Installation

Part of the ComfyUI-ArchAi3d-Qwen pack. ComfyUI Manager - search "ArchAi3d Qwen" - or:

cd ComfyUI/custom_nodes/
git clone https://github.com/amir84ferdos/ComfyUI-ArchAi3d-Qwen.git
cd ComfyUI-ArchAi3d-Qwen
pip install -r requirements.txt

Restart and it's under ArchAi3d/Utils. Yes, the pack's requirements are heavier than this node needs - that's the cost of the pack being a grab bag. Personal use is free; commercial use needs the author's license.

Where people get burned

The lazy evaluation cuts both ways. If you were expecting a branch to run for side effects (like a save node inside a non-selected branch), it won't - that's the feature working as intended, and it bites people who wired "always save" into a switched branch. Also, unconnected slots are fine (they just return nothing), but if index ever points at a slot you left empty, you get nothing out - double-check that the slot you selected actually has a wire. And unlike a boolean toggle, this is not a "true/false" switch: index 0 and index 1 are different branches, so if you convert an old boolean switch, remember the mapping.

CategoryArchAi3d/Utils

Inputs (11)

NameTypeDefaultDescription
indexINT00–9Index of the input to select (0-9)
value0opt*Input value 0
value1opt*Input value 1
value2opt*Input value 2
value3opt*Input value 3
value4opt*Input value 4
value5opt*Input value 5
value6opt*Input value 6
value7opt*Input value 7
value8opt*Input value 8
value9opt*Input value 9

Outputs (1)

NameTypeDescription
value*β€”