What’s New in API
 
 
 

The changes to the API are described in the following sections:

General Updates

Compiler information

Const changes

A number of methods which do not modify their objects have been changed to be const.

A number of method parameters which are not modified by the method have been changed to be const.

Reference documentation

API reference documentation for Maya now has improved styles and new functions to provide more useful and readable documentation, including:

New classes

We have added a number of new classes to this release.

MAtomic

The MAtomic class provides cross-platform atomic operations, such as incrementing and decrementing counters, which are useful when writing multi-threaded code.

MContainerMessage

The MContainerMessage class provides the ability to register callback functions for changes in the published attributes of a container.

MFnContainerNode

The MFnContainerNode class is a function set for creating, querying and editing containers.

MFnRenderPass

The MFnRenderPass class is a function set for working with render passes.

MFnUint64SingleIndexedComponent

The MFnUint64SingleIndexedComponent class is a function set for working with components which are indexed by an MUint64 (64-bit unsigned integer), such as subdivision surface vertex ids.

MMeshSmoothOptions

The MMeshSmoothOptions class is used to set and retrieve the options to be used with the MFnMesh::generateSmoothMesh method.

MNurbsIntersector

The MNurbsIntersector class provides methods for efficiently finding the closest point to a NURBS surface.

MPlane

The MPlane class is a utility class which describes a mathematical plane.

MPxCacheFormat

The MPxCacheFormat is used to implement new cache file formats in Maya.

MPxManipulatorNode

The MPxManipulatorNode class is used to create user-defined manipulators which can be used standalone or with MPxManipContainer.

MPxRenderPassImpl

The MPxRenderPassImpl class is used to create custom render passes.

MRenderPassDef

The MRenderPassDef class provides the ability to create, query and edit a render pass.

MRenderPassRegistry

The MRenderPassRegistry class is used to register render pass definitions with Maya and to retrieve already-registered render pass definitions.

MRichSelection

The MRichSelection class provides a selection list which retains soft selection and symmetry information.

MThreadUtils

The MThreadUtils class provides utility methods which are useful when writing threaded plug-ins.

MWeight

The MWeight class is used to access soft select and symmetric selection weights.

New methods

We have added the following new methods to this release:

M3dView

void getScreenPosition( int& x, int& y, MStatus* ReturnStatus = NULL ) const

Returns the position of the view's upper-left corner, in screen coordinates.

MStatus colorMask( bool& r, bool& g, bool& b, bool& a )

Retrieves the current color mask.

MStatus setColorMask( bool r, bool g, bool b, bool a )

Sets the color mask.

MDGMessage

static MCallbackId addPreConnectionCallback( MMessage::MPlugFunction func, void* clientData = NULL, MStatus* ReturnStatus = NULL )

Adds a callback which is called just prior to a connection being made or break.

MDrawInfo

bool inUserInteraction() const

Returns true if the current refresh is the result of the user interacting with the scene.

bool userChangingViewContext() const

Returns true if the current refresh is the result of the user manipulating view context tools such as tumble, dolly, track, etc. This is useful for changing drawing mode to something simpler to speed up interactive redraws.

MFileIO

static MPxFileTranslator* beforeOpenUserFileTranslator( MStatus* ReturnStatus = NULL )

Can be used within MSceneMessage::kBeforeOpen and MSceneMessage::kBeforeOpenCheck callbacks to return the plug-in file translator being used, if any.

static MPxFileTranslator* beforeImportUserFileTranslator( MStatus* ReturnStatus = NULL )

Can be used within MSceneMessage::kBeforeImport and MSceneMessage::kBeforeImportCheck callbacks to return the plug-in file translator being used, if any.

static MPxFileTranslator* beforeSaveUserFileTranslator( MStatus* ReturnStatus = NULL )

Can be used within MSceneMessage::kBeforeSave and MSceneMessage::kBeforeSaveCheck callbacks to return the plug-in file translator being used, if any.

static MPxFileTranslator* beforeExportUserFileTranslator( MStatus* ReturnStatus = NULL )

Can be used within MSceneMessage::kBeforeExport and MSceneMessage::kBeforeExportCheck callbacks to return the plug-in file translator being used, if any.

static MPxFileTranslator* beforeReferenceUserFileTranslator( MStatus* ReturnStatus = NULL )

Can be used within MSceneMessage::kBeforeReference and MSceneMessage::kBeforeReferenceCheck callbacks to return the plug-in file translator being used, if any.

MFileObject

void setResolveMethod( MFileResolveMethod method )

Sets how file path resolution should be done.

MFileResolveMethod resolveMethod() const

Retrieves the method being used to resolve file paths.

MFnCamera

MStatus getViewParameters( double windowAspect, double& apertureX, double& apertureY, double& offsetX, double& offsetY, bool applyOverscan = false, bool applySqueeze = false ) const

Returns the raw viewing parameters which MFnCamera::getViewingFrustum and MFnCamera::getRenderingFrustum use internally in their calculations.

MStatus setDisplayGateMask( bool displayGateMask )

If the film or resolution gate is active, this method can be used to set whether the masked portion outside the gate is shaded to make it more visible.

MFnComponent

bool hasWeights() const

Returns true if the component has soft selection or symmetry weight data attached.

MWeight weight( int index, MStatus* ReturnStatus = NULL ) const

Returns the soft selection or symmetry weight data for a given element within the component.

MFnDependencyNode

MStatus dgTimerOn()

Turns the node's dependency graph timer on. DG timers are used to collect timing information for performance analysis.

MStatus dgTimerOff()

Turns the node's dependency graph timer off. DG timers are used to collect timing information for performance analysis.

MdgTimerState dgTimerQueryState( MStatus* ReturnStatus = NULL )

Returns the current state of the node's dependency graph timer. DG timers are used to collect timing information for performance analysis.

MStatus dgTimerReset()

Resets the node's dependency graph timer and counters to zero. DG timers are used to collect timing information for performance analysis.

double dgTimer( const MdgTimerMetric timerMetric, const MdgTimerType timerType, MStatus* ReturnStatus = NULL ) const

Returns the specified timer value for the node. DG timers are used to collect timing information for performance analysis.

MStatus dgCallbacks( const MdgTimerType type, MStringArray& callbackName, MDoubleArray& value )

Returns how much of the time logged against a node's DG timer was spent in each type of callback. DG timers are used to collect timing information for performance analysis.

MStatus dgCallbackIds( const MdgTimerType type, const MString& callbackName, MCallbackIdArray& callbackId, MDoubleArray& value )

Returns how much of the time logged against a node's DG timer was spent in each callback method for a given type of callback. DG timers are used to collect timing information for performance analysis.

MString pluginName( MStatus* ReturnStatus = NULL ) const

If the node is from a plug-in, this method returns the plug-ins pathname.

MFnMesh

MStatus getSmoothMeshDisplayOptions( MMeshSmoothOptions& options ) const

Retrieves the current display smoothing options for the mesh.

MStatus setSmoothMeshDisplayOptions( const MMeshSmoothOptions& options )

Sets the current display smoothing options for the mesh.

MStatus booleanOp( BoolOperation op, MFnMesh& mesh1, MFnMesh& mesh2 )

Computes a boolean operation between two meshes.

const float* getRawPoints( MStatus* ) const

Returns a pointer to the internal vertex list for this mesh.

const float* getRawNormals( MStatus* ) const

Returns a pointer to the internal normal list for this mesh.

MStatus getVertexNormal( int vertexId, bool angleWeighted, MVector& normal, MSpace::Space space = MSpace::kObject ) const

This variant of getVertexNormal allows the caller to turn off the weighted averaging Maya normally uses when calculating normals in favor of a simple average which is much faster.

MStatus getVertexNormals( bool angleWeighted, MFloatVectorArray& normals, MSpace::Space space ) const

This variant of getVertexNormals allows the caller to turn off the weighted averaging Maya normally uses when calculating normals in favor of a simple average which is much faster.

MStatus getColorSetFamilyNames( MStringArray& familyNames ) const

Get the names of all of the color set families on this object.

MStatus getColorSetsInFamily( const MString& familyName, MStringArray& setNames ) const

Get the names of the color sets that belong to a color set family.

bool isColorSetPerInstance( const MString& name, MStatus* ReturnStatus ) const

Returns true if the specified color set is per-instance and false if it is shared across all instances.

MStatus getAssociatedColorSetInstances( const MString& setName, MIntArray& instances ) const

Returns the instance numbers of all instances which use a given color set.

MFnNurbsSurface

MObject getDataObject() const

Returns an MObject if the class has been constructed with an MFn::kNurbsSurfaceData entity, otherwise MObject::kNullObj is returned.

MFnPlugin

MStatus registerCacheFormat( const MString& cacheFormatName, MCreatorFunction creatorFunction )

Register a custom cache format with Maya.

MStatus deregisterCacheFormat( const MString& cacheFormatName )

De-register a custom cache format with Maya.

MStatus registerRenderPassImpl( const MString& passImplId, MRenderPassDef* passDef, MCreatorFunction creatorFunction, bool overload )

Register a custom render pass implementation with Maya.

MStatus deregisterRenderPassImpl( const MString& passImplId )

De-register a custom render pass implementation with Maya.

MFnRenderLayer

MStatus externalRenderPasses( MObjectArray& renderPassArray ) const

Returns an array of all the render pass nodes in a render layer.

bool passHasObject( const MObject& renderPass, const MDagPath& objectPath, MStatus* ReturnStatus ) const

Returns true if the specified object instance contributes to the given render pass.

bool passHasLight( const MObject& renderPass, const MObject& light, MStatus* ReturnStatus ) const

Returns true if the specified light contributes to the given render pass.

MGlobal

static MStatus getRichSelection( MRichSelection& dest, bool defaultToActiveSelection )

Returns the active selection with any soft selection and symmetry applied.

static SelectionMethod selectionMethod( MStatus* ReturnStatus )

Returns the selection method that should be used in the currently active viewport.

MItGeometry

MWeight weight( MStatus* ReturnStatus ) const

Returns the weight of the current component.

int exactCount( MStatus* ReturnStatus )

Returns the exact number of items in this iteration.

MStatus allPositions( MPointArray& points, MSpace::Space space ) const

Returns the position of all the points/CVs/vertices. This operation is faster than using the iterator to get values one by one.

MStatus setAllPositions( const MPointArray& points, MSpace::Space space )

Sets the position of all the points/CVs/vertices at once. This operation is faster than using the iterator to set values one by one.

MItSelectionList

MStatus getPlug( MPlug& plug )

Retrieves the current selection item as a plug.

MObjectHandle

unsigned int hashCode() const

Returns a hash code for the internal Maya object referenced by the MObject within this MObjectHandle. This provides a way for safely using internal Maya objects as keys in hash-based lookups, such as Python dictionaries.

MPxGlBuffer

virtual void beginBufferNotify()

This method is called when the GL buffer is being setup by the viewport renderer.

virtual void endBufferNotify()

This method is called when the GL buffer is being shutdown by the viewport renderer.

MPxManipContainer

MStatus addMPxManipulatorNode( const MString& manipTypeName, const MString& manipName, MPxManipulatorNode*& proxyManip )

This method creates a custom MPxManipulatorNode and adds it to the manip container.

MPxModelEditorCommand

MStatus setResult( const MDoubleArray& result )

This method should be called when the result of the panel command is a double array.

MStatus setResult( const MIntArray& result )

This method should be called when the result of the panel command is an integer array.

virtual MString editorCommandName() const

Returns the name of the model editor command.

virtual MPx3dModelView* makeModelView( MStatus* ReturnStatus )

This method is called when the modelEditor is being created and it can be overriden to allow the user to handle the allocation of the modelView directly or alter the creation according to command flags.

MRenderUtil

static MString mainBeautyPassName()

Returns the name of the main beauty pass for use by renderers for token substitution.

MSceneMessage

static MCallbackId addCallback( Message, void (*func)( const MStringArray&, void* ), void* clientData, MStatus* ReturnStatus )

This version of the method takes a callback function which takes an array of strings. This is provided to support the new plugin load/unload messages.

Modified methods

Changes were made to a number of existing methods. In those cases where the change has made the new calling sequence incompatible with the old, the old calling sequence has been retained as well for backward compatability, but is marked as deprecated in the documentation.

For brevity, those methods that only had changes in their constness or the constness of their parameters are not listed.

MColor

A number of methods have been inlined to improve performance.

MFileIO

MStatus open( const MString& fileName, const char* type = NULL, bool force = false, ReferenceMode refMode = kLoadDefault, bool ignoreVersion = false )

The optional ignoreVersion parameter has been added to indicate whether Maya should ignore the version number when opening the file.

MFnMesh

MStatus createColorSet( MString& colorSetName, MDGModifier* modifier, bool clamped, MColorRepresentation rep, const MUintArray* instances = NULL )

The optional instances parameter has been added to allow the color set to be only associated with specific instances of the node.

MString createColorSetWithName( const MString& colorSetName, MDGModifier* modifier = NULL, const MUintArray* instances = NULL, MStatus* ReturnStatus = NULL )

The optional instances parameter has been added to allow the color set to be only associated with specific instances of the node.

MString currentColorSetName( int instance = kMFnMeshInstanceUnspecified, MStatus* ReturnStatus = NULL ) const

The optional instance parameter has been added to return the instance-specific color set, if there is one.

MObject generateSmoothMesh( MObject parentOrOwner = MObject::kNullObj, MMeshSmoothOptions* options = NULL, MStatus* ReturnStatus = NULL )

The optional options parameter has been added to allow the caller to set the options used in generating the smooth mesh.

MStatus getCurrentColorSetName( MString& setName, int instance = kMFnMeshInstanceUnspecified )

The optional instance parameter has been added to return the instance-specific color set, if there is one.

MGlobal

MStatus selectFromScreen( const short& x_pos, const short& y_pos, MGlobal::ListAdjustment listAdjustment = kAddToList, MGlobal::SelectionMethod selectMethod = kWireframeSelectMethod )

The optional selectMethod parameter has been added to specify whether objects should be selected as wireframes or as surfaces.

MStatus selectFromScreen( const short& start_x, const short& start_y, const short& end_x, const short& end_y, MGlobal::ListAdjustment listAdjustment = kAddToList, MGlobal::SelectionMethod selectMethod = kWireframeSelectMethod ) 

The optional selectMethod parameter has been added to specify whether objects should be selected as wireframes or as surfaces.

MProgressWindow

An optional ReturnStatus parameter has been added to the following methods:

MPxConstraintCommand

virtual MStatus handleNewTargets( MDagPath& dagObject )

The dagObject parameter has been changed from an MObject to an MDagPath so that it can distinguish between different instances of the same node.

virtual MStatus connectTarget( MDagPath& targetPath, int index )

Previously the target was passed as an opaque pointer. This has been changed to an MDagPath, providing the developer with more flexibility when overriding this virtual method.

MStatus connectTargetAttribute( MDagPath& targetPath, int index, MObject& tarAttr, MObject& constraintAttr, bool instanced = false )

Previously the target was passed as an opaque pointer. This has been changed to an MDagPath, providing the developer with more flexibility when overriding this virtual method.

An optional instanced parameter has been added to indicate if the target attribute is instanced.

New enums

We have added a number of new enums to existing classes in this release:

Modified enums

MFn::Type

MGlobal::ListAdjustment

MPxManipContainer::baseType

MPxNode::Type

MSceneMessage::Message

MSelectionMask::SelectionType

Changes to examples

New C++ Example Plug-ins

New Python Example Plug-ins

Newly Localized Plug-ins

Bug fixes

The following is a list bugs fixed in this release of Maya which are most likely to be of interest to users of the API: