Docs Core
PaletteRegistry
Contribute tabs to TouchDesigner's Palette Browser: a tool publishes a native panel COMP and it appears beside the stock Palette tab, sized to the slot and notified on every tab change.
◈ Core
Why use it
The Palette Browser is a natural home for a tool that wants a column of its own beside the network. TouchDesigner even leaves a 32 pixel strip free above the component list, exactly the height of a row of folder tabs. But it is one dialog, and any tool that injects its own tab row there claims the same strip and the same slot as every other tool doing it, so two of them end up stacked on top of each other.
PaletteRegistry owns that strip. It puts one row of tabs there:
TouchDesigner's own Palette first, then one tab per contribution, each
showing a panel from the tool that published it. The stock palette stays where
it is, as it is: the registry loads TouchDesigner's own folderTabs widget
into the free row and shows each contributed panel through a Select COMP
mirror. The stock panels only have their display flag switched off while a
contributed tab is in front.
With nothing contributed, the palette stays exactly as TouchDesigner ships it. The strip and its mirrors appear with the first registration and disappear with the last.
Features
- Tabs in the Palette BrowserAdds a tab strip above the Palette Browser's list, with TouchDesigner's own Palette tab first and one tab per contributed panel.
- Stock palette left intactWith nothing contributed the palette stays as TouchDesigner ships it; the strip appears with the first registration and goes with the last.
- Switch back to the Palette tabSearchPalette's
Ctrl+Shift+Fswitches to the stock Palette tab before focusing its search field; other tools can call ShowTab('palette') the same way. - Register a tab from a hostA tool ships a small host copy whose Registration page sets the tab's tool, canonical name, panel, label, order and visibility.
- Tab API from PythonRegisterTab(), Tabs(), SetTabDisplayed(), ShowTab(), CurrentTab() and UnregisterTab() on op.FNS_PALETTEREGISTRY manage tabs from code.
- Tab change callbackAn optional Callbacks DAT gets onPaletteTab(canonical, previous) on every tab change.
- Panels fitted to the slotA registered panel is resized to the slot, restored when the tab goes away, and keeps its state across tab switches, Web Render included.
- Extra tabs from one toolThe Extra Tabs sequence adds one tab per block, and a block without its own panel reuses the first tab's panel.
How to use it
The registry is part of the toolkit's core and installs with it. Once a tool contributes a tab, the strip appears above the palette list:
- Click a tab to show that tool's panel, and Palette to get the stock list back.
- SearchPalette's
Ctrl+Shift+Fswitches to the Palette tab before it focuses the palette's search field, because that field lives in the stock list a contributed tab hides. - To hide a tab, switch off Shown in Palette on the contributing tool's Registry page. The registry writes its own changes back there too, so a hidden tab stays hidden with the tool. Tab Order and Tab Label on the same page move and rename it.
TouchDesigner's UI is never saved with a project, so the strip is rebuilt on every open from whatever is registered.
For tool authors
A tool that wants a palette tab ships a small host copy of this registry, the same shape as a toolbar or navbar entry. Drop the panel COMP on the FNS button and pick Palette tab, or copy a host out of a shipped tool.
The host's Registration page names the tab. It belongs to the Tool COMP
(the host's parent by default) and shows the Tab Panel (the tool itself
by default). Its unique name is Canonical Name, or the tool's name when
that is empty; palette is TouchDesigner's own tab and is rejected. To react
to tab changes, point Callbacks DAT at a DAT with
onPaletteTab(canonical, previous). Expose in Palette publishes the tab
while the tool exists, and Shown in Palette, Tab Label and Tab
Order are the usual publishing controls.
From Python, guarded, since no registry is guaranteed to exist:
reg = getattr(op, 'FNS_PALETTEREGISTRY', None)
if reg is not None:
reg.RegisterTab(comp, 'mytool', panel=panel, label='My Tool', order=20)
Tabs(), SetTabDisplayed(), ShowTab(), CurrentTab() and
UnregisterTab() are the rest of the API. Any tool whose UI is hidden by a
contributed tab can call ShowTab('palette') the way SearchPalette does.
The callback fires on every tab change for every registered tab, so check the name before you act. It is raise-contained:
def onPaletteTab(canonical, previous):
# canonical: the tab now in front ('palette' is TouchDesigner's own)
# previous: the tab that was in front before
if canonical == 'mytool':
...
Your panel is resized while it is registered. A Select COMP cannot push its size into its source, so the registry rewrites the panel's width and height to slot expressions and restores the originals when the tab goes away. Leave those two parameters alone while it is registered.
The panel keeps its state across tab switches, a Web Render's browser process included, because the mirrors are views of the same panel.
Several tabs from one tool
The Registration parameters define the first tab; the Extra Tabs sequence on the same page adds one more per block:
- A block's Canonical Name left empty means no tab, which is how a block stays inert (TouchDesigner always keeps at least one block in a sequence).
- A block's Tab Panel left empty reuses the first tab's panel. That is how
one panel serves several tabs: register them all, then route on
onPaletteTab. - A block's Tab Label, Tab Order and Shown in Palette work as above.
A block with a bad or duplicate name is reported in Registration Status and skipped; it never costs the tool its first tab.
Get it
Tick it on the install page and it installs with the rest of your setup and stays up to date.
Download FNS_PaletteRegistry.tox Version 3.2.7, the tool on its own. It works in any project, and this copy never updates itself.
Parameters
Registration
| Control | Type / default | What it does |
|---|---|---|
Tool COMPComp |
operator.. | The tool that contributes this tab. Defaults to the parent component (the host lives inside the tool it publishes). |
Canonical NameCanonicalname |
textempty | Unique name of the tab (letters, digits, _ -). Leave empty to use the tool COMP name. "palette" is TD's own tab and cannot be taken. |
Tab PanelPanel |
operatorempty | The panel COMP shown when this tab is selected. Shown in place through a Select COMP, never copied, and sized to the tab slot by the registry (its w/h become slot expressions while registered). Defaults to the tool itself. |
Callbacks DATCallback |
operatorempty | Optional Python DAT. onPaletteTab(canonical, previous) fires on every tab change so the tool can react (e.g. route a shared panel). Raise-contained. |
Expose in PaletteAutoregister |
on / offon | Publish this tab into TouchDesigner's Palette Browser while the component exists. Off = the tool contributes nothing. |
RegisterRegister |
button | Publish once into the Palette Browser, even if Expose is off. |
UnregisterUnregister |
button | Take this tool's contribution back out of the registry and turn Autoregister off, so it stays out. Register puts it back. |
Registration StatusRegstatusread-only |
textempty | Read-only status of this host registration. |
Shown in PaletteDisplayed |
on / offon | Show this tab on the Palette Browser's tab strip. Off keeps it registered but hidden; the registry writes its choice back here so it persists with the tool. |
Tab LabelTablabel |
textempty | What the tab strip shows. Empty = the canonical name. |
Tab OrderTaborder |
number50 | Position on the strip after TD's own Palette tab (always first). Contributions default to 50 and sort by this, then by label. |
Help URLHelpurl |
textempty | The tool's wiki/help page. Informational; leave empty to skip. |
Promote ParametersPromotepars |
on / offon | When on, the host mirrors its key Registration parameters onto the parent tool as a bound Registry page (Pl* pars). Turn off before shipping a tool that should not expose registry controls. |
Pre-Save HealPresaveheal |
on / offon | Before each project save, re-check this registry: update entries whose component moved, drop entries whose component is gone, and republish a host that initialised before the global registry existed. Off skips the sweep for this registry only. |
Extra TabsTab |
sequence0 | Additional tabs published by this one host. The Registration pars above define the FIRST tab; each block here adds one more, so a tool can put several tabs on the strip (optionally over the same panel) without stamping a second host. |
Canonical NameTab0name |
textempty | Unique name of this extra tab (letters, digits, _ -). Required; the block is skipped while it is empty. "palette" is TD's own tab and cannot be taken. |
Tab PanelTab0source |
operatorempty | Panel COMP shown for this tab. Leave empty to reuse the Tab Panel above. That is how one panel serves several tabs, routed by onPaletteTab. |
Tab LabelTab0label |
textempty | What the tab strip shows for this tab. Empty = the canonical name. |
Tab OrderTab0order |
number50 | Position on the strip after TD's own Palette tab. Contributions sort by this, then by label. |
Shown in PaletteTab0shown |
on / offon | Show this tab on the strip. Off keeps it registered but hidden. |