Nodes/ComfyUI_AceNodes/πŸ… Any Input Switch (bool)
ComfyUI Node

πŸ… Any Input Switch (bool)

Route any type β€” image, latent, text β€” on a boolean, no rewiring

By hay86Β·Created 2 years agoΒ·Updated about a year agoΒ· 96
πŸ… Any Input Switch (bool)
  • bool
  • any_if_true
  • any_if_false
  • *

ComfyUI's type system is strict and it will fight you over the weirdest things. The classic annoyance: you have two versions of something - two images, two latents, two prompts - and you want a single switch to pick which flows onward, but the built-in switch nodes only handle text or numbers. ACE_AnyInputSwitchBool is the escape hatch: all three inputs and the output are typed * (any), so it routes images, latents, masks, text, whatever, based on a boolean. It's the ComfyUI equivalent of an if/else in one node.

It's part of πŸ… Ace Nodes (hay86/ComfyUI_AceNodes), the usual one-author grab-bag - and this is one of the genuinely useful ones.

How it works

Three inputs, all any:

  • bool - the selector. Despite the node's name, this is typed * too, so any truthy value routes to the true branch. Wire in a real boolean output, an integer (0 vs non-zero), even a string (non-empty = true).
  • any_if_true / any_if_false - the two candidates. Only one gets touched per run; the other is passed over untouched.

Output: * - whatever you routed, with its original type intact. The type flexibility is the whole point: the node doesn't care what flows through it, so you can drag an image in and out without converting anything.

Where you'll reach for it

This is the node that makes the pack's own ACE_ImageFaceCrop usable - the face-detector there outputs a FACE_DETECTED boolean, and you use this switch to send the real crop through the detailer when a face was found and something else when it wasn't. It's also how you build "if the seed is odd, try the experimental sampler" workflows, or A/B a latent between two sampler branches without duplicating the graph.

One caveat to keep straight: it routes by truthiness, not by comparison. "Is value equal to X?" is not what this does - for that you need an expression node. And because both branches are typed any, ComfyUI won't type-check your wiring for you, so the classic bug is connecting the output to an input that expects a specific type and getting a runtime error instead of a clean red wire. Wire it deliberately.

Installing

ComfyUI Manager β†’ search ComfyUI_AceNodes, or:

cd ComfyUI/custom_nodes
git clone https://github.com/hay86/ComfyUI_AceNodes

Then restart. Installing pulls the pack's heavy requirements.txt (transformers, rembg, insightface, soundfile, …) even though this node is pure Python with zero dependencies. The usual grab-bag tax.

Verdict: every workflow-automation pack has an any-type switch, and they all work about the same. This one is as good as any and costs nothing extra if you're already in Ace Nodes - it's the reason several of the pack's other nodes (face crop, QA) become automatable.

CategoryAce Nodes

Inputs (3)

NameTypeDefaultDescription
bool*β€”
any_if_true*β€”
any_if_false*β€”

Outputs (1)

NameTypeDescription
**β€”