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

Public Member Functions

def __init__ ()
 
def canDrawUV ()
 
def drawUV ()
 
def material ()
 
def materials ()
 
def select ()
 
def selectUV ()
 
def snap ()
 
def surfaceShape ()
 

Static Public Member Functions

def __new__ ()
 
def surfaceShapeUI ()
 

Static Public Attributes

int kSelectMeshEdges = 3
 
int kSelectMeshFaces = 2
 
int kSelectMeshUVs = 0
 
int kSelectMeshVerts = 1
 

Detailed Description

Base class for the UI portion of all user defined shapes.

Constructor & Destructor Documentation

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

Member Function Documentation

def OpenMayaUI.MPxSurfaceShapeUI.__new__ ( )
static
Create and return a new object.  See help(type) for accurate signature.
def OpenMayaUI.MPxSurfaceShapeUI.canDrawUV ( )
canDrawUV() -> bool

Called by Maya to determine if this surface shape supports UV drawing.
def OpenMayaUI.MPxSurfaceShapeUI.drawUV ( )
drawUV(view, info) -> self

This method is called when the surface shape is selected and the texture view is open.  Users should override this method if their custom shape supports UVs.

* view (M3dView) - Texture view in which to draw UVs.
* info (MTextureEditorDrawInfo) - Drawing parameters.
def OpenMayaUI.MPxSurfaceShapeUI.material ( )
material(path) -> MMaterial

COMMENT
def OpenMayaUI.MPxSurfaceShapeUI.materials ( )
materials(path, componentFilter, materials, componentSet=None) -> self

Returns the material associated with this shape.
The user must supply a DAG path as a shape can have several materials if instanced.

* path (MDagPath) - the path for which to get the material
def OpenMayaUI.MPxSurfaceShapeUI.select ( )
select(selectInfo, selectionList, worldSpaceSelectPts) -> bool

This routine must be overriden if the shape is to support interactive object and/or component selection. The implementation of this method should call selectInfo.addSelection with information about the selected item and its selection mask. For single click selection, detected using the selectInfo.singleSection() method, the hit point should also be passed as an argument to selectInfo.addSelection().

Returns True if something was selected.

* selectInfo (MSelectInfo) - the Selection state information.
* selectionList [OUT] (MSelectionList) - List of items selected by this method. Do not update directly: use MSelectInfo.addSelection instead.
* worldSpaceSelectPts [OUT] (MPointArray) - List of points used to sort corresponding selections in single-select mode. (Closest to camera wins.) Do not update directly: use MSelectInfo.addSelection instead.
def OpenMayaUI.MPxSurfaceShapeUI.selectUV ( )
selectUV(view, selType, xmin, ymin, xmax, ymax, singleSelect, selList) -> bool

This method is called when the user performs a selection within the texture view.  The method is called only when the surface shape is member of the active selection list.

Maya provides the current viewport instance, the type of the selection, the extents of the selection rectangle (in viewport coordinates), and if the selection mode is single selection. The API user is expected to fill the selection list and return a result of True if 'something was selected'.

To properly use this method, you must make sure that you have a valid component type that Maya can recognize. Selection tests can be done using a pick buffer or by spatially determining the selected objects.

Currently Maya does not know how to manipulate custom UV components. This method only provides the facilities to visualize what has been selected in the viewport.  The API user is responsible for implementing commands that can manipulate the currently selected UVs.

Returns True if something was selected.

* view (M3dView) - the texture drawing view
* selType (int) - the selection type
* xmin (int) - minimum x coordinate value of the selection rectangle.
* ymin (int) - minimum y coordinate value of the selection rectangle.
* xmax (int) - maximum x coordinate value of the selection rectangle.
* ymax (int) - maximum y coordinate value of the selection rectangle.
* singleSelect (bool) - indicates if the user is in single selection mode.
* selList [OUT] (MSelectionList) - the selection list to be populated.

Valid selection types:
  kSelectMeshUVs      The UV selection type is UVs.
  kSelectMeshVerts    The UV selection type is vertices.
  kSelectMeshFaces    The UV selection type is faces.
  kSelectMeshEdges    The UV selection type is edges.
def OpenMayaUI.MPxSurfaceShapeUI.snap ( )
snap(snapInfo) -> bool

Maya calls this method when snapping to the shape's vertices.
If you wish your custom shape to support point snapping then you must override this method and have it call snapInfo's MSelectInfo.setSnapPoint() method to set the point to be snapped to.
If setSnapPoint() is called multiple times then the point closest to the cursor will be used.

Returns True if a vertex was found to be snapped to was selected.

* snapInfo (MSelectInfo) - the Selection state information.
def OpenMayaUI.MPxSurfaceShapeUI.surfaceShape ( )
surfaceShape() -> MPxSurfaceShape

Returns the non-ui shape associated with current instance.
def OpenMayaUI.MPxSurfaceShapeUI.surfaceShapeUI ( )
static
surfaceShapeUI(path) -> MPxSurfaceShapeUI

This is a static method that can be used to find the corresponding MPxSurfaceShapeUI for the specified path.  If an MPxSurfaceShapeUI does not exist then one is created.

This function can only be used for custom surface shapes and the function will return NULL if the provided path is not a custom surface shape.

* path (MDagPath) - The full path to a surface shape, including the shape.