ComfyUI Node

FL Switch Big

Route between five workflow branches by a string, evaluating only the one you pick

By filliptm·Created 3 years ago·Updated about 15 hours ago· 628
FL Switch Big
  • input_default
  • input_1
  • input_2
  • input_3
  • input_4
  • input_5
  • output
switch_condition
case_1
case_2
case_3
case_4
case_5

Sometimes one workflow needs to do five different things depending on a setting. Upscale with model A for portraits, model B for landscapes, skip upscaling entirely for tests - that kind of thing. You could build five separate workflows, or you could put a FL_Switch_Big in front and flip a single string to choose which branch runs.

The important word there is runs. This isn't a mux that quietly computes all five paths and throws four away. It's lazy-evaluated: it looks at your switch condition, finds the matching case, and only executes that one input. The other four branches never fire. So you can hang genuinely expensive graphs - a whole sampler chain, a big model load - off each input and pay only for the one you actually selected. That's the difference between this and a naive switch, and it's the reason to use it on heavy branches instead of a bunch of bypass toggles.

How it works

You give it a switch_condition string and up to five case_N strings. The node compares the condition against each case in turn. First match wins, and the corresponding input_N gets evaluated and passed to the output. No match on any of the five? It falls through to input_default. Because ComfyUI evaluates inputs lazily here, the branches you didn't select are never traversed - their upstream nodes don't run.

The inputs and outputs that matter

  • switch_condition (STRING) - the value you're routing on. Wire this to whatever decides the branch: a string constant, a selector, an upstream node's text output.
  • case_1case_5 (STRING) - the labels to match against. Set case_1 to "portrait", case_2 to "landscape", and so on.
  • input_1input_5 (any type, optional) - the branch payloads. input_1 is returned when the condition equals case_1. These are *-typed, so they carry anything: IMAGE, LATENT, MODEL, STRING, whatever.
  • input_default (any type, required) - the fallback when nothing matches. Because it's required, always wire something here.

Output is a single output of type * - same type as whichever input got selected. Wire it into the rest of your graph as if the branch had been connected directly.

Installing it

ComfyUI Manager → search ComfyUI_Fill-Nodes → install → restart. Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/filliptm/ComfyUI_Fill-Nodes

then restart. No dependencies specific to this node; it's plain routing logic. (Fill-Nodes as a whole is a large pack and installs a lot of libraries for its other nodes, so budget a minute on first launch.)

Common issues & troubleshooting

The match is exact string equality. "Portrait" does not equal "portrait", and a trailing space breaks it. If it keeps falling through to default, print your condition and your case strings and check they're byte-for-byte identical.

Wire input_N to the branch matching case_N. The pairing is positional - case_1 selects input_1. It's easy to line up the cases in one order and the inputs in another and get the wrong branch.

Always connect input_default. It's required, and it's your safety net for any condition you didn't anticipate. Leave it dangling and the node has nothing to return when nothing matches.

One branch still seems to run. Lazy evaluation only skips work that's exclusively upstream of an unselected input. If a node feeds both the selected branch and an unselected one, it still executes because the selected side needs it.

Category🏵️Fill Nodes/Utility

Inputs (12)

NameTypeDefaultDescription
switch_conditionSTRING
case_1STRING
case_2STRING
case_3STRING
case_4STRING
case_5STRING
input_default*
input_1opt*
input_2opt*
input_3opt*
input_4opt*
input_5opt*

Outputs (1)

NameTypeDescription
output*