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

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions

# MDrawRequest Class Reference

# OpenMayaUI - API module for user interface

This reference page is linked to from the following overview topics: Drawing and refresh, Overview of hardware shading node plug-ins.

Search for all occurrences

## Detailed Description

A draw reqeust used in the draw methods of MPxSurfaceShapeUI.

This class encapsulates all the information needed to fulfill a request to draw an object or part of an object. This class is used by the draw methods of MPxSurfaceShapeUI derived objects.

The draw request should be created in the overridden MPxSurfaceShapeUI::getDrawRequests method. Once created the appropriate "set" methods of this class should be used to define what is being requested. Then the request should be placed on the draw reqeust queue using MDrawRequestQueue::add.

When your request gets processed by maya, your overriden MPxSurfaceShape::draw method will get called with your request. Use the query methods of this class to determine what to draw.

You create a draw request using the method MDrawInfo::getPrototype. A draw request automatically picks up certain information (listed below) upon its creation. So you don't have to set any of this information unless you want to change it.

Information automatically set by MDrawInfo::getPrototype :

- path path to object to be drawn
- view view to draw in
- matrix world matrix for object
- display appearance how object should be drawn
- display status active, dormant etc.

The draw token is an integer value which you can use to specify what is to be drawn. This is object specific and so you should define an enum with the information you require to decide what is being drawn in your MPxSurfaceShapeUI::draw method.

Here is an example of draw token values for a polygonal mesh object as defined in an MPxSurfaceShapeUI derived class.

        // Draw Tokens
        //
        enum {
            kDrawVertices, // component token
            kDrawWireframe,
            kDrawWireframeOnShaded,
            kDrawSmoothShaded,
            kDrawFlatShaded,
            kLastToken
        };

Examples:

  apiMeshShapeUI.cpp, apiMeshShapeUI.h, apiSimpleShapeUI.cpp, apiSimpleShapeUI.h, blindDataShader.cpp, blindDataShader.h, hwAnisotropicShader_NV20.cpp, hwAnisotropicShader_NV20.h, hwColorPerVertexShader.cpp, hwDecalBumpShader_NV20.cpp, hwDecalBumpShader_NV20.h, hwPhongShader.cpp, hwPhongShader.h, hwReflectBumpShader_NV20.cpp, hwReflectBumpShader_NV20.h, hwRefractReflectShader_NV20.cpp, hwRefractReflectShader_NV20.h, hwToonShader_NV20.cpp, hwToonShader_NV20.h, hwUnlitShader.cpp, hwUnlitShader.h, pnTrianglesNode.cpp, pnTrianglesNode.h, and quadricShape.cpp.

`#include <MDrawRequest.h>`

List of all members.

## Public Member Functions
| MDrawRequest ()
| Constructor.
| MDrawRequest (const MDrawRequest &in)
| Copy constructor.
| ~MDrawRequest ()
| Destructor.
M3dView | view () const
| Returns the view where drawing will be done. Search for all occurrences
void | setView (M3dView &)
| Sets the view where drawing will be done. Search for all occurrences
const MDagPath | multiPath () const
| Returns the path to the object to be drawn. Search for all occurrences
void | setMultiPath (const MDagPath &)
| Sets the path to the object to be drawn.
MObject | component () const
| An optional component.
void | setComponent (MObject &)
| Set a component to be drawn. Search for all occurrences
MDrawData | drawData () const
| Returns the object specific draw data.
void | setDrawData (MDrawData &)
| Set the object specific draw data. Search for all occurrences
M3dView::DisplayStatus | displayStatus () const
| Return the state of object (active, dormant, etc.).
void | setDisplayStatus (M3dView::DisplayStatus)
| Set the state of object (active, dormant, etc.). Search for all occurrences
bool | displayCulling () const
| Returns the state of the culling flag for the object.
void | setDisplayCulling (bool)
| Sets the state of the culling flag for the object. Search for all occurrences
bool | displayCullOpposite () const
| Returns the state of the culling flag for the object.
void | setDisplayCullOpposite (bool)
| Sets the state of the culling flag for the object. Search for all occurrences
M3dView::DisplayStyle | displayStyle () const
| Returns how the object should be drawn (wireframe, shaded, etc.).
void | setDisplayStyle (M3dView::DisplayStyle)
| Sets how the object should be drawn (wireframe, shaded, etc.).
int | color (M3dView::ColorTable table) const
| Returns the wireframe display color.
void | setColor (int, M3dView::ColorTable table)
| Sets the wireframe display color.
MColor | color () const
| Returns the RGBA wireframe display color.
void | setColor (const MColor &color)
| Sets the RGBA wireframe display color. Search for all occurrences
MMaterial | material () const
| Returns the shaded material.
void | setMaterial (MMaterial &)
| Returns the shaded material. Search for all occurrences
bool | isTransparent () const
| Returns the transparency state of the object.
void | setIsTransparent (bool)
| Sets the transparency state of the object. Search for all occurrences
bool | drawLast () const
| Returns the order in which this object will be drawn.
void | setDrawLast (bool)
| Specifies the order in which this object will be drawn.
int | token () const
| Returns the user-defined draw token for this request.
void | setToken (int)
| Set the user-defined draw token for this request.
const MMatrix & | matrix () const
| Returns the draw matrix.
void | setMatrix (const MMatrix &)
| Set the draw matrix.
MDrawRequest & | operator= (const MDrawRequest &other)
| Assignment operator.
## Static Public Member Functions
static const char * | className ()
| Returns the name of this class. Search for all occurrences

## Constructor & Destructor Documentation

MDrawRequest | ( | const MDrawRequest & | other | ) |

Copy constructor.

Parameters:

  [in] | other | value to copy

## Member Function Documentation

MObject component | ( |  | ) | const

Search for all occurrences

An optional component.

If set draw the components that are specified, otherwise draw all components of this type for the object.

Examples:
  apiMeshShapeUI.cpp, and apiSimpleShapeUI.cpp.

void setComponent | ( | MObject & | comp | ) |

Search for all occurrences

Set a component to be drawn.

Parameters:

  [in] | comp | component to be drawn

Examples:
  apiMeshShapeUI.cpp, and apiSimpleShapeUI.cpp.

void setDrawData | ( | MDrawData & | data | ) |

Search for all occurrences

Set the object specific draw data.

Parameters:

  [in] | data | draw data

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

void setDisplayStatus | ( | M3dView::DisplayStatus | status | ) |

Search for all occurrences

Set the state of object (active, dormant, etc.).

Parameters:

  [in] | status | display status

void setDisplayCulling | ( | bool | value | ) |

Search for all occurrences

Sets the state of the culling flag for the object.

Parameters:

  [in] | value | culling value to be set

void setDisplayCullOpposite | ( | bool | value | ) |

Search for all occurrences

Sets the state of the culling flag for the object.

Parameters:

  [in] | value | culling value to be set

void setDisplayStyle | ( | M3dView::DisplayStyle | style | ) |

Search for all occurrences

Sets how the object should be drawn (wireframe, shaded, etc.).

Parameters:

  [in] | style | display style to set

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

int color | ( | M3dView::ColorTable | table | ) | const

Search for all occurrences

Returns the wireframe display color.

The color table specifies which of the 4 color planes to use. This table can be active, dormant, template, or background.

Parameters:

  [in] | table | color table

void setColor | ( | int | value,
|  | M3dView::ColorTable | table
| ) |  |

Search for all occurrences

Sets the wireframe display color.

The color table specifies which of the 4 color planes to use. This table can be active, dormant, template, or background.

Parameters:

  [in] | value | index into the color table
  [in] | table | color table

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

MColor color | ( |  | ) | const

Search for all occurrences

Returns the RGBA wireframe display color.

Returns:
  The RGBA wireframe color

void setColor | ( | const MColor & | color | ) |

Search for all occurrences

Sets the RGBA wireframe display color.

Parameters:

  [in] | color | The RGBA wireframe color

void setMaterial | ( | MMaterial & | material | ) |

Search for all occurrences

Returns the shaded material.

Parameters:

  [in] | material | the material to set

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

void setIsTransparent | ( | bool | value | ) |

Search for all occurrences

Sets the transparency state of the object.

Parameters:

  [in] | value | the transparency value

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

void setDrawLast | ( | bool | value | ) |

Search for all occurrences

Specifies the order in which this object will be drawn.

Parameters:

  [in] | value | draw last flag

int token | ( |  | ) | const

Search for all occurrences

Returns the user-defined draw token for this request.

The token is used to identify a particular part of an object to draw. It is also used to distinguish draw requests generated by derived UI objects from those generated by base classes. It some cases, it provides a way of indicating that a component should be displayed without creating a component MObject.

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

void setToken | ( | int | value | ) |

Search for all occurrences

Set the user-defined draw token for this request.

The token is used to identify a particular part of an object to draw. It is also used to distinguish draw requests generated by derived UI objects from those generated by base classes. It some cases, it provides a way of indicating that a component should be displayed without creating a component MObject.

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

const MMatrix & matrix | ( |  | ) | const

Search for all occurrences

Returns the draw matrix.

This is typically the world matrix of the object, filled in by MDrawInfo::getPrototype(). Commonly this will be equal to multiPath().inclusiveMatrix() but in some circumstances will be a modified matrix, for example, when animation ghosts are being drawn.

Returns:
  The matrix associated with this draw request.

void setMatrix | ( | const MMatrix & | value | ) |

Search for all occurrences

Set the draw matrix.

Parameters:

  [in] | value | The matrix to set.

MDrawRequest & operator= | ( | const MDrawRequest & | other | ) |

Assignment operator.

Parameters:

  [in] | other | MDrawRequest object to copy from.

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

Search for all occurrences

Returns the name of this class.

Returns:
  Name of this class.

MDrawRequest MDrawRequest MDrawRequest MDrawRequest MDrawRequest MDrawRequest MDrawRequest MDrawRequest MDrawRequest MDrawRequest
MDrawRequest MDrawRequest MDrawRequest MDrawRequest MDrawRequest MDrawRequest MDrawRequest MDrawRequest MDrawRequest MDrawRequest