The Maya 2016 Developer Kit is now available online at Autodesk Exchange at https://apps.exchange.autodesk.com/MAYA/en/Home/Index.
Jump to the following sections:
Maya 2016 Extension 2 is not binary compatible with Maya 2016. To obtain the Maya 2016 and Maya 2016 Extension 1 API Guide, see http://www.autodesk.com/me-sdk-docs-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.
Since Extension for Maya 2015, 23 new classes have been added to the Python API 2.0 and additional developer kit examples are also available in the plug-ins\scripted directory of the Maya Developer Kit. All Python API 2.0 developer kit examples are named with the prefix py.
For a list of Python classes added since Extension for Maya 2015, see New Python API 2.0 classes in Maya 2016.
The Python Learning Path is updated to include Python API 2.0 examples.
The ordering of the calls made through the UI manager interface is now consistent with the ordering used for the legacy default viewport
The uiDrawManager developer kit example has been modified to include the option to draw an icon per locator, as well as the ability to choose the icon name and scale factor from the Attribute Editor. The icon option appears in the UI Type drop-down list and an Icon Parameters section is available that contains drop-down lists for the Icon and Icon Scale attributes.
This image shows the drawing of a set of icons, where each icon is a locator created using the uiDrawManager developer kit example.
XML schema files are now available as part of the install in the ..bin/ShadeFragment folder of the Maya installation.
v2pFragment.xsd is the XML schema for shading fragments, and can also be found in XML Schema for Shading Fragments.
vp2FragmentGraph.xsd is the XML schema for fragment graphs, and can be found in XML Schema for Fragment Graphs.
Added new MFrameContext::getHwFogParameters() method, which allows users to obtain global fog parameters from the frame context. The method returns struct HwFogParams which includes the following information: whether hardware fog is enabled, hardware fog mode, fog start, fog end, fog density, and fog color.
See also Hardware fog specific semantics and Shader semantics supported by Viewport 2.0.
Added new pass semantic for selection: MPassContext::kSelectionPassSemantic. This pass only occurs during Viewport 2.0 selection and for MRenderItem::OverrideNonMaterialItems, so that the MPxShaderOverride can select the proper effect/pass.
Previously, when an MRenderOverride does not set override render targets, the targets that were used were of a preset (fixed) format.
This behavior has been changed to use instead the Viewport 2.0 rendering options for Float Point Render Target and Multisample Anti-aliasing. You can find these settings by selecting Renderer > Viewport 2.0 > to open the Hardware Renderer 2.0 Settings window, and expanding the Anti-aliasing and Floating Point Render Target categories; or, by selecting Render > Render Settings to open the Render Settings window and clicking the Maya Hardware 2.0 tab, then expanding the Anti-aliasing and Floating Point Render Target categories.
For example, if a floating point format of R32G32B32A32_FLOAT is chosen, then the color render target will attempt to use the same floating point format.
If a plug-in wishes to use the previous fixed format, than it can define a single color target with format MHWRender::kR8G8B8A8_UNORM, and a single depth target with format MHWRender::D42S8.
The viewRenderOverrideFrameCache developer kit plug-in has been modified to output floating point EXR images which can be used in conjunction with setting a floating point format to get unclamped color image output.
Updated the function viewRenderSceneRender::displayModeOverride() in the viewRenderOverride developer kit example (viewRenderOverrideOperations.cpp) to show the use of kFlatShaded and kShadeActiveOnly.
The return type of MRenderOperation::targetOverrideList() has been changed from MRenderTarget** to MRenderTarget* const*. Maya will not change the individual MRenderTarget* pointers in the returned list.
New MRenderUtilities::renderMaterialViewerGeometry() method has been added that allows swatch rendering to be drawn by leveraging the Viewport 2.0 implementation of the Material Viewer in the Hypershade.
There are 3 ways to implement swatch rendering using the new API:
You can also use meshPlane as the shape parameter and kOrthogonalCameraCloseUp as the cameraMode to generate UV editor images from MPxHardwareShader::renderImage() and MPxHwShaderNode::renderImage().
In cases 2 and 3, Maya uses this API to render a default swatch.
The following developer kit example plug-ins have been updated accordingly:
MPxSubSceneOverride Enhancements
A new version of MTextureManager::acquireTexture() has been added that acquires a texture from a file on disk.
MTextureManager::acquireTexture(const MTextureArgments& args) takes the new class MTextureArguments as its input parameter. Using MTextureArguments, you can provide the arguments (such as file path and mip map levels) for the texture that needs to be obtained.
Essentially, the new MTextureManager::acquireTexture(const MTextureArgments& args) is almost identical to the existing MHWRender::MTextureManager::acquireTexture (const MString & textureName, const MString & contextNodeFullName, int mipmapLevels = 0, bool useExposureControl = true, const MString & layerName = MString(), int alphaChannelIdx = -1) . However, it has added one functionality. It can accept a file texture node that is required if you want to activate texture background loading. You can set the file texture node through the constructor of MTextureArguments or through the method MTextureArguments::setFileTextureNode().
See the Parallel mode description in the Material Loading Mode documentation in the Display preferences topic of the Maya User Guide for more information.
MPxShaderOverride Enhancements
The following new method allows plug-in writers to supply a shader to be used in non-textured mode. If this method is not specified, then a fixed grey shader is always used:
MVertexBuffer and MIndexBuffer Enhancements
You can test the SubSceneOverride version of the plug-in by following these steps:
loadPlugin apiMeshShape; createNode apiMesh; createNode apiMeshCreator; connectAttr apiMeshCreator1.outputSurface apiMesh1.inputSurface ; sets -edit -forceElement initialShadingGroup |transform1|apiMesh1;
MPxGeometryOverride Enhancements
MPxSubSceneOverride Enhancements
New classes: MSelectionContext, MIntersection, MSelectionInfo and MPxComponentConverter were added to support component selection in Viewport 2.0.
Several methods have been added to MRenderUtil for accessing the constant noise lookup table that Maya uses to compute many built in procedural textures (for example, Noise, Fractal, Volume Noise, Solid Fractal, and so forth).
Added a new variation of the MUIDrawManager::beginDrawable() method: beginDrawable(unsigned int name, bool nameIsPickable) which allows manipulator picking in a manner similar to MPxManipulatorNode::colorAndName().
Added new colorset semantic to shading node override fragment. A 4-float colorset varying parameter represents the vertex color. It is identical to the semantic fcolor, except that multiple colorset varying parameters are supported. See Shading Node Overrides.
It is now possible for plug-ins to add in pre and post render notifications similar to the interface provided in MUiMessage.
MHWRender::MRenderer has the following new interfaces:
One key advantage is that it is now possible to directly obtain the offscreen buffer / target used for rendering, while previously it depended mostly on guess-work to find the correct buffer to access. In general, this would be the back buffer for OpenGL; however, this does not work with unified back buffers on Linux. The new interface allows for platform and draw API agnostic access.
This allows the plug-in to query the maximum allowable output target size.
This allows the plug-in to set an override for the output target size.
This allows the plug-in to query the override size values. If none are set, then (-1,-1) is returned.
This allows the plug-in to unset/reset the override size (set back to -1,-1).
This method will now take into account any override output size. This is not a new method.
The following convenience methods were added to MRenderer:
The list of Semantics supported by Viewport 2.0 has been updated.
A new viewObjectSetOverride developer kit example has been added, and a description of the example is provided in Multiple Pass Scene Rendering.
A new plug-in onbShader has been added to the developer kit that creates a dependency node as a surface shader called onbShader in Maya.
In addition to implementing the dependency node, this plug-in also shows a complete implementation of a surface shader for Viewport 2.0.
It demonstrates how to define and register shading fragments and create a final fragment graph.
This example differs from the lambertShader/phongShader examples in that it does not re-use Maya's built-in fragments, but instead define its own via the plug-in.
In addition to implementing the dependency node, this plug-in also shows a complete implementation of a texture shader for Viewport 2.0.
It demonstrates how to define and register shading fragments to create a final fragment graph and associate it with the dependency node. In addition, this example also demonstrates how to create and access the noise lookup table that Maya uses for computing procedural textures.
The primary shading fragment defines a texture and sampler parameter pair for the noise lookup table. The noise lookup table is then used to build a 3d texture that the pixel shader can sample to compute the final ‘wave’ noise result. New MRenderUtil methods: noiseTableSize() and valueInNoiseTable() are used to access the noise lookup table values. See the simpleNoiseShader developer kit example for more information.
The footPrintNode developer kit example is now made simpler and demonstrates how to use MUIDrawManager to draw a simple locator in Viewport 2.0.
Plug-in code using MUIDrawManager offers the following advantages:
The original sample is now renamed to rawfootPrintNode which demonstrates how to draw the locator with raw OpenGL/DX calls.
The rawfootPrintNode example has been updated to show how an M3dView can be obtained using the method MFrameContext::renderingDestination() to find the destination name, and then how M3dView::getM3dViewFromModelPanel() can be used to obtain a corresponding M3dView for a panel with the given destination name.
A new plug-in footPrintNode_GeometryOverride has been added that implements a locator using an MPxGeometryOverride to obtain good draw performance when a large number of locators needs to be displayed at the same time. A Python version is also available.
The following roughly outlines the logic used in this example:
The SubSceneOverride version was updated to demonstrate support for DirectX11 mode. See the MVertexBuffer and MIndexBuffer Enhancements section above on this page for more information.
In order to compile the DX11 Shader plug-in provided in the developer kit using Visual Studio 2012, you must first compile the Microsoft DirectX SDK Effects11 library using the Visual Studio 2012 project file (Effects11_vs2012.vcxproj) provided in the devkit/plug-ins/dx11Shader folder by doing the following:
Frame and draw contexts topic added.
Scheduling of python plug-ins is now improved. Previously, Python nodes were run in parallel which could cause issues with lock contention, slowing down evaluation.
Python plug-ins are now globally serialized, avoiding issues with the GIL (global interpreter lock), and improving overall performance.
To provide scheduling of plug-in nodes, the following new enum and virtual method have been added to MPxNode. They are as follows:
Added the following new classes to support GPU override deformers:
Added new MFnMatrixArrayData class that allows your plug-ins to use MMatrixArray attribute types. This can be used to generate more compact graphs instead of creating multis of MMatrix types. One immediate use of this type is to read cached frame information computed by the new DeltaMush deformer.
A new MPxMotionPathNode class has been added, and is the base class for user defined motionPath nodes. It allows you to create your own motion path classes by providing methods that specify how the position, orientation and other attributes of connected nodes transform based on the position along the path. You can follow either of these workflows to use the MPxMotionPathNode class:
The advantage of MPxMotionPathNode over the built-in motionPath node is the ability to control how calculations are performed. Here are some examples of how you can create effects using the MPxMotionPathNode node:
Attach multiple outputs to the same custom motionPath node by creating a multi for your inputs and a multi for the outputs. To simulate multiple skiers in a line following the same path, simply specify a different relative offset along the path for each skier. To simulate a platoon of soldiers marching in a parade that turn corners smartly, specify offsets both along the path as well as horizontally.
See the motionPathNode developer kit example for an example of how to use the MPxMotionPathNode class to create sophisticated path animation effects.
MPxAnimCurveInterpolator is a new class that you can derive from to create user-defined animation curve interpolation types. It dictates how an animation curve evaluates between two keyframes.
Added the following new classes to support GPU override deformers:
Deformer classes have been re-organized. New classes:
Added new MPolyMessage::addUVSetChangedCallback() method to register callbacks for UV set modification messages, including notifications for adding and deleting of a UV set, as well as the switching of the current UV set.
Added a method MFnMesh::getPinUVs() to get the pinned UVs of the mesh, as well as the pin weights associated with those UVs.
Added new MPxPolyTweakUVInteractiveCommand command proxy class. This tool command proxy class provides a simplified way to interactively edit UVs on polygonal objects within interactive contexts. A user can provide new UVs during an interactive command, and by finalizing the editing, all interactive updates are recorded as a single command, and can be undone together.
When you instrument a procedure using MProfilingScope, you can also register an associated DG node. This way, when you select an instrumented event in your Profiler graph, its associated DG node is also selected and displayed in the Attribute Editor, Outliner or Node Editor.
MProfilingScope::MProfilingScope() now accepts an optional input parameter: an MObject that points to the associated node of the procedure being instrumented.
The MObject input parameter must point to a DG node and cannot point to an attribute or a component.
import maya.OpenMaya as OpenMaya import maya.cmds as cmds testCategoryIndex = cmds.profiler(addCategory = "testCategory") def associatedNode(): # Create a cone myCone = cmds.polyCone() mSelList = OpenMaya.MSelectionList() OpenMaya.MGlobal.getActiveSelectionList( mSelList) # Prepare the MObject to point to the cone. coneObj = OpenMaya.MObject() mSelList.getDependNode(0, coneObj) # Instrument the procedure and register its associated DG node; that is the cone node that was just created. profiler = OpenMaya.MProfilingScope(testCategoryIndex, OpenMaya.MProfiler.kColorE_L1, "associatedNode", "associatedNodeDesc", coneObj) cmds.select( myCone[0] ) cmds.rotate( '45deg', 0, 0, r=True ) cmds.profiler(sampling = True) associatedNode() cmds.profiler(sampling = False)
The Maya C++ API now supports 64-bit integers. The following interfaces have been added:
A new MDGModifier::pythonCommandToExecute() has been added that allows you to add an operation that executes a Python command/script to a dependency graph modifier.
This is the Python equivalent of the method MDGModifier::commandToExecute().
MPxShaderOverride non-virtual protected methods are now exposed in the .NET API, and you can use them to render your materials in Viewport 2.0: