You can define PreInvokeMethod and PostInvokeMethod functions to run custom MAXScript before and after an MCG-based plug-in is called to update the scene.
To do this, you simply define functions with these names in the Custrom UI property of your graph. For example:
-- Restore the default rollout rollout params "Parameters" ( <<ParamUIDefs>> <<RolloutParamsHandlers>> ) fn PreInvokeMethod ( -- Add your code here ) fn PostInvokeMethod ( -- Add your code here )
The main evaluation handler for the various graph types is configured to call these functions if they exist.
Note that for animation controllers, the PostInvokeMethod function takes a single argument, and gets passed the output value of the graph when called.