Nodes/Comfyui-TOO-Pack/TOO Any Swap
ComfyUI Node

TOO Any Swap

Flip between two models, images, or prompts with one checkbox

By tetsuoo-onlineΒ·Created 9 months agoΒ·Updated about a month agoΒ· 5
TOO Any Swap
  • a
  • b
  • a
  • b
β—„swapfalseβ–Ί

TOO Any Swap is the untyped big brother of the pack's INT swap: two inputs, two outputs, one boolean that crosses them. Uncheck swap, it's a pass-through; check it, and whatever's on a comes out of the b socket and vice versa. The difference is that this one doesn't care what type of data you feed it.

That's what makes it useful. Because both inputs are the wildcard * type, you can swap a MODEL against another MODEL, an IMAGE against an IMAGE, a CONDITIONING against a CONDITIONING - anything. Wire two checkpoint loaders into it and a checkbox decides which model the sampler runs. Two CLIP text encoders, one swap. Two reference images, one swap. It's the cheapest A/B testing rig ComfyUI has: keep both variants in the graph, flip a single boolean, and never edit a widget again.

How it works. The wildcard trick is the whole mechanism. The node declares its sockets as the special * type - the one type in ComfyUI that accepts a connection from anything - so the type checker never complains no matter what you plug in. The runtime function is then trivial: return (b, a) if swap else (a, b). That's the same pattern the KB's plumbing essay calls the A/B switch: a manual routing valve with a selector, as opposed to the fallback switches (like rgthree's Any Switch) that just pass the first non-null input. This one is deliberately the manual kind.

Inputs and outputs. Required: a and b (both *), plus swap (BOOLEAN, default false). Outputs: a and b, both *, so whatever type flows in flows back out.

Install.

cd ComfyUI/custom_nodes
git clone https://github.com/tetsuoo-online/Comfyui-TOO-Pack

or via ComfyUI Manager ("Comfyui-TOO-Pack"), then restart. No dependencies.

Where people get burned. Because the sockets are *, ComfyUI won't stop you from wiring a model into a and an image into b - the node will happily swap them and dump garbage downstream. Type checking is your job here. And remember swap is a persistent state: check it once and it stays swapped until you uncheck it, so if a run "mysteriously" used the wrong model, that checkbox is the first place to look. It's a two-node pattern (int swap + this) that covers both typed and untyped routing, and for a few bucks of setup it saves a lot of re-wiring in a graph you iterate on.

CategoryπŸ”΅TOO-Pack/utils

Inputs (3)

NameTypeDefaultDescription
a*β€”
b*β€”
swapBOOLEANfalseβ€”

Outputs (2)

NameTypeDescription
a*β€”
b*β€”