Viewport Redraw Callback Mechanism

You can register one or more functions to be called whenever the 3ds Max viewports are redrawn. The following methods let you register and unregister these callbacks:

registerRedrawViewsCallback <fn>

 

unRegisterRedrawViewsCallback <fn>

 

You can register as many functions as you like. Each one is individually called whenever the viewports are redrawn. The functions you register must take no arguments.

Example

fn redrawviews_p = print "Viewports Redrawn"

registerRedrawViewsCallback redrawviews_p

In the above example, the registered function causes the string "Viewports Redrawn" to be printed in the Listener window whenever the 3ds Max viewports are redrawn.

Special Considerations

For Example:

fn redrawviews_cb = print currentTime

fn rvcb = redrawviews_cb()

registerRedrawViewsCallback rvcb


In this case, the registered callback function, rvcb, calls the real call back, redrawviews_cb, (by referencing the global variable it is defined in), meaning you can redefine redrawviews_cb() as often as you need and the callback will always invoke the latest definition. This is a useful technique to employ while you are developing and debugging a callback.

 

See also

Change Handlers and Callbacks

Change Handlers and When Constructs

Time Change Callback Mechanism

General Event Callback Mechanism