Base class for interative selection tools.
Method resolution order:
- MPxSelectionContext
- MPxContext
- __builtin__.object
Constructor & Destructor Documentation
OpenMayaUI.MPxSelectionContext.__init__
(
)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
Member Function Documentation
OpenMayaUI.MPxSelectionContext.abortAction
(
)
abortAction() -> None
This method is called when the abort key is pressed.
The default abort key in Maya is the <b>escape</b> key.
Users can override this method if they wish to perform
certain operations when the abort key is pressed.
OpenMayaUI.MPxSelectionContext.addManipulator
(
)
addManipulator(manipulator) -> None
This method adds a manipulator to the context.
* manipulator (MObject) - the manipulator to be added to the context.
argTypeNumericalInput(index) -> MSyntax.MArgType
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:
<b>MSyntax.kNoArg</b> for no argument
<b>MSyntax.kDistance</b> for linear units
<b>MSyntax.kAngle</b> for angular units
* index (int) - the index of the numerical input whose argument type is requested.
OpenMayaUI.MPxSelectionContext.deleteManipulators
(
)
deleteManipulators() -> None
This method deletes all the manipulators that belong
to the context.
OpenMayaUI.MPxSelectionContext.doDragLegacy
(
)
doDragLegacy(event) -> None
This method is called when a mouse drag event occurs.
The base method does nothing and should be overridden if
the user needs to do anything during a mouse drag.
This method is called only when it is in either default viewport renderer
or hardware viewport renderer, not viewport 2.0.
The <b>event</b> can be used to get more explicit information
about the drag such as the cursor location. See MEvent for
more information.
* event (MEvent) - The button drag event information.
OpenMayaUI.MPxSelectionContext.doHoldLegacy
(
)
doHoldLegacy(event) -> None
This method is called when a mouse button is pressed but
before the mouse is dragged.
The base method does nothing and should be overridden if the user needs
to do anything on a button hold.
This method is called only when it is in either default viewport renderer
or hardware viewport renderer, not viewport 2.0.
The <b>event</b> can be used to get more explicit information
about the hold such as the button number. See MEvent for
more information.
* event (MEvent) - The button hold event information.
OpenMayaUI.MPxSelectionContext.doPressLegacy
(
)
doPressLegacy(event) -> None
This method is called when any mouse button is pressed.
The base method does nothing and should be overridden if
the user needs to do anything on a button press.
This method is called only when it is in either default viewport renderer
or hardware viewport renderer, not viewport 2.0.
The <b>event</b> can be used to get more explicit information
about the press such as the button number. See MEvent for
more information.
* event (MEvent) - The button press event information.
OpenMayaUI.MPxSelectionContext.doReleaseLegacy
(
)
doReleaseLegacy(event) -> None
This method is called when any mouse button is released.
The base method does nothing and should be overridden if
the user needs to do anything on a button release.
This method is called only when it is in either default viewport renderer
or hardware viewport renderer, not viewport 2.0.
The <b>event</b> can be used to get more explicit information
about the release such as the button number. See MEvent for
more information.
* event (MEvent) - The button release event information.
feedbackNumericalInput() -> bool
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. The default return value is false.
helpStateHasChanged(event) -> None
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 <b>event</b> can be used to get more explicit information
about the event. See MEvent for more information.
* event (MEvent) - The event information.
OpenMayaUI.MPxSelectionContext.image
(
)
image(index) -> string
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.
* index (ImageIndex) - the index of the image being retrieved; three image
representations are permitted: kImage1, kImage2, kImage3.
OpenMayaUI.MPxSelectionContext.isSelecting
(
)
isSelecting() -> bool
Determines whether an object is selected.
returns True if an object(s) is selected, False otherwise.
OpenMayaUI.MPxSelectionContext.lastDragPoint
(
)
lastDragPoint() -> MPoint
Returns the position of the last drag point.
OpenMayaUI.MPxSelectionContext.newToolCommand
(
)
newToolCommand() -> MPxToolCommand
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.
Returns a new instance of the MPxToolCommand.
processNumericalInput(values, flags, isAbsolute) -> bool
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.
* values (MDoubleArray) - the values from the numerical input field.
* flags (MIntArray) - used in conjunction with the ignoreEntry method,
determines whether or not a given entry should be ignored.
* isAbsolute (bool) - whether or not the input should be interpreted as absolute.
setAllowPreSelectHilight() -> None
This method enables the support of pre-selection highlight for this context.
It needs to be called by the user-overriden MPxContext::toolOnSetup method.
OpenMayaUI.MPxSelectionContext.setAllowSoftSelect
(
)
setAllowSoftSelect() -> None
This method enables the support of soft selection for this context.
OpenMayaUI.MPxSelectionContext.setAllowSymmetry
(
)
setAllowSymmetry() -> None
This method enables the support of symmetrical selection for this context.
OpenMayaUI.MPxSelectionContext.setImage
(
)
setImage(image, index) -> self
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.
* image (string) - the name of an XPM file to be used as the icon.
* index (ImageIndex) - the index of the image being set; three image
representations are permitted: kImage1, kImage2, kImage3.
OpenMayaUI.MPxSelectionContext.startPoint
(
)
startPoint() -> MPoint
Returns the position of the button press.