What's new in the Maya 2023 devkit

Update:

{{toc}}

Changes to operating system requirements, CMake version, and third party library locations

New minimum macOS version

The new minimum version of macOS is 10.14.

Back to top

Updated CMake version

Devkit examples now require CMake version 3.13 or later to compile.

Back to top

Alembic libraries have moved

The Alembic libraries have moved. This change should be transparent as long as you are using the find_alembic macro in your CMakeLists.txt files.

If you are not currently using library macros, you are strongly encouraged to do so.

Back to top

Python changes

Python version updated to 3.9

Maya now only supports Python 3. Support for Python 2 has been removed on all platforms. You will need to update your plug-ins and scripts to Python 3.9.

If you have plug-ins or scripts written in Python 3.7, you may encounter issues when porting them to Python 3.9 as code compatibility is not guaranteed between these two versions.

PySide now also builds with Python 3.9.

Consult What's New in Python 3.8 and What's New in Python 3.9 for details.

Back to top

New Python site-packages directories

New site-package directories specific to Maya's release version have been introduced.

Operating system Path to new site-packages location
macOS $HOME/Library/Preferences/Autodesk/maya/2023/scripts/site-packages
linux $HOME/maya/2023/scripts/site-packages
Windows C:/Users/<username>/Documents/maya/2023/scripts/site-packages

This is an added directory. Packages will not be moved to this directory, and this directory will not replace any existing directories. However, packages in this directory will be prioritized over Maya's own site-packages directory.

Use the pip --target option to install packages to this location:

mayapy -m pip install <package_name> --target <full_path_to_maya_2023_site-packages>

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 .ui files.

Back to top

Improvement to the preference system

In order to improve how Maya handles preferences, changes have been made to the MGlobal class and the optionVar command.

Three new methods have been added to MGlobal:

And several new options and flags have been added to the optionVar command:

Back to top

API changes

Changes to MFnMesh

Change to the default tolerance of getPointsAtUV()

The default tolerance of MFnMesh::getPointsAtUV() has changed from 0 to 0.001. If no points are found, the method will no longer fail. Instead its arrays of points polygon IDs will be empty.

Back to top

New methods and new enums

The new BorderInfo enum holds information about whether an edge lies on geometry/UV borders or shares UVs. This enum is returned by the new edgeBorderInfo() method:

BorderInfo MFnMesh::edgeBorderInfo(int edgeId, unsigned int setId=-1, MStatus *ReturnStatus=NULL) const

The new getUVBorderEdges() method retrieves the edge indecies of edges lying on a UV border:

MStatus MFnMesh::getUVBorderEdges(unsigned int setId, MIntArray &edgeList) const

The new getMeshShellIds() method is the mesh counterpart to getUvShellsIds(). It returns an array of integers where each unique integer represents a mesh shell. The array lets users identify connected pieces of mesh.

MStatus MFnMesh::getMeshShellsIds(MFn::Type compType, MIntArray & meshShellIds, unsigned int & nbMeshShells)

The new getRawUVs() method returns a pointer to the internal texture coordinates for this mesh.

const float* MFnMesh::getRawUVs(MStatus*, const MString * uvSet = NULL) const;

The new BoolClassification enum indicates whether to use edge classification or normal classification when computing booleans between meshes using the booleanOps() method.

The signature of booleanOps() has changed to accommodate the use of this classification:

MStatus MFnMesh::booleanOps(BoolOperation op, const MObjectArray &meshes, bool useLegacy = false, BoolClassification classification = kNormalClassification)

The classification will be ignored if useLegacy is set to true.

Back to top

New overloaded create() and createInPlace() methods

The new overloaded methods mirror the mesh creation used by mayaAscii and mayaBinary file readers.

MObject create( const MPointArray &vertexArray, const MIntArray &edgeArray, const MIntArray &polygonCounts, const MIntArray &polygonConnects, MObject parentOrOwner = MObject::kNullObj, MStatus * ReturnStatus = NULL )

MObject create( const MFloatPointArray &vertexArray, const MIntArray &edgeArray, const MIntArray &polygonCounts, const MIntArray &polygonConnects, MObject parentOrOwner = MObject::kNullObj, MStatus * ReturnStatus = NULL )

MObject create( const MPointArray &vertexArray, const MIntArray &edgeArray, const MIntArray &polygonCounts, const MIntArray &polygonConnects, const MFloatArray & uArray, const MFloatArray & vArray, MObject parentOrOwner = MObject::kNullObj, MStatus * ReturnStatus = NULL )

MObject create( const MFloatPointArray &vertexArray, const MIntArray &edgeArray, const MIntArray &polygonCounts, const MIntArray &polygonConnects, const MFloatArray & uArray, const MFloatArray & vArray, MObject parentOrOwner = MObject::kNullObj, MStatus * ReturnStatus = NULL );

MStatus createInPlace( const MPointArray &vertexArray, const MIntArray &edgeArray, const MIntArray &polygonCounts, const MIntArray &polygonConnects )

MStatus createInPlace( const MFloatPointArray &vertexArray, const MIntArray &edgeArray, const MIntArray &polygonCounts, const MIntArray &polygonConnects )

Back to top

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

Changes to MIntersection::SelectionLevel() and MSelectionContext::SelectionLevel in OpenMayaRender

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

kComponent is still a valid selection level for MSelectionContext::setSelectionLevel() and MSelectionContext::selectionLevel(). However, for each individual selection hit, MIntersection::selectionLevel() will no longer return kComponent. Instead, MIntersection::selectionLevel() will return 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 instead.

Back to top

Changes to the reset() methods in MItMeshPolygon, MItMeshEdge, and MItMeshVertex

The following reset() methods in MItMeshPolygon, MItMeshVertex, and MItMeshEdge have been modified to remove invalid component IDs automatically:

MStatus MItMeshPolygon::reset( const MDagPath &polyObject, MObject & component )

MStatus MItMeshVertex::reset( const MDagPath &polyObject, MObject& component )

MStatus MItMeshEdge::reset( MObject & polyObject, MObject & component )

MStatus MItMeshEdge::reset( const MDagPath &polyObject, MObject & component )

Back to top

Enhanced GPU deformer APIs

Three classes and five methods have been added to simplify using GPU deformers.

The MOpenCLUtils, MOpenCLKernelInfo, and MPxGPUStandardDeformer classes have been added.

One new method has been added to MGPUDeformerRegistrationInfo:

virtual bool isGeometryFilter() const

And four new methods have been added to MPxGPUDeformer:

static bool isBufferUpdateNeeded(const MOpenCLBuffer& buffer, const MEvaluationNode& evaluationNode, const MObject& attribute)

cl_int uploadFixedSetupData(const MString& name, MOpenCLBuffer& buffer, cl_int& errorCode, unsigned int* arrayLength)

static MFnGeometryData::SubsetState getSubsetState(MDataBlock& block, unsigned int multiIndex, MStatus* ReturnStatus = NULL)

static const char* className()

The offsetNode example has been updated to use these new classes and methods.

Back to top

New class and methods added for creating a color managed color picker

Two new methods, MColorPickerUtilities::applyViewTransform() and MColorPickerUtilities::grabColor(), and one new class, MColorMixingSpaceHelper, have been added for creating a color managed color picker using the API.

MColor MColorPickerUtilities::applyViewTransform(const MColor &inputColor, Direction direction)

MColor MColorPickerUtilities::grabColor(MStatus * returnedStatus = nullptr)

grabColor() runs an eye dropper tool that lets users interactively grab a color on screen with their mouse. applyViewTransform() applies a color transform using Maya's color management settings.

Back to top

New MTimeSliderCustomDrawManager class

The MTimeSliderCustomDrawManager class has been added to the Maya API. This class provides a way to draw custom items on the timeline.

In PR131, three callback methods were added:

void setStopPrimitiveEditFunction(MCustomDrawID id, MSharedPtr< MStopPrimitiveEditingFct > fct)

void setStartPrimitiveEditFunction(MCustomDrawID id, MSharedPtr< MStartPrimitiveEditingFct > fct)

void setEditPrimitiveFunction(MCustomDrawID id, MSharedPtr< MEditPrimitiveFct > fct)

The three abstract classes, MStopPrimitiveEditingFct, MStartPrimitiveEditingFct, and MEditPrimitiveFct, were added to support these callbacks.

Back to top

Changed return type on MIndexMapper::affectMap()

The return type of MIndexMapper::affectMap() has changed from MIntArray to MUintArray.

MUintArray MIndexMapper::affectMap() const

Back to top

Changes to MUIDrawManager::setTexture()

The MUIDrawManager::setTexture() method has been modified. Two new parameters, inputColorSpace and alphaDiscardThreshold, have been added to its signature:

void MUIDrawManager::setTexture(MHWRender::MTexture* texture, const MString& inputColorSpace, const float alphaDiscardThreshold = 0.05f)

inputColorSpace is the color space of the texture that will be used to create a shader override when converting texture color to render space color.

alphaDiscardThreshold controls the shader that draws textured UI objects. Any parts of the texture that have an alpha value lower than the threshold will not be drawn. A threshold of 0.0 means everything will be drawn while 1.0 means nothing will be. This parameter was added in PR131.

Back to top

New selection highlighting added to MGeometry::DrawMode

kSelectionHighlighting has been 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 example has been updated to use this new enum.

Back to top

A new stock shader, k3dIsotropicStandardSurfaceShader has been added to the MShaderManager class.

The apiMeshShape example has been updated to use this shader instead of the Blinn shader.

Back to top

New enum and three new methods added to MRenderItem

A new enum and three new methods have been added to MHWRender::MRenderItem.

DefaultMaterialFiltering, setDefaultMaterialHandling(), and getDefaultMaterialHandling() were added 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 MHWRender::MRenderItem::setDefaultMaterialHandling(MRenderItem::DefaultMaterialFiltering state) determines whether this object should be drawn when default material mode is active.

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

And InternalObjectId() was added to provide a unique identifier for a render item:

MUint64 MHWRender::MRenderItem::InternalObjectId() const

It 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 enum and two new methods added to MUIDrawManager

A new enum and new method have been added to MHWRender::MUIDrawManager.

The DrawPass enum indicates whether a HUD pass item is drawn before or after the view cube.

beginDrawPass() specifies which draw pass items within the scope of beginDrawable() and endDrawable() will be added to.

MStatus MHWRender::MUIDrawManager::beginDrawPass(DrawPass pass)

A call to endDrawPass() must follow a call to beginDrawPass().

Back to top

Two new methods added to MPxTransform and MPxTransformationMatrix

Two new methods have been added to replicate joint-like behavior in custom transforms:

MQuaternion MPxTransformationMatrix::preRotation() const

MQuaternion MPxTransform::getPreRotation() const

MPxTransformationMatrix::preRotation() is an optional rotation that can be applied after the rotation channel and before the translation channel in the transform matrix. It can be used to replicate joint-like behavior in a custom transform.

MPxTransform::getPreRotation() returns the preRotation.

The rockingTransform example has been modified to use this new functionality.

Back to top

Two new methods added to MPlug

Two new methods, isProxy() and proxied(), have been added to MPlug.

bool MPlug::isProxy(MStatus* ReturnStatus ) const MPlug MPlug::proxied()

isProxy() returns true if the plug is a proxy plug. A proxy plug forwards its connection to another plug, and is not associated with a datablock.

proxied() returns the plug the proxy plug forwards to. If the plug is empty or not a proxy plug, proxied() will return the plug itself. If the plug iis an unconnected proxy, proxied() will return a null plug.

Back to top

thisMObject() added to several classes

thisMObject() has been added to the following classes

{{#style "tablenobordernocolor"}}

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

|

{{/style}}

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

getMemberPaths() added to MFnSets

A new method, getMemberPaths(), has been added to MFnSets:

MStatus MFnSet::getMemberPaths(MDagPathArray &members, bool shading) const

getMemberPaths() is used to get an array of dagPaths that are members of the set.

Back to top

isInCrashHandler() added to MGlobal

A new method, isInCrashHandler(), has been added to MGlobal:

bool MGlobal::isInCrashHandler()

isInCrashHandler() lets a plug-in query whether or not Maya has crashed. This is useful in the case where the plug-in is responding to a callback, especially one related to file I/O, as it lets the plug-in know if the callback was triggered by a crash.

Back to top

isValidReference() added to MFnReference

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

bool MFnReference::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 MFnDependencyNode::uniqueName(MStatus* ReturnStatus = NULL) const

Back to top

devicePixelRatio() added to M3dView

A new method, devicePixelRatio(), has been added to M3dView:

double M3dView::devicePixelRatio (MStatus* ReturnStatus = NULL) const

devicePixelRatio() returns the ratio of Qt logical pixels to viewport rendering pixels for the devide.

Back to top

ufeIdentifiersInUse() added to MPxSubSceneOverride

A new method, ufeIdentifiersInUse(), has been added to MPxSubSceneOverride:

bool MHWRender::MPxSubSceneOverride::ufeIdentifiersInUse() const

ufeIdentifiersInUse() returns true when a Maya feature that relies on Ufe Identifiers is enabled.

isEmpty() added to MString

A new method, isEmpty(), has been added to MString:

bool MString::isEmpty( ) const

isEmpty() will return true if the string is empty. It will return false otherwise.

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

Methods added to the Python API 2.0

The Python counterparts of the following C++ methods have been added to the Python API 2.0:

virtual void MPxNode::getCacheSetup(const MEvaluationNode&, MNodeCacheDisablingInfo&, MNodeCacheSetupInfo&, MObjectArray&) const

virtual void MPxNode::configCache(const MEvaluationNode&, MCacheSchema&) const

virtual MTimeRange MPxNode::transformInvalidationRange(const MPlug& source, const MTimeRange& input) const

bool MPxNode::hasInvalidationRangeTransformation() const

virtual void MPxGeometryOverride::configCache(const MEvaluationNode&, MCacheSchema&) const

Back to top

New and modified examples

A new py1ArrayAttrBlenderNode.py example demonstrates how to implement array attributes in a straightforward way.

The py1MoveTool.py example has been updated from using VP1 to using VP2, and updated to use Python API 2.0. It has been renamed to py2MoveTool.py.

The customImagePlane example has been updated to fix an issue where images were not animated when scrubbing.

The gpuCache example has been updated to use the new kSelectionHighlighting enum.

The rockingTransform example has been updated to use the new preRotation() method in MPxTransformationMatrix.

The offsetNode example has been updated to use the new GPU deformer API.

The apiMeshShape example has been updated to remove deprecated code, to fix a bug in the example, and to use the new k3dIsotropicStandardSurfaceShader stock shader.

Back to top

New Blue Pencil commands

The following Blue Pencil commands have been added:

These commands were introduced in an earlier PR under similar names prefixed with "cz", for example czBluePencilUtil.

Other scripting and node changes

Back to top