Nodes/ꘇ Genereti/ꘇ dat.switch
ComfyUI Node

ꘇ dat.switch

A/B your parameters, and blend them while you're at it

By languel·Created about a month ago·Updated 3 days ago· 1
ꘇ dat.switch
  • sources
  • table
  • text
◄mode▾►
◄index0.00►

The switch that does arithmetic

Every node pack has a switch. ComfyUI's plumbing layer is full of them, and the KB's node map splits them into two shapes: the A/B valve with a selector, and the fallback switch that passes the first non-empty input. ꘇ dat.switch is the first kind - with a twist.

You connect up to 64 GENERETI_DAT tables, and a single index value picks one. Set mode to int and it behaves exactly like a normal switch: index 2 gives you source 2. Set mode to float and the index becomes a crossfade - index 1.5 gives you a table that's halfway between sources 1 and 2. That's the whole reason this node is interesting. It's a mutation-control surface: wire several curated parameter tables in, and sweep one float to interpolate between whole presets.

How the blend actually works

The blend function is conservative, and knowing its rules saves you from a table full of surprises. Between two tables it decodes each cell where it can and interpolates per type:

  • Numbers lerp. 0.5 to 0.8 at t=0.5 gives 0.65.
  • Dicts merge recursively, key by key, but only for keys present in both. Keys that exist in just one side take whichever table is nearer (below t=0.5 it's the first, above it's the second).
  • Equal-length lists interpolate element-wise.
  • Everything else snaps. Two strings - "warm" and "cool" - don't blend; you get one or the other. Same for any pair whose shape doesn't match, including lists of different lengths and mismatched key sets.

So a table of channel names plus numeric values blends its numbers and hard-switches its names. That's sane, and it's the behaviour you want for a preset sweep: the labels flip, the values slide.

There's a fast path when both sides came from dat.json (the internal representation carries the parsed JSON), which preserves types properly through the blend. Tables built by dat.table take the decode-the-cell-text path instead, which handles numbers fine but treats unparseable cells as strings to snap on.

Selection itself is forgiving in the way a performance node should be: a float index floors to the lower source for blending, indices are clamped into range, and the two-source blend at the top end clamps both sides to the last source rather than erroring. mode is a plain int/float combo, so it's a two-state toggle, not a numeric type conversion.

Inputs and outputs

  • sources - the autogrow input. Connect a table and it becomes source0, source1, and so on; the author caps it at 64.
  • mode - int or float. Int means pure switching, float means blending.
  • index - a FLOAT from 0 to 63 in hundredths. The author's tooltip: "Zero-based index of connected sources; int floors, float blends adjacent sources. Clamped to available sources."
  • Out come table (GENERETI_DAT) and text (the CSV).

Wire text into dat.inspect while you sweep and you can watch the interpolated values live. Wire table into dat.tochop and the swept table becomes named channels - which is how you'd drive, say, a sampler's cfg and steps from one crossfade sweep instead of editing two widgets by hand between runs.

Install

Genereti-only. ComfyUI Manager → search Genereti (publisher liuboto) → install → restart → hard-refresh the browser. Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/languel/genereti.git genereti
cd ../
./.venv/bin/python -m pip install -r custom_nodes/genereti/requirements.txt

ComfyUI's own Python, please - python_embeded\python.exe on Windows Portable. Requirements are one line (comfyui-frontend-package>=1.53.6): no models, no compiled dependencies. The autogrow input uses Comfy's newer V3 node API, which is why the pack needs ComfyUI 0.38.2+ and frontend 1.53.6+; on older builds the node may not register at all.

Gotchas

  • Blending only really works on numeric data. Curated preset tables of numbers blend beautifully. Tables of text snap, and you should expect that.
  • Shapes must match for lists. Two arrays of different lengths don't interpolate, they flip.
  • Index is not a percent. Float mode wants 1.5 to sit halfway between sources 1 and 2, not 0.5. Sweeping 0→(count-1) is the full travel.
  • Super alpha pack. The README is explicit: early classroom testing, back up workflows before updating. This node sits on the newer V3 API, which is exactly the part of Comfy that moves.
CategoryGenereti / DAT

Inputs (3)

NameTypeDefaultDescription
modeCOMBO2 options: int, float
indexFLOAT0.000–63Zero-based index of connected sources; int floors, float blends adjacent sources. Clamped to available sources.
sourcesoptCOMFY_AUTOGROW_V3—

Outputs (2)

NameTypeDescription
tableGENERETI_DAT—
textSTRING—