- Main Page
- Related Pages
- Modules
- Classes
- Examples

- Class List
- Class Hierarchy
- Class Members

Public Types | Public Member Functions | Static Public Member Functions | Friends

# MPxSurfaceShapeUI Class Reference

# OpenMayaUI - API module for user interface | Proxy classes

This reference page is linked to from the following overview topics: Shapes in Maya, Shape classes, Writing a shape, Selection, Components, Scene Overrides, Using the Maya Python API.

Search for all occurrences

## Detailed Description

drawing and selection for user defined shapes

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

Examples:

  apiMeshShapeUI.h, apiSimpleShapeUI.h, and quadricShape.cpp.

`#include <MPxSurfaceShapeUI.h>`

List of all members.

## Public Types
enum | UVSelectionType { kSelectMeshUVs, kSelectMeshVerts, kSelectMeshFaces, kSelectMeshEdges }
| Selection modes for UVs. More...
## Public Member Functions
| MPxSurfaceShapeUI ()
| Class constructor.
virtual | ~MPxSurfaceShapeUI ()
| Class destructor.
void | getDrawData (void *geom, MDrawData &)
| Sets up draw data for the shape.
virtual void | getDrawRequests (const MDrawInfo &, bool objectAndActiveOnly, MDrawRequestQueue &requests)
| This routine must be overriden if the shape is to be drawn in the interactive display.
virtual void | draw (const MDrawRequest &, M3dView &view) const
| This routine must be overriden if the shape is to be drawn in the interactive display.
virtual bool | select (MSelectInfo &selectInfo, MSelectionList &selectionList, MPointArray &worldSpaceSelectPts) const
| This routine must be overriden if the shape is to support interactive object and/or component selection.
virtual bool | snap (MSelectInfo &snapInfo) const
| Maya calls this method when snapping to the shape's vertices.
virtual bool | canDrawUV () const
| Called by Maya to determine if this surface shape supports UV drawing.
virtual void | drawUV (M3dView &view, const MTextureEditorDrawInfo &info) const
| This method is called when the surface shape is selected and the texture view is open.
virtual bool | selectUV (M3dView &view, UVSelectionType selType, int xmin, int ymin, int xmax, int ymax, bool singleSelect, MSelectionList &selList) const
| This method is called when the user performs a selection within the texture view.
MPxSurfaceShape * | surfaceShape () const
| Returns the non-ui shape associated with current instance of this class.
MMaterial | material (MDagPath &path) const
| Returns the material associated with this shape.
void | materials (MDagPath &path, MObjectArray &componentFilter, MMaterialArray &materials, MObjectArray *componentSet=NULL) const
| Returns a list of materials associated with this shape and a given list of components.
## Static Public Member Functions
static MPxSurfaceShapeUI * | surfaceShapeUI (const MDagPath &path, MStatus *ReturnStatus=NULL)
| This is a static method that can be used to find the corresponding MPxSurfaceShapeUI for the specified path.
static const char * | className ()
| Returns the name of this class.
## Friends
class | MDrawRequest Search for all occurrences
class | MDrawInfo Search for all occurrences

## Member Enumeration Documentation

enum UVSelectionType

Search for all occurrences

Selection modes for UVs.

Enumerator:

  kSelectMeshUVs | The UV selection type is UVs. Search for all occurrences
  kSelectMeshVerts | The UV selection type is vertices. Search for all occurrences
  kSelectMeshFaces | The UV selection type is faces. Search for all occurrences
  kSelectMeshEdges | The UV selection type is edges. Search for all occurrences

## Member Function Documentation

void getDrawData | ( | void * | geom,
|  | MDrawData & | data
| ) |  |

Search for all occurrences

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.

Parameters:

  [in] | geom | the geometry necessary to draw the shape
  [out] | data | the draw data to be initialized

void getDrawRequests | ( | const MDrawInfo & | info,
|  | bool | objectAndActiveOnly,
|  | MDrawRequestQueue & | queue
| ) |  | `[virtual]`

Search for all occurrences

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.

Parameters:

  [in] | info | Drawing state information.
  [in] | objectAndActiveOnly | 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.
  [out] | queue | Queue on which to place the draw request.

Examples:
  apiMeshShapeUI.h, apiSimpleShapeUI.h, and quadricShape.cpp.

void draw | ( | const MDrawRequest & | request,
|  | M3dView & | view
| ) |  | const `[virtual]`

Search for all occurrences

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.

Parameters:

  [in] | request | the drawing request
  [in] | view | the interactive 3d view in which to draw

Examples:
  apiMeshShapeUI.h, apiSimpleShapeUI.h, and quadricShape.cpp.

bool select | ( | MSelectInfo & | selectInfo,
|  | MSelectionList & | selectionList,
|  | MPointArray & | worldSpaceSelectPts
| ) |  | const `[virtual]`

Search for all occurrences

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.

Parameters:

  [in] | selectInfo | the Selection state information.
  [out] | selectionList | List of items selected by this method. Do not update directly: use MSelectInfo::addSelection instead.
  [out] | worldSpaceSelectPts | List of points used to sort corresponding selections in single-select mode. (Closest to camera wins.) Do not update directly: use MSelectInfo::addSelection instead.

Returns:
  - true something was selected
  - false nothing was selected

Examples:
  apiMeshShapeUI.h, apiSimpleShapeUI.h, and quadricShape.cpp.

bool snap | ( | MSelectInfo & | snapInfo | ) | const `[virtual]`

Search for all occurrences

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.

Parameters:

  [in] | snapInfo | the Selection state information.

Returns:
  - true found a vertex to be snapped to
  - false found no vertex to be snapped to

bool canDrawUV | ( |  | ) | const `[virtual]`

Search for all occurrences

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

Returns:
  true if the shape supports UV drawing, false otherwise.

Examples:
  apiMeshShapeUI.h.

void drawUV | ( | M3dView & | view,
|  | const MTextureEditorDrawInfo & | info
| ) |  | const `[virtual]`

Search for all occurrences

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.

Parameters:

  [in] | view | Texture view in which to draw UVs.
  [in] | info | Drawing parameters.

Examples:
  apiMeshShapeUI.h.

bool selectUV | ( | M3dView & | view,
|  | MPxSurfaceShapeUI::UVSelectionType | selType,
|  | int | xmin,
|  | int | ymin,
|  | int | xmax,
|  | int | ymax,
|  | bool | singleSelect,
|  | MSelectionList & | selList
| ) |  | const `[virtual]`

Search for all occurrences

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.

Parameters:

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

Returns:
  true if something was selected, false otherwise.

MPxSurfaceShape * surfaceShape | ( |  | ) | const

Search for all occurrences

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

Returns:
  The non ui shape object

MMaterial material | ( | MDagPath & | path | ) | const

Search for all occurrences

Returns the material associated with this shape.

The user must supply a DAG path as a shape can have several materials if instanced.

Parameters:

  [in] | path | the path for which to get the material

Returns:
  The material associated with this shape

Examples:
  apiMeshShapeUI.cpp, apiSimpleShapeUI.cpp, and quadricShape.cpp.

void materials | ( | MDagPath & | path,
|  | MObjectArray & | componentFilter,
|  | MMaterialArray & | materials,
|  | MObjectArray * | componentSet = `NULL`
| ) |  | const

Search for all occurrences

Returns a list of materials associated with this shape and a given list of components.

The user must supply a DAG path as a shape can have several materials if instanced.

Parameters:

  [in] | path | the path for which to get materials
  [in] | componentFilter | the (optional) list of components to iterate over. If the list is empty, it will return materials for all components.
  [out] | materials | materials associated with this shape.
  [out] | componentSet | optional output for components associated with each returned material. A MObject::kNullObj entry indicates that the corresponding material is associated with the entire shape, not a specific component.

MPxSurfaceShapeUI * surfaceShapeUI | ( | const MDagPath & | path,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  | `[static]`

Search for all occurrences

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.

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

Parameters:

  [in] | path | The full path to a surface shape, including the shape.
  [out] | ReturnStatus | The return status. MS::kSuccess The method was successful. MS::kInvalidObjectType The specified object is not a custom surface shape.

Returns:
  The pointer to an MPxSurfaceShapeUI instance.

const char * className | ( |  | ) | `[static]`

Search for all occurrences

Returns the name of this class.

Returns:
  The name of this class.

MPxSurfaceShapeUI MPxSurfaceShapeUI MPxSurfaceShapeUI MPxSurfaceShapeUI MPxSurfaceShapeUI MPxSurfaceShapeUI MPxSurfaceShapeUI MPxSurfaceShapeUI MPxSurfaceShapeUI MPxSurfaceShapeUI
MPxSurfaceShapeUI MPxSurfaceShapeUI MPxSurfaceShapeUI MPxSurfaceShapeUI MPxSurfaceShapeUI MPxSurfaceShapeUI MPxSurfaceShapeUI MPxSurfaceShapeUI MPxSurfaceShapeUI MPxSurfaceShapeUI