Public Member Functions

CommandMode Class Reference

This reference page is linked to from the following overview topics: Foreground / Background Planes, Command Modes and Mouse Procedures, Sub-Object Selection, Implementing Sub-Object Selection, Ring Array Classes.


Search for all occurrences

Detailed Description

This base class allows the developer to create a command mode that handles processing user interaction using the mouse in the viewports.

See the page on "Command Modes and Mouse Procs" and "Foreground / Background Planes". There are methods in 3ds Max's Interface class to set and get the current command mode.

See also:
Class MouseCallBack, Class ChangeForegroundCallback, page "

#include <cmdmode.h>

Inheritance diagram for CommandMode:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual  ~CommandMode ()
  Destructor.
virtual int  Class ()=0
  Returns the Class of the command mode.
virtual int  SuperClass ()
  This method can be ignored.
virtual int  ID ()=0
  Returns the ID of the command mode.
virtual MouseCallBack MouseProc (int *numPoints)=0
  This method establishes the number of points required by the command mode and returns a pointer to the mouse callback object that is used to process the user input.
virtual ChangeForegroundCallback ChangeFGProc ()=0
  Returns a pointer to a callback procedure that flags nodes that belong in the foreground plane.
virtual BOOL  ChangeFG (CommandMode *oldMode)=0
  This method returns TRUE if the command mode needs to change the foreground proc (using ChangeFGProc()) and FALSE if it does not.
virtual void  EnterMode ()=0
  This method is called when a command mode becomes active.
virtual void  ExitMode ()=0
  This method is called when the active command mode is replaced by a different mode.

Constructor & Destructor Documentation

virtual ~CommandMode ( ) [inline, virtual]

Destructor.

{} 

Member Function Documentation

virtual int Class ( ) [pure virtual]
virtual int SuperClass ( ) [inline, virtual]

This method can be ignored.

The default implementation should be used.

{ return 0; }
virtual int ID ( ) [pure virtual]

Returns the ID of the command mode.

This value should be the constant CID_USER plus some random value chosen by the developer. As an example, this method could be implemented as: { CID_USER+0x1423; } In the special case of the developer implementing a custom command mode to be used as part of sub-object manipulation (Move, Rotate or Scale) the value for ID() should be one of the following values:

  • CID_SUBOBJMOVE
  • CID_SUBOBJROTATE
  • CID_SUBOBJSCALE
  • CID_SUBOBJUSCALE
  • CID_SUBOBJSQUASH Note: It is not a problem if two command modes conflict in this ID value, so the uniqueness is not strictly required. However, this ID() method is often used to check which mode is active. Therefore, unless the value for your command mode is identifiable via this ID, you may not be able to recognize if your mode is indeed the active one.

Implemented in EditSSMode, MoveModBoxCMode, RotateModBoxCMode, UScaleModBoxCMode, NUScaleModBoxCMode, SquashModBoxCMode, SelectModBoxCMode, MoveCtrlApparatusCMode, RotateCtrlApparatusCMode, UScaleCtrlApparatusCMode, NUScaleCtrlApparatusCMode, SquashCtrlApparatusCMode, SelectCtrlApparatusCMode, EP_BindCMode, EP_ExtrudeCMode, EP_NormalFlipCMode, EP_BevelCMode, EP_CreateVertCMode, EP_CreatePatchCMode, EP_VertWeldCMode, EP_CopyTangentCMode, EP_PasteTangentCMode, SSOutlineCMode, SSFilletCMode, SSChamferCMode, SSSegBreakCMode, SSSegRefineCMode, SSCrossInsertCMode, SSVertConnectCMode, SSVertInsertCMode, SSCreateLineCMode, SSCrossSectionCMode, SSBooleanCMode, SSTrimCMode, SSExtendCMode, SSBindCMode, SSRefineConnectCMode, SSCopyTangentCMode, SSPasteTangentCMode, and MouseToolCommandMode.

virtual MouseCallBack* MouseProc ( int *  numPoints ) [pure virtual]

This method establishes the number of points required by the command mode and returns a pointer to the mouse callback object that is used to process the user input.

Parameters:
numPoints This is where to store the number of points used by the CommandMode. If the plug-in needs to use an undetermined number of points it can specify a large number for this value. When the mouse proc has finished processing points it returns FALSE to stop the point processing before the number of points specified here have been entered.
Returns:
A pointer to the mouse callback object that is used to process the user input.
See also:
Class MouseCallBack.

Implemented in EditSSMode, MoveModBoxCMode, RotateModBoxCMode, UScaleModBoxCMode, NUScaleModBoxCMode, SquashModBoxCMode, SelectModBoxCMode, MoveCtrlApparatusCMode, RotateCtrlApparatusCMode, UScaleCtrlApparatusCMode, NUScaleCtrlApparatusCMode, SquashCtrlApparatusCMode, SelectCtrlApparatusCMode, EP_BindCMode, EP_ExtrudeCMode, EP_NormalFlipCMode, EP_BevelCMode, EP_CreateVertCMode, EP_CreatePatchCMode, EP_VertWeldCMode, EP_CopyTangentCMode, EP_PasteTangentCMode, SSOutlineCMode, SSFilletCMode, SSChamferCMode, SSSegBreakCMode, SSSegRefineCMode, SSCrossInsertCMode, SSVertConnectCMode, SSVertInsertCMode, SSCreateLineCMode, SSCrossSectionCMode, SSBooleanCMode, SSTrimCMode, SSExtendCMode, SSBindCMode, SSRefineConnectCMode, SSCopyTangentCMode, SSPasteTangentCMode, and MouseToolCommandMode.

virtual ChangeForegroundCallback* ChangeFGProc ( ) [pure virtual]

Returns a pointer to a callback procedure that flags nodes that belong in the foreground plane.

Plug-ins typically use a standard callback object provided by the system that flags all nodes dependent on the plug-in object. This ensures that when the plug-in object changes, any nodes that change as a result will be in the foreground plane, making redraw time faster. These constants may be specified to use one of the standard callback objects instead of an actual FG proc. For example {return CHANGE_FG_SELECTED;} CHANGE_FG_SELECTED Selected nodes are flagged. CHANGE_FG_ANIMATED Nodes that are animated are flagged.

Returns:
A pointer to a callback procedure that flags nodes that belong in the foreground plane.
See also:
For additional information see the Advanced Topics section "Foreground / Background Planes".

Implemented in EditSSMode, MoveModBoxCMode, RotateModBoxCMode, UScaleModBoxCMode, NUScaleModBoxCMode, SquashModBoxCMode, SelectModBoxCMode, MoveCtrlApparatusCMode, RotateCtrlApparatusCMode, UScaleCtrlApparatusCMode, NUScaleCtrlApparatusCMode, SquashCtrlApparatusCMode, SelectCtrlApparatusCMode, EP_BindCMode, EP_ExtrudeCMode, EP_NormalFlipCMode, EP_BevelCMode, EP_CreateVertCMode, EP_CreatePatchCMode, EP_VertWeldCMode, EP_CopyTangentCMode, EP_PasteTangentCMode, SSOutlineCMode, SSFilletCMode, SSChamferCMode, SSSegBreakCMode, SSSegRefineCMode, SSCrossInsertCMode, SSVertConnectCMode, SSVertInsertCMode, SSCreateLineCMode, SSCrossSectionCMode, SSBooleanCMode, SSTrimCMode, SSExtendCMode, SSBindCMode, SSRefineConnectCMode, SSCopyTangentCMode, SSPasteTangentCMode, and MouseToolCommandMode.

virtual BOOL ChangeFG ( CommandMode oldMode ) [pure virtual]

This method returns TRUE if the command mode needs to change the foreground proc (using ChangeFGProc()) and FALSE if it does not.

A command mode that does not involve any redrawing of the viewports can just return FALSE.

Parameters:
oldMode This is the command mode that is currently in place. This may be used for comparison with a potential new mode. See the sample code below.
Sample Code:
The sample code below checks to see if the command mode is already CHANGE_FG_SELECTED. If it is there is no reason to change to foreground proc to this mode so the method returns FALSE. If a different mode is in place TRUE is returned.
        BOL ChangeFG( CommandMode *oldMode ) { return (oldMode->ChangeFGProc() != CHANGE_FG_SELECTED); }
        ChangeForegroundCallback *ChangeFGProc() { return CHANGE_FG_SELECTED; }

Implemented in EditSSMode, MoveModBoxCMode, RotateModBoxCMode, UScaleModBoxCMode, NUScaleModBoxCMode, SquashModBoxCMode, SelectModBoxCMode, MoveCtrlApparatusCMode, RotateCtrlApparatusCMode, UScaleCtrlApparatusCMode, NUScaleCtrlApparatusCMode, SquashCtrlApparatusCMode, SelectCtrlApparatusCMode, EP_BindCMode, EP_ExtrudeCMode, EP_NormalFlipCMode, EP_BevelCMode, EP_CreateVertCMode, EP_CreatePatchCMode, EP_VertWeldCMode, EP_CopyTangentCMode, EP_PasteTangentCMode, SSOutlineCMode, SSFilletCMode, SSChamferCMode, SSSegBreakCMode, SSSegRefineCMode, SSCrossInsertCMode, SSVertConnectCMode, SSVertInsertCMode, SSCreateLineCMode, SSCrossSectionCMode, SSBooleanCMode, SSTrimCMode, SSExtendCMode, SSBindCMode, SSRefineConnectCMode, SSCopyTangentCMode, SSPasteTangentCMode, and MouseToolCommandMode.

virtual void EnterMode ( ) [pure virtual]

This method is called when a command mode becomes active.

Usually a developer responds by changing the state of a control to indicate to the user that they have entered the mode. Typically this means pushing in a tool button. When the mode is finished the button should be returned to normal (see ExitMode() below). Note: A developer should use the standard color GREEN_WASH for check buttons that instigate a command mode. While the command mode is active the button should be displayed in GREEN_WASH. See Class ICustButton (specifically the method SetHighlightColor()) for more details.

Sample Code:
iPick->SetHighlightColor(GREEN_WASH); iPick->SetCheck(TRUE);

Implemented in EditSSMode, MoveModBoxCMode, RotateModBoxCMode, UScaleModBoxCMode, NUScaleModBoxCMode, SquashModBoxCMode, SelectModBoxCMode, MoveCtrlApparatusCMode, RotateCtrlApparatusCMode, UScaleCtrlApparatusCMode, NUScaleCtrlApparatusCMode, SquashCtrlApparatusCMode, SelectCtrlApparatusCMode, EP_BindCMode, EP_ExtrudeCMode, EP_NormalFlipCMode, EP_BevelCMode, EP_CreateVertCMode, EP_CreatePatchCMode, EP_VertWeldCMode, EP_CopyTangentCMode, EP_PasteTangentCMode, SSOutlineCMode, SSFilletCMode, SSChamferCMode, SSSegBreakCMode, SSSegRefineCMode, SSCrossInsertCMode, SSVertConnectCMode, SSVertInsertCMode, SSCreateLineCMode, SSCrossSectionCMode, SSBooleanCMode, SSTrimCMode, SSExtendCMode, SSBindCMode, SSRefineConnectCMode, SSCopyTangentCMode, SSPasteTangentCMode, and MouseToolCommandMode.

virtual void ExitMode ( ) [pure virtual]

CommandMode CommandMode CommandMode CommandMode CommandMode CommandMode CommandMode CommandMode CommandMode CommandMode
CommandMode CommandMode CommandMode CommandMode CommandMode CommandMode CommandMode CommandMode CommandMode CommandMode