Mpi If Else Inverted
One input, two conditional destinations
- input
- out_a
- out_b
Think of MpiIfElse as "two values, pick one to output." MpiIfElseInverted is the mirror image: one value in, and it goes to one of two outputs depending on a boolean. Same family, opposite shape - and the shape is exactly what you need when a single result has two possible homes, like a video that could either be saved directly or routed into an audio pass.
How it works
Two inputs: input (any type) and boolean (the gate). Two outputs: out_a and out_b. When the boolean is true, input comes out on out_b; when false, it comes out on out_a. The other output isn't just left empty - it's wrapped in ComfyUI's ExecutionBlocker, which tells the executor to skip anything downstream of that dead output. So the branch you don't take genuinely doesn't run, same lazy guarantee as its sibling.
That's the key mechanism, and it's worth internalising: an inverted switch isn't just about where the value goes, it's about which downstream chain gets to run at all. Put a sampler on out_a and a cheap preview on out_b, and flipping the boolean toggles an entire execution path off - not merely the wire it's attached to.
The inputs that matter
input- whatever you're routing. Because it's*, it can be a model, an image batch, a conditioning, a latent.boolean- the router. Wire it from a compare, a has-audio check, a has-options result, or just flip the widget.
Where people get burned
Two things to watch. First, both outputs must be connected (or explicitly unused) - the node doesn't merge or drop; it routes to exactly one, and ComfyUI treats the blocked output as a hard stop. If you expected the unselected side to receive a passthrough value, it doesn't - it receives a block, deliberately.
Second, the naming confuses people: out_a is the false branch and out_b is the true branch, and the widget's label_on/label_off spell it out. It reads backwards to a lot of people the first time. Check which output is which before you assume, or you'll spend an hour debugging a workflow that routes to the opposite side of where you thought.
Install
From the MadPonyInteractive/ComfyUi-MpiNodes pack. ComfyUI Manager → search ComfyUi-MpiNodes (publisher mad-pony-interactive), install, restart. Or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/MadPonyInteractive/ComfyUi-MpiNodes
then restart. Pure Python, no dependencies, no model files. The pack is AGPL-3.0 (≤ 1.2.6 MIT) and is the node library behind the author's Cubric Vision app.
The pattern worth stealing
Pair it with MpiHasAudio for the classic video-workflow split: a clip either has a soundtrack or it doesn't, and the two outcomes need different handling. MpiHasAudio → boolean, the video into input, one branch wires audio through, the other routes around it - and the dead branch is skipped instead of erroring on a missing audio stream. It's the same routing idea as a switch, but inverted: instead of choosing a source, you're choosing a destination.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| input | * | — | |
| boolean | BOOLEAN | true | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| out_a | * | — |
| out_b | * | — |