Python API 2.0 Reference
OpenMayaUI.MPxSelectionContext Class Reference
+ Inheritance diagram for OpenMayaUI.MPxSelectionContext:

Public Member Functions

def __init__ ()
 
def abortAction ()
 
def addManipulator ()
 
def argTypeNumericalInput ()
 
def deleteManipulators ()
 
def doDrag ()
 
def doDragLegacy ()
 
def doHold ()
 
def doHoldLegacy ()
 
def doPress ()
 
def doPressLegacy ()
 
def doRelease ()
 
def doReleaseLegacy ()
 
def feedbackNumericalInput ()
 
def helpStateHasChanged ()
 
def image ()
 
def isSelecting ()
 
def lastDragPoint ()
 
def newToolCommand ()
 
def processNumericalInput ()
 
def setAllowDoubleClickAction ()
 
def setAllowPaintSelect ()
 
def setAllowPreSelectHilight ()
 
def setAllowSoftSelect ()
 
def setAllowSymmetry ()
 
def setImage ()
 
def startPoint ()
 
- Public Member Functions inherited from OpenMayaUI.MPxContext
def __init__ ()
 
def abortAction ()
 
def addManipulator ()
 
def argTypeNumericalInput ()
 
def beginMarquee ()
 
def completeAction ()
 
def deleteAction ()
 
def deleteManipulators ()
 
def doDrag ()
 
def doDragLegacy ()
 
def doEnterRegion ()
 
def doHold ()
 
def doHoldLegacy ()
 
def doPress ()
 
def doPressLegacy ()
 
def doPtrMoved ()
 
def doPtrMovedLegacy ()
 
def doRelease ()
 
def doReleaseLegacy ()
 
def dragMarquee ()
 
def drawFeedback ()
 
def feedbackNumericalInput ()
 
def helpStateHasChanged ()
 
def image ()
 
def inAlternateContext ()
 
def newToolCommand ()
 
def processNumericalInput ()
 
def releaseMarquee ()
 
def setCursor ()
 
def setHelpString ()
 
def setImage ()
 
def setTitleString ()
 
def stringClassName ()
 
def toolOffCleanup ()
 
def toolOnSetup ()
 

Static Public Member Functions

def __new__ ()
 
- Static Public Member Functions inherited from OpenMayaUI.MPxContext
def __new__ ()
 

Additional Inherited Members

- Static Public Attributes inherited from OpenMayaUI.MPxContext
int kImage1 = 0
 
int kImage2 = 1
 
int kImage3 = 2
 

Detailed Description

Base class for interative selection tools.

Method resolution order:
-   MPxSelectionContext
-   MPxContext
-   builtins.object

Constructor & Destructor Documentation

def OpenMayaUI.MPxSelectionContext.__init__ ( )
Initialize self.  See help(type(self)) for accurate signature.

Member Function Documentation

def OpenMayaUI.MPxSelectionContext.__new__ ( )
static
Create and return a new object.  See help(type) for accurate signature.
def 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.
def OpenMayaUI.MPxSelectionContext.addManipulator ( )
addManipulator(manipulator) -> None

This method adds a manipulator to the context.

* manipulator (MObject) - the manipulator to be added to the context.
def OpenMayaUI.MPxSelectionContext.argTypeNumericalInput ( )
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.
def OpenMayaUI.MPxSelectionContext.deleteManipulators ( )
deleteManipulators() -> None

This method deletes all the manipulators that belong
to the context.
def OpenMayaUI.MPxSelectionContext.doDrag ( )
doDrag(event, drawManager, frameContext) -> 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.
* drawManager (MUIDrawManager) - Draw manager to use to draw custom shape
* frameContext (MFrameContext) - Context of the frame being rendered.
def 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.

    DEPRECATED in 2023, please use doDrag.
def OpenMayaUI.MPxSelectionContext.doHold ( )
doHold(event, drawManager, frameContext) -> 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.
* drawManager (MUIDrawManager) - Draw manager to use to draw custom shape
* frameContext (MFrameContext) - Context of the frame being rendered.
def 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.

    DEPRECATED in 2023, please use doHold.
def OpenMayaUI.MPxSelectionContext.doPress ( )
doPress(event, drawManager, frameContext) -> 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.
* drawManager (MUIDrawManager) - Draw manager to use to draw custom shape
* frameContext (MFrameContext) - Context of the frame being rendered.
def 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.

    DEPRECATED in 2023, please use doPress.
def OpenMayaUI.MPxSelectionContext.doRelease ( )
doRelease(event, drawManager, frameContext) -> 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.
* drawManager (MUIDrawManager) - Draw manager to use to draw custom shape
* frameContext (MFrameContext) - Context of the frame being rendered.
def 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.

    DEPRECATED in 2023, please use doRelease.
def OpenMayaUI.MPxSelectionContext.feedbackNumericalInput ( )
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.
def OpenMayaUI.MPxSelectionContext.helpStateHasChanged ( )
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.
def 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.
def OpenMayaUI.MPxSelectionContext.isSelecting ( )
isSelecting() -> bool

Determines whether an object is selected.
returns True if an object(s) is selected, False otherwise.
def OpenMayaUI.MPxSelectionContext.lastDragPoint ( )
lastDragPoint() -> MPoint

Returns the position of the last drag point.
def 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.
def OpenMayaUI.MPxSelectionContext.processNumericalInput ( )
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.
def OpenMayaUI.MPxSelectionContext.setAllowDoubleClickAction ( )
setAllowDoubleClickAction() -> None

This method enables the support of double click smart selection for this context.
def OpenMayaUI.MPxSelectionContext.setAllowPaintSelect ( )
setAllowPaintSelect() -> None

This method enables drag selection mode for this context.
def OpenMayaUI.MPxSelectionContext.setAllowPreSelectHilight ( )
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.
def OpenMayaUI.MPxSelectionContext.setAllowSoftSelect ( )
setAllowSoftSelect() -> None

This method enables the support of soft selection for this context.
def OpenMayaUI.MPxSelectionContext.setAllowSymmetry ( )
setAllowSymmetry() -> None

This method enables the support of symmetrical selection for this context.
def 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.
def OpenMayaUI.MPxSelectionContext.startPoint ( )
startPoint() -> MPoint

Returns the position of the button press.