Docs Network
OpTemplates
A library of preconfigured operator templates to drop into a network.
⇄ Network
OP Create menu entry
Toolbar button
Where it appears
Read off the registry hosts in the component, so this is where the tool puts itself in a default install; every one of these can be reordered or hidden from Hub.
OP Create menu entryposition 1
Toolbar buttonposition 17
OpTemplates
Start with this feature as this is probably the most "innovative" and exciting addition to TD.
This component lets you define default operator states (templates) which you may want to use instead of the factory ones, and is found under FNSTools/OpTemplates (or in the Toolbar)
Defining a Template
For single operators, just drag and drop the operator with the desired parameter settings onto the icon in the toolbar.
Saving your templates is done by middle-clicking on the icon.
Otherwise, in case of OP chains, or snippets:
- Right-click an operator in the
OP Create Dialogand clickEdit Templates....
Alternatively, you can manually create a Base COMP naming it the desiredOPTypeattribute. E.g. for creating one for Trigger CHOP you would name ittriggerCHOP - Place your template operators of the same
OPTypeinside this Base COMP. - You can also drag-and-drop a single operator to the
icon in the toolbar! - You can define multiple templates for the same operator type!
- The name of the operator will show up in a menu when choosing from multiple to put down, so name away!
- You can chain additional operators after the template operator!
- You can also define whole Snippets (see next chapter)!
- It is strongly suggested that you bypass / disable cooking of template definitions to avoid performance issues or errors.
Template Snippets
You can define OP snippets for an operator type which will behave the same way as other templates:
- Create a Base COMP inside the Base COMP named after the
OPTypedescribed above. - You can create any network inside this Base COMP that will be extracted when placing down a template, allowing you e.g. to place down a Render TOP and get a full render network with geo, camera, light (and whatever you want).
- Inside this Base COMP you can add another Base COMP, which is the way to substitute an operator with a COMP if your heart desires!
- In case of adding or inserting a template snippet between two OPs, you can help the script figure out the input and output node, by adding an In/Out OP to your snippet Base COMP. Otherwise it will have to guess and it might be wrong.
Templates Usage
Creating an operator anywhere in your network using the OP Create Dialog, you will see a >>> mark show next to the operator type that you defined templates for.
- Click the operator to start placing it.
- Hold
Ctrl+Alt(orCtrl+Cmdon Mac) when actually placing it in your network. - If there is only one template defined for the given OP type it will be replaced with the template automatically.
- If there are multiple defined, you will see a menu pop up to choose which one you want to use (the name of the OP/COMP, followed by
(OpTemplates)), and is then replaced.
Since 3.1: templates are op alternatives
Placing a template is now done by OpMenuRegistry, which watches for new operators, holds the shortcut and does the swap for every tool that declares an alternative for an operator type. OpTemplates publishes its library to it. What that means for you:
- The shortcut lives on the registry. It is the
Alternatives ShortcutonFNS_OpMenuRegistry's Alternatives page (Ctrl+Alt, orCtrl+Cmdon Mac). OpTemplates' ownKeysparameter now mirrors that value and is read-only. If you had changedKeysbefore upgrading, your shortcut was carried onto the registry the first time the new version started, so it keeps working. - Other tools can appear in the same menu. A tool that offers itself for
the operator type you are placing is listed beside your templates, and a tool
you downloaded to your store without installing is listed below a divider. A
>>mark beside a type (instead of>>>) means its only alternatives are in the store. - Both packages are needed. OpTemplates 3.1 places nothing under an older OpMenuRegistry, because the watcher moved out of OpTemplates. OpMenuRegistry is a core package, so a normal install or update has both.
- Your libraries are untouched. The external
.toxfiles in your Palette folder,Edit Templates...and the four commands all work as before. Where a library lives is now theLibrary Scopesetting, see Maintaining OpTemplates below.
You can simply place the templates, or insert them between connections, which also works with templates of OP chains and templates contained on Base COMPs.
In case of adding or inserting a template Snippet between two OPs, you can help the script figure out the input and output node, by adding an In/Out OP to your snippet Base COMP. Otherwise it will have to guess and it might be wrong.
If those are not present, or simply inserting an OP Chain, assumptions are made:
- The operator with the same type and no inputs is taken as the first input of the chain
- The operator at the end of the chain is taken as the last output of the chain.
- If there are multiple parallel "dead-end" operators it's more or less random what is chosen to be the output of the chain. This should not affect the majority of use-cases.
Maintaining OpTemplates
One library is active at a time, and Library Scope says where it lives:
- Global (the historical default): one
.toxin your User Palette folder (FNSTools/OpTemplates/), shared by every project on this machine. Saving writes that file. - Project: a component named
OpTemplatesLibraryat the network root, next to the FNSTools container. It saves with the project file and stays through toolkit updates, because it lives outside the tool. - Follow config scope (the default): global or project, whatever the toolkit's
Config Scopesetting says, so a project-scoped install keeps its templates in the project without a second decision.
A library that does not exist yet is created from the set that is loaded at that moment. The templates that ship with the tool are only that starting point. Switching scope never overwrites anything by itself: it loads what is there, or creates it. Switching from project to global when both a project library and a global file exist asks what to do with the project set: push it to the global file, adopt the global set as it is, or stay on project. Push To Global does the same push on demand, asking first when the file exists.
IMPORTANT: Under global scope, Save the templates by
Middle-Clickingon the toolbar icon, or clickingSave Templatesin the Custom Pars (which you can open byRight-Clickingon the toolbar icon). Under project scope, saving the project saves the templates.
The Templates parameter shows the library the scope resolved to and is read-only. The former Advanced mode, where you pointed the tool at any Base COMP in the project, is retired; a component it pointed at is adopted as the project library on the first start after upgrading.
Upgrading from an older FNSTools
Your templates come along on their own. On the first start, the toolkit renames the old FNStools_ext palette folder to FNSTools, and OpTemplates loads your library from FNSTools/OpTemplates/. Before it would ever create a library from the shipped templates, it looks for one you already have and uses the most recently saved:
- the
_2023copy that TouchDesigner 2023 saved to (OPTemplates1_2023.tox), - an
OPTemplates2.toxor higher, which the oldCreate Newchoice made, - a copy the folder migration set aside in
FNSTools/legacy_FNStools_ext/.
This check also runs once on a machine that already has a library, so a newer set saved under one of those names still wins. Whatever it replaces is kept beside it as OPTemplates1.before-adopt.tox, and the textport log names the file it adopted.
Two older setups are not found automatically, because they left no file:
- Templates you never saved. The old tool wrote the palette file only when you saved the templates (Middle-Click on the toolbar icon). Edits you only saved with the project live in that project's copy of OpTemplates.
- External turned off. With it off, the templates lived only in the project.
For either, open the old project, copy the templates Base COMP out of the old OpTemplates, and save it as OPTemplates1.tox in your palette's FNSTools/OpTemplates/ folder (Right-Click the COMP, Save Component .tox). Then restart the project.
Known issues
- Creating an OP by typing the operator type fully and hitting enter will not give the opportunity to place a template instead.
- Relative operator references in parameters can be broken due to naming conflicts.
- Template libraries saved by versions before 3.1 may carry
TEMPLATE_ROOT,TEMPLATE_INorTEMPLATE_OUTtags on their operators, left behind by earlier placements. They are harmless and are cleaned off as those templates get placed again.
Open Templates
Opens a floating window of the current Templates container of the OpTemplates component. Right-Click to open custom parameters, Middle-Click to save.
Parameters
Its Registry page comes from FNS_ConfigRegistry, FNS_OpMenuRegistry and FNS_ToolbarRegistry.
Custom
| Control | Type / default | What it does |
|---|---|---|
RootTarget |
operatorx | The component whose network is watched for newly created operators. '/' watches the whole project; narrow it if you want templates to apply in one branch only. |
Library ScopeLibraryscope |
menuFollow config scope | Where the active templates library lives. Global: one .tox in your user palette folder, shared by every project on this machine. Project: a component at the network root outside FNSTools, saved with this .toe and kept across toolkit updates. Follow: whatever the toolkit's Config Scope says. A missing library is created from the set that is loaded now; the shipped templates are only the seed. |
Library FolderLibraryfolder |
textempty | Folder under |
TemplatesTemplatesread-only |
operatorempty | The library the scope resolved to. Read-only: change Library Scope instead. |
Open TemplatesOpentemplates |
button | Open the templates component in a floating network, to add or edit templates by hand. |
Save TemplatesSavetemplates |
button | Write the templates to disk: to the external .tox when External is on, otherwise by saving the project. It confirms first, because it overwrites what is already there. |
Push To GlobalPushtoglobal |
button | Write the active library to the global palette file, so a set built in this project becomes the one every project on this machine loads. Asks before overwriting an existing file. |
Refresh TemplatesRefreshtemplates |
button | Reload the templates component from its external .tox, discarding unsaved edits made in this session. |
KeysKeysread-only |
textempty | Mirrors the Alternatives Shortcut on FNS_OpMenuRegistry, which is where the alternatives are offered from now. Change it there. |