Script operator

The Script operator provides advanced control over particles, using C#.

tyFlow’s script operator is fast. Combined with its multithreading capabilities, it performs nearly as fast as native c++ code, and is suitable for very complex tasks.

An exhaustive API of all tyFlow-related C# functions and parameters can be found within each Script operator’s editor window. Users may also reference other C# libraries accessible from Max.NET, like the Math library, for common functions.


Script-Accessible Objects

Script-accessible objects are scene objects that you wish to access directly from within a script.

Scene objects that you wish to access directly from within a script must be registered with the script operator by adding them to the script-accessible object list. Once an object is added to the accessible object list, it can be accessed from within a script using its script-accessible name (displayed in square brackets within the object list). For example, a sphere object added to the list might be displayed as “[obj001] Sphere001”, which can then be accessed within the script by the name: obj001.

Script-Accessible Texmaps

Script-accessible texmaps are scene texmaps that you wish to access directly from within a script.

Scene texmaps that you wish to access directly from within a script must be registered with the script operator by adding them to the script-accessible texmap list. Once a texmap is added to the accessible texmap list, it can be accessed from within a script using its script-accessible name (displayed in square brackets within the texmap list). For example, a bitmap texture added to the list might be displayed as “[tex001] Map #1”, which can then be accessed within the script by the name: tex001.

Optimization

  • Cache custom data keys: enables a compile-time optimization which caches custom data channel strings (which are converted into hashmap keys) for faster custom data access.

By default, every time a custom data channel is accessed by its channel name, tyFlow must convert the string to a hash and then do a hashmap lookup to find the value of that channel for a particular particle. Doing such queries on huge numbers of particles can be very slow. Keeping this optimization enabled will greatly speed up all custom data access, as it manually moves hashmap lookups outside of all particle iteration loops, caching the resulting values for later use.

This should only be disabled for testing purposes.