class MPxSurfaceShapeUI

Jump to documentation

drawing and selection for user defined shapes (OpenMayaUI) (OpenMayaMPx.py)

public members:

MPxSurfaceShapeUI ()
virtual ~MPxSurfaceShapeUI ()
enum UVSelectionType
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.
void getDrawData ( void * geom, MDrawData & )
virtual void getDrawRequests ( const MDrawInfo &, bool objectAndActiveOnly, MDrawRequestQueue & requests )
virtual void draw ( const MDrawRequest &, M3dView & view ) const
virtual bool select ( MSelectInfo &selectInfo, MSelectionList &selectionList, MPointArray &worldSpaceSelectPts ) const
virtual bool canDrawUV () const
virtual void drawUV ( M3dView &view, const MTextureEditorDrawInfo &) const
virtual bool selectUV ( M3dView &, UVSelectionType selType, int xmin, int ymin, int xmax, int ymax, bool singleSelect, MSelectionList &selList ) const
MPxSurfaceShape * surfaceShape () const
MMaterial material ( MDagPath & path ) const

Documentation

drawing and selection for user defined shapes (OpenMayaUI) (OpenMayaMPx.py)
Description

The base class for the UI portion of all user defined shapes.

Functions

MPxSurfaceShapeUI:: MPxSurfaceShapeUI ()

Description

Class constructor.

MPxSurfaceShapeUI:: ~MPxSurfaceShapeUI ()

Constructor

Class destructor.

void MPxSurfaceShapeUI:: getDrawData ( void * geom, MDrawData & data )

Description

Sets up draw data for the shape. The draw data is meant to be a light weight class which can be used to pass geometry data through draw requests.

Arguments

  • geom the geometry necessary to draw the shape
  • data the draw data to be initialized

void MPxSurfaceShapeUI:: getDrawRequests ( const MDrawInfo & info, bool objectAndActiveOnly, MDrawRequestQueue & queue )

Description

This routine must be overriden if the shape is to be drawn in the interactive display. This function places drawing requests on maya's drawing queue and is called whenever the view is refreshed and the shape needs to be redrawn.

Arguments

  • info the drawing state information
  • objectAndActiveOnly This parameter is used to determine if draw requests for components need to be supplied. If false, some or all components are active and draw requests must be built for all components.
  • queue the drawing queue to place the draw request on

void MPxSurfaceShapeUI:: draw ( const MDrawRequest & request, M3dView & view ) const

Description

This routine must be overriden if the shape is to be drawn in the interactive display. Maya will call this routine with requests that have been previously added to the drawing queue.

Arguments

  • reqeust the drawing request
  • view the interactive 3d view in which to draw

bool MPxSurfaceShapeUI:: select ( MSelectInfo & selectInfo, MSelectionList & selectionList, MPointArray & worldSpaceSelectPts ) const

Description

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.

Arguments

  • selectInfo the selection state information
  • selectionList this list does not need to be modified, but it must be passed into the MSelectInfo::addSelection method
  • worldSpaceSelectPts this list does not need to be modified, but it must be passed into the MSelectInfo::addSelection method

Return Value

  • true something was selected
  • false nothing was selected

MPxSurfaceShape * MPxSurfaceShapeUI:: surfaceShape () const

Description

Returns the non-ui shape associated with current instance of this class.

Return Value

  • the non ui shape object

MMaterial MPxSurfaceShapeUI:: material ( MDagPath & path ) const

Description

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

Arguments

  • path the path for which to get the material

Return Value

  • the material associated with this shape

bool MPxSurfaceShapeUI:: canDrawUV ( ) const

Description

Called by Maya to determine if this surface shape supports UV drawing.

Arguments

  • None

Return Value

  • true - supports UV drawing.

void MPxSurfaceShapeUI:: drawUV ( M3dView &, const MTextureEditorDrawInfo & ) const

Description

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.

Arguments

  • view the texture drawing view
  • info the drawing parameters.

Return Value

  • None

bool MPxSurfaceShapeUI:: selectUV ( M3dView &, MPxSurfaceShapeUI::UVSelectionType selType, int xmin, int ymin, int xmax, int ymax, bool singleSelect, MSelectionList &selList ) const

Description

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.

Important 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.

Arguments

  • view the texture drawing view
  • selType the selection type
  • xmin minimum x coordinate value of the selection rectangle.
  • ymin minimum y coordinate value of the selection rectangle.
  • xmax maximum x coordinate value of the selection rectangle.
  • ymax maximum y coordinate value of the selection rectangle.
  • singleSelect indicates if the user is in single selection mode.
  • selList the selection list to be populated.

Return Value

  • true if something was selected.

This class has no child classes.


Autodesk® Maya® 2008 © 1997-2007 Autodesk, Inc. All rights reserved. doc++ Copyright