Modular Design and Toxes
Keeping your networks clean, organized, and reusable.
Toxes and Version Control (Git)
A .tox is a saved TouchDesigner component (like a Base COMP or Container COMP) that encapsulates a piece of your network.
- Saving: Right-click a COMP → Save Component .tox…
- External Loading: On the COMP’s Common page, set the External .tox path.
- Save on Quit: Turn on
Save on Quitso the.toxfile updates automatically when you save your main project. - Git Best Practices: TouchDesigner
.toe(project) files are binary and terrible for Git version control. The standard practice is to build your project out of modularExternal .toxfiles. You commit the.toxfiles to Git, allowing multiple developers to work on different modules simultaneously without merge conflicts on the main.toefile.
Parameter Promotion (Custom Parameters)
To make your .tox modules reusable, you shouldn’t have to dive inside them to change settings.
- Right-click your COMP and select Customize Component…
- In the dialog, you can create custom sliders, toggles, and menus.
- Dive inside the COMP, and use a Parameter CHOP or Python expressions to map these custom parameters to the nodes inside.
Python Extensions
When your module needs complex logic or state management, loose script nodes become messy.
- Extensions are Python classes attached directly to a COMP.
- Right-click a COMP → Customize Component… → Go to the Extension Code section and type a name (e.g.,
MyModuleExt). Click “Add”. - This attaches a Python DAT containing a class. Any functions or variables defined in this class become natively accessible as properties of that COMP.
- Example: If your extension has a function
def Fire(self):, you can callop('myComp').Fire()from anywhere in the project.
Organization Best Practices
- Use Base COMPs to group related logic.
- Avoid “spaghetti” wiring across levels (don’t drag wires constantly in and out of COMPs). Use
SelectOPs,In/OutOPs, or Global OP Shortcuts to establish clear data highways between your modules.
(y) Return to Scripting & Architecture | (y) Return to TouchDesigner | (y) Return to Home