ComfyUI Node

If True

Make your workflow pick a model, LoRA, or prompt for you

By levox00·Created 2 months ago·Updated 2 months ago· 0
If True
  • if_true
  • fallback
  • result
trigger
expectedtext

If True is the heart of the Conditional Nodes pack: a string comparison that routes data. Give it a trigger string and an expected string; if they match, it passes whatever you put in if_true through to result. If they don't, it passes the fallback instead. That one idea turns a ComfyUI workflow from a fixed pipeline into something that switches models, prompts, or LoRAs based on a single value - the "graph as a small program" pattern this pack exists for.

How it works

The mechanism is plain string equality, and that matters more than it sounds. trigger == expected is case-sensitive and whitespace-sensitive - "sdxl" won't match "SDXL", and a stray trailing newline from a text field will quietly break your branch. The trigger input is marked forceInput in the source, meaning it expects to come from a wire (a Const String or another node), while expected is a normal widget you type into. The if_true and optional fallback inputs are wildcard (*) sockets, so they'll carry a MODEL, a CLIP, a conditioning, an int, anything - the node doesn't care what data type it's routing.

The inputs that matter

  • trigger (STRING, wired) - the value being tested.
  • expected (STRING, default "text") - what you're testing against.
  • if_true () - passed through on a match; fallback (, optional) - passed through otherwise.

Output is a single result socket of the same wildcard type.

The gotchas

The part to be careful with is what happens when a branch comes up empty. If the match wins but if_true is None or a blank string, or the match loses with no fallback connected, If True returns None - the downstream node still runs, but receives a None it may not know how to handle. A KSampler getting None where it wanted a MODEL will error out mid-graph. That's where the pack's Merge First node earns its keep: it treats None as "no value" and skips to the next live branch, so you can chain "try this, else try that" without the crash. (The 3- and 4-way siblings, If True 3 and If True 4, behave differently - they emit an ExecutionBlocker that stops downstream nodes from running at all - worth knowing before you swap one for another.)

Putting it together

The classic use is dynamic model selection. Feed a Const String holding a preset name ("cinematic", "anime", "photoreal") into trigger, wire one checkpoint's MODEL to if_true and another's to fallback, and the whole graph follows the string. Pair it with the pack's Load LoRA From String and an empty-string fallback, and you get "apply this LoRA when the preset says so, otherwise no LoRA" - the loaders were built for exactly this dance.

Installing it

Install: ComfyUI Manager → "Conditional Nodes by Mikudes", or:

cd ComfyUI/custom_nodes
git clone https://github.com/levox00/Conditional-Nodes-Comfy-Ui

Restart after. No pip dependencies, no models to download. The node lands in the conditional category.

One honest caveat: this pack is young and not much discussed yet, so you won't find a sea of community workflows using it - you're the early adopter, and the payoff is a workflow you can reconfigure without touching a single wire.

Categoryconditional

Inputs (4)

NameTypeDefaultDescription
triggerSTRING
expectedSTRINGtext
if_true*
fallbackopt*

Outputs (1)

NameTypeDescription
result*