HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Creating a custom POP expression function
See Also
HDK_ExtendEXPR

In order to create a custom POP expression function that accesses the current particle system and can be called from within a POP parameter, one must be able to access the POP_ContextData currently being processed. This is possible via the static POP_ContextData::getExpressionData(int thread) method. This method will return a pointer to the POP_ContextData being processed by the last POP node to start cooking in the supplied thread. In the event that the supplied thread is not currently cooking any POP nodes, it will return 0. Note that this means your custom function can only access the particle system when evaluated during a POP cook.

The following code fragment illustrates how the implementation of such functions typically begins:

EV_START_FN(fn_examplefunc)
{
if (!data)
{
result->value.fval = 0;
return;
}
Note
thread and result are arguments declared by EV_START_FN.