Lazy Case Switch (auto) (obvpm)
Branches named after the nodes feeding them
- fallback
- on_case_1
- on_case_2
- on_case_3
- on_case_4
- on_case_5
- on_case_6
- on_case_7
- on_case_8
- on_case_9
- on_case_10
- on_case_11
- on_case_12
- on_case_13
- on_case_14
- on_case_15
- on_case_16
- value
Typing a case list is fine when the list is a real list - three checkpoints, four styles, a set of resolutions. It's tedious when the branches already have names because they're the nodes in front of you. This variant of the pack's case switch reads those names off the graph instead.
What it does
Plug a branch in, and the branch is called whatever the node feeding it is called. That's the source node's title - the one you see on the canvas - with its own spacing and capitals kept intact. So you title the two nodes at the end of your fork "Upscale" and "Refine", and those are the choices in the selected dropdown. That's the whole setup.
Two details from the mechanism worth knowing:
- It starts with a single empty input and grows another as each one fills, so there's always one spare pin to drop a wire onto. Unplug one in the middle and the gap closes rather than leaving a hole.
- Two branches from identically titled nodes get numbered -
Upscale,Upscale_2- so you're never stuck with a dropdown containing two identical entries and no way to tell them apart.
Underneath, it's the same class as the plain Lazy Case Switch: same fallback, same exact-name matching, same laziness. Only one branch is ever requested from the engine, so the other branches' loaders and samplers never run. The difference is where the name list comes from. There's still a cases widget on the node - the tooltip says it's filled in from the connected branches - because that's how the names travel from the browser to the server for selected to be matched against. You don't edit it.
When to use this one, and when not to
Use auto when the graph is the naming. Two upscalers, three refinement chains, a couple of alternate samplers you're comparing - you already know which node is which because you're looking at it. Renaming a node to rename a branch is a nice property: the label and the thing it labels can't disagree.
Use the plain Lazy Case Switch when the names must be stable. If selected is driven by a string from elsewhere - a filename, a bundle field, a documented setting - then the name has to mean the same thing after you rewire the graph. Here's the failure mode to be aware of with auto: selected is matched against the current title list. Rename the source node and the branch is renamed with it, which is exactly what you want while editing and exactly what you don't want if something outside the graph is naming the case. A saved selected value pointing at a name that no longer exists falls through to fallback - and if no fallback is connected, out comes None.
There's a second, subtler reason the plain version exists: it can be driven by a shared list. Wire a Dropdown's options into cases and three switches can follow one control. Auto names come from each switch's own wiring, so they can't be shared that way.
The caveats it shares with its siblings
Laziness prunes upstream only. If a save or preview node is still fed, it runs - output nodes are execution roots and ComfyUI works backwards from them, so nothing reaches one through a wire that can be dropped. And an unconnected selected branch outputs None rather than erroring, which is usually what you want and occasionally how you end up shipping a run that did nothing but didn't complain either. Wire a fallback and you'll never see it.
Install
Manager, search comfyui-obvpm, or:
cd ComfyUI/custom_nodes
git clone https://github.com/chanon/comfyui-obvpm
Restart ComfyUI. No extra Python dependencies - the pack declares none, because everything it imports already ships with ComfyUI - and no model downloads. All nodes carry an (obvpm) suffix, so searching the node menu for obvpm lists every one of them.
Inputs (19)
| Name | Type | Default | Description |
|---|---|---|---|
| selected | STRING | Which case to run. Shown as a dropdown of the case lines; convert it to an input to drive it from a Choice node or any string. | |
| cases | STRING | Filled in from the connected branches. | |
| fallbackopt | * | Output when no case line matches. Only executes while selected; may be left unconnected. | |
| on_case_1opt | * | Output when selected matches case line 1. Only executes while selected; may be left unconnected. | |
| on_case_2opt | * | Output when selected matches case line 2. Only executes while selected; may be left unconnected. | |
| on_case_3opt | * | Output when selected matches case line 3. Only executes while selected; may be left unconnected. | |
| on_case_4opt | * | Output when selected matches case line 4. Only executes while selected; may be left unconnected. | |
| on_case_5opt | * | Output when selected matches case line 5. Only executes while selected; may be left unconnected. | |
| on_case_6opt | * | Output when selected matches case line 6. Only executes while selected; may be left unconnected. | |
| on_case_7opt | * | Output when selected matches case line 7. Only executes while selected; may be left unconnected. | |
| on_case_8opt | * | Output when selected matches case line 8. Only executes while selected; may be left unconnected. | |
| on_case_9opt | * | Output when selected matches case line 9. Only executes while selected; may be left unconnected. | |
| on_case_10opt | * | Output when selected matches case line 10. Only executes while selected; may be left unconnected. | |
| on_case_11opt | * | Output when selected matches case line 11. Only executes while selected; may be left unconnected. | |
| on_case_12opt | * | Output when selected matches case line 12. Only executes while selected; may be left unconnected. | |
| on_case_13opt | * | Output when selected matches case line 13. Only executes while selected; may be left unconnected. | |
| on_case_14opt | * | Output when selected matches case line 14. Only executes while selected; may be left unconnected. | |
| on_case_15opt | * | Output when selected matches case line 15. Only executes while selected; may be left unconnected. | |
| on_case_16opt | * | Output when selected matches case line 16. Only executes while selected; may be left unconnected. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| value | * | The matching branch's value. None when that branch is unconnected and there is no fallback. |