Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

These functions can only be called when the simulator is in the appropriate internal state. The moments of time when the content can be manipulated properly are signaled by calling several callback functions, and you can access the simulator's content only inside them. Every single Phoenix FD object has its own script code that is kept in the scene file. When the simulation starts, the script is compiled, and its callback function overrides the callback functions of any previous simulation. During the simulation, you can change the script by executing the Evaluate all command from the File menu of the script editor. If a shared script for all simulator instances is desired, you have to delete the individual scripts for each simulator and deliver the callback functions as an ordinary MAXScript file.

 

Callback functions

...

These functions are available when you enable Use Script in the Simulation rollout of a Phoenix Simulator.

At different moments of the simulation, Phoenix will call them and you can add your custom MAXScript code inside.

For example, it is possible to script starting another Simulator automatically once a simulation ends, or start of a sequence or single frame rendering.

The following function are available:

FunctionDescription
OnSimulationBeginCalled after the initialization of the simulator is done and before first execution.
OnSimulationStepCalled before each simulation step, after the interaction with the scene.
OnSimulationEndCalled after the end of the simulation.  The The simulation core would be already destroyed during this callback so it should not be accessed.
OnNewFrameCalled after each frame export.

...

Global functions

...

Each of the simulation channels (temperature, velocity, smoke etc.) exists in two instances - in the simulation core and in the simulation result. The functions in this section can access both the simulation core and result. If the first argument passed to the function specifies a Phoenix FD node, then the function accesses the simulation result. If there is no explicit Phoenix FD node specified, the function accesses the simulation core. In this case the target node is delivered internally. All the functions are exported as global functions beginning with "A_".

...