Nodes/ViewComfy Utils/ViewComfy - Anything Inversed Switch
ComfyUI Node

ViewComfy - Anything Inversed Switch

The Switch That Picks Which Branch of Your Workflow Even Runs

By ViewComfy·Created 11 months ago·Updated 8 months ago· 8
ViewComfy - Anything Inversed Switch
  • in
  • out0
index0

Most "switch" nodes in ComfyUI are routing valves: they pick which value passes through, but every downstream path still executes. The Anything Inversed Switch from the ViewComfy-Utils pack is different, and that difference is the whole point. Give it one input and an index, and it hands the value to exactly one output - everything wired to the other outputs is blocked from running at all. If you've ever wanted a genuine switch/case in a graph, this is the node.

It's called "inversed" because it inverts the usual switch shape. Instead of many inputs collapsing to one output (the rgthree Any Switch style, which grabs the first non-null input), this one takes a single input and fans it out to several outputs, letting you point it at one. The index widget (index, an INT from 0–9, default 0) decides which slot gets the value. You'll see a single out0 output when the node first lands on the canvas; more output sockets appear as you connect downstream nodes, up to a couple dozen in the code. Wire a different pipeline to each one and the index becomes your program counter.

How the blocking actually works: under the hood, every non-selected output is handed an ExecutionBlocker instead of your data. ComfyUI sees that sentinel and refuses to schedule anything downstream of it, so you get real conditional execution - not a null value flowing through a node that then has to decide what to do with it. The value you feed in can be any type (in is a * wildcard), which is what makes this usable for routing latents, images, models, strings - whatever. This is the plumbing-layer pattern documented in the KB's node-plumbing essay: the * type and blocker sentinel are how a graph becomes a small program.

Where you'd actually use it: anywhere a user-facing app or API needs to branch. A ViewComfy app where a dropdown selects between "portrait" and "landscape" pipelines, each feeding its own KSampler chain - the unselected chain never touches your GPU. Or a switch/case that routes a seed through different LoRA stacks. For plain "pick one of two values" needs, you want Conditional Select instead; this node is for when the branches themselves should be skipped.

The gotcha is that it's execution-blocking, so don't use it where you want everything to run. And because the output sockets only appear as you connect them, build the node up as you wire it rather than expecting a fixed set of ports.

Install is the same for every node in this pack: ComfyUI Manager, search "ViewComfy-Utils", install, restart. Or by hand:

cd ComfyUI/custom_nodes
git clone https://github.com/ViewComfy/ViewComfy-Utils

Then restart ComfyUI. The pack has no extra dependencies beyond what ComfyUI already ships (its requirements file is just torch and Pillow), and it downloads no models - about as safe an add as this ecosystem offers.

One honest caveat: with 0 impressions and almost no community discussion, this is a node you'll mostly see inside ViewComfy-hosted apps rather than shared workflows. It's not a bad thing - it's solving a problem most local tinkerers never hit. If you're building a workflow you plan to expose as an app or API, it's one of the few tools that genuinely does conditional execution without leaving a garbage path running.

Categoryutils

Inputs (2)

NameTypeDefaultDescription
indexINT00–9
in*

Outputs (1)

NameTypeDescription
out0*