MPxSelectionContext Class Reference
[OpenMayaUI - API module for user interfaceProxy classes]

#include <MPxSelectionContext.h>

Inheritance diagram for MPxSelectionContext:

Inheritance graph
[legend]
Collaboration diagram for MPxSelectionContext:

Collaboration graph
[legend]

List of all members.


Detailed Description

Base class for interative selection tools.

This class is used in creating user defined tools that use the internal selection mechanism in maya.

Examples:

componentScaleManip.cpp, customAttrManip.cpp, meshRemapTool.h, meshReorderTool.h, moveManip.cpp, moveNumericTool.cpp, moveTool.cpp, rotateManip.cpp, and surfaceBumpManip.cpp.


Public Member Functions

 MPxSelectionContext ()
virtual ~MPxSelectionContext ()
virtual MStatus doPress (MEvent &event)
virtual MStatus doRelease (MEvent &event)
virtual MStatus doDrag (MEvent &event)
virtual MStatus doHold (MEvent &event)
virtual MStatus helpStateHasChanged (MEvent &)
virtual MStatus addManipulator (const MObject &manipulator)
virtual MStatus deleteManipulators ()
MStatus setImage (const MString &image, ImageIndex index)
MString image (ImageIndex index, MStatus *ReturnStatus=NULL) const
MStatus getImage (MString &image, ImageIndex index) const
 NO SCRIPT SUPPORT.
virtual void abortAction ()
virtual bool processNumericalInput (const MDoubleArray &values, const MIntArray &flags, bool isAbsolute)
virtual bool feedbackNumericalInput () const
virtual MSyntax::MArgType argTypeNumericalInput (unsigned int index) const
virtual void getClassName (MString &name) const

Protected Member Functions

bool isSelecting ()
 USE _isSelecting() IN SCRIPT.
MPoint startPoint ()
 USE _startPoint() IN SCRIPT.
MPoint lastDragPoint ()
 USE _lastDragPoint() IN SCRIPT.
virtual MPxToolCommandnewToolCommand ()
 CALL _newToolCommand() IN SCRIPT.

Constructor & Destructor Documentation

MPxSelectionContext::MPxSelectionContext (  ) 

Class contstructor. This constructor will only be called from MPxContextCommand::makeObj. Users must override this method.

MPxSelectionContext::~MPxSelectionContext (  )  [virtual]

Default destructor. Users can override this method to free any user instantiated data when the context is destroyed.


Member Function Documentation

MStatus MPxSelectionContext::doPress ( MEvent event  )  [virtual]

This method is called when any mouse button is pressed. The base method does nothing and should be overriden if the user needs to do anything on a button press.

The event can be used to get more explicit information about the press such as the button number. See MEvent for more information.

Parameters:
[in] event The button press event information.
Returns:
Status code
Status Codes:

Reimplemented from MPxContext.

Examples:

MStatus MPxSelectionContext::doRelease ( MEvent event  )  [virtual]

This method is called when any mouse button is released. The base method does nothing except marquee selection and should be overriden if the user needs to do anything on a button release.

The event can be used to get more explicit information about the release such as the button number. See MEvent for more information.

Parameters:
[in] event The mouse button release information.
Returns:
Status code
Status Codes:

Reimplemented from MPxContext.

Examples:

MStatus MPxSelectionContext::doDrag ( MEvent event  )  [virtual]

This method is called when a mouse drag event occurs. The base method does nothing except marquee selection and should be overriden if the user needs to do anything during a mouse drag.

The event can be used to get more explicit information about the drag such as the cursor location. See MEvent for more information.

Parameters:
[in] event The mouse drag event information.
Returns:
Status code
Status Codes:

Reimplemented from MPxContext.

Examples:

MStatus MPxSelectionContext::doHold ( MEvent event  )  [virtual]

This method is called when after a mouse button is pressed but before the mouse is dragged. The base method does nothing except marquee selection and should be overriden if the user needs to do anything on a button hold.

The event can be used to get more explicit information about the hold such as the button number. See MEvent for more information.

Parameters:
[in] event The mouse button hold event information.
Returns:
Status code
Status Codes:

Reimplemented from MPxContext.

MStatus MPxSelectionContext::helpStateHasChanged ( MEvent event  )  [virtual]

This method is called whenever the help state may need to be updated. The base method does nothing and should be overriden if the user needs to change the help information based on events.

The event can be used to get more explicit information about the event. See MEvent for more information.

Parameters:
[in] event The event information. Unused in the base class.
Returns:
Status code
Status Codes:
MS::kSuccess

Reimplemented from MPxContext.

Examples:

MStatus MPxSelectionContext::addManipulator ( const MObject manipulator  )  [virtual]

This method adds a manipulator to the context, and also adds the manipulator to the DAG. Note that the manipulator should not yet be added to the DAG when this method is called.

Parameters:
[in] manipulator the manipulator to be added to the context
Returns:

Reimplemented from MPxContext.

MStatus MPxSelectionContext::deleteManipulators (  )  [virtual]

This method deletes all the manipulators that belong to the context.

Returns:

Reimplemented from MPxContext.

MStatus MPxSelectionContext::setImage ( const MString image,
ImageIndex  index 
)

This method is used to set an XPM icon image that is to be used to represent this tool context in various places including the tool bar and can be queried from mel using the contextInfo command.

Parameters:
[in] image the name of an XPM file to be used as the icon
[in] index the index of the image being set; three image representations are permitted: kImage1, kImage2, kImage3
Returns:

Reimplemented from MPxContext.

MString MPxSelectionContext::image ( ImageIndex  index,
MStatus ReturnStatus = NULL 
) const

This method is used to retrieve an XPM icon image that has previously been set for this tool context. This icon image will be used to represent this tool context in various places including the tool bar and can be queried from mel using the contextInfo command.

Parameters:
[in] index the index for the image being retrieved; three image representations are permitted: kImage1, kImage2, kImage3
[out] ReturnStatus Status code (see below)
Returns:
String name
Status Codes:

Reimplemented from MPxContext.

MStatus MPxSelectionContext::getImage ( MString image,
ImageIndex  index 
) const

NO SCRIPT SUPPORT.

This method is not available in Python.

This method is used to retrieve an XPM icon image that has previously been set for this tool context. This icon image will be used to represent this tool context in various places including the tool bar and can be queried from mel using the contextInfo command.

Python Notes

This method is not supported in Python. See the image function which returns a string.

Parameters:
[in] image the returned name of an XPM Icon file
[in] index the index for the image being retrieved; three image representations are permitted: kImage1, kImage2, kImage3
Returns:

Reimplemented from MPxContext.

bool MPxSelectionContext::isSelecting (  )  [protected]

USE _isSelecting() IN SCRIPT.

Determines whether an object is selected.

Returns:
true An object(s) is selected, false otherwise.

MPoint MPxSelectionContext::startPoint (  )  [protected]

USE _startPoint() IN SCRIPT.

Returns the position of button press.

Returns:
The start point

MPoint MPxSelectionContext::lastDragPoint (  )  [protected]

USE _lastDragPoint() IN SCRIPT.

Returns the position of the last drag point.

Returns:
The last drag point

MPxToolCommand * MPxSelectionContext::newToolCommand (  )  [protected, virtual]

CALL _newToolCommand() IN SCRIPT.

Create a new instance of the tool command associated with this context. The tool command (derived from MPxToolCommand) is the command that was registered along with the context command in :

    MFnPlugin::registerContextCommand( contextCommand, contextCommandCreator,
                                       toolCommand, toolCommandCreator )

Returns:
A new instance of the MPxToolCommand.

Reimplemented from MPxContext.

void MPxSelectionContext::abortAction (  )  [virtual]

This method is called when the abort key is pressed. The default abort key in Maya is the escape key. Users can override this method if they wish to perform certain operations when the abort key is pressed.

Reimplemented from MPxContext.

bool MPxSelectionContext::processNumericalInput ( const MDoubleArray values,
const MIntArray flags,
bool  isAbsolute 
) [virtual]

This method processes the input from the numerical input field. Users can override this method if they wish to process numerical input. For a given entry in the numeric input field, if the user types a dot ".", this indicates that the entry should not be modified. The overridden version of this method should take this into account using the ignoreEntry method with the flags that are passed in. The overridden version of this method should also process the numeric input as an absolute input or relative input depending on whether the isAbsolute flag is true or not. The return value should indicate whether or not the numerical input has been processed.

Parameters:
[in] values the values from the numerical input field
[in] flags used in conjunction with the ignoreEntry method, determines whether or not a given entry should be ignored
[in] isAbsolute whether or not the input should be interpreted as absolute
Returns:
false the default return value.

Reimplemented from MPxContext.

Examples:

bool MPxSelectionContext::feedbackNumericalInput (  )  const [virtual]

This method is called to update the numerical feedback. The format and values for the feedback line can be set through the methods in MFeedbackLine, specifically setFormat and setValue. The return value should indicate whether or not the numerical feedback has been provided.

Returns:
false the default return value

Reimplemented from MPxContext.

Examples:

MSyntax::MArgType MPxSelectionContext::argTypeNumericalInput ( unsigned int  index  )  const [virtual]

This method is used by the feedback line to determine what units to display. Users should override this method to return the appropriate argument type for the given index of the numeric input field. Specifically, this method should be overridden to return one of the following:

Parameters:
[in] index the index of the numerical input whose argument type is requested
Returns:
MSyntax::kNoArg the default return value

Reimplemented from MPxContext.

Examples:

void MPxSelectionContext::getClassName ( MString name  )  const [virtual]

This method is called to determine the name that uniquely identifies the context. This method should be overridden such that the name is set to the appropriate string. For example:

        void MPxExampleContext::getClassName(MString &name) const
        { name.set("exampleTool"); }

This name is used by Maya to call the appropriate tool property sheet MEL scripts, specifically:

  • nameProperties.mel
  • nameValues.mel
If this method is not overriden, by default it will set the string to "defaultTool".

Parameters:
[out] name string that uniquely identifies the context

Reimplemented from MPxContext.


Autodesk® Maya® 2010 © 1997-2009 Autodesk, Inc. All rights reserved. Generated with doxygen 1.5.6