C++ API Reference

Register and deregister plug-in services with Maya. More...

#include <MFnPlugin.h>

+ Inheritance diagram for MFnPlugin:

Public Member Functions

 MFnPlugin ()
 Default class constructor. More...
 
 MFnPlugin (MObject &object, const char *vendor="Unknown", const char *version="Unknown", const char *requiredApiVersion="Any", MStatus *ReturnStatus=0L)
 Class constructor that initializes the function set to the given MObject. More...
 
virtual ~MFnPlugin ()
 The class destructor.
 
virtual MFn::Type type () const
 Return the type of this function set. More...
 
MString vendor (MStatus *ReturnStatus=nullptr) const
 Return the vendor string supplied in the MFnPlugin constructor. More...
 
MString version (MStatus *ReturnStatus=nullptr) const
 Return the version string supplied in the MFnPlugin constructor. More...
 
MString apiVersion (MStatus *ReturnStatus=nullptr) const
 Return the required API version string supplied in the MFnPlugin constructor. More...
 
MString name (MStatus *ReturnStatus=nullptr) const
 Return the name by which Maya knows this plug-in. More...
 
MString loadPath (MStatus *ReturnStatus=nullptr) const
 Determine the path where the plugin was loaded. More...
 
MStatus setName (const MString &newName, bool allowRename=true)
 Set the name by which Maya knows this plug-in. More...
 
MStatus setVersion (const MString &newVersion)
 Set the version name for this plug-in. More...
 
MStatus registerCommand (const MString &commandName, MCreatorFunction creatorFunction, MCreateSyntaxFunction createSyntaxFunction=nullptr)
 Register a new command with Maya. More...
 
MStatus deregisterCommand (const MString &commandName)
 Deregister the user defined command from Maya. More...
 
MStatus registerControlCommand (const MString &commandName, MCreatorFunction creatorFunction)
 Register a new control command with Maya. More...
 
MStatus deregisterControlCommand (const MString &commandName)
 Deregister the user defined control command from Maya. More...
 
MStatus registerModelEditorCommand (const MString &commandName, MCreatorFunction creatorFunction, MCreatorFunction paneCreatorFunction)
 Register a new model editor command with Maya. More...
 
MStatus deregisterModelEditorCommand (const MString &commandName)
 Deregister the user defined editor command from Maya. More...
 
MStatus registerConstraintCommand (const MString &commandName, MCreatorFunction creatorFunction)
 Register a new constraint command with Maya. More...
 
MStatus deregisterConstraintCommand (const MString &commandName)
 Deregister the user defined constraint command from Maya. More...
 
MStatus registerContextCommand (const MString &commandName, MCreatorFunction creatorFunction)
 Register a new context command with Maya. More...
 
MStatus registerContextCommand (const MString &commandName, MCreatorFunction creatorFunction, const MString &toolCmdName, MCreatorFunction toolCmdCreator, MCreateSyntaxFunction toolCmdSyntax=nullptr)
 Register a new context command and a new tool command with Maya. More...
 
MStatus deregisterContextCommand (const MString &commandName)
 Deregister the given user defined context command from Maya. More...
 
MStatus deregisterContextCommand (const MString &commandName, const MString &toolCmdName)
 Deregister the given user defined context command and tool command from Maya. More...
 
MStatus registerNode (const MString &typeName, const MTypeId &typeId, MCreatorFunction creatorFunction, MInitializeFunction initFunction, MPxNode::Type type=MPxNode::kDependNode, const MString *classification=nullptr)
 Register a new dependency node with Maya. More...
 
MStatus deregisterNode (const MTypeId &typeId)
 Deregister the given user defined dependency node type Maya. More...
 
MStatus registerEvaluator (const MString &evaluatorName, unsigned int uniquePriority, MCustomEvaluatorCreatorFunction creatorFunction)
 Register a new evaluator with Maya. More...
 
MStatus deregisterEvaluator (const MString &evaluatorName)
 Deregister the given user defined evaluator. More...
 
MStatus registerTopologyEvaluator (const MString &evaluatorName, unsigned int uniquePriority, MTopologyEvaluatorCreatorFunction creatorFunction)
 Register a new evaluator with Maya. More...
 
MStatus deregisterTopologyEvaluator (const MString &evaluatorName)
 Deregister the given user defined evaluator. More...
 
MStatus registerShape (const MString &typeName, const MTypeId &typeId, MCreatorFunction creatorFunction, MInitializeFunction initFunction, MCreatorFunction uiCreatorFunction, const MString *classification=nullptr)
 Registers the given user defined shape node with Maya. More...
 
MStatus registerTransform (const MString &typeName, const MTypeId &typeId, MCreatorFunction creatorFunction, MInitializeFunction initFunction, MCreateXformMatrixFunction xformCreatorFunction, const MTypeId &xformId, const MString *classification=nullptr)
 Registers the given user defined transform node with Maya. More...
 
MStatus registerData (const MString &typeName, const MTypeId &typeId, MCreatorFunction creatorFunction, MPxData::Type type=MPxData::kData)
 Register a new data type with Maya. More...
 
MStatus deregisterData (const MTypeId &typeId)
 Deregister the given user defined data type from Maya. More...
 
MStatus registerDevice (const MString &deviceName, MCreatorFunction creatorFunction)
 Register a new input device with Maya. More...
 
MStatus deregisterDevice (const MString &deviceName)
 Deregister the given user defined input device from Maya. More...
 
MStatus registerFileTranslator (const MString &translatorName, const char *pixmapName, MCreatorFunction creatorFunction, const char *optionsScriptName=nullptr, const char *defaultOptionsString=nullptr, bool requiresFullMel=false, MString dataStorageLocation=MFnPlugin::kDefaultDataLocation)
 Register a new file translator with Maya. More...
 
MStatus deregisterFileTranslator (const MString &translatorName)
 Deregister the specified file translator with Maya. More...
 
MStatus registerURIFileResolver (const MString &fileResolverName, const MString &uriScheme, MCreatorFunction creatorFunction)
 Register a Custom URI File Resolver with Maya. More...
 
MStatus deregisterURIFileResolver (const MString &fileResolverName)
 Deregister the specified URI file resolver with Maya. More...
 
MStatus registerIkSolver (const MString &ikSolverName, MCreatorFunction creatorFunction)
 Register a new ik-solver with Maya. More...
 
MStatus deregisterIkSolver (const MString &ikSolverName)
 Deregister the specified ik-solver with Maya. More...
 
MStatus registerCacheFormat (const MString &cacheFormatName, MCreatorFunction creatorFunction)
 Register a new cache format with Maya. More...
 
MStatus deregisterCacheFormat (const MString &cacheFormatName)
 Deregister the specified cache format with Maya. More...
 
MStatus registerUIStrings (MInitializeFunction registerMStringResources, const MString &pluginStringsProc)
 Set the callback and procedure names of routines that register plugin string resources and optionally load localized values for them. More...
 
MStatus registerUI (PyObject *creationProc, PyObject *deletionProc, PyObject *creationBatchProc=nullptr, PyObject *deletionBatchProc=nullptr)
 Sets the Python callable objects to be called to create and destroy any UI associated with the plugin. More...
 
MStatus registerDragAndDropBehavior (const MString &behaviorName, MCreatorFunction creatorFunction)
 Register a new drag and drop behavior with Maya. More...
 
MStatus deregisterDragAndDropBehavior (const MString &behaviorName)
 Deregister the given drag and drop behavior from Maya. More...
 
MStatus registerImageFile (const MString &imageFormatName, MCreatorFunction creatorFunction, const MStringArray &imageFileExtensions, ImageFilePriority priority=kImageFilePriorityDefault)
 Register a new image file translator with Maya. More...
 
MStatus deregisterImageFile (const MString &imageFormatName)
 Deregister the specified image file translator with Maya. More...
 
MStatus registerRenderPassImpl (const MString &passImplId, MRenderPassDef *passDef, MCreatorFunction creatorFunction, bool overload=false)
 Register a new render pass implementation with Maya and associate with the given render pass definition. More...
 
MStatus deregisterRenderPassImpl (const MString &passImplId)
 Deregister the specified render pass implementation with Maya. More...
 
MStatus registerAttributePatternFactory (const MString &typeName, MCreatorFunction fnPtr)
 Registers a new attribute pattern factory type with Maya. More...
 
MStatus deregisterAttributePatternFactory (const MString &typeName)
 Deregister the attribute pattern factory type with Maya. More...
 
MStatus registerAnimCurveInterpolator (const MString &typeName, int typeId, MCreatorFunction creatorFunction, int flags=0)
 Register a new animation curve interpolator with Maya. More...
 
MStatus deregisterAnimCurveInterpolator (const MString &typeName)
 Deregister the given user defined animation curve interpolator from Maya. More...
 
MStatus registerDisplayFilter (const MString &name, const MString &label, const MString &classification)
 Register a new display filter with Maya. More...
 
MStatus deregisterDisplayFilter (const MString &name)
 Deregister a display filter with Maya. More...
 
MStatus registerRenderer (const MString &name, MCreatorFunction creatorFunction)
 Registers a new renderer identified by name. More...
 
MStatus deregisterRenderer (const MString &name)
 Deregisters an renderer identified by name. More...
 
MTypeId matrixTypeIdFromXformId (const MTypeId &xformTypeId, MStatus *ReturnStatus=nullptr)
 The function returns the MTypeId of the matrix when the MTypeId of the corresponding xform is given. More...
 
MStringArray addMenuItem (const MString &menuItemName, const MString &parentName, const MString &commandName, const MString &commandParams, bool needOptionBox=false, const MString *optBoxFunction=nullptr, MStatus *retStatus=nullptr, const MString *extraMenuItemParams=nullptr)
 The function adds the menuItem to the specified parent, and associates a command with it. More...
 
MStatus removeMenuItem (MStringArray &menuItemNames)
 The function removes the menuItem and the corresponding option box, if exists, from the UI. More...
 
MStatus registerMaterialInfo (const MString &type, MMaterialInfoFactoryFnPtr fnPtr)
 Registers a new material information type with Maya. More...
 
MStatus unregisterMaterialInfo (const MString &typeName)
 Deregister the specified material info type with Maya. More...
 
MStatus registerBakeEngine (const MString &typeName, MBakeEngineCreatorFnPtr fnPtr)
 Registers a new bake engine type with Maya. More...
 
MStatus unregisterBakeEngine (const MString &typeName)
 Deregister the bake engine type with Maya. More...
 
void setCallableInfo (MPluginCallableInfo *info)
 Set callback info to be passed as ClientData to scripts.
 
MPluginCallableInfogetCallableInfo ()
 Get callback info to be passed as ClientData to scripts.
 
MStatus registerTransform (const MString &typeName, const MTypeId &typeId, MCreatorFunction creatorFunction, MInitializeFunction initFunction, MCreatorFunction xformCreatorFunction, const MTypeId &xformId, const MString *classification=nullptr)
 This method is obsolete. More...
 
MStatus registerUI (const MString &creationProc, const MString &deletionProc, const MString &creationBatchProc="", const MString &deletionBatchProc="")
 NO SCRIPT SUPPORT. More...
 
MStatus registerEvaluator (const MString &evaluatorName, unsigned int uniquePriority, MCreatorFunction creatorFunction)
 This method is obsolete. More...
 
MStatus registerTopologyEvaluator (const MString &evaluatorName, unsigned int uniquePriority, MCreatorFunction creatorFunction)
 This method is obsolete. More...
 
- Public Member Functions inherited from MFnBase
virtual ~MFnBase ()
 Class Destructor. More...
 
bool hasObj (MFn::Type) const
 Determines whether or not the Function Set is compatible with the specified Maya Object within the API RTTI system. More...
 
bool hasObj (const MObject &) const
 Determines whether or not the Function Set is compatible with the specified Maya Object within the API RTTI system. More...
 
MObject object (MStatus *ReturnStatus=NULL) const
 Returns the MObject that is attached to the Function Set. More...
 
virtual MStatus setObject (MObject &object)
 Attaches the Function Set to the specified Maya Object. More...
 
virtual MStatus setObject (const MObject &object)
 NO SCRIPT SUPPORT. More...
 

Static Public Member Functions

static MObject findPlugin (const MString &pluginName)
 Returns an MObject corresponding to the named plugin. More...
 
static bool isNodeRegistered (const MString &typeName)
 Queries if the given typeName has been registered by maya or plugins. More...
 
static void setRegisteringCallableScript ()
 Mark this MFnPlugin object as one that will be passed callbacks defined in script.
 
static bool registeringCallableScript ()
 Return true if this MFnPlugin object has its callbacks defined in script.
 
static const char * className ()
 Returns the name of this class. More...
 
- Static Public Member Functions inherited from MFnBase
static const char * className ()
 Returns the name of this class. More...
 
static const char * typeString (MFn::Type)
 Returns the type string for a given type. More...
 
static bool isValid (MFn::Type)
 Returns true if type is in the range of valid types. More...
 

Static Public Attributes

static const MString kDefaultDataLocation = "data"
 Specifies the default storage location for registerFileTranslator, the default value is "data".
 

Detailed Description

Register and deregister plug-in services with Maya.

This class is used in the initializePlugin and uninitializePlugin functions of a Maya plug-in to respectively register and deregister the plug-in's services (commands, node types, etc) with Maya. The constructor for this class must be passed the MObject that Maya provides as an argument to initializePlugin and uninitializePlugin.

MFnPlugin provides various registration methods for use inside initializePlugin, when the plug-in is being loaded, and deregistration methods for use inside uninitializePlugin, when the plug-in is being unloaded. In general it is good practice to have uninitializePlugin deregister the plug-in's services in the reverse order in which they were registered in initializePlugin. This ensures, for example, that a custom datatype is not deregistered before the node types which use it.

A plug-in's uninitializePlugin function is only called when the plug-in is explicitly unloaded. It is not called when Maya exits. Normally this is not a problem because system resources such as memory and open file handles are automatically released by the operating system when Maya exits. However, if there are cleanup tasks which a plug-in must perform even when Maya exits, for example deleting a temporary file, then the plug-in's initializePlugin can use the MSceneMessage::addCallback method with a message of "kMayaExiting" to register a callback function that will be executed when Maya is about to exit. The callback function can then handle any cleanup activities which the operating system won't handle automatically on exit.

A side effect of including MFnPlugin.h in a source file is to embed an API version string into the corresponding compiled object file. Because of this, including MFnPlugin.h in more than one source file in the same plug-in will lead to conflicts when the plug-in is linked. If it is necessary to include MFnPlugin.h in more than one of a plug-in's source files the preprocessor macro MNoVersionString should be defined in all but one of those files prior to the inclusion of MFnPlugin.h. Normally, this issue will not arise as only the file that contains the initializePlugin and uninitializePlugin routines should need to include MFnPlugin.h.

It is unusual, but possible, to instantiate several MFnPlugin objects within a single plug-in binary. In this case the vendor and version information that is set for the plug-in is taken from the first instance as this information works per binary rather than per command/node etc.

Examples:
AbcBullet/AbcBullet.cpp, AbcExport/AbcExport.cpp, AbcImport/main.cpp, affectsNode/affectsNode.cpp, animCubeNode/animCubeNode.cpp, animExportUtil/animExportUtil.cpp, animImportExport/animImportExport.cpp, animInfoCmd/animInfoCmd.cpp, anisotropicShader/anisotropicShader.cpp, apiDirectionalLightShape/apiDirectionalLightShape.cpp, apiMeshShape/apiMeshShape.cpp, arcLenNode/arcLenNode.cpp, atomImportExport/atomImportExport.cpp, autoLoader/autoLoader.cpp, backfillShader/backfillShader.cpp, basicBlendShape/basicBlendShape.cpp, basicSkinCluster/basicSkinCluster.cpp, blast2Cmd/blast2Cmd.cpp, blindComplexDataCmd/blindComplexDataCmd.cpp, blindDataShader/blindDataPluginMain.cpp, blindDoubleDataCmd/blindDoubleDataCmd.cpp, blindShortDataCmd/blindShortDataCmd.cpp, brickShader/brickShader.cpp, buildRotationNode/buildRotationNode.cpp, cameraMessageCmd/cameraMessageCmd.cpp, cameraSetSubclass/exCameraSet.cpp, captureViewRenderCmd/captureViewRenderCmd.cpp, cellShader/cellShader.cpp, cgFx/pluginMain.cpp, checkerShader/checkerShader.cpp, circleNode/circleNode.cpp, cleanPerFaceAssignment/cleanPerFaceAssignmentPluginMain.cpp, clearcoat.cpp, closestPointCmd/closestPointCmd.cpp, closestPointOnCurve/closestPointOnCurvePlugin.cpp, closestPointOnNurbsSurfaceCmd/closestPointOnNurbsSurfaceCmd.cpp, clusterWeightFunction/clusterWeightFunction.cpp, colorTransformData/colorTransformData.cpp, componentScaleManip/componentScaleManip.cpp, compositingShader/compositingShader.cpp, conditionTest/conditionTest.cpp, constraintEvaluator/constraintEvaluator.cpp, contrastShader/contrastShader.cpp, convertBumpCmd/convertBumpCmd.cpp, convertEdgesToFacesCmd/convertEdgesToFacesCmd.cpp, convertVerticesToEdgesCmd/convertVerticesToEdgesCmd.cpp, convertVerticesToFacesCmd/convertVerticesToFacesCmd.cpp, createClipCmd/createClipCmd.cpp, customAttrManip/customAttrManip.cpp, customImagePlane/customImagePlane.cpp, customSpriteShader/customSpriteShader.cpp, customTextureShader/customTextureShaderMainMaya.cpp, cvColorNode/cvColorNode.cpp, cvColorShader/cvColorShader.cpp, cvPosCmd/cvPosCmd.cpp, dagMessageCmd/dagMessageCmd.cpp, dagPoseInfoCmd/dagPoseInfoCmd.cpp, ddsFloatReader.cpp, deletedMsgCmd/deletedMsgCmd.cpp, depthShader/depthShader.cpp, displacementShader/displacementShader.cpp, dx11Shader/dx11ShaderPluginMain.cpp, dynExprField/dynExprField.cpp, eventTest/eventTest.cpp, exampleCameraSetView/exampleCameraSetViewMain.cpp, exampleRampAttribute/exampleMRampAttribute.cpp, exportJointClusterDataCmd/exportJointClusterDataCmd.cpp, exportSkinClusterDataCmd/exportSkinClusterDataCmd.cpp, externalDropCallback/externalDropCallback.cpp, fileIOMsgCmd/fileIOMsgCmd.cpp, fileTexture/fileTexture.cpp, filteredAsciiFile/filteredAsciiFile.cpp, flameShader/flameShader.cpp, flipUVCmd/flipUVMain.cpp, fluidInfoCmd/fluidInfoCmd.cpp, footPrintManip/footPrintManip.cpp, footPrintNode/footPrintNode.cpp, footPrintNode_GeometryOverride/footPrintNode_GeometryOverride.cpp, footPrintNode_GeometryOverride_AnimatedMaterial/footPrintNode_GeometryOverride_AnimatedMaterial.cpp, footPrintNode_SubSceneOverride/footPrintNode_SubSceneOverride.cpp, fragmentDumper/fragmentDumper.cpp, fullLoftNode/fullLoftNode.cpp, gameInputDevice/gameInputDevice.cpp, gammaShader/gammaShader.cpp, genericAttributeNode/genericAttributeNode.cpp, geometryCacheConverter/geometryCacheConverter.cpp, geometryOverrideExample1/geometryOverrideExample1.cpp, geometryOverrideExample2/geometryOverrideExample2.cpp, geometryReplicator/geometryReplicator.cpp, geometrySurfaceConstraint/geometrySurfaceConstraint.cpp, geomShader/geomShader.cpp, glslShader/GLSLShaderMainMaya.cpp, gpuCache/gpuCachePluginMain.cpp, grabUVMain.cpp, hairCollisionSolver/hairCollisionSolver.cpp, helix2Cmd/helix2Cmd.cpp, helixQtCmd.cpp, helixTool/helixTool.cpp, hlslShader/hlslPluginMain.cpp, hwApiTextureTest/hwApiTextureTest.cpp, hwPhongShader/hwPhongShader.cpp, hwRenderPostEffect/hwRenderPostEffect.cpp, identityGeomFilter/identityGeomFilter.cpp, identityNode/identityNode.cpp, iffInfoCmd/iffInfoCmd.cpp, iffPixelCmd/iffPixelCmd.cpp, iffPpmCmd/iffPpmCmd.cpp, instanceCallbackCmd/instanceCallbackCmd.cpp, interpPlugins/interpPlugins.cpp, interpShader/interpShader.cpp, interpZero/interpZero.cpp, intersectCmd/intersectCmd.cpp, intersectOnNurbsSurfaceCmd/intersectOnNurbsSurfaceCmd.cpp, jitterNode/jitterNode.cpp, jlcVcrDevice/jlcVcrDevice.cpp, lambertShader/lambertShader.cpp, lassoTool/lassoTool.cpp, latticeNoise/latticeNoise.cpp, lavaShader/lavaShader.cpp, lensDistortionCallback/lensDistortionCallback.cpp, lepTranslator/lepTranslator.cpp, lightShader/lightShader.cpp, lineManip/lineManip.cpp, lineManipContainer/lineManipContainer.cpp, listRichSelectionCmd/listRichSelectionCmd.cpp, lockEvent/lockEvent.cpp, manipOverride/manipOverride.cpp, marqueeTool/marqueeTool.cpp, maTranslator/maTranslator.cpp, MayaPluginForSpreticle/spReticleLoc.cpp, meshOpCmd/meshOpMain.cpp, MetadataSample/metadataPlugin.cpp, MetadataXML/metadataXMLPlugin.cpp, mixtureShader/mixtureShader.cpp, motionPathCmd/motionPathCmd.cpp, motionPathNode/motionPathNode.cpp, motionTraceCmd/motionTraceCmd.cpp, moveCurveCVsCmd/moveCurveCVsCmd.cpp, moveManip/moveManip.cpp, moveNumericTool/moveNumericTool.cpp, moveTool/moveTool.cpp, multiCurveNode/multiCurveNode.cpp, multiPlugInfoCmd/multiPlugInfoCmd.cpp, narrowPolyViewer/narrowPolyViewerMain.cpp, nodeCreatedCBCmd/nodeCreatedCBCmd.cpp, nodeIconCmd/nodeIconCmd.cpp, nodeInfoCmd/nodeInfoCmd.cpp, nodeMessageCmd/nodeMessageCmd.cpp, noiseShader/noiseShader.cpp, objExport/objExport.cpp, offsetNode/offsetNode.cpp, onbShader/onbShader.cpp, OpenEXR.cpp, ownerEmitter/ownerEmitter.cpp, paintCallback/paintCallback.cpp, particleAttrNode/particleAttrNodeMain.cpp, particlePathsCmd/particlePathsCmd.cpp, particleSystemInfoCmd/particleSystemInfoCmd.cpp, peltOverlapCmd/peltOverlapCmd.cpp, pfxInfoCmd/pfxInfoCmd.cpp, phongShader/phongShader.cpp, pickCmd/pickCmd.cpp, pointManip/pointManip.cpp, pointOnMeshInfo/pointOnMeshInfoPlugin.cpp, pointOnSubdNode/pointOnSubdNode.cpp, polyMessageCmd/polyMessageCmd.cpp, polyPrimitiveCmd/polyPrimitiveCmd.cpp, polyRawExporter/polyRawExporter.cpp, polyTrgNode/polyTrgNode.cpp, polyX3DExporter/polyX3DExporter.cpp, progressWindowCmd/progressWindowCmd.cpp, qtForms.cpp, randomizerDevice/randomizerDevice.cpp, rawfootPrintNode/rawfootPrintNode.cpp, referenceQueryCmd/referenceQueryCmd.cpp, renderAccessNode/renderAccessNode.cpp, renderViewInteractiveRenderCmd/renderViewInteractiveRenderCmd.cpp, renderViewRenderCmd/renderViewRenderCmd.cpp, renderViewRenderRegionCmd/renderViewRenderRegionCmd.cpp, richMoveCmd/richMoveCmd.cpp, richSelectionTool/richSelectionTool.cpp, rockingTransform/rockingTransformMain.cpp, rockingTransformCheck/rockingTransformCheckMain.cpp, rotateManip/rotateManip.cpp, sampleCmd/sampleCmd.cpp, sampleParticles/sampleParticles.cpp, saveSwatchesCmd.cpp, scanDagCmd/scanDagCmd.cpp, scanDagSyntax/scanDagSyntax.cpp, sceneAssembly/sceneAssemblyPluginMain.cpp, shadowMatteShader/shadowMatteShader.cpp, shellNode/shellNode.cpp, shiftNode/shiftNode.cpp, simpleEmitter/simpleEmitter.cpp, simpleEvaluationDraw/simpleEvaluationDraw.cpp, simpleEvaluationNode/simpleEvaluationNode.cpp, simpleEvaluator/simpleEvaluator.cpp, simpleFluidEmitter/simpleFluidEmitter.cpp, simpleImageFile/simpleImageFile.cpp, simpleLoftNode/simpleLoftNode.cpp, simpleNoiseShader/simpleNoiseShader.cpp, simpleSolverNode/simpleSolverNode.cpp, simpleSpring/simpleSpring.cpp, sineNode/sineNode.cpp, skinClusterWeights/skinClusterWeights.cpp, slopeShader/slopeShader.cpp, solidCheckerShader/solidCheckerShader.cpp, spiralAnimCurveCmd/spiralAnimCurveCmd.cpp, splatDeformer/splatDeformer.cpp, splitUVCmd/splitUVMain.cpp, squareScaleManip/squareScaleManip.cpp, squareScaleManipContext/squareScaleManipContext.cpp, squaresNode_noDepthTest/squaresNode_noDepthTest.cpp, sseDeformer/sseDeformer.cpp, stringFormatNode/stringFormatNode.cpp, surfaceBumpManip/surfaceBumpManip.cpp, surfaceCreateCmd/surfaceCreateCmd.cpp, surfaceTwistCmd/surfaceTwistCmd.cpp, sweptEmitter/sweptEmitter.cpp, swissArmyManip/swissArmyManip.cpp, template/createTransformNodeTemplate/createTransformNodeTemplate.cpp, template/helloTemplateWorld/helloTemplateWorld.cpp, template/zoomCameraTemplate/zoomCameraTemplate.cpp, tessellatedQuad/TessellatedQuadNode.cpp, testCameraSetCmd/testCameraSetCmd.cpp, testMTopologyEvaluator/testMTopologyEvaluator.cpp, testNobjectNode/testNobjectNode.cpp, testNpassiveNode/testNpassiveNode.cpp, testNsolverNode/testNsolverNode.cpp, testNucleusNode/testNucleusNode.cpp, tiffFloatReader.cpp, topologyTrackingNode/topologyTrackingNode.cpp, torusField/torusField.cpp, transCircleNode/transCircleNode.cpp, transformDrawNode/transformDrawNode.cpp, translateCmd/translateCmd.cpp, udpDevice/udpDevice.cpp, uiDrawManager/uiDrawManager.cpp, undoRedoMsgCmd/undoRedoMsgCmd.cpp, userMsgCmd/userMsgCmd.cpp, viewCallbackTest/viewCallbackTest.cpp, viewDX11DeviceAccess/viewDX11DeviceAccess.cpp, viewImageBlitOverride/viewImageBlitOverrideMain.cpp, viewMRenderOverride/viewMRenderOverride.cpp, viewObjectFilter/viewObjectFilter.cpp, viewOverrideSimple/viewOverrideSimpleMain.cpp, viewOverrideTrackTexture/viewOverrideTrackTextureMain.cpp, viewRenderOverride/viewRenderOverrideMain.cpp, viewRenderOverrideFrameCache/viewRenderOverrideFrameCacheMain.cpp, viewRenderOverrideMRT/viewRenderOverrideMRTMain.cpp, viewRenderOverridePointLightShadows/viewRenderOverridePointLightShadowsMain.cpp, viewRenderOverridePostColor/viewRenderOverridePostColorMain.cpp, viewRenderOverrideShadows/viewRenderOverrideShadowsMain.cpp, viewRenderOverrideTargets/viewRenderOverrideTargetsMain.cpp, volumeShader/volumeShader.cpp, vp2BlinnShader/vp2BlinnShader.cpp, weightListNode/weightListNode.cpp, workspaceControlCmd.cpp, XmlGeometryCache/XmlGeometryCache.cpp, XmlGeometryCacheDesc/XmlGeometryCacheDesc.cpp, yTwistNode/yTwistNode.cpp, and zoomCameraCmd/zoomCameraCmd.cpp.

Constructor & Destructor Documentation

MFnPlugin ( )

Default class constructor.

The function set is not attached to an MObject.

MFnPlugin ( MObject object,
const char *  vendor = "Unknown",
const char *  version = "Unknown",
const char *  requiredApiVersion = "Any",
MStatus ReturnStatus = 0L 
)

Class constructor that initializes the function set to the given MObject.

The MObject should the be one passed as an argument to either the initializePlugin or uninitializePlugin entry points of a Maya plug-in.

Parameters
[in]objectthe MObject to attach the function set to
[in]vendora string identifying the vendor of this plug-in
[in]versiona string identifying the version number of this plug-in
[in]requiredApiVersionif the plug-in is known to work with only a specify API version, that version can be specified here. This argument is current not used by the Maya API.
[out]ReturnStatusthe return status
Status Codes:
  • MS::kSuccess if the function set is successfully attached
  • MS::kInvalidParameter if the function set is not allowed to attach to this MObject or if the MObject does not represent a valid Maya object

Member Function Documentation

MFn::Type type ( ) const
virtual

Return the type of this function set.

Returns
The constant MFn::kPlugin

Reimplemented from MFnBase.

MString vendor ( MStatus ReturnStatus = nullptr) const

Return the vendor string supplied in the MFnPlugin constructor.

Parameters
[out]ReturnStatusthe return status
Returns
An MString containing the vendor name
Status Codes:
  • MS::kSuccess if successful
  • MS::kObjectDoesNotExist if the function set is not attached to an MObject.
MString version ( MStatus ReturnStatus = nullptr) const

Return the version string supplied in the MFnPlugin constructor.

Parameters
[out]ReturnStatusthe return status
Returns
An MString containing the version string
Status Codes:
  • MS::kSuccess if successful
  • MS::kObjectDoesNotExist if the function set is not attached to an MObject.
MString apiVersion ( MStatus ReturnStatus = nullptr) const

Return the required API version string supplied in the MFnPlugin constructor.

Parameters
[out]ReturnStatusthe return status
  • MS::kSuccess if successful
  • MS::kObjectDoesNotExist if the function set is not attached to an MObject.
Returns
An MString containing the required API version string
MString name ( MStatus ReturnStatus = nullptr) const

Return the name by which Maya knows this plug-in.

Parameters
[out]ReturnStatusthe return status
  • MS::kSuccess if successful
  • MS::kObjectDoesNotExist if the function set is not attached to an MObject.
Returns
An MString containing the plug-in name
MString loadPath ( MStatus ReturnStatus = nullptr) const

Determine the path where the plugin was loaded.

Parameters
[out]ReturnStatusthe return status
  • MS::kSuccess if successful
  • MS::kObjectDoesNotExist if the function set is not attached to an MObject.
Returns
An MString containing path name to the location of the plugin.
MStatus setName ( const MString newName,
bool  makeUnique = true 
)

Set the name by which Maya knows this plug-in.

Parameters
[in]newNamethe new name
[in]makeUniqueif true and the requested name is already in use, then Maya will create an unused name for this plug-in. If false, and the name is in use, do not change the current name.
Returns
Status code
Status Codes:
  • MS::kSuccess if successful
  • MS::kFailure makeUnique was false, and the requested name is already in use
  • MS::kObjectDoesNotExist if the function set is not attached to an MObject.
MStatus setVersion ( const MString newVersion)

Set the version name for this plug-in.

Parameters
[in]newVersionthe new version
Returns
Status code
Status Codes:
  • MS::kSuccess if successful
  • MS::kObjectDoesNotExist if the function set is not attached to an MObject.
MStatus registerCommand ( const MString commandName,
MCreatorFunction  creatorFunction,
MCreateSyntaxFunction  createSyntaxFunction = nullptr 
)

Register a new command with Maya.

Once registered, the command can be invoked from MEL in a manner identical to built-in Maya commands.

Parameters
[in]commandNamethe name of the command to register
[in]creatorFunctiona pointer to a function that will return a pointer to a new instance of the class (derived from MPxCommand) that implements the new command.
[in]createSyntaxFunctiona pointer to a function that will return a new instance of a syntax object (MSyntax) that implements the syntax of the command.
Returns
Status code
Status Codes:
  • MS::kSuccess if the command is successfully registered
  • MS::kObjectDoesNotExist if the function set is not attached to an MObject
Examples:
cleanPerFaceAssignment/cleanPerFaceAssignmentPluginMain.cpp, glslShader/GLSLShaderMainMaya.cpp, hlslShader/hlslPluginMain.cpp, latticeNoise/latticeNoise.cpp, meshOpCmd/meshOpMain.cpp, MetadataSample/metadataPlugin.cpp, pointOnMeshInfo/pointOnMeshInfoPlugin.cpp, sceneAssembly/sceneAssemblyPluginMain.cpp, splitUVCmd/splitUVMain.cpp, and viewRenderOverridePostColor/viewRenderOverridePostColorMain.cpp.
MStatus deregisterCommand ( const MString commandName)

Deregister the user defined command from Maya.

Once deregistered the command can no longer be invoked from MEL.

Parameters
[in]commandNamethe name of the command to deregister
Returns
Status code
Status Codes:
  • MS::kSuccess if successful
  • MS::kFailure the command was not owned by this plug-in
  • MS::kObjectDoesNotExist if the function set is not attached to an MObject.
Examples:
sceneAssembly/sceneAssemblyPluginMain.cpp.
MStatus registerControlCommand ( const MString commandName,
MCreatorFunction  creatorFunction 
)

Register a new control command with Maya.

Once registered, the command can be invoked from MEL in a manner identical to built-in Maya commands.

Parameters
[in]commandNamethe name of the control to register
[in]creatorFunctiona pointer to a function that will return a pointer to a new instance of the class(derived from MPxControlCommand) that implements the new command.
Returns
Status code
Status Codes:
  • MS::kSuccess if the command is successfully registered
  • MS::kObjectDoesNotExist if the function set is not attached to an MObject
MStatus deregisterControlCommand ( const MString commandName)

Deregister the user defined control command from Maya.

Once deregistered the command can no longer be invoked from MEL.

Parameters
[in]commandNamethe name of the command to deregister
Returns
Status code
Status Codes:
  • MS::kSuccess if successful
  • MS::kFailure the command was not owned by this plug-in
  • MS::kObjectDoesNotExist if the function set is not attached to an MObject.
MStatus registerModelEditorCommand ( const MString commandName,
MCreatorFunction  creatorFunction,
MCreatorFunction  viewCreatorFunction 
)

Register a new model editor command with Maya.

Once registered, the command can be invoked from MEL in a manner identical to built-in Maya commands.

Parameters
[in]commandNamethe name of the command to register
[in]creatorFunctiona pointer to a function that will return a pointer to a new instance of the class (derived from MPxEditorCommand) that implements the new command.
[in]viewCreatorFunctiona pointer to a function that will return a pointer to a new instance of the class (derived from MPx3dModelView) that implemented the new view associated with this command.
Returns
Status code
Status Codes:
  • MS::kSuccess if the command is successfully registered
  • MS::kInvalidParameter if the function set is not attached to an MObject
Examples:
exampleCameraSetView/exampleCameraSetViewMain.cpp, and narrowPolyViewer/narrowPolyViewerMain.cpp.
MStatus deregisterModelEditorCommand ( const MString commandName)

Deregister the user defined editor command from Maya.

Once deregistered the command can no longer be invoked from MEL.

Parameters
[in]commandNamethe name of the command to deregister
Returns
Status code
Status Codes:
  • MS::kSuccess if successful
  • MS::kFailure the command was not owned by this plug-in
  • MS::kObjectDoesNotExist if the function set is not attached to an MObject.
MStatus registerConstraintCommand ( const MString commandName,
MCreatorFunction  creatorFunction 
)

Register a new constraint command with Maya.

Once registered, the command can be invoked from MEL in a manner identical to built-in Maya commands.

Parameters
[in]commandNamethe name of the command to register
[in]creatorFunctiona pointer to a function that will return a pointer to a new instance of the class (derived from MPxConstraintCommand) that implements the new command.
Returns
Status code
Status Codes:
  • MS::kSuccess if the command is successfully registered
  • MS::kInvalidParameter if the function set is not attached to an MObject
MStatus deregisterConstraintCommand ( const MString commandName)

Deregister the user defined constraint command from Maya.

Once deregistered the command can no longer be invoked from MEL.

Parameters
[in]commandNamethe name of the command to deregister
Returns
Status code
Status Codes:
  • MS::kSuccess if successful
  • MS::kFailure the command was not owned by this plug-in
  • MS::kObjectDoesNotExist if the function set is not attached to an MObject.
MStatus registerContextCommand ( const MString commandName,
MCreatorFunction  creatorFunction 
)

Register a new context command with Maya.

Once registered, the context can be used to create a new tool that can be used in a manner identical to built-in Maya tools.

Parameters
[in]commandNamethe name of the context command to register
[in]creatorFunctiona pointer to a function that will return a pointer to a new instance of the class (derived from MPxToolCommand) that implements the new tool.
Returns
Status code
Status Codes:
  • MS::kSuccess if the command is successfully registered
  • MS::kObjectDoesNotExist if the function set is not attached to an MObject
MStatus registerContextCommand ( const MString commandName,
MCreatorFunction  creatorFunction,
const MString toolCmdName,
MCreatorFunction  toolCmdCreator,
MCreateSyntaxFunction  toolCmdSyntax = nullptr 
)

Register a new context command and a new tool command with Maya.

This version of registerContextCommand must be used if a tool command (a class derived from MPxToolCommand) is used within the context. The method newToolCommand of MPxContext will return a new instance of the tool command that can be used in the context.

Once registered, the context can be used to create a new tool that can be used in a manner identical to built-in Maya tools. The tool command can also be used as a MEL command.

Parameters
[in]commandNamethe name of the context command to register
[in]creatorFunctiona pointer to a function that will return a pointer to a new instance of the class (derived from MPxToolCommand) that implements the new tool.
[in]toolCmdNamethe name of the tool command to register
[in]toolCmdCreatora pointer to a function that will return a pointer to a new instance of the class (derived from MPxToolCommand) that implements the new command.
[in]toolCmdSyntaxa pointer to a function that will return a new instance of a syntax object (MSyntax) that implements the syntax of the command.
Returns
Status code
Status Codes:
  • MS::kSuccess if the command is successfully registered
  • MS::kObjectDoesNotExist if the function set is not attached to an MObject
MStatus deregisterContextCommand ( const MString commandName)

Deregister the given user defined context command from Maya.

Once deregistered the user defined tool can no longer be used.

Parameters
[in]commandNamethe name of the context command to deregister
Returns
Status code
Status Codes:
  • MS::kSuccess if successful
  • MS::kFailure the command was not owned by this plug-in
  • MS::kObjectDoesNotExist if the function set is not attached to an MObject.
MStatus deregisterContextCommand ( const MString commandName,
const MString toolCmdName 
)

Deregister the given user defined context command and tool command from Maya.

Once deregistered the user defined tool can no longer be used and the tool command can no longer be invoked from MEL.

Parameters
[in]commandNamethe name of the context command to deregister
[in]toolCmdNamethe name of the command to deregister
Returns
Status code
Status Codes:
  • MS::kSuccess if successful
  • MS::kFailure the command was not owned by this plug-in
  • MS::kObjectDoesNotExist if the function set is not attached to an MObject.
MStatus registerNode ( const MString typeName,
const MTypeId typeId,
MCreatorFunction  creatorFunction,
MInitializeFunction  initFunction,
MPxNode::Type  type = MPxNode::kDependNode,
const MString classification = nullptr 
)

Register a new dependency node with Maya.

Once registered, the node can be used from MEL in a manner identical to built-in Maya nodes.

Parameters
[in]typeNamethe name of the new type of node
[in]typeIda unique id that identifies this node
[in]creatorFunctiona pointer to a function that will return a pointer to a new instance of the class (derived from MPxNode) that implements the new node type
[in]initFunctiona pointer to a function that will initialize all the attributes of the new node type
[in]typethe type of plugin node to be registered
[in]classificationa string that determines how the node will be categorized in various rendering-related UI, such as the Create Render Node and HyperShade windows. See the documentation for the getClassification command for a list of the supported classifications. If no string is supplied then the node will not be considered a rendering node and will not be displayed in those UI. The classification also allows the node type to be recognized as a shape with Viewport 2.0. A classification string which starts with "drawdb/geometry" (plus any further subclassifications) is required. Note that adding the subclassification "transform" immediately after "geometry" will indicate that this is a transform instead of shape. See the documentation for registerTransform().
Returns
Status code
Status Codes:
  • MS::kSuccess if the node type was successfully registered
  • MS::kFailure the registration failed.
  • MS::kObjectDoesNotExist if the function set is not attached to an MObject.
Examples:
customTextureShader/customTextureShaderMainMaya.cpp, glslShader/GLSLShaderMainMaya.cpp, hlslShader/hlslPluginMain.cpp, latticeNoise/latticeNoise.cpp, meshOpCmd/meshOpMain.cpp, MetadataSample/metadataPlugin.cpp, particleAttrNode/particleAttrNodeMain.cpp, pointOnMeshInfo/pointOnMeshInfoPlugin.cpp, sceneAssembly/sceneAssemblyPluginMain.cpp, slopeShader/slopeShader.cpp, and splitUVCmd/splitUVMain.cpp.
MStatus deregisterNode ( const MTypeId typeId)

Deregister the given user defined dependency node type Maya.

Once deregistered new instances of the user defined dependency node can no longer be created. Additionally, any existing instances of the node type will be changed to the special type Unknown and will no longer evaluate in the dependency graph although they will be saved correctly if the scene is written.

Parameters
[in]typeIdthe unique type id of the node type to deregister
Returns
Status code
Status Codes:
  • MS::kSuccess if successful
  • MS::kFailure the node type was not owned by this plug-in
  • MS::kObjectDoesNotExist if the function set is not attached to an MObject.
Examples:
latticeNoise/latticeNoise.cpp, and sceneAssembly/sceneAssemblyPluginMain.cpp.
MStatus registerEvaluator ( const MString evaluatorName,
unsigned int  uniquePriority,
MCustomEvaluatorCreatorFunction  creatorFunction 
)

Register a new evaluator with Maya.

Once registered, the evaluator can be turned on and off via the command line like any other evaluator.

Parameters
[in]evaluatorNamethe name of the evaluator
[in]uniquePrioritya priority that needs to be unique. The custom evaluator with highest priority order will get the chance to claim nodes first.
[in]creatorFunctiona pointer to a function that will return a pointer to a new instance of the evaluator
Returns
Status code
Status Codes:
  • MS::kSuccess the evaluator was successfully registered
  • MS::kFailure the registration failed because an evaluator was already registered under the same name or the same priority.
  • MS::kInvalidParameter the registration failed because the evaluator object has already been registered under a different name.
  • MS::kNotFound registration failed because the creator function provided an invalid object.
MStatus deregisterEvaluator ( const MString evaluatorName)

Deregister the given user defined evaluator.

Once deregistered, the evaluator can no longer be used until registered again.

Parameters
[in]evaluatorNamethe name of the evaluator.
Returns
Status code
Status Codes:
  • MS::kSuccess evaluator successfully unregistered
  • MS::kFailure deregistration failed (possibly because the evaluator could not be found)
MStatus registerTopologyEvaluator ( const MString evaluatorName,
unsigned int  uniquePriority,
MTopologyEvaluatorCreatorFunction  creatorFunction 
)

Register a new evaluator with Maya.

Once registered, the evaluator can be turned on and off via the command line like any other evaluator.

Parameters
[in]evaluatorNamethe name of the evaluator
[in]uniquePrioritya priority that needs to be unique. The custom evaluator with highest priority order will get the chance to claim nodes first.
[in]creatorFunctiona pointer to a function that will return a pointer to a new instance of the evaluator
Returns
Status code
Status Codes:
  • MS::kSuccess the evaluator was successfully registered
  • MS::kFailure the registration failed because an evaluator was already registered under the same name or the same priority.
  • MS::kInvalidParameter the registration failed because the evaluator object has already been registered under a different name.
  • MS::kNotFound registration failed because the creator function provided an invalid object.
MStatus deregisterTopologyEvaluator ( const MString evaluatorName)

Deregister the given user defined evaluator.

Once deregistered, the evaluator can no longer be used until registered again.

Parameters
[in]evaluatorNamethe name of the evaluator.
Returns
Status code
Status Codes:
  • MS::kSuccess evaluator successfully unregistered
  • MS::kFailure deregistration failed (possibly because the evaluator could not be found)
MStatus registerShape ( const MString typeName,
const MTypeId typeId,
MCreatorFunction  creatorFunction,
MInitializeFunction  initFunction,
MCreatorFunction  uiCreatorFunction,
const MString classification = nullptr 
)

Registers the given user defined shape node with Maya.

Once registered, the shape can be used from MEL in a manner identical to built-in Maya nodes.

To deregister the shape node use the MFnPlugin::deregisterNode() method.

Parameters
[in]typeNamethe name of the new type of user defined shape node
[in]typeIda unique id that identifies this node
[in]creatorFunctiona pointer to a function that will return a pointer to a new instance of the class (derived from MPxSurfaceNode) that implements the new shape node type
[in]initFunctiona pointer to a function that will initialize all the attributes of the new shape node type
[in]uiCreatorFunctiona pointer to a function that will return a pointer to a new instance of the class (derived from MGxSurfaceShapeUI) that is used to implement the drawing and selection functions of the user defined shape.
[in]classificationa string that determines how the node will be categorized in various rendering-related UI, such as the Create Render Node and HyperShade windows. See the documentation for the getClassification command for a list of the supported classifications. If no string is supplied then the node will not be considered a rendering node and will not be displayed in those UI. The classification also allows the node type to be recognized as a shape with Viewport 2.0. A classification string which starts with "drawdb/geometry" (plus any further subclassifications) is required. Note that adding the subclassification "transform" immediately after "geometry" will indicate that this is a transform instead of shape. See the documentation for registerTransform().
Returns
Status code
Status Codes:
  • MS::kSuccess if the node type was successfully registered
  • MS::kFailure the registration failed.
  • MS::kObjectDoesNotExist if the function set is not attached to an MObject.
MStatus registerTransform ( const MString typeName,
const MTypeId typeId,
MCreatorFunction  creatorFunction,
MInitializeFunction  initFunction,
MCreateXformMatrixFunction  xformCreatorFunction,
const MTypeId xformId,
const MString classification = nullptr 
)

Registers the given user defined transform node with Maya.

Once registered, the transform can be used from MEL in a manner identical to built-in Maya nodes.

To deregister the transform node use the MFnPlugin::deregisterNode() method.

Parameters
[in]typeNamethe name of the new type of user defined transform node
[in]typeIda unique id that identifies this node
[in]creatorFunctiona pointer to a function that will return a pointer to a new instance of the class (derived from MPxTransform) that implements the new transform node type
[in]initFunctiona pointer to a function that will initialize all the attributes of the new transform node type
[in]xformCreatorFunctiona pointer to a function that will return a pointer to a new instance of the class (derived from MPxTransformationMatrix) that is used to implement the matrix functions of the custom transform. For default behavior, use the MPxTransformationMatrix::creator method.
[in]xformIda unique id that identifies this transformation matrix. If MPxTransformationMatrix::creator is used, then MPxTransformationMatrix::baseTransformationMatrixId should be used.
[in]classificationa string that determines how the node will be categorized in various rendering-related UI, such as the Create Render Node and HyperShade windows. See the documentation for the getClassification command for a list of the supported classifications. If no string is supplied then the node will not be considered a rendering node and will not be displayed in those UI. The classification also allows the node type to be recognized as a transform with Viewport 2.0. A classification string which starts with "drawdb/geometry/transform" (plus any further subclassifications) is required. If this classification is not specified then it will automatically be added for this node type.
Returns
Status code
Status Codes:
  • MS::kSuccess The node type was successfully registered
  • MS::kFailure The registration failed.
  • MS::kObjectDoesNotExist The function set is not attached to an MObject.
Examples:
rockingTransform/rockingTransformMain.cpp, and rockingTransformCheck/rockingTransformCheckMain.cpp.
MStatus registerData ( const MString typeName,
const MTypeId typeId,
MCreatorFunction  creatorFunction,
MPxData::Type  type = MPxData::kData 
)

Register a new data type with Maya.

Once registered, the data type can be passed between dependency nodes in a manner identical to built-in Maya data types.

Parameters
[in]typeNamethe name of the data type to register
[in]typeIdthe unique type id of the data type to register
[in]creatorFunctiona pointer to a function that will return a pointer to a new instance of the class (derived from MPxData) that implements the new data type.
[in]typethe type of data being registered, see the Type enum in MPxData.h for all available types

/return Status code

Status Codes:
  • MS::kSuccess if the data type is successfully registered
  • MS::kObjectDoesNotExist if the function set is not attached to an MObject
MStatus deregisterData ( const MTypeId typeId)

Deregister the given user defined data type from Maya.

It is important to note that this method will always fail if there are any instances of the user-defined data in the scene. If the plug-in were to be allowed to deregister its implementation of the data, it would become impossible to save the scene since the writeASCII and writeBinary methods would no longer be accessible.

Parameters
[in]typeIdthe unique type id of the data type to deregister
Returns
Status code
Status Codes:
  • MS::kSuccess if successful
  • MS::kFailure the data type is being used by current instances of nodes in the dependency graph
  • MS::kObjectDoesNotExist if the function set is not attached to an MObject.
MStatus registerDevice ( const MString deviceName,
MCreatorFunction  creatorFunction 
)

Register a new input device with Maya.

Once registered, the new input device can be connected to Maya actions using the assignInputDevice command in MEL in a manner identical to built-in Maya devices. In Maya 1.0, only Midi input devices are supported and the creatorFunction must return a pointer to a MPxMidiInputDevice instance. This interface will be generalized in a future release.

Parameters
[in]deviceNamethe name of the device to register
[in]creatorFunctiona pointer to a function that will return a pointer to a new instance of the class (derived from MPxMidiInputDevice) that implements the new device.
Returns
Status code
Status Codes:
  • MS::kSuccess if the device is successfully registered
  • MS::kObjectDoesNotExist if the function set is not attached to an MObject
MStatus deregisterDevice ( const MString deviceName)

Deregister the given user defined input device from Maya.

Parameters
[in]deviceNamethe name of the input device to deregister
Returns
Status code
Status Codes:
  • MS::kSuccess if successful
  • MS::kObjectDoesNotExist if the function set is not attached to an MObject.
MStatus registerFileTranslator ( const MString translatorName,
const char *  pixmapName,
MCreatorFunction  creatorFunction,
const char *  optionsScriptName = nullptr,
const char *  defaultOptionsString = nullptr,
bool  requiresFullMel = false,
MString  dataStorageLocation = MFnPlugin::kDefaultDataLocation 
)

Register a new file translator with Maya.

It requires a name string containing the "name" by which Maya will refer to this file type, and a pathname to an "icon" file which Maya will use in its file selection dialogs.

Parameters
[in]translatorNamethe string by which Maya will refer to this file type
[in]pixmapNamethe pathname of the icon used in file selection dialogs
[in]creatorFunctiona pointer to a function that will return a pointer to a new instance of the class (derived from MPxFileTranslator) that implements the new file type.
[in]optionsScriptNamethe name of a MEL script that will be used to display the contents of the options dialog during file open and save.
[in]defaultOptionsStringthe default value of the options string that will be passed to the options script.
[in]requiresFullMelthis should be set to true if the reader method in the derived class intends to issue MEL commands via the MGlobal::executeCommand method. Setting this to true will slow down the creation of new objects, but allows MEL commands other than those that are part of the Maya Ascii file format to function correctly. This parameter defaults to false.
[in]dataStorageLocationthe default location where this translator will store its data relative to the current project. This defaults to MFnPlugin::kDefaultDataLocation The translator command parameter -defaultFileRule will return this value.
Returns
  • MS::kSuccess if the file translator is successfully registered
  • MS::kObjectDoesNotExist if the function set is not attached to an MObject
MStatus deregisterFileTranslator ( const MString translatorName)

Deregister the specified file translator with Maya.

Parameters
[in]translatorNamethe name of the translator to deregister
Returns
Status code
Status Codes:
  • MS::kSuccess if the file translator is successfully registered
  • MS::kObjectDoesNotExist if the function set is not attached to an MObject
MStatus registerURIFileResolver ( const MString fileResolverName,
const MString uriScheme,
MCreatorFunction  creatorFunction 
)

Register a Custom URI File Resolver with Maya.

Parameters
[in]fileResolverNameName of new file resolver to register.
[in]uriSchemeURI scheme this resolver supports.
[in]creatorFunctionPointer to a function that will return a pointer to a new instance of the class (derived from MPxFileResolver) that implements the new file type.
Returns
Status code
Status Codes:
  • MS::kSuccess The file resolver was successfully registered
  • MS::kFailure otherwise
MStatus deregisterURIFileResolver ( const MString fileResolverName)

Deregister the specified URI file resolver with Maya.

Parameters
[in]fileResolverNamethe name of the file resolver to deregister
Returns
Status code
Status Codes:
  • MS::kSuccess if the file resolver is successfully deregistered
  • MS::kFailure otherwise
MStatus registerIkSolver ( const MString ikSolverName,
MCreatorFunction  creatorFunction 
)

Register a new ik-solver with Maya.

NOTE: this method is obsolete. Instead, register the IK solver as a node as described in the example plug-in simpleSolverNode.cpp.

Parameters
[in]ikSolverNamename of the new IK solver
[in]creatorFunctionpointer to a function that will return a pointer to a new instance of the class (derived from MPxIkSolver) that implements the new file type.
Returns
Status code
Status Codes:
  • MS::kSuccess The ik-solver was successfully registered
  • MS::kObjectDoesNotExist The function set is not attached to an MObject
MStatus deregisterIkSolver ( const MString ikSolverName)

Deregister the specified ik-solver with Maya.

NOTE: this method is obsolete. Instead, register the IK solver as a node as described in the example plug-in simpleSolverNode.cpp.

Parameters
[in]ikSolverNamethe name of the ik solver to deregister
Returns
Status code
Status Codes:
  • MS::kSuccess if the ik-solver is successfully registered
  • MS::kObjectDoesNotExist if the function set is not attached to an MObject
MStatus registerCacheFormat ( const MString cacheFormatName,
MCreatorFunction  creatorFunction 
)

Register a new cache format with Maya.

Parameters
[in]cacheFormatNameName of the new cache format.
[in]creatorFunctionPointer to a function that will return a pointer to a new instance of the class (derived from MPxCacheFormat) that implements the new file type.
Returns
Status code
Status Codes:
  • MS::kSuccess The cache format was successfully registered
  • MS::kObjectDoesNotExist The function set is not attached to an MObject
MStatus deregisterCacheFormat ( const MString cacheFormatName)

Deregister the specified cache format with Maya.

Parameters
[in]cacheFormatNamethe name of the cache format to deregister
Returns
Status code
Status Codes:
  • MS::kSuccess if the cache format type is successfully deregistered
  • MS::kFailure otherwise
MStatus registerUIStrings ( MInitializeFunction  registerMStringResources,
const MString pluginStringsProc 
)

Set the callback and procedure names of routines that register plugin string resources and optionally load localized values for them.

These procedures are called immediately upon plugin load. They are responsible for registering all string resources that can be referred to during the plugin execution. If the string resources are localized, the localized values are also loaded at this time.

Each string resource is given a default value when it is registered. If the plugin is localized, any localized values specified will override the registered default and will be used instead of the default value when the resource value is queried.

The registerMStringResources callback is a function which makes a series of calls to MStringResource::registerString for each MStringResourceId to be registered. Its signature is described by the MInitializeFunction typedef.

The pluginStringsProc is a mel procedure that will be evaluated to register any other strings resources for the plugin, i.e. those used in the plugin's scripts (see the registerPluginString command). It is also responsible for loading the localized resource overrides if they are available (see loadPluginLanguageResources).

See also the following classes: MStringResourceId, MStringResource.

Parameters
[in]registerMStringResourcesThis callback is used to register MStringResources that are used by the plugin code. The callback signature type is defined by MInitializeFunction.
[in]pluginStringsProcThe name of the mel procedure to be run during plugin load to register script-based resources. This script will also make the necessary calls to load localized string values if they exist.
Returns
Status code
Status Codes:
  • MS::kSuccess if successful
  • MS::kObjectDoesNotExist if the function set is not attached to an MObject.
Examples:
glslShader/GLSLShaderMainMaya.cpp, and sceneAssembly/sceneAssemblyPluginMain.cpp.
MStatus registerUI ( PyObject *  creationProc,
PyObject *  deletionProc,
PyObject *  creationBatchProc = nullptr,
PyObject *  deletionBatchProc = nullptr 
)

Sets the Python callable objects to be called to create and destroy any UI associated with the plugin.

Parameters
[in]creationProcThe name of the Python callable object to be run when the plug in is loaded
[in]deletionProcThe name of the Python callable object to be run when the plug in is unloaded
[in]creationBatchProcThe name of the Python callable object to be run when the plug in is loaded in batch mode. The procedure should not contain UI related code.
[in]deletionBatchProcThe name of the Python callable object to be run when the plug in is unloaded in batch mode. The procedure should not contain UI related code.
Returns
Status code
Status Codes:
  • MS::kSuccess if successful
  • MS::kObjectDoesNotExist if the function set is not attached to an MObject.
MStatus registerDragAndDropBehavior ( const MString behaviorName,
MCreatorFunction  creatorFunction 
)

Register a new drag and drop behavior with Maya.

Once registered, the new behavior can be used to finish connections between node drag and drops from the hyperGraph/hyperShade to other nodes or Maya UI.

Parameters
[in]behaviorNamethe name of the drag and drop behavior to register
[in]creatorFunctiona pointer to a function that will return a pointer to a new instance of the class (derived from MPxDragAndDropBehavior) that implements the new behavior.
Returns
Status code
Status Codes:
  • MS::kSuccess if the bevavior is successfully registered
  • MS::kObjectDoesNotExist if the function set is not attached to an MObject
Examples:
slopeShader/slopeShader.cpp.
MStatus deregisterDragAndDropBehavior ( const MString behaviorName)

Deregister the given drag and drop behavior from Maya.

Parameters
[in]behaviorNamethe name of the behavior to deregister
Returns
Status code
Status Codes:
  • MS::kSuccess if successful
  • MS::kObjectDoesNotExist if the function set is not attached to an MObject.
MStatus registerImageFile ( const MString imageFormatName,
MCreatorFunction  creatorFunction,
const MStringArray imageFileExtensions,
ImageFilePriority  priority = kImageFilePriorityDefault 
)

Register a new image file translator with Maya.

Parameters
[in]imageFormatNamethe name of the image format to register
[in]creatorFunctiona pointer to a function that will return a pointer to a new instance of the class (derived from MImageFile) that implements the new file type.
[in]imageFileExtensionsthis list of file extensions this image file should be associated with.
[in]priorityPriority number that allow user to specify the plugin priority. The higher the number is, the lower the priority is. High priority plugin will be use before Maya internal code and low priority plugin will be use after Maya internal code.
Returns
Status code
Status Codes:
  • MS::kSuccess if the image file type is successfully registered
  • MS::kFailure otherwise
MStatus deregisterImageFile ( const MString imageFormatName)

Deregister the specified image file translator with Maya.

Parameters
[in]imageFormatNamethe name of the image format to deregister
Returns
Status code
Status Codes:
  • MS::kSuccess if the image file type is successfully deregistered
  • MS::kFailure otherwise
MStatus registerRenderPassImpl ( const MString passImplId,
MRenderPassDef passDef,
MCreatorFunction  creatorFunction,
bool  overload = false 
)

Register a new render pass implementation with Maya and associate with the given render pass definition.

If an implementation with id passImplId has already been registered and creatorFunction is the same as the already registered creator function then the existing implementation will also be used for the current pass (SAME instances). It is an error if the passImplId is already defined and a different creatorFunction is used. If you wish to associate DIFFERENT instances of the same pass implementation with different passes, then use unique passImplIds when registering each.

Parameters
[in]passImplIda unique name identifying the pass implementation
[in]passDefthe render pass definition to associate this implementation with
[in]creatorFunctiona pointer to a function that will return a pointer to a new instance of the class (derived from MPxRenderPassImpl) that implements the render pass definiton.
[in]overloadOverride any existing implementation in the registry
Returns
Status code
Status Codes:
  • MS::kSuccess if the render pass implementation is successfully registered
  • MS::kFailure otherwise
MStatus deregisterRenderPassImpl ( const MString passImplId)

Deregister the specified render pass implementation with Maya.

This will remove the implementation from all passes it is associated with.

Parameters
[in]passImplIdthe name identifying the pass implementation to remove
Returns
Status code
Status Codes:
  • MS::kSuccess if the render pass implementation is successfully deregistered
  • MS::kFailure otherwise
MStatus registerAttributePatternFactory ( const MString patternFactoryName,
MCreatorFunction  creatorFunction 
)

Registers a new attribute pattern factory type with Maya.

Parameters
[in]patternFactoryNamethe new attribute pattern factory name.
[in]creatorFunctionpointer to function that returns a new instance of an attribute pattern factory.
Returns
Status code
Status Codes:
  • MS::kSuccess if the attribute pattern factory is successfully registered.
  • MS::kFailure otherwise
MStatus deregisterAttributePatternFactory ( const MString attributePatternFactoryName)

Deregister the attribute pattern factory type with Maya.

Parameters
[in]attributePatternFactoryNamethe attribute pattern factory name.
Returns
Status code
Status Codes:
  • MS::kSuccess if the attribute pattern factory is successfully deregistered
  • MS::kFailure otherwise
MStatus registerAnimCurveInterpolator ( const MString typeName,
int  typeId,
MCreatorFunction  creatorFunction,
int  flags = 0 
)

Register a new animation curve interpolator with Maya.

Once registered, the interpolator can be used in interpolating between keyframes.

Parameters
[in]typeNamethe name of the interpolator to register
[in]typeIdthe unique type id of the interpolator to register. See MPxAnimCurveInterpolator.
[in]creatorFunctiona pointer to a function that will return a pointer to a new instance of the class (derived from MPxAnimCurveInterpolator) that implements the new interpolator.
[in]flagsan integer value containing a combination of enum values as specified in the InterpolatorFlags enumerated type (see MPxAnimCurveInterpolator). The default value is 0.
Returns
  • MS::kSuccess if the interpolator type is successfully registered
  • MS::kInvalidParameters if the typeId or name has already been registered
  • MS::MS::kFailure if the registration is not successful
Examples:
interpPlugins/interpPlugins.cpp.
MStatus deregisterAnimCurveInterpolator ( const MString typeName)

Deregister the given user defined animation curve interpolator from Maya.

Parameters
[in]typeNamethe unique type id of the interpolator to deregister
Returns
  • MS::kSuccess if successful
  • MS::kNotFound if the interpolator type cannot be found
MStatus registerDisplayFilter ( const MString name,
const MString label,
const MString classification 
)

Register a new display filter with Maya.

A display filter with the same label and classification can be registered multiple times. There is a counter to maintain the registration. Each successful registration needs a call to deregisterDisplayFilter() to balance the counter.

See M3dView::setPluginObjectDisplay() for more details on plug-in display filters.

Parameters
[in]namethe new display filter name
[in]labelthe UI display name of the display filter
[in]classificationthe classification to filter objects in Viewport 2.0
Returns
Status code
Status Codes:
  • MS::kSuccess if the display filter is successfully registered.
  • MS::kFailure if there is already a filter with the same name but a different label or classification.
MStatus deregisterDisplayFilter ( const MString name)

Deregister a display filter with Maya.

Parameters
[in]namethe display filter name
Returns
Status code
Status Codes:
  • MS::kSuccess if the display filter is successfully deregistered.
  • MS::kFailure if there is no such display filter.
MStatus registerRenderer ( const MString name,
MCreatorFunction  creatorFunction 
)

Registers a new renderer identified by name.

Parameters
[in]nameThe name of the renderer
[in]creatorFunctiona pointer to a function that will return a pointer to a new instance of the class (derived from MPxRenderer) that implements the new renderer.
Returns
Status code
Status Codes:
  • MS::kSuccess if the renderer is successfully registered.
  • MS::kFailure if there is already a renderer with the same name.
MStatus deregisterRenderer ( const MString name)

Deregisters an renderer identified by name.

Parameters
[in]nameThe name of the renderer
Returns
Status code
MObject findPlugin ( const MString pluginName)
static

Returns an MObject corresponding to the named plugin.

If the plugin isn't loaded, the MObject will be kNullObj. This MObject may be used in the same way as the MObject passed to the plugin's initializePlugin() function. Do not hold onto this MObject, if you need it again later, call findPlugin() again.

Parameters
[in]pluginNamethe name of the plugin you want a handle for.
Returns
bool isNodeRegistered ( const MString typeName)
static

Queries if the given typeName has been registered by maya or plugins.

Parameters
[in]typeNamethe type name of a depend graph node to query.
Returns
true if registered, false otherwise.
MTypeId matrixTypeIdFromXformId ( const MTypeId xformTypeId,
MStatus ReturnStatus = nullptr 
)

The function returns the MTypeId of the matrix when the MTypeId of the corresponding xform is given.

Parameters
[in]xformTypeIdthe typeId of the transform.
[out]ReturnStatusReturn status.
Returns
MTypeId TypeId of the corresponding transformation matrix, if found.
MStringArray addMenuItem ( const MString menuItemName,
const MString parentName,
const MString commandName,
const MString commandParams,
bool  needOptionBox = false,
const MString optBoxFunction = nullptr,
MStatus retStatus = nullptr,
const MString extraMenuItemParams = nullptr 
)

The function adds the menuItem to the specified parent, and associates a command with it.

Additionally, an option box can be created and a MEL function/command can be added to it. The function returns the names of the new menuItem and the optionBox created.

Parameters
[in]menuItemNameThis will be used as the label for the menuItem.
[in]parentNameName of the parent to which the new menuItem needs to be attached.
[in]commandNameCommand to be attached.
[in]commandParamsParameters for the command.
[in]needOptionBoxBoolean indicating whether an option box is required. Default value is false.
[in]optBoxFunctionMEL Function to be attached to the option box. If the needOptionBox is false, then this argument will have no effect.
[out]retStatusReturn status.
[in]extraMenuItemParamsParameters for creating the menuItem.
Returns
MStringArray returns the names of the new menuItems created. In case the method fails, and MStringArray has items in it, removeMenuItem() should be called on it to remove the unused UI references.
MStatus removeMenuItem ( MStringArray menuItemNames)

The function removes the menuItem and the corresponding option box, if exists, from the UI.

Parameters
[in]menuItemNamesNames of the menuItem which needs to be removed.
Returns
Status code
Status Codes:
  • MS::kSuccess Menu item was removed.
  • MS::kFailure An error occurred.
MStatus registerMaterialInfo ( const MString materialInfoName,
MMaterialInfoFactoryFnPtr  fnPtr 
)

Registers a new material information type with Maya.

Parameters
[in]materialInfoNamethe new material info generator name.
[in]fnPtrpointer to function that return a new instance of material information node.
Returns
Status code
Status Codes:
  • MS::kSuccess if the material info node is successfully registered.
  • MS::kFailure otherwise
MStatus unregisterMaterialInfo ( const MString materialInfoName)

Deregister the specified material info type with Maya.

Parameters
[in]materialInfoNamethe material info generator name.
Returns
Status code
Status Codes:
  • MS::kSuccess if the material info node is successfully deregistered
  • MS::kFailure otherwise
MStatus registerBakeEngine ( const MString bakeEngineGenName,
MBakeEngineCreatorFnPtr  fnPtr 
)

Registers a new bake engine type with Maya.

Parameters
[in]bakeEngineGenNamethe new bake engine generator name.
[in]fnPtrpointer to function that return a new instance of bake engine generator node.
Returns
Status code
Status Codes:
  • MS::kSuccess if the bake engine generator node is successfully registered.
  • MS::kFailure otherwise
MStatus unregisterBakeEngine ( const MString bakeEngineGenName)

Deregister the bake engine type with Maya.

Parameters
[in]bakeEngineGenNamethe bake engine generator name.
Returns
Status code
Status Codes:
  • MS::kSuccess if the bake engine generator node is successfully deregistered
  • MS::kFailure otherwise
MStatus registerTransform ( const MString typeName,
const MTypeId typeId,
MCreatorFunction  creatorFunction,
MInitializeFunction  initFunction,
MCreatorFunction  xformCreatorFunction,
const MTypeId xformId,
const MString classification = nullptr 
)

This method is obsolete.

[From Maya 2019]

Deprecated:
Use the other version of registerTransform instead.
Deprecated:
Use the other version of registerTransform instead.
Parameters
[in]typeName
[in]typeId
[in]creatorFunction
[in]initFunction
[in]xformCreatorFunction
[in]xformId
[in]classification
Returns
Status code
MStatus registerUI ( const MString creationProc,
const MString deletionProc,
const MString creationBatchProc = "",
const MString deletionBatchProc = "" 
)

NO SCRIPT SUPPORT.

Sets the names of the mel procedures to be evaled to create and destroy any UI associated with the plugin.

You can use MEL procedure names as arguments to this method as long as the procedure is located in a file named procedure.mel. This works because, as described in the MEL documentation, when MEL is given a undefined procedure, it searchs MAYA_SCRIPT_PATH looking for a file with the name procedure.mel. If it finds such a file it is sourced and if the procedure was defined by the file, it is then executed.

Example: The procedure lassoToolCreateUI will be run when the plugin is loaded, the procedure lassoToolDeleteUI when the plugin is unloaded. This works as long as the MEL procedure lassoToolCreateUI is defined in a file called lassoToolCreateUI.mel and the procedure lassoToolDeleteUI is defined in a file called lassoToolDeleteUI.mel.

MStatus initializePlugin( MObject obj )
{
MStatus status;
MFnPlugin plugin( obj, "Autodesk - Example", "1.0", "Any");
status = plugin.registerContextCommand( "lassoToolContext",
lassoContextCmd::creator );
if (!status) {
status.perror("registerContextCommand");
return status;
}
// set the mel procs to be run when the plugin is loaded / unloaded
status = plugin.registerUI("lassoToolCreateUI", "lassoToolDeleteUI");
if (!status) {
status.perror("registerUIScripts");
return status;
}
return status;
}
Parameters
[in]creationProcThe name of the procedure to be run when the plug in is loaded
[in]deletionProcThe name of the procedure to be run when the plug in is unloaded
[in]creationBatchProcThe name of the procedure to be run when the plug in is loaded in batch mode. The procedure should not contain UI related code.
[in]deletionBatchProcThe name of the procedure to be run when the plug in is unloaded in batch mode. The procedure should not contain UI related code.
Returns
Status code
Status Codes:
  • MS::kSuccess if successful
  • MS::kObjectDoesNotExist if the function set is not attached to an MObject.
MStatus registerEvaluator ( const MString evaluatorName,
unsigned int  uniquePriority,
MCreatorFunction  creatorFunction 
)

This method is obsolete.

[From Maya 2020]

Deprecated:
Use the type-safe version of registerEvaluator instead.
Deprecated:
Use the type-safe version of registerEvaluator instead.
Parameters
[in]evaluatorNameDeprecated
[in]uniquePriorityDeprecated
[in]creatorFunctionDeprecated
Returns
Deprecated
MStatus registerTopologyEvaluator ( const MString evaluatorName,
unsigned int  uniquePriority,
MCreatorFunction  creatorFunction 
)

This method is obsolete.

[From Maya 2020]

Deprecated:
Use the type-safe version of registerTopologyEvaluator instead.
Deprecated:
Use the type-safe version of registerTopologyEvaluator instead.
Parameters
[in]evaluatorNameDeprecated
[in]uniquePriorityDeprecated
[in]creatorFunctionDeprecated
Returns
Deprecated
const char * className ( )
static

Returns the name of this class.

Returns
Name of this class.

The documentation for this class was generated from the following files: