TektTDCommon is a collection of utilities that can be used when creating TouchDesigner C++ custom OPs.
It includes utilities for:
- CHOP channels
The library provides a set of classes to represent parameters, combining their definitions and properties with helpers for loading their values.
Each parameter tuplet (a single row in a parameter editor) is represented by an instance of one of the Parameter classes. The constructors for these classes take in the various properties (name, label, default value, range) that will be used when the OP's parameters are set up.
Settings and ParamGroup classes
Where the Parameter classes represent an individual parameter, the ParamGroup and Settings classes represent groups of related parameters.
A ParamGroup is a group of parameters, which contains one or more parameters. A Settings object is a collection of ParamGroups.
The channel classes are used for extracting values of various types from CHOP input channels.
The original pattern that the classes were designed for was a particle simulation, where there are a number of channels and each sample represents a single particle, which has a field for each channel. But they can be used for other kinds of CHOPs.
The ChannelMap class is used to map channel names to/from channel indexes. The CHOP infrastructure only allows you to access channels by their number. But a CHOP might need to efficiently look them up by name. The channel map also supports cases where there are arbitrary other channels, which could be used to mirror them from input to output alongside updated values in some of the output channels.
ChannelMap provides low-level methods (compared to InputChannel/OutputChannel) for reading and writing values to/from CHOP channels by name.
The OutputChannel<T> class represents one or more channels to which values can be written.
For simple types like int, float, and bool, the object would only have a single associated CHOP channel. But for compound types like Vector and Color, the object would have 3 or 4 CHOP channels (e.g. "__x", "__y", "__z" for Vector).
Each channel has one or more names, as well as a default value. The default value is used by the outputDefault(i) method, which can be used to represent something like an empty slot in a list of possible entities.
The InputChannel<T> class is equivalent to the OutputChannel<T> class, but for reading values from input channels.