Initialize Start is an approach in TouchDesigner to prepare and run timed processes. It applies to any system in TouchDesigner where there first needs be an initialization, like files read, server queried or data prepared until the system is ready, putting it in a "ready" state, and then it is signalled to start. For example, before starting a show, you may want to initialize all your generative components at their first frame.
Initialization often takes more than one frame to complete, so there is usually provision to initialize over several frames without substantially stalling TouchDesigner.
Examples of parts of TouchDesigner where the Initialize Start approach is used are:
- Timer CHOP
- USD COMP, FBX COMP
- Bullet Solver COMP
- Nvidia Flow TOP, Nvidia Flex TOP
- Notch TOP
- Animation COMP
- Palette:moviePlayer COMP in Palette
- ( Palette:particlesGpu COMP in Palette WIP )
- Engine COMP (WIP)
There is a component in the palette called initalizeStart that you can use to convert any of your components to use the same mechanism.
Initialize Start follows the model of the Timer CHOP.
- Initialize (pulse) - prepares all data, in
- Start (pulse) - starts all the timers, puts in
- Play (toggle) - used to pause while playing
- Speed (float) - speed or slows the timer or simulation clock while running.
- Cue (toggle), Cue Pulse (pulse), Cue Point (float with menu % index, frames, seconds) - allows you to put/scrub system at specified time
- Length (float) - if behavior is fixed-length, length is sometimes pre-determined like a movie file, sometimes user-set.
- Pre-Roll (float) - if behavior is a procedural simulation, at initialization, it may run the sim a few seconds to get it going.
- Initialize Time (float) - for fixed-length systems, where implemented, this initializes part-way into its internal timeline.
- Go to Done (pulse) - stops all the timers, possibly goes to an end-state, puts in
initializing(0 if operator currently initializes in the same-frame)
ready(after Initialize complete and before Start pressed)
runninggoes on after Start, stays on until Done or Initialize
Counters - used to drive animations, index lookups, etc
timer_fraction(where applicable), zero for infinite sims and length not known
timer_seconds(seconds) which is affected by Speed. If the length is known and you loop, your
timer_secondsgoes back to 0. It’s really your calculated index / (end - start) / (file_sample_rate)
cumulative_seconds(seconds) counts from 0 when you Start, affected by speed and play
playing_seconds(seconds) - counts from 0 when you Start, affected by play but not speed
running_seconds(seconds) - keeps counting up after Start and not affected by speed or play
length_secondsfor operators with known length
Fixed-length vs infinite (unknown) length. An example of infinite length would be a particle simulation. There are two flavors of fixed-length - user-specified length or media-determined length (like an audio file).
In some cases, like the Timer CHOP, there are callbacks where you can run python code when events occur, such as the end of initialization, or the end of a fixed-length behavior. The common ones are:
onInitialize()called when the Initialize is pulsed, and is called every frame thereafter until you return 0, in order for multi-frame initializations to occur.
onReady()is called when initialization is complete
onStart()is called when Start is pressed.
onDone()is called when fixed-length systems complete, and when Go to Done is pulsed.
Errors and Warnings
In some cases, the operator reports errors or warnings, like failure to initialize.