If-Else Dispatcher (PixNodes)
Split one flow into two branches
- any_value
- true_branch
- false_branch
Conditional routing in ComfyUI is quietly the hardest "simple" thing to get right, and PixNodes built a two-node solution for it: a dispatcher that splits a value into two branches, and a logic gate that merges them back. This article is the first half. Pix_IfElseDispatcher takes any value and a boolean, then sends the value down one of two output wires - and, importantly, blocks the other branch entirely rather than letting it run with nothing.
Mechanically it's clean: any_value is a wildcard * input, if_true is a BOOLEAN (default true). When if_true is true you get any_value on the true_branch output and the false_branch is handed an ExecutionBlocker; flip it and the branches swap. That ExecutionBlocker is the whole trick - ComfyUI's execution engine understands it as "this node produced nothing, don't run anything downstream of this wire." So the unselected branch doesn't just receive a null, it's skipped, which means nodes on the dead branch don't try to sample, don't try to encode, don't error. That's the difference between this and a naive switch that passes None and then crashes everything downstream with a type error.
So the mental model is: dispatcher = the fork in the road, and the road you don't take is actually closed. The matching Pix_IfElseLogicGate is the merge point, and the two are designed as a pair - dispatcher at the top, gate at the bottom, both branches of your pipeline between them. Drive if_true from a comparison, an "any data is empty" check, a boolean that came out of an LLM node, whatever produces a BOOLEAN.
The one behavior to internalize before you build with it: the unselected branch is genuinely dead, and ComfyUI's caching means it may appear to have not run even when you expect it to. That's correct behavior, but it's confusing the first time you put a Preview Image on the false branch, flip the switch, and the preview just... doesn't update. It's not broken; that branch was never executed. Wire the gate's output to your preview instead and you'll see the selected path's result.
Install is the standard PixNodes path - ComfyUI Manager, search PixNodes, restart - or:
cd ComfyUI/custom_nodes
git clone https://github.com/pixixai/Comfyui-PixNodes
cd Comfyui-PixNodes
pip install -r requirements.txt
then restart. Deps are just openai and Requests. Nothing heavy, no models.
Use it with the Pix_IfElseLogicGate in the same pack (they're the front and back half of one idea) and with Pix_Compare/Pix_AnyDataIsEmpty upstream as the condition source. It's one of the few nodes in the suite that genuinely changes how much you can express in a graph - real branch-and-merge control flow, without touching a sampler.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| any_value | * | — | |
| if_true | BOOLEAN | true | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| true_branch | * | — |
| false_branch | * | — |