Maya 2027 API Update guide

The guide is based on What’s New in the Maya Devkit in Maya 2027 with some extra info. The details could be found here.

Building environment

Here are the latest requirements:

Operating System Requirements
Windows Visual Studio 2022 v17.14.13
macOS macOS 14.0, XCode 16.2 or higher
Linux RHEL 8.10 or higher, DTS-14. gcc 14.2.1

Devkit Changes

  • libxml2 header directory moved
  • Python has been updated from 3.11.9 to 3.13.3
  • .net SDK has been updated to .net 10.
  • Qt has been updated to 6.

New Classes

MPxFileDialog

This class provides a base class from which a custom file dialog can be derived. A custom file dialog allows the user to inject a custom file browser within the standard Maya file dialog. When one or more custom file dialogs are present, Maya’s file browser UI will switch to a tabbed format with Maya’s standard file browser occupying the main tab and separate tabs provided for each custom browser. The MPxFileDialog class and architecture is strongly based on the QT QFileDialog class used by the standard Maya file dialog. Please refer to the QT documentation for details regarding those methods.

For more details, please check the document or the header files.

MPreviewRenderEnvironment

This class is created by MRenderUtilities, and it is used by LookDevX to generate offscreen shader preview. You can render preview of a shader node with

MStatus renderImage(MObject shaderNode, MImage &image);

and set clear color with

void setClearColor(float clearColor[4]);

The rest properties are read only, please check MRenderUtilities for more details.

API Changes

MFnDistanceManip

  • Added functions for enabling/disabling snap mode
MStatus		setSnapMode(bool state);
bool		isSnapModeOn(MStatus *ReturnStatus = NULL) const;

Check moveManip in the plugin for details.

MAnimUtil

There are updates for animation layers and animation layers usage with blend node plugs and animation curves.

  • Added an enum for filtering animation layers.
OPENMAYA_ENUM(AnimLayerFilter,
    kAllLayers,                    //!< All animation layers of the plug
    kAllUnlockedLayers,            //!< All unlocked animation layers of the plug
    kAffectingLayers,              //!< Animation layers affecting the value of the plug
    kAffectingUnlockedLayers,      //!< Unlocked animation layers affecting the value of the plug
    kActiveLayer                   //!< The active animation layer used for keying of the plug
);
  • Added methods for finding animation layers and getting active animation layer which affects the given plug.
static bool  findAnimationLayers( const MPlug &plug,
                                  MObjectArray& layers, //The out array will not be cleared. 
                                  AnimLayerFilter filter = MAnimUtil::AnimLayerFilter::kAllLayers,
                                  MStatus * ReturnStatus = NULL );
static MObject  findActiveAnimationLayer( const MPlug &plug, 
                                          MStatus * ReturnStatus = NULL );

If there are layers found, the result will be true/MObject. Otherwise, it will be false/MObject::kNullObj.

  • Add a method for finding the input plug of the blend node of the specified animation layer for the given plug. It will return the MPlug representing the input to the blend node for the specified animation layer or an empty plug if not found.
static MPlug findBlendNodeInputPlug( const MPlug &plug,
             				       const MObject &animLayer = MObject::kNullObj,
                                     MStatus * ReturnStatus = NULL );
  • Added methods for creating and finding animation curve
static MObject  findAnimCurve( const MPlug &plug, 
                               const MObject &animLayer = MObject::kNullObj,
                               MStatus * ReturnStatus = NULL);
static MObject  createAnimCurve( const MPlug &plug,
                                 MDGModifier &modifier,
                                 const MObject &animLayer = MObject::kNullObj,
                                 MStatus * ReturnStatus = NULL );

MFnPlugin

  • Added two methods for registering and deregistering MPxFileDialog

    MStatus registerFileDialog( const MString& fileDialogName, MCreatorFunction creatorFunction );
    MStatus deregisterFileDialog( const MString& fileDialogName);
    

MHWGeometry

  • createVertexBuffer has been merged into one method signature

    MVertexBuffer* createVertexBuffer(const MVertexBufferDescriptor& desc, bool useBufferFromDesc=false);
    

MVertexBuffer

  • The constructor has been merged into one signature

    MVertexBuffer(const MVertexBufferDescriptor& descriptor, bool softwareStaged=true, bool useBufferFromDesc=false);
    

MRenderItem

  • Added a function for getting ufePath

    MString ufePathString() const;
    

MPxShaderOverride

  • Added a method for indicating whether it supports non-texture shading.

    virtual bool supportsNonTextured() const;
    

MRenderUtilities

  • Added a static method for getting current IBL present path. It can be used in createPreviewRenderEnvironment.

    static MString getIBLPresetPath(const MString& iblPresetName);
    
  • Added a static method for creating MPreviewRenderEnvironment. The vaild shapes are "meshSphere", "meshPlane", "meshShaderball", "meshTeapot", "meshCloth", and "meshHair". The iblPath must be a path to an EXR file.

static MSharedPtr createPreviewRenderEnvironment(
		const MString& shape,
		const MString& iblPath,
		MaterialViewerCamera cameraMode,
		bool useDisplayColorSpace,
		float iblYRotation = 0.0f);

MSceneRender

  • Add a method to return a string list of excluded plugins for displaying. By default, it will return mPluginDisplayFilterExclusions member of the current class instance.

    virtual MStringArray & pluginDisplayFilterExclusions();
    

MRenderOverride

  • Add a method indicates which MRenderOperation should be applied with color management.

    virtual MRenderOperation * colorManagedOperation();
    


Comments

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading