What's New in the Maya 2022 devkit

{{toc}}

New in the Maya 2022.3 devkit

Two classes were added to the Maya API to replicate the behavior of jointOrient in a custom transform.

MPxTransformPreRotation lets a user-defined transform supply a pre-rotation, and MPxTransformationMatrixPreRotation lets a user-defined transformation matrix supply a pre-rotation.

Any code that used these two classes should be rewritten to use MPxTransformationMatrix::preRotation() and MPxTransform::getPreRotation() in Maya PR132.

Back to top

New in the Maya 2022.2 devkit

New download locations for Qt and PySide

The download location for Qt changed to https://github.com/autodesk-forks/qt5/releases/tag/Maya2022.2

And the download location for PySide changed to https://github.com/autodesk-forks/pyside-setup/releases/tag/Maya2022.2

Back to top

kSelectionHighlighting added to MGeometry::DrawMode

kSelectionHighlighting added to MGeometry::DrawMode.

When kSelectionHighlighting is passed to MRenderItem::setDrawMode(), the render item will only be drawn if selection highlighting is enabled.

The gpuCache devkit example has been updated to use this new enum.

Back to top

snapToActive() added to MSelectionInfo

The snapToActive() method has been added to MSelectionInfo:

bool MHWRender::MSelectionInfo::snapToActive (MStatus* ReturnStatus = nullptr) const

snapToActive() returns true if an active object should be snapped to, and returns false otherwise.

Back to top

InternalObjectId() added to MRenderItem

MUint64 MRenderItem::InternalObjectId() const returns a unique identifier for a render item. If two MRenderItems hold the same internal render item, they will have the same InternalObjectIds.

Back to top

New in the Maya 2022.1 devkit

Change to the way maya.api.OpenMaya.MFnMesh() handles empty meshes

maya.api.OpenMaya.MFnMesh() in the Maya Python API 2.0 now returns an error when it is initialized with an empty mesh. This aligns it with the way maya.OpenMesh.MFnMesh() Maya Python API 1.0 handles empty meshes.

Back to top

isValidReference() added to MFnReference

A new method, isValidReference() has been added to MFnReference:

bool isValidReference(MStatus* ReturnStatus = NULL) const

The method returns true if the reference is a valid file reference. This method is used to validate a file reference before passing it to other methods, such as MFnReferemce::isLoaded(), to avoid triggering an exception.

Back to top

uniqueName() added to MFnDependencyNode

A new method, uniqueName() has been added to MFnDependencyNode:

MString uniqueName(MStatus* ReturnStatus = NULL) const

Back to top

New overloaded getReferenceNodes() method added to MFileIO

A new overloaded getReferenceNodes() that has dagPath as a parameter has been added to MFileIO.

MStatus MFileIO::getReferenceNodes(const MString& fileName, MStringArray& nodes, bool dagPath)

When dagPath is set to true, the names of any returned dag objects will include enough path to make their names unique. When set to false, the names of the dag objects are returned without a path.

dagPath is false by default, and getReferenceNodes(const MString& fileName, MStringArray& nodes) will return the names of dag objects without their paths.

Back to top

New selection levels added to MHWRender::MSelectionContext::SelectionLevel

Three new selection levels have been added to the MSelectionContext::SelectionLevel enum that specifies the granularity to use for a Viewport 2.0 selection:

MSelectionContext::setSelectionLevel() can now take any one of five selection levels: kComponent, kObject, kFace, kEdge, and kVertex.

Similarly, MSelectionContext::selectionLevel() can now return any one of five selection levels: kComponent, kObject, kFace, kEdge, and kVertex.

MIntersection::selectionLevel() will continue to return either kObject or kComponent in Maya 2022 and its updates. However, in Maya PR132, MIntersection::selectionLevel() no longer returns kComponent. Instead, MIntersection::selectionLevel() returns one of the three new levels.

Plug-ins that test the selection level of a selection hit against the kComponent level should be updated to test against the three new levels when using Maya PR132 .

Back to top

New enum and new methods added to MHWRender::MRenderItem

A new enum and two new methods have been added to MHWRender::MRenderItem so that a MRenderItem can be filtered based on the default material setting of the viewport.

enum DefaultMaterialFiltering specifies how to handle drawing when the default material mode is active.

void setDefaultMaterialHandling(MRenderItem::DefaultMaterialFiltering state) determines whether this object should be drawn when default material mode is active.

MRenderItem::DefaultMaterialFiltering getDefaultMaterialHandling() const returns whether this render item will draw when default material mode is active.

Back to top

MFn.kAttribute2Long and MFn.kAttribute3Long have been deprecated

The MFn.kAttribute2Long and MFn.kAttribute3Long Maya Python API 2.0 attributes have been deprecated. Use MFn.kAttribute2Int and MFn.kAttribute3Int instead.

Back to top

Generating Python code from ui files using pyside2-uic

pyside2-uic and pyside2-rcc are now included with Maya.

Users can now use pyside2-uic to generate Python code from their .ui files.

Back to top

Changes to the duplicate and internalVar commands

Back to top

Qt distribution now includes QML

Maya's Qt distribution now includes QML

New in the Maya 2022 devkit

Changes to minimum requirements

New OS and compiler requirements

The minimum Maya Linux version has been updated to CentOS 7.6.

The devkit now requires gcc 9.3.1 and Visual Studio 2019.7

Back to top

Updated required libraries list for Maya on Linux

The required Linux libraries has been updated.

See Additional required Linux packages for Maya installation for the complete list of required Linux libraries.

Back to top

Python 3 support

Maya 2022 for Linux and Windows now supports both Python 2 and Python 3. However, future versions of Maya will only support Python 3.

Maya 2022 for macOS only supports Python 3.

Maya starts up in Python 3 mode by default

Note: Maya 2022 for Linux and Windows now supports both Python 2 and Python 3. However, future versions of Maya will only support Python 3.

Maya 2022 for macOS only supports Python 3.

Maya on Windows and Linux now start in Python 3 mode by default. However, if needed, it can still be started in Python 2 mode.

To start Maya in Python 2 mode, start Maya from the command line with -pythonver 2. For example, to start Maya on Windows in Python 2 mode, run maya.exe -pythonver 2 from a command window.

Alternately, you can use the MAYA_PYTHON_VERSION environment variable to set the Python mode.

  1. Open a command or terminal window
  2. Set the MAYA_PYTHON_VERSION environment variable to 2
  3. Start Maya from the same command or terminal window.

The Python mode specified in the Maya start up command will override the mode specified by MAYA_PYTHON_VERSION.

Back to top

Render.exe and Render.sh can now run in either Python 2 or Python 3 mode

The pythonver command line option has been added to the command line renderer on Windows and Linux. This lets users choose whether they want to run the command line renderer in either Python 2 or Python 3 mode.

Use Render.exe -pythonver 2 on Windows or ./Render -pythonver 2 to use Python 2.

Use Render.exe -pythonver 3 on Windows or ./Render -pythonver 3 to use Python 3.

Back to top

New pip support

mayapy now supports installing Python 3 modules with pip. To use pip with mayapy, use the following commands:

Linux ./mayapy -m pip <command>
macOS ./mayapy -m pip <command>
Windows mayapy -m pip <command>

See Managing Python packages with mayapy and pip for more information.

Back to top

Notable changes to third party components

Qt and PySide have been updated to version 5.15.2

The versions of Qt and PySide used by Maya have been updated to version 5.15.2. Any code that uses an older version of Qt will need to be recompiled.

Back to top

Updates to Alembic and OpenEXR libraries

Updates have been made to the Alembic and OpenEXR libraries packaged with Maya. Minor security updates have been made to Alembic, and OpenEXR has been updated to version 2.4.1.

Plug-ins that rely on these libraries will need to be recompiled.

Back to top

Qt Creator Tools

Qt Creator auxiliary tools will not be distributed in their entirety with Maya from this point forward.

Qt Creator tools can be downloaded from the Qt website.

Back to top

Generating Python code from ui files

Starting in PySide 5.14, the pysideuic module has been removed by QtC.

Users should use:

uic -g python <ui_file> -o <output_python_file>

to generate python code from their .ui files.

Back to top

The Maya Script Editor now fully supports Unicode characters

The Maya Script Editor now fully supports Unicode characters. Python scripts are now saved using UTF-8 encoding as prescribed by PEP-263, ensuring that file contents do not appear corrupted when reopened.

If a script containing international characters needs to be read by the script editor in an earlier version of Maya that does not support UTF-8, a new option in the Maya Preferences menu lets you save files using the system encoding instead. Go to Preferences -> Settings -> Files/Projects, scroll down to Script Editor and select system encoding from the drop-down menu.

The script editor now also correctly reads, and can optionally insert, magic comments indicating the encoding to use.

New environment variables

Two new environment variables, MAYA_BATCH_STDOUT_LOGGING_LEVEL and MAYA_BATCH_STDERR_LOGGING_LEVEL, have been added to control what is output to stderr and stdout by scripts, commands, and API calls.

Valid values for both variables are all, info, result, warning, error, and none.

MAYA_BATCH_STDOUT_LOGGING_LEVEL defaults to none, and MAYA_BATCH_STDERR_LOGGING_LEVEL defaults to all.

See Output stream variables.

Back to top

Opting out of analytics when starting Maya in batch mode

When starting Maya in batch mode, analytics will run by default. To opt out of analytics, set MAYA_DISABLE_ADP to 1 before starting Maya.

See General variables.

Back to top

AutoLoadOnce option added to PackageContent.xml

A new option, AutoLoadOnce has been added to the PackageContents.xml file that is used when distributing plug-ins using the Autodesk App Store format. When set to True, the plug-in will be autoloaded the first time Maya is started after it has been installed. However, if the plug-in's autoload option is unchecked in the plug-in manager, the plug-in will not be autoloaded on startup from that point on.

<ComponentEntry ModuleName="./Contents/plug-ins/myNode.py" AutoLoadOnce="True" />

See the section on distributing applications through the Autodesk app store for more information.

Back to top

API changes

New smart pointer

MSharedPtr<> has been added to Maya.

MSharedPtr<> objects are used in the Maya API to make object ownership explicit. They must be used with the Maya APIs that use MSharedPtr<>. No other object ownership scheme may be mixed with usage of MSharedPtr<>.

As with any other smart pointer, hold an MSharedPtr<> for any object you may want to reuse later. Maya will hold its own MSharedPtr<> for any objects it may use again later to prevent the objects from being destroyed and deallocated.

Back to top

New validator for decimal indicators

The MayaQclocaleDoubleValidator was added to maya.internal.common.qt.doubleValidator to accomodate locales where decimal values use commas instead of periods.

This validator should be used instead of QDoubleValidator when developing a user interface with PySide.

Back to top

New class in OpenMayaAnim module

MFalloffContext has been added to the OpenMayaAnim module.

Back to top

New class added as part of the GPU deformer upgrades

MFnFloatVectorArrayData has been added to provide access to MFloatVectorArray. This is part of the GPU deformers upgrade.

Back to top

New class and methods to perform MRenderItem-specific evaluations

MPxViewportComputeItem has been added to perform MRenderItem-specific evaluation. MRenderItem::addViewportComputeItem() and MRenderItem::viewportComputeItem() have been added to associate MPxViewportComputeItem with an MRenderItem.

Back to top

New syntax for Python iterators

New iterator syntax has been added to both Python API 1.0 and 2.0.

The existing syntax calls next on the object: iterator.next().

The newly-added syntax calls next with the iterator as the parameter: next(iterator).

The existing syntax has not been deprecated in the Maya Python APIs, and any plug-ins and applications that use the existing syntax do not need to be updated to use the new syntax.

Examples that used the existing syntax have been updated to use the new syntax.

Back to top

Changed behavior for MGlobal::setActiveSelectionList()

Calling MGlobal::setActiveSelectionList() with an empty selection list no longer clears the active selection list regardless of the ListAdjustment parameter value.

Now MGlobal::setActiveSelectionList() behaves as expected: when it is called with an empty selection list, it will delete the list if ListAdjustment is set to kReplaceList, otherwise it will do nothing.

Back to top

Deprecated method and changed behavior in MCacheSchema

The following changes have been made to the MCacheSchema class:

reset() has been deprecated. It should be removed from any code that uses it.

attributes() is now a range over MObject rather than MPlug. Any code that uses this method needs to be modified to reflect this change.

For example, if the original code used:

for (MPlug plug : schema.attributes())  
    {
      //...
    }

it must be changed to:

for (MObject attribute : schema.attributes())
    {
      //...
    }

Back to top

Changes to MItGeometry constructors

Two new constructors have been added:

The new non-empty constructor is used when iterating over a subset of the geometry specified by a componentTagExpression.

The behavior of

MItGeometry (MDataHandle &dataHandle, unsigned int groupId, bool readOnly, MStatus *ReturnStatus)

has changed. Now when a groupID of 0 is passed to it, zero vertices are returned instead of all vertices. To return all vertices, pass the constructor a groupID of -1.

Back to top

Changes to MRenderItem

Six methods have been added to MRenderItem.

One method was added to set the primitive type of a RenderItem explicitly created by a plug-in:

Two new methods were added for the purpose of marking objects for display filtering:

setObjectTypeExclusionFlag() sets a bit flag for display filtering based on object type. objectTypeExclusionFlag() queries the bit flag.

Three methods were added that use the new MSharedPtr:

Three methods have been deprecated:

Note: You will need to replace any instances of setShaderFromNode() in your code with setShaderFromNode2().

Back to top

New attribute and method added to MPxGeometryFilter

The componentTagExpression attribute has been added to MPxGeometry filter in the OpenMayaAnim module.

The following new method was also added to the class:

MFnGeometryData::SubsetState getGeometryIterator (MItGeometry &iter, MDataBlock &block, MDataHandle &dataHandle, unsigned int multiIndex, bool readOnly=true, MStatus *ReturnStatus=nullptr) const

Back to top

New interface added to MRenderOverride in the OpenMayaRender module

The following interface was added to MRenderOverride to override the default Viewport 2.0 selection:

virtual bool MRenderOverride::select(const MFrameContext& frameContext, const MSelectionInfo& selectInfo, bool useDepth, MSelectionList& selectionList, MPointArray& worldSpaceHitPts)

Back to top

New methods added to MSelectionInfo in the OpenMayaRender module

The following methods were added to MSelectionInfo:

pointSnapping() determines whether the Viewport 2.0 selection is launched to find snap points, and cursorPoint() queries the cursor point relative the lower left corner of the viewport.

Back to top

New methods and types added to MFnGeometryData to support component tags

Back to top

New methods and types added to MItDependencyGraph

Several new methods and types have been added to MItDependencyGraph to allow for traversing on graphs based on different relations. Whereas previously it only followed "affects" relationships, it can now traverse dependencies, traverse dependency graph connections, or traverse the evaluation graph.

New type:

enum MItDependencyGraph::Relationship

New constructors:

New methods:

Back to top

New methods added to MFragmentManager

Two new methods were added to MFragmentManager to add and remove, respectively, a specific shader stage's input parameters.

Three new methods were added to manage the mapping between parameter names and transient names.

Back to top

New method added to MSelectionList

MStatus getPlug ( unsigned int index, bool convertComponents, MPlug &plug ) const has been added to MSelectionList. convertComponents controls whether selected components are converted to their equivalent plug when possible.

Back to top

New method added to MDGModifier

MStatus deleteNode( const MObject & node, bool includeParents ) has been added to MDGModifier. This method exposes a boolean parameter that controls whether a DAG node's parents will be considered for deletion when it is deleted.

Back to top

New methods added to MPxGPUDeformer

Two new methods have been added to MPxGPUDeformer:

getFixedSetupData() facilitates sharing of setup data between the CPU and GPU versions of the deformer node.

hadPlugBeenModified() indicates whether a plug has been changed since the last call to MPxGPUDeformer::evaluate().

The offsetNode example has been updated to use getFixedSetupData() .

Back to top

New method added to MFnNurbsCurve

A new method has been added to MFnNurbsCurve:

double findParamFromLength( double partLength, double tolerance, MStatus * ReturnStatus = NULL ) const

This method is identical to the two parameter findParamFromLength() method, but adds a tolerance parameter to control the search precision.

Back to top

New methods added to MEvaluationNode

Two new methods have been added to MEvaluationNode:

skipEvaluation() tries to mark an attribute as skippable so that it is not evaluated by the Evaluation Engine. skippingEvaluation() returns true if an attribute is marked as skippable.

A new example, simpleSkipNode, has been added to demonstrate the use of these new methods.

Back to top

New methods added to MPxCustomEvaluator

Two new methods have been added to MPxCustomEvaluator:

A new example, evaluationPruningEvaluator, has been added to demonstrate the use of these new methods.

Back to top

New methods added to MGPUDeformerRegistrationInfo

Four new methods have been added to MGPUDeformerRegistrationInfo:

Back to top

Changes to MGPUDeformerBuffer

Two new methods added to MGPUDeformerBuffer:

And the signature for MGPUDeformerBuffer() has been changed from

MGPUDeformerBuffer(const MUniqueString& name, bool readOnly, unsigned int elementSizeInBytes, unsigned int elementCount, unsigned int capacityInBytes, const MAutoCLMem& buffer, const MAutoCLEvent& event);

to

MGPUDeformerBuffer::MGPUDeformerBuffer(const MPlug& plug, const MUniqueString& name, bool readOnly, unsigned int elementSizeInBytes, unsigned int elementCount, unsigned int capacityInBytes, const MAutoCLMem& buffer, const MAutoCLEvent& event);

Back to top

Signature changes in MGPUDeformerData and MPxGPUDeformer classes

The signature for MGPUDeformerData::getBuffer() has changed from

virtual MGPUDeformerBuffer MGPUDeformerData::getBuffer (const MUniqueString &name) const

to

virtual MGPUDeformerBuffer MGPUDeformerData::getBuffer(const MUniqueString& name, const MPlug& plug) const

The signature for MPxGPUDeformer::evaluate() changed from

virtual DeformerStatus evaluate (MDataBlock &block, const MEvaluationNode &evaluationNode, const MPlug &outputPlug, const MGPUDeformerData &inputData, MGPUDeformerData &outputData)

to

virtual DeformerStatus evaluate(MDataBlock& block, const MEvaluationNode& evaluationNode, const MPlug& outputPlug, const MPlugArray& inputPlugs, const MGPUDeformerData& inputData, MGPUDeformerData& outputData)

Back to top

New argument added to MPxCommand.setResult

A new argument, append, has been added to MPxCommand.setResult in Python API 2.0. When set to False, setResult returns a single value instead of a list.

To maintain backward compatibility, append is set to True by default.

Back to top

Other new methods

Back to top

Other deprecated methods

Back to top

Changes to devkit examples

New node IDs for several examples

The node IDs (MTypeID) of many examples have changed.

These changes were made to ensure that the node IDs used in all examples were unique.

However, any scene created using an example with a changed node ID will no longer open. You will need to recompile the example and recreate the scene.

If you will be using an example in production, request a unique ID from http://mayaid.autodesk.io/ and use the provided node ID in the example before compiling.

Back to top

Python examples have been moved and renamed

Python API 1.0 examples have been renamed to have the py1 prefix, and Python API 2.0 examples have been renamed to have the py2 prefix.

Python examples have also been moved from the scripting directory to the python directory.

Platform Python API 1.0 Python API 2.0 Python standalone applications
Windows devkit\plug-ins\python\api1 devkit\plug-ins\python\api2 devkit\applications\python
macOS and Linux devkit/plug-ins/python/api1 devkit/plug-ins/python/api2 devkit/applications/python

Back to top

New examples

Back to top

Updated examples

The folllowing examples have been updated:

Back to top

Alembic examples updated to only support Ogawa Alembic files

Maya no longer supports HDF5 variants of Alembic. Because of this, the following devkit examples now only support Ogawa Alembic files:

Back to top

Removed examples

The following examples have been removed:

Back to top

Scripting changes

UFE-aware commands

Some commands now accept UFE path strings.

Commands that are UFE-aware will have different syntax than non-UFE-aware commands.

The following is a list of UFE-aware commands. You are encouraged to look at the technical documentation for these commands before using them:

{{#style "tablenobordernocolor"}}

| | | | | --- | --- | --- | | | |

|

{{/style}}

Back to top

New plug-ins

Back to top

New commands

The FBXExtPlugin command has been added to the fbxmaya plug-in. This command lets the user pass arguments to the FBX Extensions plug-in.

The mimicManipulation command has been added to Maya.

Back to top

New flags and options

The mergeBaseAnimLayer (mbl) and uiLoadConfiguration (ulc) options have been added to the file command.

autoExpandAnimatedShapes (xas) flag has been added to the outlinerEditor command.

noIntermediate (ni) flag has been added to the sets command.

The dumpInfo (di) option has been added to the deformerEvaluator command. Executing deformerEvaluator -di prints debug information about the deformer evaluator's clusters in JSON format.

Two new options, startTime (s) and endTime (e), have been added to the filterCurve command. These options specify the start time and end time, respectively, of the section to filter.

Three new options, stash, unstash, and clearStash, have been added to the optVar command. These options let you backup and restore a variable.

Several new options related to deformable chains have been added to the geometryAttrInfo and deformableShape commands.

Several new options have been added to the ghosting command to support the new ghosting editor workflows.

Back to top

Changed flags and options

The deformableShape command's componentTagInjection (cti) option has been renamed tagInjectionList (til), and three new options, createUpstreamTagInjectionNode, tagInjectionNode, and upstreamTagInjectionNode have been added.

The name flag has been removed from the deleteAttr, affectedNet, and dynExpression commands.

To specify all keys when using the cutKey Python command, use time=(None,None) rather than time=().

Back to top

Removed script

The performSkinCluster.mel script has been removed. The equivalent functionality can be achieved using:

import maya.internal.nodes.skincluster.cmd_create as sk_create
sk_create.Command().executeWithDefaults()

Back to top