ComfyUI Node

Latent Switch

Which latent goes in? The Latent Switch is the lazy answer

By r-vage·Created about a year ago·Updated 5 months ago· 23
Latent Switch
  • input1
  • input2
  • latent
Input1

You've got two latent sources and one KSampler, and you keep rewiring the same cable every time you change your mind. That's the whole problem this node exists for. The Latent Switch takes two latent inputs, picks one based on an integer widget, and hands it to whatever's downstream - the sort of thing that sounds trivial until you've built a workflow with a hires pass, an img2img branch, and a fresh-texture branch all fighting over the same sampler input.

How it works

It's genuinely dumb, and that's a compliment. A widget called Input (an integer, default 1, range 1–2) decides which of input1 / input2 gets passed through to the single latent output. Set it to 1 and you get input1; set it to 2 and you get input2. That's the whole mechanism - no caching, no merging, no magic.

There's a second behavior worth knowing, and it's ComfyUI's doing rather than this node's: bypass the switch and ComfyUI passes input1 straight through. The author built the whole switch family around that trick - bypass the node and whatever is hooked into input 1 keeps flowing to the target. That's how people "disable" a branch in group-heavy workflows without muting anything. If you ever see a switch doing something you didn't expect, check whether it's bypassed first.

The inputs that matter

You'll really only touch two of them:

  • Input - the 1-or-2 selector. If you want to vary it per run, this one can be driven by an external value (like a control node or a bookmark), which is the whole appeal: change one widget, not a tangle of wires.
  • input1 / input2 - wire your two latent candidates in here. They're marked forceInput, so you can't type into them; they exist to receive cables.

The output (latent) plugs into the latent socket of a KSampler (or anything else that eats a LATENT). One switch, and your sampler input is now a single place to point at either branch. This is the RvTools switch family's origin story too - the author cheerfully admits the Image Switch came from the ComfyRoll set and was altered to spawn all the others in this pack, so if these feel familiar, that's why.

Installing it

No model files, no big downloads - this pack is pure Python glue, and the core of its dependency list (torch, numpy, Pillow) is already there because ComfyUI ships it. The extra deps in its requirements.txt - opencv-python, pilgram, pynvml, piexif - get pulled in automatically when you install through Manager.

ComfyUI ManagerInstall Custom Nodes → search RvTools → install ComfyUI-RvTools_v2, then restart. Or the old-fashioned way:

cd ComfyUI/custom_nodes
git clone https://github.com/r-vage/ComfyUI-RvTools_v2

Restart and you should see RvTools v2: Version 2.5.x in the console on startup.

One historical trap: the original RvTools repo (Rvage0815/ComfyUI-RvTools) was deleted, so old workflows referencing those node names fail with "cannot find this node" in Manager. This is v2 - every node was renamed to fix ComfyUI's node library. If you're resurrecting an old workflow that mentions RvTools, this is the pack it wants. Heads-up: the author has since moved on to ComfyUI_Eclipse, which supersedes this pack; RvTools_v2 still runs fine, but that's where new development went.

Troubleshooting

The one real gotcha: if a branch isn't connected and you switch to it, you get None out, and whatever's downstream will either error or silently do nothing. Switches only route what's actually plugged in. So before you blame the node, check that both inputs are wired - and if you're switching between different latent sizes, remember the empty-latent nodes feeding each side need their own width/height set, because the switch won't resize anything for you.

Category🫦 RvTools II/ Switches

Inputs (3)

NameTypeDefaultDescription
InputINT11–2
input1optLATENT
input2optLATENT

Outputs (1)

NameTypeDescription
latentLATENT