Docs Core

MainMenuRegistry

TD main-menu surface registry, including project-name display. The raw master, promoted to /sys.

◈ Core

Why use it

TouchDesigner's main-menu bar runs from File and Edit on the left, through the wiki, forum, tutorials and fps items, to the corner on the right. Several tools want a place on it: the FNS button that opens Hub, the project name that BorderlessTD shows once the title bar is hidden, and Autosave's on/off button. Each one copying its own widget in would mean each guessing a free position among TouchDesigner's items, colliding when two guess the same, and leaving a gap when one is removed.

MainMenuRegistry manages the bar as one surface. The order, visibility and left or right placement of every entry live here in one place, TouchDesigner's own built-in items included, so a tool's entry can sit exactly where you want it.

Features

  • Order, hide and place entriesHolds the order, visibility and left or right placement of every main-menu entry, TouchDesigner's own items and the ones tools publish alike.
  • Edit from the Hub MainMenu tabThe MainMenu tab of Hub reorders, hides or groups entries, so a tool's entry can sit between TouchDesigner's own items.
  • Restore TouchDesigner's orderThe TD button in that tab puts TouchDesigner's own items back in their original order, all visible.
  • Publish an entry from a toolA tool ships a small host copy of the registry beside its widget to get a main-menu entry, reachable globally as op.FNS_MAINMENUREGISTRY.for tool authors
  • Pin next to a stock itemAnchor After pins an entry directly after a named TouchDesigner item, such as tutorials, and heals if that item comes and goes.for tool authors
  • Lifecycle callbacksAn optional mainmenu_callbacks DAT hears when its entry is registered, unregistered, shown, hidden or moved to the other side.for tool authors

How to use it

The registry is part of the toolkit's core and installs with it. You arrange the bar from Hub:

  1. Left-click the FNS button at the right end of the main-menu bar and pick the MainMenu tab.
  2. Drag rows to reorder. TouchDesigner's own items are in the list too, so an entry can sit between two of them, the way BorderlessTD's project name follows the tutorials item.
  3. Flip an entry between the left and right of the bar, hide what you do not need, or group entries.
  4. To undo your changes to TouchDesigner's own items, use the tab's TD button. It puts them back in their original order, visible and outside any group, and leaves your other entries alone.

The layout is saved with your settings through ConfigRegistry and follows you to every project. A tool's Registry page carries the same settings for its own entry, such as Menu Bar Order, Menu Bar Side and Displayed (see What it adds to a registered tool).

For tool authors

A tool that wants a main-menu entry ships a small host copy of this registry alongside its widget, the way BorderlessTD's project name and the hub's own FNS button do. The quickest start is to drop the panel COMP on the FNS button and pick MainMenu; the COMP gets a self-registering host and appears at once.

On the host, Widget COMP is the panel to publish (the host's parent by default), Canonical Name its unique name, and Auto-register keeps it published. Placement:

  • Menu Bar Side set to left packs the entry after TouchDesigner's left cluster; right, the default, puts it before the corner on the right.
  • To sit next to something specific, put a stock item's name in Anchor After, for example tutorials. The entry is pinned into the gap directly after that item, whatever its side says. The name is looked up live on every sync, so if the item disappears the entry falls back to its side and returns when the item does.
  • The bar shows your panel through a Select COMP mirror at 19 pixels tall, the height of TouchDesigner's own items. The width follows the panel unless Bar Width is set.

The panel handles its own clicks; the mirror passes them through. The optional callbacks DAT is for reacting to the registry. Press Create Callbacks and the host puts a mainmenu_callbacks DAT into your tool and points Callback DAT at it; pressing it again adopts the existing DAT and never overwrites it. Every hook is optional, and one that raises is contained:

def onRegistered(canonical, info):
	# fires on every publish, including the ones at project open; keep it idempotent
	return

def onUnregistered(canonical):
	return

def onDisplayChanged(canonical, visible):
	# shown or hidden from Hub; collapsing a group does not call this
	return

def onSideChanged(canonical, side):
	# 'left' or 'right'
	return

The global lives in /sys as op.FNS_MAINMENUREGISTRY. From Python, guarded:

reg = getattr(op, 'FNS_MAINMENUREGISTRY', None)
if reg is not None:
	reg.RegisterWidget(op('mybutton'), 'MyButton', side='left', anchor='tutorials')

/sys is rebuilt on every open, so a script registration has to run again each time; a host does that for you. SetWidgetSide(), SetWidgetAnchor(), SetWidgetDisplay() and SetWidgetOrder() are the rest of the manager API.

Get it

Tick it on the install page and it installs with the rest of your setup and stays up to date.

Download FNS_MainMenuRegistry.tox Version 3.2.8, the tool on its own. It works in any project, and this copy never updates itself.

Parameters

Registration

ControlType / defaultWhat it does
Widget COMPComp operator.. Panel COMP published as the toolbar widget. Defaults to the parent component.
Canonical NameCanonicalname textempty Unique name for this widget in the global toolbar registry.
Callback DATCallback operatorempty Optional DAT with toolbar callbacks for this widget.
Create CallbacksCreatecallbacks button Spawn a 'mainmenu_callbacks' DAT into the tool (from the registry's template) and point the Callback parameter at it. Idempotent: an existing DAT is adopted, never overwritten. The hooks are optional lifecycle notifications: onRegistered, onUnregistered, onDisplayChanged, onSideChanged.
Auto-registerAutoregister on / offoff When on, keep this widget published into the global toolbar registry while this component exists.
RegisterRegister button Publish once into the global toolbar registry, even if Auto-register 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.
Menu Bar OrderMenuorder number-1 Preferred order among registered widgets, managed by the global registry. -1 = no preference (append at the end).
Menu Bar SideAlign menuRight Which side of the pane bar's path area this item docks to. Left sits after TD's own left-hand icons; right sits between the path area and TD's right-hand icons.
Options: Left, Right
Anchor AfterAnchor textempty Pin this entry into the gap directly AFTER a named stock menu-bar item (e.g. 'tutorials'), overriding the left/right side band. Resolved live each sync: a vanished anchor falls back to the side band and heals if the item returns. Empty = normal side placement.
DisplayedDisplayed on / offon Default visibility of the widget in the toolbar (managed by the global registry).
Bar WidthBarwidth number0 Width of this widget in the toolbar. 0 = auto (follow the widget). Persisted here; the registry writes manager edits back.
Help URLHelpurl textempty The tool's wiki/help page opened from the Configurator (right-click the Name cell). Leave empty to auto-discover from a docsHelper COMP (its Url par) inside the registered panel or its parent.
Promote ParametersPromotepars on / offon When on, the host mirrors its key Registration parameters onto the parent tool as a bound 'Registry' page. 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.

What it adds to a registered tool

Every tool that registers gets these on its own Registry page.

ControlType / defaultWhat it does
Create CallbacksCreatecallbacks button Spawn a 'mainmenu_callbacks' DAT into the tool (from the registry's template) and point the Callback parameter at it. Idempotent: an existing DAT is adopted, never overwritten. The hooks are optional lifecycle notifications: onRegistered, onUnregistered, onDisplayChanged, onSideChanged.
Auto-registerAutoregister on / offoff When on, keep this widget published into the global toolbar registry while this component exists.
RegisterRegister button Publish once into the global toolbar registry, even if Auto-register 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.
Menu Bar OrderMenuorder number-1 Preferred order among registered widgets, managed by the global registry. -1 = no preference (append at the end).
Menu Bar SideAlign menuRight Which side of the pane bar's path area this item docks to. Left sits after TD's own left-hand icons; right sits between the path area and TD's right-hand icons.
Options: Left, Right
Anchor AfterAnchor textempty Pin this entry into the gap directly AFTER a named stock menu-bar item (e.g. 'tutorials'), overriding the left/right side band. Resolved live each sync: a vanished anchor falls back to the side band and heals if the item returns. Empty = normal side placement.
DisplayedDisplayed on / offon Default visibility of the widget in the toolbar (managed by the global registry).
Bar WidthBarwidth number0 Width of this widget in the toolbar. 0 = auto (follow the widget). Persisted here; the registry writes manager edits back.