Nodes/TrentNodes/This, That, or The Other
ComfyUI Node

This, That, or The Other

Three independent gates on one node

By TrentHunter82·Created 9 months ago·Updated 4 days ago· 36
This, That, or The Other
  • this
  • that
  • the_other
  • this_out
  • that_out
  • the_other_out

ComfyUI graphs get conditional whether you plan for it or not: sometimes an image branch produces something, sometimes it's empty, and you don't want the downstream nodes running on garbage. This, That, or The Other is a parallel gating node with three independent channels - each input passes to its matching output only if it's truthy (non-None, non-zero, non-empty), and falsy inputs block their downstream path entirely.

The mental model is three mini-switches stacked in one node instead of three separate gate nodes cluttering the canvas. It's the kind of flow-control node that the "plumbing layer" of ComfyUI is built from, alongside A/B switches, first-non-null fallbacks, and the * wildcard type.

How it works

Three inputs - this, that, the_other - are * (wildcard) typed, so each accepts any data type. Each maps to its own output: this_out, that_out, the_other_out. The gate rule per channel is simple truthiness: a connected, non-empty value flows through; an unconnected or empty one doesn't.

Two engine details make this node behave well rather than just existing:

  • ExecutionBlocker - a falsy input doesn't pass a None downstream, it blocks execution of the downstream branch. The graph doesn't run a dead branch and error out; it skips it, ComfyUI-style.
  • Lazy evaluation - the inputs use lazy evaluation (check_lazy_status), so upstream nodes connected to the channel only get evaluated when the node actually needs them. A branch you're not using isn't burned on compute for nothing.

So the practical shape is: three independent conditional branches, each live or dead based on whether its data arrived. And because the channels are independent, one branch can be dead while the other two run - which is exactly the behavior a fallback chain can't give you.

When to reach for it

  • You have three optional sources (say, an image from a picker, a mask from a segmenter, a latent from a branch) and downstream nodes that each should run only when their input exists.
  • You're building a graph where a channel is "conditionally present" and you'd rather not hand-wire bypasses and muters for each case.
  • You want lazy evaluation to keep an expensive branch from running when it isn't feeding anything real.

Its sibling FirstValid in the same pack is the complementary shape: that one picks the first truthy value as a fallback chain, while this one keeps all three channels separate in parallel. If you're choosing: parallel independence → This, That, or The Other; priority fallback → FirstValid.

Gotchas

Truthiness can surprise you. An image tensor is "truthy" even if it's a black frame; a string " " (whitespace) is truthy; 0 and 0.0 are falsy. If your "empty" case is actually a zeroed tensor or an all-black image, the gate will pass it - the node is checking presence/non-emptiness, not "does this image have content." Know your data, and the gate does what you expect.

Install

Part of TrentNodes (TrentHunter82/TrentNodes):

# ComfyUI Manager: search "Trent Nodes"

# or:
cd ComfyUI/custom_nodes
git clone https://github.com/TrentHunter82/TrentNodes.git
cd TrentNodes && pip install -r requirements.txt

No model downloads, no heavy deps - pure flow control. If you're already running Impact Pack or rgthree, you may have an equivalent, but if you're building inside this pack, it's the tidy native option.

CategoryTrent/Flow

Inputs (3)

NameTypeDefaultDescription
thisopt*First input - passes to this_out if truthy
thatopt*Second input - passes to that_out if truthy
the_otheropt*Third input - passes to the_other_out if truthy

Outputs (3)

NameTypeDescription
this_out*
that_out*
the_other_out*