Scripted Helper Plug-ins

Scripted Helper plug-ins can only extend existing Helper plug-ins.A scripted Helper plug-in is declared by specifying the <superclass> as helper . If a create tool is specified, it will override the delegate's create tool.

An example of a scripted Helper plug-in is shown in the Three Lights example in Scripted Plug-in Methods.

Event Handlers

on getDisplayMesh do ....

This event handler is available to scripted cameras and helpers in 3ds Max 7 and higher and lets the developer replace the viewport display mesh of the delegate with a custom display mesh.

This handler is optional.

Note: For performance reasons, it is critical to regenerate the returned mesh as little as possible. The handler is called often - for display, bounds testing, and hit testing.

The example below shows how to update the mesh in the handler only when the mesh has actually changed:

EXAMPLE

   plugin Helper HelperTest_DisplayMesh
   name:"HelperTest"
   classID:#(0x47db14fe, 0x4e9b5f90)
   category:"Standard"
   extends:dummy
   (
     local lastSize, meshObj
     parameters pblock rollout:params
     (
       size type:#float animatable:true ui:amount default:40.0
     )
     rollout params "HelperTest Parameters"
     (
       Spinner amount "Size:" range:[0, 1e9, 40]
     )
     on getDisplayMesh do
     (
       if (meshObj == undefined) do
       (
         meshObj = createInstance box length:size \
         width:size height:size mapCoords:false \
         lastSize = size
       )
       if size != lastSize do
       (
         meshObj.length = meshObj.width = meshObj.height = size \
         lastSize = size
       )
       meshObj.mesh
     )
     tool create
     (
       on mousePoint click do
       (
         nodeTM.translation = gridPoint;#stop
       )
     )
   )
on useWireColor do ....

This optional event handler lets the developer specify whether to use the node's wire color when drawing the object in the viewport, or use the UI color for the object type (Dummy Object for Helpers). If this handler returns true, the node's wire color is used, otherwise the UI color for the object type is used. If the event handler is not specified, the wire color is used. This handler is only applicable when a getDisplayMesh handler is supplied. Available in 3ds Max 8 and higher.