Nodes/ComfyUI-UtilsCollection/Soft Switch (Inverse)
ComfyUI Node

Soft Switch (Inverse)

The name is a red herring — it's just a soft switch

By silveroxides·Created 2 months ago·Updated about 7 hours ago· 24
Soft Switch (Inverse)
  • on_true
  • on_false
  • output
switch

Let's clear something up before you read any intent into the name: despite being called "inverse," UC_SoftSwitchInverseNode behaves exactly like ComfyUI's core Soft Switch. The "inverse" is just this pack's label for the node it re-registers. When switch is true you get on_true; when it's false you get on_false. No inversion happens. That's grounded in the source - this class subclasses ComfyUI's own SoftSwitchNode and inherits its execute logic. So treat the display name as decoration and the behavior as standard.

What a soft switch actually buys you

A switch node routes between two inputs based on a boolean. The "soft" part is the important part: both inputs are lazy, so the branch you don't select never gets evaluated. That means you can hang an expensive generation branch on one side - a second model load, a full upscaler, an entire sampling chain - and it won't run unless it's actually chosen. With a hard switch, upstream branches compute regardless, and ComfyUI's caching means "it's fine, it's cached" until it isn't. Soft is the version that saves you the VRAM and the seconds.

The second soft-switch benefit: the inputs are wildcard (COMFY_MATCHTYPE_V3), so it doesn't care what type you route. Model, conditioning, image, latent, string, prompt - anything goes. One node routes whatever you throw at it. The two inputs are even optional, so you can build a soft switch that only has one side wired up and let the other fall through to None - a neat way to gate a branch on a condition.

The inputs that matter

  • switch (BOOLEAN) - the selector. Any boolean source works: a fixed widget, another logic node, a comparison.
  • on_true / on_false (any type, optional) - the two candidates. Wire them in the order that matches your switch value; there's no swap magic hiding in the "inverse" name.

Output is a single output socket of the same wildcard type, ready to feed anything downstream that matches the branch you selected.

Where you'd actually use it

Classic A/B pattern: two model loaders (or two LoRA configs, or a fast checkpoint vs. a slow high-quality one) feeding one downstream graph, flipped by a single boolean. Or gate a detaileder / refiner on/off. The lazy evaluation is the real reason to prefer this over building the branch-switch with plain reroutes - only the chosen side of the graph lights up.

Install

Ships in ComfyUI-UtilsCollection:

cd ComfyUI/custom_nodes
git clone https://github.com/silveroxides/ComfyUI-UtilsCollection

Restart, or grab it through ComfyUI Manager by searching "UtilsCollection." Requirements (opencv-python, typing-extensions) install automatically.

Gotchas

The node is flagged experimental, so don't be alarmed if its API moves in a future pack update. And because this pack re-registers a bunch of logic IDs that other packs also claim (it explicitly replaces ComfyUI-LogicMath's equivalents), expect a "replace node?" prompt when loading older workflows - that's this pack's migration working, and accepting is usually fine.

Categorylogic

Inputs (3)

NameTypeDefaultDescription
switchBOOLEAN
on_trueoptCOMFY_MATCHTYPE_V3
on_falseoptCOMFY_MATCHTYPE_V3

Outputs (1)

NameTypeDescription
outputCOMFY_MATCHTYPE_V3