Nodes/ComfyUI-Toggle-Pass/Ref Latent Input
ComfyUI Node

Ref Latent Input

Skip the re-encode — feed pre-made latents into the DynamicRef conditioning

By electricty00·Created 4 months ago·Updated 4 months ago· 0
Ref Latent Input
  • conditioning
  • latent1
  • latent2
  • latent3
  • latent4
  • latent5
  • latent6
  • latent7
  • latent8
  • latent9
  • latent10
  • conditioning
num_latents1

Every other node in the DynamicRef family takes images and VAE-encodes them for you. Ref Latent Input is the version that skips that step: you hand it latents that were already encoded elsewhere, plus a conditioning, and it packages them together as reference_latents on that conditioning. If you're chaining two edits in one graph - encode a reference once, use its latent in two different spots - this is the node that lets you reuse the latent instead of re-running the VAE.

How it works

Mechanically it's the smallest node in the pack. It takes a conditioning and up to ten latent1latent10 inputs, collects whichever latents are actually connected (up to the num_latents count), and attaches them to the conditioning via node_helpers.conditioning_set_values(..., {"reference_latents": [...]}, append=True) - exactly the same mechanism the image-encoding nodes use, just fed directly instead of produced internally. If no latents are connected it passes the conditioning through untouched.

The num_latents widget (1–10) controls how many latent slots show up; the frontend JS adds and removes them, and adding more is always safe while shrinking removes from the top.

Inputs and outputs that matter

Required: conditioning (the CONDITIONING you want to augment) and num_latents. Optional: latent1latent10. Output: a single conditioning with the reference latents folded in - wire it straight into your sampler's positive input.

A natural pairing: take the latent output from Ref Image Encode, run it through whatever processing you need, and feed the result back in here so a second conditioning gets the same reference without a second VAE pass. Or use it with latents coming from a VAE Encode you positioned earlier in the graph for other reasons.

Where it sits in the pack

It's one of the quiet utility nodes - no impressions on its comfy.icu page yet, and no real community discussion of it, because it's a plumbing node that most users will never touch directly. It exists to make the DynamicRef family compose: the pack's author clearly hit "I already have this latent, why encode the image again?" and built the answer. You'll reach for it on big graphs where you're reusing a reference in several conditionings; for a single encode, the image-input nodes do the same job with less fiddling.

Installing it

Comes with the whole Toggle-Pass pack:

cd ComfyUI/custom_nodes
git clone https://github.com/electricty00/ComfyUI-Toggle-Pass

then restart ComfyUI, or install via ComfyUI Manager by searching ComfyUI-Toggle-Pass. No requirements.txt and no pip dependencies - it only uses ComfyUI's own node_helpers, so it's one less thing that can break your environment. Small personal pack, minimal polish, but the mechanism here is just thin glue over standard ComfyUI conditioning - nothing exotic to trip on.

CategoryToggle-Pass

Inputs (12)

NameTypeDefaultDescription
conditioningCONDITIONING
num_latentsINT11–10
latent1optLATENT
latent2optLATENT
latent3optLATENT
latent4optLATENT
latent5optLATENT
latent6optLATENT
latent7optLATENT
latent8optLATENT
latent9optLATENT
latent10optLATENT

Outputs (1)

NameTypeDescription
conditioningCONDITIONING