Python API 2.0 Reference
|
Public Member Functions | |
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 Attributes | |
int | kImage1 = 0 |
int | kImage2 = 1 |
int | kImage3 = 2 |
This is the base class for user defined drag and drop behaviors.
def OpenMayaUI.MPxContext.__init__ | ( | ) |
Initialize self. See help(type(self)) for accurate signature.
|
static |
Create and return a new object. See help(type) for accurate signature.
def OpenMayaUI.MPxContext.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.MPxContext.addManipulator | ( | ) |
addManipulator(manipulator) -> None This method adds a manipulator to the context. * manipulator (MObject) - the manipulator to be added to the context.
def OpenMayaUI.MPxContext.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.MPxContext.beginMarquee | ( | ) |
beginMarquee(event) -> self Start drawing a dragged out marquee box. A marquee box is a rectangular area of the screen specified by two points representing opposite corners of the rectangle. Marquee's are commonly used in the selection of multiple items from a region of the screen. The marquee rectangle acts as a guideline for the region of the screen that will be effected. * event (MEvent) - current event information.
def OpenMayaUI.MPxContext.completeAction | ( | ) |
completeAction() -> None This method is called when the complete key is pressed. The default complete key in Maya is the <b>enter</b> key. Users can override this method if a tool has several steps. For example, a tool may have several steps where the user must select objects and then press the completion key before proceeding.
def OpenMayaUI.MPxContext.deleteAction | ( | ) |
deleteAction() -> None This method is called when the delete or backspace key is pressed. The default behaviour for this method is to delete the items on the current selection list. Users can override this method if they wish to do anything else when this event occurs.
def OpenMayaUI.MPxContext.deleteManipulators | ( | ) |
deleteManipulators() -> None This method deletes all the manipulators that belong to the context.
def OpenMayaUI.MPxContext.doDrag | ( | ) |
doDrag(event, drawMgr, context) -> 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 in Viewport 2.0. MUIDrawManager must be used for any viewport drawing done in this method. Direct calls to OpenGL or DirectX are unsupported and may result in instability or unpredictable behavior. MUIDrawManager allows for drawing primitives in the 3D modeling space. Those primitives will then be projected onto a 2D overlay plane before being displayed. 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 press event information. * drawMgr (MHWRender::MUIDrawManager) - The UI draw manager, it can be used to draw some simple geometry including text. * context (MHWRender::MFrameContextFrame) - level context information.
def OpenMayaUI.MPxContext.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.
def OpenMayaUI.MPxContext.doEnterRegion | ( | ) |
doEnterRegion(event) -> None This method is called when a mouse enters the viewport. The base method does nothing and should be overridden if the user needs to do anything during an enter event. The <b>event</b> can be used to get more explicit information about the event such as the cursor location. See MEvent for more information. * event (MEvent) - The event information.
def OpenMayaUI.MPxContext.doHold | ( | ) |
doHold(event, drawMgr, context) -> 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 in Viewport 2.0. MUIDrawManager must be used for any viewport drawing done in this method. Direct calls to OpenGL or DirectX are unsupported and may result in instability or unpredictable behavior. MUIDrawManager allows for drawing primitives in the 3D modeling space. Those primitives will then be projected onto a 2D overlay plane before being displayed. 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 press event information. * drawMgr (MHWRender::MUIDrawManager) - The UI draw manager, it can be used to draw some simple geometry including text. * context (MHWRender::MFrameContextFrame) - level context information.
def OpenMayaUI.MPxContext.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.
def OpenMayaUI.MPxContext.doPress | ( | ) |
doPress(event, drawMgr, context) -> 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 in Viewport 2.0. MUIDrawManager must be used for any viewport drawing done in this method. Direct calls to OpenGL or DirectX are unsupported and may result in instability or unpredictable behavior. MUIDrawManager allows for drawing primitives in the 3D modeling space. Those primitives will then be projected onto a 2D overlay plane before being displayed. The event 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. * drawMgr (MHWRender::MUIDrawManager) - The UI draw manager, it can be used to draw some simple geometry including text. * context (MHWRender::MFrameContextFrame) - level context information.
def OpenMayaUI.MPxContext.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.
def OpenMayaUI.MPxContext.doPtrMoved | ( | ) |
doPtrMoved(event, drawMgr, context ) -> None This method is called when a mouse move 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 in Viewport 2.0. MUIDrawManager must be used for any viewport drawing done in this method. Direct calls to OpenGL or DirectX are unsupported and may result in instability or unpredictable behavior. MUIDrawManager allows for drawing primitives in the 3D modeling space. Those primitives will then be projected onto a 2D overlay plane before being displayed. 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 press event information. * drawMgr (MHWRender::MUIDrawManager) - The UI draw manager, it can be used to draw some simple geometry including text. * context (MHWRender::MFrameContextFrame) - level context information.
def OpenMayaUI.MPxContext.doPtrMovedLegacy | ( | ) |
doPtrMovedLegacy(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 press event information.
def OpenMayaUI.MPxContext.doRelease | ( | ) |
doRelease(event, drawMgr, context) -> 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 in Viewport 2.0. MUIDrawManager must be used for any viewport drawing done in this method. Direct calls to OpenGL or DirectX are unsupported and may result in instability or unpredictable behavior. MUIDrawManager allows for drawing primitives in the 3D modeling space. Those primitives will then be projected onto a 2D overlay plane before being displayed. 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 press event information. * drawMgr (MHWRender::MUIDrawManager) - The UI draw manager, it can be used to draw some simple geometry including text. * context (MHWRender::MFrameContextFrame) - level context information.
def OpenMayaUI.MPxContext.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.
def OpenMayaUI.MPxContext.dragMarquee | ( | ) |
dragMarquee(event) -> self Draws a rectangle representing the dragged out area initiated with the beginMarquee method. * event (MEvent) - current event information.
def OpenMayaUI.MPxContext.drawFeedback | ( | ) |
drawFeedback(event, drawMgr, context ) -> None This method is called to draw primitives when your context is activated This method is called only when using Viewport 2.0. MUIDrawManager must be used for any viewport drawing done in this method. Direct calls to OpenGL or DirectX are unsupported and may result in instability or unpredictable behavior. MUIDrawManager allows for drawing primitives in the 3D modeling space. Those primitives will then be projected onto a 2D overlay plane before being displayed. * drawMgr (MHWRender::MUIDrawManager) - The UI draw manager, it can be used to draw some simple geometry including text. * context (MHWRender::MFrameContextFrame) - level context information.
def OpenMayaUI.MPxContext.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.MPxContext.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.MPxContext.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.MPxContext.inAlternateContext | ( | ) |
inAlternateContext() -> bool This method is called to determine if an alternate context is active. For example, this method returns true if the user moves the camera while the current context is active.
def OpenMayaUI.MPxContext.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.MPxContext.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.MPxContext.releaseMarquee | ( | ) |
releaseMarquee(event) -> (top, left, bottom, right) End the marquee drawing cycle and return the coordinates corresponding to the dragged out area. The rectangular guideline representing the dragged area is cleared. Returns a tuple consisting of the top, left, bottom, and right corners of the marquee area. * event (MEvent) - current event information.
def OpenMayaUI.MPxContext.setCursor | ( | ) |
setCursor(newCursor) -> self Set the cursor used by the context to the MCursor that is passed in. * newCursor (MCursor) - The new cursor.
def OpenMayaUI.MPxContext.setHelpString | ( | ) |
setHelpString(str) -> self Set the help string to the given MString. This string will appear in the help line in Maya. * str (string) - The new help string.
def OpenMayaUI.MPxContext.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.MPxContext.setTitleString | ( | ) |
setTitleString(str) -> self Set the title of the context to the MString that is passed in. This string will appear in the help line when this context is activated. * str (string) - The new title string.
def OpenMayaUI.MPxContext.stringClassName | ( | ) |
stringClassName() -> string This method is called to determine the name that uniquely identifies the context. Either this method, or the getClassName method, should be overridden such that the name is set to the appropriate string. For example: def stringClassName(self) return 'exampleTool' This name is used by Maya to call the appropriate tool property sheet MEL scripts, specifically: <b>name</b>Properties.mel <b>name</b>Values.mel If this method is not overriden, by default it will set the string to 'defaultTool'. The method returns a string that uniquely identifies the context.
def OpenMayaUI.MPxContext.toolOffCleanup | ( | ) |
toolOffCleanup() -> None This method is called when the context is deactivated, i.e when another context is activated. Users can override this method and use it to reset any user defined data to a specific state.
def OpenMayaUI.MPxContext.toolOnSetup | ( | ) |
toolOnSetup(event) -> None This method is called when the context is activated, i.e when the toolButton for the context is pressed. Users can override this method and use it to set up any user defined data that needs to be initialized on each activation. * event (MEvent) - The button press event information.