The attachment model for DG nodes or DAG objects is supported by the registration interface MDrawRegistry. The attachment model for render loop overrides is discussed in greater detail in the section: 3.6 Render Loop Overrides.
For draw, shader, shading node, geometry and sub-scene overrides, the association is implicitly provided via the use of node classification strings. Override classification and Maya node/object classification matching forms this implicit link. The matching is performed hierarchically from broad to specific via the usage of “sub-classifications.”
The format required of a classification string is as follows:
“drawdb/<object classification>/[<sub-classification>]/<override classification>”
<sub-classification> : This provides additional levels of classification which are useful, and in some cases, required for grouping and managing overrides. In particular, shading nodes that are used as surface shaders (connected to the Maya shading engine) must use a classification which starts with “drawdb/shader/surface/”. Sub-classification is optional for DAG overrides.
In general, the more sub-classifications specified, the more specific the type of objects/nodes associated with a given entry point. For example, in these two examples:
The first classification string, when used, would match fewer objects/nodes than the more-generic second string.
For either existing or new plug-in node types, it is the responsibility of the plug-in writer to ensure that the appropriate classifications are used for both the override and for the node itself so that the correct classification string matching (association) is performed.
Figure 35: For each override type the classification matches any objects or nodes specified in the classification.
Figure 36: Example demonstrating that, depending on how on how specific the classification is, different matches results. The “drawdb/geometry/parametricSurface/B-spline” DAG object classification matches more closely to the override with the identical classification string, rather than the more generic “drawdb/geometry/parametricSurface” string. The classification with the closest match is used.
The getClassification command documentation contains a list of classifications recognized by Viewport 2.0.
For example, for the rockingTransform plug-in, the code is as follows:
// Classify the node as a transform. This causes Viewport // 2.0 to treat the node the same way it treats a regular // transform node. const MString classification = "drawdb/geometry/transform"; status = plugin.registerTransform("rockingTransform", rockingTransformNode::id, &rockingTransformNode::creator, &rockingTransformNode::initialize, &rockingTransformMatrix::creator, rockingTransformMatrix::id, &classification);
If this is not done, then registerTransform() automatically adds the drawdb/geometry/transform classification if no other drawdb classification is specified.
New display filter types can be added for plug-in objects via a registration interface. If the classification string used matches the classification string used for registering a draw override, the override may be filtered out when visibility checking is performed. The UI name for the filter appears as an option for display filter interfaces for 3d viewports and batch rendering.
MFnPlugin::registerDisplayFilter() is the interface to register a new display filter type. The gpuCache SDK plug-in contains code which demonstrates its usage.