Nodes/ComfyUI Impact Pack/ImpactConditionalBranchSelMode
ComfyUI Node Runs on cloud

ImpactConditionalBranchSelMode

Pick one of two values from a boolean

By ltdrdata·Created 3 years ago·Updated 4 months ago· 3,242
ImpactConditionalBranchSelMode
  • tt_value
  • ff_value
  • *
cond

The ternary operator for your node graph: cond ? tt_value : ff_value. You feed it a boolean and two candidate values, and it outputs the first when the boolean is true and the second when it's false. This is how you make an Impact Pack workflow choose - send an image down one processing path or another, pick between two prompts, switch a setting based on a detection result.

Both value inputs are the wildcard * type, so this branches over anything - images, latents, conditioning, numbers, SEGS. It's a core piece of the pack's experimental logic system, sitting alongside ImpactBoolean, ImpactCompare, and the loop nodes.

How it works

It reads cond and selects: true routes tt_value to the output, false routes ff_value. The output is the wildcard type, resolving to whatever you connected. The "SelMode" in the name is the important distinction from the plain ImpactConditionalBranch. Impact Pack ships two branch nodes because ComfyUI, by default, evaluates every input to a node before running it - which for a branch means both upstream paths compute even though you only use one, wasting the work on the branch you discard. The selection-mode variant is built on Impact's execution-model inversion (the "Switch based on Execution Model Inversion" the pack added in v7.0) so it can evaluate only the branch it actually takes. When each branch is an expensive subgraph - a whole sampling pass, say - that's the difference between doing the work once and doing it twice.

The inputs and output

  • cond (BOOLEAN, required) - the selector. True picks tt_value, false picks ff_value.
  • tt_value (*, optional) - the value returned when cond is true.
  • ff_value (*, optional) - the value returned when cond is false.

Output is a single * - the selected value, typed to whatever you wired in. It flows on like any normal value of that type.

How to install it

Part of Impact Pack. ComfyUI Manager: search ComfyUI Impact Pack, Install, restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/ltdrdata/ComfyUI-Impact-Pack

then pip install -r requirements.txt in ComfyUI's Python env (portable: python_embeded\python.exe -m pip ...), restart. Pack's by ltdrdata, the ComfyUI-Manager author - safe, mainstream. No models.

Common issues & troubleshooting

Where the boolean comes from is the usual sticking point - this node selects, it doesn't decide. Generate cond with ImpactCompare, ImpactIsNotEmptySEGS, ImpactIfNone, or a plain ImpactBoolean toggle. Feed both value inputs the same type; mixing an image on one branch and a latent on the other will confuse downstream nodes since the output is the wildcard any-type and won't warn you. If you specifically wanted the lazy behavior - only the taken branch running - make sure you're using this SelMode variant and not the plain ImpactConditionalBranch, which evaluates both. And as with all the logic nodes, ComfyUI's type checker can throw cosmetic warnings on the wildcard sockets even when the wiring is correct; that's the pack's known dynamic-type workaround, not an error you need to fix.

CategoryImpactPack/Logic

Inputs (3)

NameTypeDefaultDescription
condBOOLEAN
tt_valueopt*
ff_valueopt*

Outputs (1)

NameTypeDescription
**