What's New in API in Maya 2017

API version and binary compatibility

Maya's API version has been updated (MAYA_API_VERSION is now 201700). Note that all plug-ins compiled against Maya 2016, including Maya 2016 Extension 1, 2 or service pack releases, must be re-compiled against Maya 2017 in order to be recognized by this version of Maya.

New Qt and PySide versions

Maya now uses Qt version 5.6.1 and PySide version 2.0.

See Building the plug-in for updated instructions on how to build Qt plug-ins.

Maya Developer Kit

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

Maya 2016 API Guides

The Maya 2016 Extension 2 API Guide is available online at http://www.autodesk.com/maya-sdkdoc-2016-enu. You can also obtain a downloadable version at http://www.autodesk.com/me-sdk-docs-2016.

The downloadable version of the Maya 2016 and Maya 2016 Extension 1 API Guide is available at http://www.autodesk.com/me-sdk-docs-2016.

Jump to the following sections:

Rendering

Fragment renderer

A viewRenderOverrideFromFragments example plug-in has been added which demonstrates the use of a set of new APIs that allow you to use scripted fragment and fragment graphs to render the scene and any desired post effects. Script fragments are the building blocks used internally by Maya for standard viewport rendering effects, and are located in a series of .xml files in the bin/ScriptFragment folder of your Maya installation directory.

The following API classes and interfaces have been added to enable you to create a fragment renderer:

  • Added a new MSceneRender constructor that allows you to provide the name of the fragment with which you want to render the scene.
    MSceneRender (const MString &name, const MString &fragmentName)
  • Added the MRenderParameters class that can be used to read or write render input values.
  • Added the MSceneRender::getParameters() method that returns a pointer to the MRenderParameters class, which is a block of render input parameters used to control the renderer.
  • Added the MSceneRender::fragmentName() method that returns the name of the script fragment or fragment graph for use when rendering the scene.
  • Added the MRenderScriptCallback class.

    Derive from this class to create a callback function that can be registered and called from your script fragment .xml. Implement the execute() function which allows you to obtain the MRenderParameters from the current renderer graph and three optional values coming from the script. Use this method to compute any desired behavior and call MRenderParameters::setParameter() to pass the results back to the script or to other connected fragments in the graph. See the Call command in the Script fragment commands topic for more information.

  • Added the MRenderer::registerScriptCallback() and MRenderer::deregisterScriptCallback() interfaces that allow you to register/deregister an MRenderScriptCallback. After registering, this callback can be called using the Call command in your script fragment .xml.
  • Register script fragments and fragment graphs to the Fragment Manager through MFragmentManager::addFragmentGraphFromFile(). Although this interface previously existed to support shade fragments and shade fragment graphs, it complements the new classes/ interfaces to provide the new functionality that allows you to create a custom fragment renderer.

See Write fragments and fragment graphs to render to the viewport.

Locators

Drawing

  • Two interfaces have been added to expose view filtering states: M3dView::viewIsFiltered() and M3dView::filteredObjectList().

    See the viewObjectSetOverride plug-in example in the Developer Kit.

  • For Python API 2.0, a new parameter isAlwaysDirty has been added as the last parameter to the constructor of MPxDrawOverride in order to align with its C++ counterpart.

    To achieve the best performance, set this parameter to False, and refrain from using the static draw callback.

    See the pyFootPrintNode.py Developer Kit example for more information.

Shading and color management

Selection

  • The MSelectionList::intersect() interface has been added that can be used to modify a selection list to contain the intersection of itself and the given list.
  • To clarify the usage of beginDrawable, the following changes were made to MUIDrawManager:
    • The non-parameter version of beginDrawable() was removed
    • The two-parameter version of beginDrawable (unsigned int name, bool nameIsPickable) was marked as deprecated
    • Added a new enum Selectability, and added a new two-parameter version of beginDrawable (Selectability selectability=kAutomatic, unsigned int selectionName=0)
    • The Python API 2.0 version of MUIDrawManager was also updated accordingly

    Refer to the uiDrawManager and lineManipContainer (C++ API) and the pyUiDrawManager.py (Python API 2.0) Developer Kit examples for more information.

Render overrides

  • A new method has been added:

    const MFrameContext* MRenderOverride::getFrameContext()

    This method allows access to the current frame render context information which is available between MRenderOverride::setup() and MRenderOverride::cleanup(). Per object / render item information is not available at setup time as the pipeline has not yet been run. Note that this provides information regardless of whether the override is called for viewport, Playblast, Render View or batch rendering.

    See the pyFrameContexTest.py plug-in example which demonstrates the use of MRenderOverride.getFrameContext() to extract various per-frame data.

Lights

It is now possible to combine a custom draw override with internal Viewport 2.0 lighting support by specifying both a "drawdb/light" and a "drawdb/geometry" classification when registering a node.

A sample use case is to draw a custom object in the viewport that performs lighting in Viewport 2.0 as a native Maya light would. See the apiDirectionalLightShape plug-in example and Registration for more information.

Geometry

The access of vertex ids, face ids and local parameterization is now exposed via the MGeometryExtractor interface. To extract completely unshared geometric data from a DAG shape, kPolyGeom_NotSharing needs to be specified when constructing an MGeometryExtractor instance.

Similar to MPxShaderOverride, there is no new interface on MGeometryExtractor that requests vertex ids, face ids or local parameterization. Instead MVertexBufferDescriptor should be specified with the following semantic names to populate these vertex buffers:

  • “vertexid” : When set, will return a vertex id buffer
  • “faceid” : When set, will return a face id buffer
  • “localuvcoord” : When set, will return a local uv coordinate buffer

Refer to the geometryReplicator plug-in example for more information. To execute this plug-in example, first set the following environment variables, then assign a hwPhongShader to the geometryReplicator shape.

  • MAYA_HWPHONG_TEST_VERTEXID_AND_FACEID = 1
  • MAYA_HWPHONG_TEST_LOCALUVCOORD=1
  • MAYA_HWPHONG_TEST_INDEXING=1

See Viewport 2.0: MGeometryExtractor access.

Animation

Custom evaluators

New API extensions have been added that let you define custom evaluators. Custom evaluators allow you to override how DG nodes are scheduled and executed by the evaluation manager. See Custom evaluator overview. See also MPxCustomEvaluator and the simpleEvaluator and constraintEvaluator plug-in examples in the Developer Kit.

Threading

Scene Assembly

A new MPxAssembly::postActivateRep() virtual function has been added that provides the assembly with an opportunity to perform operations on it after the representation has been activated.

General

Maya Viewport 2.0 and animation performance whitepapers

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.

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.