Class ViewportDisplayCallback

3DS Max Plug-In SDK

Class ViewportDisplayCallback

See Also: Class Interface, Class ViewExp, Data Types.

class ViewportDisplayCallback

Description:

This class is available in release 2.0 and later only.

This class is a callback object that enables plug-ins that aren't actually objects (such as utility plug-ins) to draw in the 3ds max viewports. See the methods in class Interface that register and unregister this callback object:

Inteface::RegisterViewportDisplayCallback(), and Interface::UnRegisterViewportDisplayCallback()

Also see the method Interface::NotifyViewportDisplayCallbackChanged().

Methods:

Prototype:

virtual void Display(TimeValue t, ViewExp *vpt, int flags)=0;

Remarks:

This method is called to allow the plug-in to draw in the viewports.

Parameters:

TimeValue t

The current time when this method is called.

ViewExp *vpt

An interface into the viewport.

int flags

These flags are used internally.

Prototype:

virtual void GetViewportRect(TimeValue t, ViewExp *vpt, Rect *rect)=0;

Remarks:

Retrieves the dimensions of the specified viewport given an ViewExp interface to it.

Parameters:

TimeValue t

The time to get the viewport rectangle.

ViewExp *vpt

Specifies which viewport

Rect *rect

The rectangle is returned here.

Prototype:

virtual BOOL Foreground()=0;

Remarks:

This method should return TRUE if the object changes a lot or FALSE if it doesn't change very much. This method relates to the foreground/background display system used by 3ds max. Basically, items that change a lot are placed in the foreground buffer. Items that don't change much are placed in the background buffer and simply biltted to the dispaly. See the Advanced Topics section on Foreground / Background Planes for more details. Most plug-ins can simply return TRUE because they are not likely to be very heavyweight objects (they are usually just a gizmo or apparatus image) and can simply go into the foreground. On the other hande, some items, for instance the 3ds max home grid, don't change and can always go into the background. The home grid only changes when the view direction is changed in which case everything is redrawn.