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

- Class List
- Class Hierarchy
- Class Members

Static Public Member Functions

# MDrawRegistry Class Reference

# OpenMayaRender - API module for rendering

This reference page is linked to from the following overview topics: Scene Overrides, Framework Classes, Transition Guide.

Search for all occurrences

## Detailed Description

Access the registry associating node types with custom draw classes.

This class provides a means to register custom draw overrides to be used by Viewport 2.0 to draw dependency nodes.

The registry is based on classification strings. Each draw override must be registered with a classification string and any node type with a matching classification string will be drawn using the registered draw override.

`#include <MDrawRegistry.h>`

List of all members.

## Static Public Member Functions
static MStatus | registerShaderOverrideCreator (const MString &drawClassification, const MString &registrantId, ShaderOverrideCreator creator)
| Register an implementation of MPxShaderOverride to use with nodes that have the specified, draw-specific classification string.
static MStatus | deregisterShaderOverrideCreator (const MString &drawClassification, const MString &registrantId)
| Deregister an implementation of MPxShaderOverride.
static MStatus | registerGeometryOverrideCreator (const MString &drawClassification, const MString &registrantId, GeometryOverrideCreator creator)
| Register an implementation of MPxGeometryOverride to use with nodes that have the specified, draw-specific classification string.
static MStatus | deregisterGeometryOverrideCreator (const MString &drawClassification, const MString &registrantId)
| Deregister an implementation of MPxGeometryOverride.
static MStatus | registerDrawOverrideCreator (const MString &drawClassification, const MString &registrantId, DrawOverrideCreator creator)
| Register an implementation of MPxDrawOverride to use with DAG objects that have the specified, draw-specific classification string.
static MStatus | deregisterDrawOverrideCreator (const MString &drawClassification, const MString &registrantId)
| Deregister an implementation of MPxDrawOverride.
static MStatus | registerVertexBufferGenerator (const MString &bufferName, VertexBufferGeneratorCreator creator)
| Register an implementation of MPxVertexBufferGenerator to provide custom vertex streams for shapes.
static MStatus | deregisterVertexBufferGenerator (const MString &bufferName)
| Deregister an implementation of MPxVertexBufferGenerator.
static const char * | className ()
| Returns the name of this class.

## Member Function Documentation

MStatus registerShaderOverrideCreator | ( | const MString & | drawClassification,
|  | const MString & | registrantId,
|  | ShaderOverrideCreator | creator
| ) |  | `[static]`

Search for all occurrences

Register an implementation of MPxShaderOverride to use with nodes that have the specified, draw-specific classification string.

For each shading node in the scene, the closest matching registered override will be used to create a shading effect for drawing in the viewport.

For example, say the following overrides are registered under the given classification strings: myShaderOverride - "drawdb/shaders/myLibrary/myShader" myLibraryOverride - "drawdb/shaders/myLibrary" Then all shaders with classification string "drawdb/shaders/myLibrary/myShader" will be evaluated by myShaderOverride while a shader with the classification string "drawdb/shaders/myLibrary/myShinyShader" would be evaluated by myLibraryOverride.

Note that for Viewport 2.0 to recognize a node as a shading node, it must have a classification string beginning with "drawdb/shader".

If multiple implementations are registered for the same classification, the most recently registered will be used. It is an error to try to register multiple implementations for the same classification using the same registrant id.

Parameters:

  [in] | drawClassification | The draw-specific classification string
  [in] | registrantId | Unique name to identify registration
  [in] | creator | Pointer to a function that creates the override

Returns:
  - MS::kSuccess Registration was successful
  - MS::kInvalidParameter Incorrect classification or classification already registered

Examples:
  hwColorPerVertexShader.cpp, hwPhongShader.cpp, and pluginMain.cpp.

MStatus deregisterShaderOverrideCreator | ( | const MString & | drawClassification,
|  | const MString & | registrantId
| ) |  | `[static]`

Search for all occurrences

Deregister an implementation of MPxShaderOverride.

Parameters:

  [in] | drawClassification | The draw-specific classification string
  [in] | registrantId | Unique name to identify registration, must match the name used to register the override.

Returns:
  - MS::kSuccess Deregistration was successful
  - MS::kInvalidParameter Incorrect classification or no matching registration

Examples:
  hwColorPerVertexShader.cpp, hwPhongShader.cpp, and pluginMain.cpp.

MStatus registerGeometryOverrideCreator | ( | const MString & | drawClassification,
|  | const MString & | registrantId,
|  | GeometryOverrideCreator | creator
| ) |  | `[static]`

Search for all occurrences

Register an implementation of MPxGeometryOverride to use with nodes that have the specified, draw-specific classification string.

For each DAG object in the scene, the closest matching registered override will be used to generate geometry for drawing that object in Viewport 2.0.

For example, say the following overrides are registered under the given classification strings: myShapeOverride - "drawdb/geometry/myLibrary/myShape" myLibraryOverride - "drawdb/geometry/myLibrary" Then all DAG objects with classification string "drawdb/geometry/myLibrary/myShape" will have draw geometry generated through myShapeOverride while DAG objects with the classification string "drawdb/geometry/myLibrary/myPointyShape" will have draw geometry generated through myLibraryOverride.

Note that for Viewport 2.0 to recognize a DAG object as a piece of drawable geometry, it must have a classification string beginning with "drawdb/geometry".

If multiple implementations are registered for the same classification, the most recently registered will be used. It is an error to try to register multiple implementations for the same classification using the same registrant id.

Parameters:

  [in] | drawClassification | The draw-specific classification string
  [in] | registrantId | Unique name to identify registration
  [in] | creator | Pointer to a function that creates an instance of the override class

Returns:
  - MS::kSuccess Registration was successful
  - MS::kInvalidParameter Incorrect classification or classification already registered

Examples:
  apiMeshShape.cpp.

MStatus deregisterGeometryOverrideCreator | ( | const MString & | drawClassification,
|  | const MString & | registrantId
| ) |  | `[static]`

Search for all occurrences

Deregister an implementation of MPxGeometryOverride.

Parameters:

  [in] | drawClassification | The draw-specific classification string
  [in] | registrantId | Unique name to identify registration, must match the name used to register the override.

Returns:
  - MS::kSuccess Deregistration was successful
  - MS::kInvalidParameter Incorrect classification or no matching registration

Examples:
  apiMeshShape.cpp.

MStatus registerDrawOverrideCreator | ( | const MString & | drawClassification,
|  | const MString & | registrantId,
|  | DrawOverrideCreator | creator
| ) |  | `[static]`

Search for all occurrences

Register an implementation of MPxDrawOverride to use with DAG objects that have the specified, draw-specific classification string.

For each DAG object in the scene whose classification string is satisfied by the registered classification string, the draw() method of the given MPxDrawOverride implementation will be called to draw the object in Viewport 2.0.

For example, say the following overrides are registered under the given classification strings: myShapeDrawOverride - "drawdb/geometry/myLibrary/myShape" myLibraryDrawOverride - "drawdb/geometry/myLibrary" Then all DAG objects with classification string "drawdb/geometry/myLibrary/myShape" will be drawn through myShapeDrawOverride while DAG objects with the classification string "drawdb/geometry/myLibrary/myPointyShape" would be drawn through myLibraryDrawOverride.

Note that for Viewport 2.0 to recognize a DAG object as a piece of drawable geometry, it must have a classification string beginning with "drawdb/geometry".

If multiple implementations are registered for the same classification, the most recently registered will be used. It is an error to try to register multiple implementations for the same classification using the same registrant id.

Parameters:

  [in] | drawClassification | The draw-specific classification string
  [in] | registrantId | Unique name to identify registration
  [in] | creator | Pointer to a function that creates an instance of the draw override class

Returns:
  - MS::kSuccess Registration was successful
  - MS::kInvalidParameter Incorrect classification or classification already registered

Examples:
  footPrintNode.cpp.

MStatus deregisterDrawOverrideCreator | ( | const MString & | drawClassification,
|  | const MString & | registrantId
| ) |  | `[static]`

Search for all occurrences

Deregister an implementation of MPxDrawOverride.

Parameters:

  [in] | drawClassification | The draw-specific classification string
  [in] | registrantId | Unique name to identify registration, must match the name used to register the override.

Returns:
  - MS::kSuccess Deregistration was successful
  - MS::kInvalidParameter Incorrect classification or no matching registration

Examples:
  footPrintNode.cpp.

MStatus registerVertexBufferGenerator | ( | const MString & | bufferName,
|  | VertexBufferGeneratorCreator | creator
| ) |  | `[static]`

Search for all occurrences

Register an implementation of MPxVertexBufferGenerator to provide custom vertex streams for shapes.

These vertex streams are opaque to the system so a registry is used to add buffer generators to the system. The bufferName is used to match the Name in a MVertexBufferDescriptor. A static creator function is supplied to initialize the generator.

Parameters:

  [in] | bufferName | Unique name to identify the custom stream this generator can produce.
  [in] | creator | A static function pointer used to create a new instance of the generator.

Returns:
  - MS::kSuccess Registration was successful
  - MS::kFailure A generator was already registered for this buffer name. Unregister the existing generator first if you would like to replace it.

MStatus deregisterVertexBufferGenerator | ( | const MString & | bufferName | ) | `[static]`

Search for all occurrences

Deregister an implementation of MPxVertexBufferGenerator.

Parameters:

  [in] | bufferName | Unique name to identify the custom stream this generator can produce.

Returns:
  - MS::kSuccess Deregistration was successful
  - MS::kInvalidParameter No generator was found with the given name.

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

Search for all occurrences

Returns the name of this class.

Returns:
  The name of this class.

MDrawRegistry MDrawRegistry MDrawRegistry MDrawRegistry MDrawRegistry MDrawRegistry MDrawRegistry MDrawRegistry MDrawRegistry MDrawRegistry
MDrawRegistry MDrawRegistry MDrawRegistry MDrawRegistry MDrawRegistry MDrawRegistry MDrawRegistry MDrawRegistry MDrawRegistry MDrawRegistry