Docs Show & output
SwitchTools
A companion for any Switch, Cross or multi-input operator: index by slider, menu or bind, loop or clamp, colour the live input, cook only the inputs in use and unload the rest from the GPU, plus reorder, reverse, randomize and align the inputs.
▶ Show & output ◆ Patreon:Base
This tool unlocks with Patreon. It installs through the same picker as everything else and unlocks with the Patreon Base tier or higher, connected from inside TouchDesigner. Everything else in the toolkit stays free and MIT, and the membership is what keeps that work moving.
What it is
Drop SwitchTools next to a Switch TOP, Switch CHOP, Cross CHOP, Switch POP or any multi-input operator and point Switch Op at it (or dock it): the tool binds the operator's index to its own Index, so a slider, a menu, a CHOP or a bound parameter drives the switch, looping or clamping at the ends. Every input the switch is not showing stops cooking and, if you ask, unloads from the GPU, so a scene wall of heavy inputs costs only what is on screen. The live input is coloured in the network, and the inputs can be reordered, reversed, randomized or aligned in one click.
Callbacks
Create Callbacks makes a DAT beside the tool with onCookingChange (which inputs started and stopped cooking) and onSelectionChange (which inputs were selected and unselected); the Callbacks parameter points at it.
Parameters
Custom
| Control | Type / default | What it does |
|---|---|---|
Switch OPSwitchop |
operatorempty | The Switch, Cross or multi-input operator to drive. Dropping the tool next to it or docking it sets this too. |
BindBind |
on / offoff | Bind the switch operator's index (or Cross) to this tool's Index, so either one moves the other. |
| Control | ||
IndexIndex |
number0 | Which input is shown. With Blend on, values between inputs crossfade. |
BlendBlend |
on / offoff | Turn on the switch operator's blending between inputs, so fractional indexes crossfade. |
Loop TypeType |
menuOff | What happens when Index runs past the first or last input: off, clamp at the ends, loop round, or zigzag back. |
SelectSelect |
menuempty | Pick an input by name; sets Index. |
Current SelectCurrentselectread-only |
menuempty | Read-only: the input currently shown. |
Out IndexOutindexread-only |
number0 | Read-only: the index actually sent to the switch operator after Loop Type. |
Num InputsNuminputsread-only |
number0 | Read-only: how many inputs the switch operator has. |
| Cooker | ||
Control Cook (COMPs)Controlcook |
on / offoff | Let only the input COMPs in use cook; the rest stop cooking until selected. |
Unload GPUUnloadgpu |
on / offoff | When an input stops being used, release its COMP's CPU/GPU memory a few frames later (cancelled if it is selected again first), paced by Unload Method and Unload Budget. |
Unload MethodUnloadmethod |
menuProgressive (COMP.progressiveUnload) | How an unused input COMP's memory is released. Progressive uses COMP.progressiveUnload() paced by Unload Budget and covers every node type including POPs. Immediate calls unload() on each unlocked TOP in one frame (the previous behaviour). |
Unload Budget (ms/frame)Unloadbudget |
number2 | Milliseconds per frame spent releasing an unused input's memory (COMP.progressiveUnload). Spreads the unload over several frames so a heavy input never hitches the frame it stops being used. 0 unloads everything in a single frame. |
ColorizeColorize |
on / offoff | Colour input nodes by state: On Color for the one in use, Off Color for the rest. |
On ColorOncolor |
colour0 | Node colour of the input in use, with Colorize on. |
Off ColorOffcolor |
colour1 | Node colour of the inputs not in use, with Colorize on. |
ActiveActive |
on / offon | Turn the tool off without removing it: the switch operator is unbound and left as it is. |
Inputs
| Control | Type / default | What it does |
|---|---|---|
Reverse InputsReverseinputs |
button | Reverse the order the inputs are wired in. |
Randomize InputsRandomize |
button | Rewire the inputs in a random order. |
Order to NodeY (swap)Reorderswitchops |
button | Move the input nodes so their vertical position follows their input order. |
NodeY to Order (reconnect)Reorderswitchinputs |
button | Rewire the inputs so their order follows the nodes' vertical position. |
^(automatic)^Positiontoorder |
on / offoff | Rewire automatically whenever an input node is moved, so the order always follows the layout. |
Re-Digitize Inputs (rename)Redigitizeinputs |
button | Change the digits of the inputs to match the select index |
^1 based index^Onebasedindex |
on / offoff | Number inputs from 1 instead of 0 when renaming them. |
Align Inputs (retoggle)Aligninputs |
on / offoff | Re-toggle to re-align |
Alignment ModeAlignmentmode |
menuCenter | How Align Inputs lines the input nodes up: top, centre or bottom. |
Adjust Offset (X, Y, YGap)Adjust |
number0 | Offsets used when aligning inputs: horizontal offset, vertical offset and the gap between nodes. |
Save as OriginalSave |
button | Remember the current input wiring as the original. |
Restore OriginalRestore |
button | Rewire the inputs back to the saved original. |
Disconnect All InputsDisconnectall |
button | Disconnect every input of the switch operator. |
First == LastFirstlast |
on / offoff | The last input repeats the first, so a loop closes cleanly; it is left out of reordering. |
Callbacks
| Control | Type / default | What it does |
|---|---|---|
CallbacksCallbacks |
operatorempty | The DAT holding your callbacks: onCookingChange and onSelectionChange. |
Create CallbacksCreatecallbacks |
button | Create a callbacks DAT beside the tool and point Callbacks at it. |
About
| Control | Type / default | What it does |
|---|---|---|
Show Builtin PagesBuiltinpages |
on / offoff | Show the component's built-in parameter pages. |