Class Manipulator

3DS Max Plug-In SDK

Class Manipulator

See Also: Class HelperObject, Class SimpleManipulator, Class IManipulatorMgr, Class INode, Class ViewExp, Class IPoint2, Class Box3

class Manipulator : public HelperObject

Description:

This class is available in release 4.0 and later only.

This is the base class for the development of Manipulator plug-ins. Shown are the methods that need to be implemented by the plug-in. Most of these methods are implemented by the SimpleManipulator class so most developers will not need to use these unless SimpleManipulator is not sufficient.

Data Members:

protected:

INode* mpINode;

The node being manipulated

Methods:

public:

Prototype:

Manipulator(INode* pINode);

Remarks:

Constructor. The node data member is initialized to the node passed.

Prototype:

virtual int HitTest(TimeValue t, INode* pNode, int type, int crossing, int flags, IPoint2 *pScreenPoint, ViewExp *pVpt) = 0;

Remarks:

This method is called to determine if the specified screen point intersects the manipulator. The method returns nonzero if the item was hit; otherwise 0. This is like the normal HitTest() method in the BaseObject class. The difference is that it needs to log it hits in the viewport SubObjectHitList. It does this using the ManipHitData class defined in Manipulator.h.

Parameters:

TimeValue t

The time to perform the hit test.

INode* pNode

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 *pScreenPoint

Points to the screen point to test.

ViewExp *pVpt

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

Return Value:

Nonzero if the item was hit; otherwise 0.

Prototype:

virtual int Display(TimeValue t, INode* pNode, ViewExp *pVpt, int flags) = 0;

Remarks:

This method lines the BaseObject::Display() method and displays the manipulator object.

Parameters:

TimeValue t

The time to display the object.

INode* pNode

Points to the node that is being manipulated by the manipulator.

ViewExp *pVpt

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

int flags

See List of Display Flags.

Return Value:

The return value is not currently used.

Prototype:

virtual void GetLocalBoundBox(TimeValue t, INode* inode, ViewExp* vp, Box3& box) = 0;

Remarks:

Used Internally.

Returns the object space bounding box of the manipulator in the object's local coordinates.

Parameters:

TimeValue t

The time to retrieve the bounding box.

INode* inode

The node that is being manipulated by the manipulator.

ViewExp* vp

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

Box3& box

The bounding box is returned here.

Prototype:

virtual bool AlwaysActive();

Remarks:

This method can be used to tell the manipulator management system that this manipulator is always active.

Default Implementation:

{ return false; }

Prototype:

virtual TSTR& GetManipName() = 0;

Remarks:

This method returns the manipulator name string. The SimpleManipulator class uses this method for the tooltip in the viewport.

Prototype:

virtual DisplayState MouseEntersObject(TimeValue t, ViewExp* pVpt, IPoint2& m, ManipHitData* pHitData);

Remarks:

This method gets called when the mouse first passes over a manipulator object. The return value is used to determine whether a redraw is needed or not. Normally manipulators display in a different color when the mouse is over them, so this should return kFullRedrawNeeded.

Parameters:

TimeValue t

The time to display the object.

ViewExp* pVpt

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

IPoint2& m

The location of the tooltip.

ManipHitData* pHitData

A pointer to the hitdata containing information on which manipulator was hit.

Return Value:

The display state indicating whether no redraw, a full redraw, or a post redraw is needed.

Default Implementation:

{return kNoRedrawNeeded; }

Prototype:

virtual DisplayState MouseLeavesObject(TimeValue t, ViewExp* pVpt, IPoint2& m, ManipHitData* pHitData);

Remarks:

This method gets called when the mouse leaves the manipulator object. The return value is used to determine whether a redraw is needed or not. Normally manipulators display in a different color when the mouse is over them, so this should return kFullRedrawNeeded.

Parameters:

TimeValue t

The time to display the object.

ViewExp* pVpt

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

IPoint2& m

The location of the tooltip.

ManipHitData* pHitData

A pointer to the hitdata containing information on which manipulator was hit.

Return Value:

The display state indicating whether no redraw, a full redraw, or a post redraw is needed.

Default Implementation:

{return kNoRedrawNeeded; }

Prototype:

virtual void OnMouseMove(TimeValue t, ViewExp* pVpt, IPoint2& m, DWORD flags, ManipHitData* pHitData);

Remarks:

This method gets called when the mouse is pressed down and moves within the manipulator context. It is the method that does the actual manipulator. It is up to the manipulator code to turn the mouse position into a new value for the parameter(s) being manipulated.

Parameters:

TimeValue t

The time to display the object.

ViewExp* pVpt

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

IPoint2& m

The location of the tooltip.

DWORD flags

Not used, should be set to 0.

ManipHitData* pHitData

A pointer to the hitdata containing information on which manipulator was hit.

Default Implementation:

{ }

Prototype:

virtual void OnButtonDown(TimeValue t, ViewExp* pVpt, IPoint2& m, DWORD flags, ManipHitData* pHitData);

Remarks:

This method gets called when the mouse buttons is first pressed down within the manipulator context.

Parameters:

TimeValue t

The time to display the object.

ViewExp* pVpt

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

IPoint2& m

The location of the tooltip.

DWORD flags

Not used, should be set to 0.

ManipHitData* pHitData

A pointer to the hitdata containing information on which manipulator was hit.

Default Implementation:

{ }

Prototype:

virtual void OnButtonUp(TimeValue t, ViewExp* pVpt, IPoint2& m, DWORD flags, ManipHitData* pHitData);

Remarks:

This method gets called when the mouse buttons is released within the manipulator context, and thus signals the end of the manipulation.

Parameters:

TimeValue t

The time to display the object.

ViewExp* pVpt

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

IPoint2& m

The location of the tooltip.

DWORD flags

Not used, should be set to 0.

ManipHitData* pHitData

A pointer to the hitdata containing information on which manipulator was hit.

Default Implementation:

{ }

Prototype:

virtual INode* GetINode();

Remarks:

This method returns a pointer to the INode that is currently being manipulated.

Default Implementation:

{ return mpINode; }

Prototype:

virtual void DeleteThis();

Remarks:

This method deletes the manipulator instance.

Default Implementation:

{ delete this; }