Nodes/ComfyUI-WBLESS/Inversed Switch
ComfyUI Node

Inversed Switch

Split one stream into 64 branches — and only one of them runs

By LaoMaoBoss·Created about a year ago·Updated 5 days ago· 0
Inversed Switch
  • Input
  • Output_1
  • Output_2
  • Output_3
  • Output_4
  • Output_5
  • Output_6
  • Output_7
  • Output_8
  • Output_9
  • Output_10
  • Output_11
  • Output_12
  • Output_13
  • Output_14
  • Output_15
  • Output_16
  • Output_17
  • Output_18
  • Output_19
  • Output_20
  • Output_21
  • Output_22
  • Output_23
  • Output_24
  • Output_25
  • Output_26
  • Output_27
  • Output_28
  • Output_29
  • Output_30
  • Output_31
  • Output_32
  • Output_33
  • Output_34
  • Output_35
  • Output_36
  • Output_37
  • Output_38
  • Output_39
  • Output_40
  • Output_41
  • Output_42
  • Output_43
  • Output_44
  • Output_45
  • Output_46
  • Output_47
  • Output_48
  • Output_49
  • Output_50
  • Output_51
  • Output_52
  • Output_53
  • Output_54
  • Output_55
  • Output_56
  • Output_57
  • Output_58
  • Output_59
  • Output_60
  • Output_61
  • Output_62
  • Output_63
  • Output_64
Path1

If Switch is the branch picker, Inversed Switch is the branch splitter - the two are designed as a pair. You feed it one Input, and it sends that value out through exactly one of up to 64 Output_N ports, chosen by Path. Everything else gets blocked. It's the "one stream, many possible destinations" side of a workflow router.

The name's a hint: it's the inverse of Switch. Switch takes many inputs and picks one; Inversed Switch takes one input and picks one destination out of many. Together they let you build a routing hub - one value fans out to a set of branches, and a Switch downstream decides which branch actually delivers. The README credits ComfyUI-Impact-Pack for the core idea, and it shows: this is the same execution-blocking trick ltdrdata's pack popularized, so downstream nodes in unselected branches never run.

How it works

This is where the mechanism gets clever, and it's the part to understand before you trust it. ComfyUI normally executes everything a node's inputs need. An unselected branch would waste VRAM and time. Inversed Switch avoids that by filling the 63 unselected outputs with an execution blocker - a special marker that tells ComfyUI's executor "don't compute anything downstream of this." The pack installs a small hook into ComfyUI's execution engine (it patches execution.get_output_data on import) so blocked values propagate through other nodes without executing them. Only the selected Path output carries real data.

  • Input - whatever you're routing: an image, a prompt, a seed, anything.
  • Path - which Output_N gets the real value (1–64).

Every unselected output gets the blocker instead of data. Wire those outputs into a Switch with the matching Path, and the routed value flows through cleanly.

Install

Part of ComfyUI-WBLESS, no dependencies beyond what ComfyUI already ships:

cd ComfyUI/custom_nodes
git clone https://github.com/LaoMaoBoss/ComfyUI-WBLESS

restart ComfyUI, or install via ComfyUI Manager ("ComfyUI-WBLESS").

Troubleshooting

The one thing to internalize: unselected branches do not execute, so don't put nodes with side effects (like a Save Image) on an unselected branch and expect them to run - that's the point. If a workflow from someone else uses Inversed Switch and "half the graph does nothing," that's correct behavior, not a broken workflow. The hook-based blocking is tied to ComfyUI's execution model, and the pack's changelog (V2.2.x) shows it had to chase ComfyUI updates - so if switches act up after a ComfyUI update, update the pack. For its intended job - one input, one live path out of many - it's a clean, fast router that keeps the rest of your graph from burning cycles it doesn't need.

Category🌈WBLESS

Inputs (2)

NameTypeDefaultDescription
Input*
PathINT11–64

Outputs (64)

NameTypeDescription
Output_1*
Output_2*
Output_3*
Output_4*
Output_5*
Output_6*
Output_7*
Output_8*
Output_9*
Output_10*
Output_11*
Output_12*
Output_13*
Output_14*
Output_15*
Output_16*
Output_17*
Output_18*
Output_19*
Output_20*
Output_21*
Output_22*
Output_23*
Output_24*
Output_25*
Output_26*
Output_27*
Output_28*
Output_29*
Output_30*
Output_31*
Output_32*
Output_33*
Output_34*
Output_35*
Output_36*
Output_37*
Output_38*
Output_39*
Output_40*
Output_41*
Output_42*
Output_43*
Output_44*
Output_45*
Output_46*
Output_47*
Output_48*
Output_49*
Output_50*
Output_51*
Output_52*
Output_53*
Output_54*
Output_55*
Output_56*
Output_57*
Output_58*
Output_59*
Output_60*
Output_61*
Output_62*
Output_63*
Output_64*