Class PickModeCallback

3DS Max Plug-In SDK

Class PickModeCallback

See Also: Class IObjParam, Class ViewExp, Class Interface, Class IPoint2.

class PickModeCallback : public InterfaceServer

Description:

This class is the callback object passed to Interface::SetPickMode().

Methods:

Prototype:

virtual BOOL HitTest(IObjParam *ip, HWND hWnd,ViewExp *vpt, IPoint2 m, int flags)=0;

Remarks:

Implemented by the Plug-In.

This method is called whenever the pick mode needs to hit test.

Parameters:

IObjParam *ip

An interface pointer available to call functions defined by 3ds max.

HWND hWnd

The window handle.

ViewExp *vpt

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

IPoint2 m

Point to check in screen coordinates.

int flags

The flags for hit testing. See List of Hit Test Flags.

Return Value:

Return TRUE if something was hit; otherwise FALSE.

Sample Code:

// This implementation use the Interface::PickNode method

// to perform the hit test.

{

 return ip->PickNode(hWnd,m,&thePickFilt)?TRUE:FALSE;

}

Prototype:

virtual BOOL Pick(IObjParam *ip,ViewExp *vpt)=0;

Remarks:

Implemented by the Plug-In.

This method is called when the user picks something.

Parameters:

IObjParam *ip

An interface pointer available to call functions defined by 3ds max.

ViewExp *vpt

An interface pointer that may be used to call methods associated with the viewports. The vpt should have the result of the hit test in it.

Return Value:

Return TRUE to end the pick mode; FALSE to stay in the pick mode. Note that returning TRUE will set the command mode to MOVE. When a plug-in is in the create branch, setting the command mode to move ends the creation process.

Prototype:

virtual BOOL PickAnimatable(Animatable* anim);

Remarks:

This method is available in release 4.0 and later only.

This method gets called when a node or controller is picked from Trackview or Schematic view The track will not be selected in trackview if the this function returns FALSE. Override this function if you wish to support and receive nodes or controllers picked from trackview.

Parameters:

Animatable* anim

A pointer to the animatable object.

Return Value:

TRUE if the Pick Mode callback accepts the animatable object, otherwise FALSE.

Default Implementation:

{ return TRUE; }

Prototype:

virtual BOOL RightClick(IObjParam *ip,ViewExp *vpt);

Remarks:

Implemented by the Plug-In.

This method is called when the user right-clicks or presses ESC.

Parameters:

IObjParam *ip

An interface pointer available to call functions defined by 3ds max.

ViewExp *vpt

An interface pointer that may be used to call methods associated with the viewports. The vpt should have the result of the hit test in it.

Return Value:

TRUE to end the pick mode, FALSE to continue picking.

Default Implementation:

{ return FALSE; }

Prototype:

virtual void EnterMode(IObjParam *ip)

Remarks:

Implemented by the Plug-In.

Called when the mode is entered. The developer may provide any pre-processing here.

Parameters:

IObjParam *ip

An interface pointer available to call functions defined by 3ds max.

Prototype:

virtual void ExitMode(IObjParam *ip)

Remarks:

Implemented by the Plug-In.

Called when the mode is exited. The developer may provide any post-processing here.

Parameters:

IObjParam *ip

An interface pointer available to call functions defined by 3ds max.

Prototype:

virtual HCURSOR GetDefCursor(IObjParam *ip)

Remarks:

Implemented by the Plug-In.

Called to get the default cursor to use.

Return Value:

The handle of the default cursor.

Default Implementation:

{return NULL;}

Prototype:

virtual HCURSOR GetHitCursor(IObjParam *ip)

Remarks:

Implemented by the Plug-In.

Called to get the hit test cursor to use.

Return Value:

The handle of the hit test cursor.

Default Implementation:

{return NULL;}

Prototype:

virtual PickNodeCallback *GetFilter()

Remarks:

Implemented by the Plug-In.

This method is called if the user hits the H key while in your pick mode. You can provide a filter to filter the name list. See Class PickNodeCallback.

Return Value:

A pointer to an instance of PickNodeCallback.

Default Implementation:

{return NULL;}

Prototype:

virtual BOOL AllowMultiSelect();

Remarks:

This method is available in release 2.0 and later only.

Implement this method to return TRUE to allow the user to pick more than one thing. In that case the Pick() method may be called more than once.

Return Value:

TRUE to allow multiple picks; otherwise FALSE.

Default Implementation:

{return FALSE;}