Class NodeDisplayCallback

3DS Max Plug-In SDK

Class NodeDisplayCallback

See Also: Class InterfaceServer, Class INodeDisplayControl, Class INode, Class ViewExp, Class IPoint2.

class NodeDisplayCallback : public InterfaceServer

Description:

This class is available in release 4.0 and later only.

A callback to allow plug-ins that aren't actually objects (such as utilities) to control a Node's display.

This class enables you to display extra information on top of a node in a viewport. Once activated, a plug-in will control the display (on/off) of a node’s world space representation as well as add data in a viewport on a per node basis. This approach allows you to replace the drawing code of every node without adding modifiers on top of each of them.

Methods:

public:

Prototype:

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

Remarks:

This method is called just before 3ds max draws the nodes in the scene.

Parameters:

TimeValue t

The time at which the nodes are being drawn.

ViewExp *vpt

Points to an interface for the viewport the node is being drawn in.

int flags

These flags are used internally.

Prototype:

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

Remarks:

This method is called just after 3ds max draws the nodes in the scene.

Parameters:

TimeValue t

The time at which the nodes were drawn.

ViewExp *vpt

Points to an interface for the viewport the node is being drawn in.

int flags

These flags are used internally.

Prototype:

virtual bool Display(TimeValue t, ViewExp *vpt, int flags, INode *node)=0;

Remarks:

This method is called for every node to allow it display itself.

Parameters:

TimeValue t

The time at which the node is to be drawn.

ViewExp *vpt

Points to an interface for the viewport in which the node is being drawn in.

int flags

The display flags, which are;

USE_DAMAGE_RECT

If this flag is set, only the damaged area needs to be displayed. The damaged rectangle may be retrieved using INode::GetDamagedRect(). See Class INode.

DISP_SHOWSUBOBJECT

This indicates if an item should display its sub-object selection state. The system will set this flag is the item is selected, the user is in the modify branch, and the item is in sub-object selection mode.

INode *node

Points to the node being drawn.

Return Value:

TRUE if displayed, otherwise FALSE.

Prototype:

virtual bool SuspendObjectDisplay(TimeValue t, INode *node)=0;

Remarks:

This method is called to determine if the node mesh should be displayed. It should return true; otherwise return false.

Parameters:

TimeValue t

The time at which to check if the node should be displayed.

INode *node

The node to check.

Prototype:

virtual void AddNodeCallbackBox(TimeValue t, INode *node, ViewExp *vpt, Box3& box)=0;

Remarks:

This method will ask the callback to participate in the bounding box calculation.

Parameters:

TimeValue t

The time at which to calculate the bounding box.

INode *node

The node to calculate the bounding box for.

ViewExp *vpt

Points to an interface for the viewport in which the node is being drawn in.

Box3& box

A reference to the bounding box.

Prototype:

virtual bool HitTest(TimeValue t, INode *node, int type, int crossing, int flags, IPoint2 *p, ViewExp* vpt)=0;

Remarks:

This method hit tests the callback's mesh.

Parameters:

TimeValue t

The time at which to hit test.

INode *node

A pointer to the node to test.

int type

The type of hit testing to perform. See Hit Test Types for details.

int crossing

The state of the crossing setting. If TRUE crossing selection is on.

int flags

The hit test flags. See Hit Test Flags for details.

IPoint2 *p

The screen point to test.

ViewExp* vpt

An interface pointer that may be used to call methods associated with the viewports.

Return Value:

TRUE if the item was hit, otherwise FALSE.

Prototype:

virtual void Activate()=0;

Remarks:

This method is called when the callback gets activated. It is up to the callback to invalidate the screen.

Prototype:

virtual void Deactivate()=0;

Remarks:

This method is called when the callback is deactivated.

Prototype:

virtual TSTR GetName() const = 0;

Remarks:

This method returns the name of the callback which is used for display in the menu. The user must delete the string returned.