Important:
Updates to Maya 2022 will continue to support both Python 2 and Python 3. However, it is recommended that you migrate your Python 2 scripts and plug-ins to Python 3.
What's new in Maya 2022.1 at a glance
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.
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.
A new method, uniqueName()
has been added to MFnDependencyNode:
MString uniqueName(MStatus* ReturnStatus = NULL) const
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.
Three new selection levels have been added to the MSelectionContext::SelectionLevel
enum that specifies the granularity to use for a Viewport 2.0 selection:
kFace
: Face-level selection; only faces are selectablekEdge
: Edge-level selection; only edges are selectablekVertex
: Vertex-level selection; only vertices are selectableMSelectionContext::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
.
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.
The MFn.kAttribute2Long
and MFn.kAttribute3Long
Maya Python API 2.0 attributes have been deprecated. Use MFn.kAttribute2Int
and MFn.kAttribute3Int
instead.
pyside2-uic
and pyside2-rcc
are now included with Maya.
Users can now use pyside2-uic
to generate Python code from their .ui
files.
-fullPath
option was added to the duplicate
command.mayaInstallDir
option was added to the internalVar
command. This option returns the directory where Maya is installed. This directory will be identical to the one pointed to by MAYA_LOCATION on Linux and Windows, but will be different than the one pointed to by MAYA_LOCATION on macOS. On macOS, MAYA_LOCATION includes the path to the Contents
folder under Maya.app
. The directory returned by mayaInstallDir
does not include that path.Maya's Qt distribution now includes QML
The FreeImage and FreeType versions were corrected in the 2022 Open Source Components list.
The correct versions are: