Nourivex Latent Route Toggle
The switch that decides whether your sampler dreams or edits
- latent_a
- latent_b
- LATENT
Every ComfyUI graph that does both text-to-image and image-to-image in one file ends up with the same awkward question: which latent feeds the sampler? T2I wants a fresh empty latent; I2I wants the VAE-encoded version of your reference image. You could rewire every time you switch modes, or you could drop in an A/B switch and let one boolean decide. That's this node, and it's the kind of thing that looks trivial until you've rebuilt a graph for the third time in a session.
How it works
Three inputs, one output, no logic worth explaining:
latent_a- the first latent path.latent_b- the second latent path.use_latent_b- the selector.false(the default) passeslatent_athrough;truepasseslatent_b.
The LATENT that comes out is whatever you pointed at, untouched. It's a pure routing valve in the comfyui-node-plumbing sense: a manual A/B switch, not a first-non-null fallback. If you wire only one side, the node errors - both inputs are required.
Where this one actually shows up
In the pack's Flux Klein workflow, this node is the "mode switch" at the heart of the graph. Latent A comes from Nourivex Prompt Forge XL (an empty latent at your chosen size - the T2I branch); latent B comes from VAEEncode on a loaded reference image (the I2I/edit branch). Flip use_latent_b and the same sampler, conditioning, and guidance run either mode:
- T2I mode:
use_latent_b = false - I2I/edit mode:
use_latent_b = true
That's a genuinely nice pattern - one workflow, one checkbox, and you've switched between dreaming an image from nothing and editing an existing one. The README notes this node replaced ImpactLatentSwitch in that workflow, which tells you both where the idea came from and that the pack wanted to stop depending on Impact Pack just for a switch.
The trap
Because both latents are just tensors to the sampler, you can wire them backwards and nothing complains until the results are mysteriously wrong. A common slip: putting the empty latent on latent_b and the reference latent on latent_a, then wondering why "I2I mode" generates from noise. Also remember the default is use_latent_b = false - if you reload a saved workflow that was last saved in T2I mode, it stays in T2I mode until you flip it. The quick manual switch is a feature, but it's a manual feature.
Install
Pack install, as ever:
cd ComfyUI/custom_nodes
git clone https://github.com/Nourivex/Nour_Comfy
Restart ComfyUI (or search Nour_Comfy in ComfyUI Manager). No dependencies, no downloads. If you only ever run one mode, you don't need this node - but if you bounce between T2I and I2I, it's the difference between a flip and a rewire.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| latent_a | LATENT | — | |
| latent_b | LATENT | — | |
| use_latent_b | BOOLEAN | false | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| LATENT | LATENT | — |