What's New in API in Maya 2016 Extension 2

Maya Viewport 2.0 whitepaper

The Maya Viewport 2.0 whitepaper can be found at http://www.autodesk.com/developmaya.

This document is divided into two parts. The first (Viewport 2.0 API Porting Guide) is an overview of Viewport 2.0 and outlines the differences between the legacy default viewport and Viewport 2.0. The second part (Viewport 2.0 API Porting Guide Details) is more detailed and specifies the recommended interfaces and provides code examples for common tasks.

Maya animation performance whitepaper

The Improving Performance with Parallel Evaluation whitepaper can be found at http://www.autodesk.com/maya-docs.

Refer to this document for information on how to use the new Evaluation Manager feature to improve playback and manipulation of your animated scenes through scene-level graph analysis and parallelization. In addition, it provides information on the API extensions that your plug-in can implement to take advantage of these features, as well as guidelines on how to use the Profiler to evaluate performance in your scene.

API compatibility

Maya 2016 Extension 2 is not binary compatible with Maya 2016.

C++ plug-ins that were compiled against Maya 2016 or Maya 2016 Extension 1, including Maya 2016 service pack releases, must be re-compiled against Maya 2016 Extension 2 in order to be recognized by this version of Maya.

In addition, plug-ins compiled against Maya 2016 Extension 2 will either not load or exhibit unpredictable behavior if loaded in Maya 2016, Maya 2016 Extension 1, or any Maya 2016 service pack release.

To obtain the Maya 2016 and Maya 2016 Extension 1 API Guide, see http://www.autodesk.com/me-sdk-docs-2016.

Location of C++ API header files and libraries

The C++ API header files and libraries are now available with the Maya installation. It is no longer necessary to download the Maya Developer Kit in order to compile your custom plug-ins. The header and library files can be found in the following folders of your Maya installation:

Windows and Linux:

Mac OS X:

Maya Developer Kit

The Developer Kit is available online at Autodesk Exchange at https://apps.exchange.autodesk.com/MAYA/en/Home/Index.

Register Node ID block and Tangent Types ID block

You can now register a Maya Node ID block or a Tangent Types ID block at http://mayaid.autodesk.io/. See also the Tools & Documentation archives section at http://www.autodesk.com/developmaya for more information.

Jump to the following sections:

Python API 2.0

The following classes and methods have been added to Python API 2.0:

Rendering

OpenMayaRender

Selection

Drawing

M3dView

MDrawContext

MFrameContext

MPassContext

MPxPrimitiveGenerator and MRenderItem

MPxDrawOverride

Post effects enhancements

MPxDrawOverride can opt-in to being called from post-effects passes by specifying a classification of drawdb/geometry/includePostEffects. By default, draw overrides are not called for additional post-effect passes such as: depth-of-field, screen space ambient occlusion, and motion-blur.

MPxDrawOverride::excludedFromPostEffects() can be used to exclude a draw override from being called for post-effects passes. See the rawfootPrintNode plug-in example.

Note: The use of the method MPxDrawOverride::excludedFromPostEffects() is preferable to the use of the classification string.

New pass semantics have been added to MPassContext - MPassContext::kDOFPassSemantic, and MPassContext::kMotionVectorPassSemantic. These are equivalent to checking for the strings dofPass and motionVectorPass in previous releases. MPassContext::kPEPatternPassSemantic and MPassContext::kNonPEPatternPassSemantic have been added to indicate a post effect pattern pass and a non post effect pattern pass, respectively.

The ProjectionZSense semantic has been added that denotes whether the projection matrix flips the Z component of a point when transformed: if so, its value is -1.0; otherwise 1.0. See Shader semantics supported by Viewport 2.0.

For more information regarding these passes, see Effects interfaces.

Shaders

MShaderInstance

MShaderManager

MPxShaderOverride

MPxHwShaderNode

MRenderItem

Textures

MTextureManager

Lighting

In Maya 2016 Extension 2, Viewport 2.0 only evaluates lights up to the light limit. Therefore, if you want to request light information on demand, you must call the new MRenderer::needEvaluateAllLights() method.

If your plug-in calls the following interfaces:

You must first call this method before drawing.

If you do not want to modify your existing plug-in, you can also set an optionVar MAYA_VP2_IGNORE_EVALUATION_LIGHT_LIMIT=1 to ensure that your plug-in continues to work as it did before Extension 2. When this optionVar is set, all lights in your scene are evaluated at all times, regardless of whether you have loaded a plug-in. As a result, this optionVar may decrease the performance of Viewport 2.0 if you have a scene with many lights.

To mitigate this, you can set this optionVar to 0 again when your plug-in no longer needs to evaluate all lights, and Viewport 2.0 will revert back to only evaluating lights up to the light limit.

Geometry

Locators

Cameras

Render overrides

MQuadRender

Implement an MRenderOverride

It is now easier to implement an MRenderOverride. New classes and interfaces have been added that allow you to create a render override by populating a list of MRenderOperations. To create this list, you can obtain the list of standard viewport operations, and then optionally add to it your own custom operations.

This new method of implementation also eliminates the need for an MRenderOverride to manage and create render targets, as these are now managed by MRenderOperation.

New classes and interfaces added include:

See Implementing an MRenderOverride.

Tools and context

MPxContext

Tracing/sequencing

Debug tracing information has been added for several override classes to help track evaluation order, as well as to the internal pipeline to track renderable list execution.

MPxDrawOverride and MPxGeometryOverride have new tracing methods (such as MPxDrawOverride::traceCallSequence() and MPxDrawOverride::handleTraceMessage(), and the ogs command has a new trace option (-traceRenderPipeline flag).

See Basic Viewport 2.0 Pipeline Sequencing and Basic Viewport 2 Object Sequencing for more information.

Profiling

The Profiler now graphs rendering events that execute within Viewport 2.0. These events include node evaluation and UI drawables list/render list building, as well as draw events such as UV Editor drawing, beauty pass render, and UI drawables rendering (such as manipulator drawing). If you are using a render override plug-in, operations such as the quad render, 3d scene render and HUD render are also presented.

This feature allows you to identify render events or passes that may be performance bottlenecks in your scene

To filter these events, search for the prefix Vp2.

For more information on rendering events in Viewport 2.0, as well as information on what each event represents, see Profile Viewport 2.0 rendering events and Viewport 2.0 rendering events Profiler examples.

Render Setup

A new MRenderSetup class has been added that allows for access to Maya's new render setup functionality.

Performance improvements for Viewport 2.0 API plug-ins

Developer Kit examples

Documentation updates

Animation

GPU Override

Added the following functions for tracking the GPU memory usage:

Note: To avoid running out of GPU memory, Maya GPU buffers might be moved to system memory when GPU memory is almost full. This process relies on accurately tracking the GPU memory usage.

New convenience class that makes allocating, updating, and releasing OpenCL buffers easy

Added the following functions to get correct behavior in certain scenarios without having to turn off and turn on the GPU override:

Note: The MGPUDeformerRegistrationInfo::validateNode() function has been removed.

Function to detect change in attributes

Added the following functions in the MOpenCLInfo class to localize strings.

MOpenCLInfo interface name change

MultiDraw consolidation support

Modeling

OpenMaya

Updated the MFnBlendShapeDeformer interface

User interface

General

New MRandom namespace

New methods for working with double precision meshes

Added the following functions to mute reference edits in a file reference node temporarily:

Added the following functions to create a proxy attribute:

Developer Kit example update

The Alembic version has been upgraded to 1.5.8. The AbcExport and AbcImport plug-ins now have the ability to import/export UV sets.

Effects and painting

The new MPaintMessage class has been added that allows you to register callbacks for vertex color paining. See the paintCallback developer kit example for a demonstration of how to use this class.