Override Event Handlers
You can override the generated event handlers and create additional handlers for an MCG tool by defining them in the Custom UI property.
For example, when an MCG-based controller, modifier, or geometry operator is applied in 3ds Max, the create
event gets triggered which in turn calls the tool's initialize()
function. If you evaluate the graph and open the generated .ms file, this is the code you will see:
on create do
(
initialize()
)
If you want to extend this to add your own creation logic, you can enter the following in the Custom UI property:
-- Restore the default rollout
rollout params "Parameters"
(
<<ParamUIDefs>>
<<RolloutParamsHandlers>>
)
-- Define your custom functions before they are called
fn myCustomSetup
(
-- Add your code here
)
-- Override the create handler
on create do
(
-- Initialise the plug-in
initialize()
-- Call your custom MAXScript
myCustomSetup()
)
-- Define additional handlers
on postCreate do
(
-- Add your code here
)