Change Handlers and Callbacks

Change Handlers and Callbacks are used to detect when certain types of events occur to scene objects or within 3ds Max.

Change Handlers are applied to individual MAXWrapper objects and specify an attribute to monitor for that object and an expression to evaluate when that attribute changes. Example attributes that can be monitored are geometry, name, transform, and parameters. Change Handlers are not stored in a 3ds Max scene.

Callbacks are used to register with 3ds Max functions that are called when specific events occur within 3ds Max. Events that can be monitored are changes to the time slider time and redrawing of viewports. Callbacks are not stored in a 3ds Max scene.

MAXScript also provides several methods that automatically tie into 3ds Max’s Callback system. These methods are used to register and unregister 3ds Max scripts that are called for a variety of 3ds Max events. These scripts can optionally be saved with the currently-open file and stay permanently with it, running whenever the scene is loaded, until they are explicitly removed.

The above are described in more detail in the following topics:

Change Handlers and When Constructs

Time Change Callback Mechanism

Viewport Redraw Callback Mechanism

RenderEffect Progress Callback Mechanism

General Event Callback Mechanism

MAXScript also allows you to register a scripted menu that is invoked when the user performs a right-click in a 3ds Max viewport. See Scripted Right-Click Menus for more information.