Nodes/DD-LogicNodes/DD If Any Getter
ComfyUI Node

DD If Any Getter

\"did anything actually arrive?\" as a branch condition

By dumbdemon·Created 6 months ago·Updated 2 days ago· 0
DD If Any Getter
  • on_true
  • on_false
  • ANY
  • *

Most conditional nodes ask "is this boolean true?" DD If Any Getter asks a different question: "did a value actually arrive at all?" That distinction matters more than it sounds, because in ComfyUI a node can exist in your graph and still produce nothing - bypassed, optional, or upstream just didn't fire.

The node takes an optional ANY input plus on_true and on_false, and routes based on whether ANY has a value. Anything real shows up → you get on_true. Empty or unconnected → you get on_false. Think of it as a presence check dressed up as a switch.

Inputs and outputs

  • ANY - optional, wildcard type. This is the thing being checked. Leave it unwired and the node treats it as "nothing there."
  • on_true / on_false - MatchType inputs that adopt whatever type you plug in, and - the important part - they're lazy.
  • Output: a single * output matching the input type.

Why you'd reach for it

Optional branches are the eternal ComfyUI annoyance. A workflow with an optional upscaler: if that branch runs, you want the upscaled image; if it doesn't, you want the plain one. Wire the branch's output into ANY, the upscaled result into on_true, the plain result into on_false. The same shape covers an optional LoRA, an optional ControlNet, an optional anything - any place where "something came through or it didn't" is the real question.

The lazy part is what makes it worth wiring up. Because on_true and on_false are lazy and the node tells ComfyUI which side it needs before that side runs, the losing branch never executes. If ANY is empty and the node picks on_false, a whole KSampler chain hanging off on_true simply doesn't run. That's the difference between a workflow that works and a workflow that melts your GPU doing both branches.

The mechanism

Under the hood it checks ANY for actual content - the code tries ANY.any() and falls back to plain truthiness if the object doesn't support it - and passes on_true if there's something there, on_false otherwise. It's a thin wrapper around "is this populated," which is exactly why it's a getter rather than a gate: the inputs and output are values, not booleans.

A couple of honest notes

It's the sibling of DD Either, and they cover adjacent ground. DD Either prefers the optional input when it has a value; DD If Any Getter branches on whether the checked input has a value and hands you a chosen replacement either way. If you only need "pass the populated one through," DD Either is simpler. If you need distinct outputs for the two cases, this is the one.

Keep on_true and on_false the same type - the template enforces it. And remember the check is "has a value," not "is truthy in some clever way," so a node that produces an empty-but-present result still counts as present in most cases.

Installing

Standard DD-LogicNodes install: ComfyUI Manager → search DD-LogicNodes → Install → restart, or git clone https://github.com/dumbdemon/DD_LogicNodes into ComfyUI/custom_nodes. No dependencies, no models, and it needs a reasonably current ComfyUI build for the newer extension API it's built on.

CategoryDD Logic Nodes/Getters

Inputs (3)

NameTypeDefaultDescription
on_trueCOMFY_MATCHTYPE_V3
on_falseCOMFY_MATCHTYPE_V3
ANYopt*

Outputs (1)

NameTypeDescription
*COMFY_MATCHTYPE_V3