- Main Page
- Related Pages
- Modules
- Classes
- Examples

- Class List
- Class Hierarchy
- Class Members

Public Types | Public Member Functions | Friends

# MStatus Class Reference
OpenMaya - API module for common classes

This reference page is linked to from the following overview topics: スレッド化と Maya, 国際化プロセス.

Search for all occurrences

## Detailed Description

Manipulate Maya Status codes.

This class facilitates API level error handling. It encapsulates the status code and the internal MAYA error code as return by API functions. The user can query, set, print the error code along with the error description.

Examples:

  affectsNode.cpp, animCubeNode.cpp, animExportUtil.cpp, animExportUtil.h, animFileExport.cpp, animFileUtils.cpp, animFileUtils.h, animImportExport.cpp, animImportExport.h, animInfoCmd.cpp, anisotropicShader.cpp, apiMeshCreator.cpp, apiMeshCreator.h, apiMeshData.cpp, apiMeshData.h, apiMeshShape.cpp, apiMeshShape.h, apiSimpleShape.cpp, apiSimpleShape.h, arcLenNode.cpp, asciiToBinary.cpp, AshliPluginMain.cpp, backfillShader.cpp, blindComplexDataCmd.cpp, blindDataMesh.cpp, blindDataMesh.h, blindDataPluginMain.cpp, blindDataShader.cpp, blindDataShader.h, blindDoubleDataCmd.cpp, blindShortDataCmd.cpp, brickShader.cpp, buildRotationNode.cpp, cellShader.cpp, cgfxAttrDef.cpp, cgfxFindImage.cpp, cgfxShaderCmd.cpp, cgfxShaderCmd.h, cgfxShaderNode.cpp, cgfxShaderNode.h, cgfxVector.cpp, cgfxVector.h, checkerShader.cpp, circleNode.cpp, cleanPerFaceAssignmentCmd.cpp, cleanPerFaceAssignmentCmd.h, cleanPerFaceAssignmentPluginMain.cpp, clearcoat.cpp, closestPointCmd.cpp, closestPointOnCurveCmd.cpp, closestPointOnCurveCmd.h, closestPointOnCurveNode.cpp, closestPointOnCurveNode.h, closestPointOnCurvePlugin.cpp, closestPointOnNurbsSurfaceCmd.cpp, closestPointOnNurbsSurfaceCmd.h, clothPaintAttrCmd.cpp, clothPaintAttrCmd.h, clusterWeightFunction.cpp, componentScaleManip.cpp, compositingShader.cpp, conditionTest.cpp, contrastShader.cpp, convertBumpCmd.cpp, convertEdgesToFacesCmd.cpp, convertVerticesToEdgesCmd.cpp, convertVerticesToFacesCmd.cpp, createClipCmd.cpp, curvedArrowsNode.cpp, customAttrManip.cpp, customImagePlane.cpp, cvColorNode.cpp, cvColorShader.cpp, cvExpandCmd.cpp, cvPosCmd.cpp, D3DResourceManager.cpp, D3DViewportRenderer.cpp, D3DViewportRenderer.h, D3DViewportRendererPlugin.cpp, dagMessageCmd.cpp, dagPoseInfoCmd.cpp, ddsFloatReader.cpp, deletedMsgCmd.cpp, depthShader.cpp, displacementShader.cpp, dynExprField.cpp, dynExprField.h, eventTest.cpp, exampleMRampAttribute.cpp, exportJointClusterDataCmd.cpp, exportSkinClusterDataCmd.cpp, fileIOMsgCmd.cpp, filteredAsciiFile.cpp, findFileTexturesCmd.cpp, findTexturesPerPolygonCmd.cpp, flameShader.cpp, flipUVCmd.cpp, flipUVCmd.h, flipUVMain.cpp, fluidInfoCmd.cpp, footPrintManip.cpp, footPrintNode.cpp, fullLoftNode.cpp, fxManagerCmd.cpp, fxManagerCmd.h, gammaShader.cpp, genericAttributeNode.cpp, geometryCacheConverter.cpp, geometryCacheFile.cpp, geometryCacheFile.h, geometrySurfaceConstraint.cpp, geometrySurfaceConstraint.h, geomShader.cpp, getAttrAffectsCmd.cpp, glExtensions.cpp, GLSLShaderNode.cpp, GLSLShaderNode.h, hairCollisionSolver.cpp, helix2Cmd.cpp, helixCmd.cpp, helixTool.cpp, helloCmd.cpp, helloWorld.cpp, helloWorldCmd.cpp, hlslPluginMain.cpp, hlslShader.cpp, hlslShader.h, hwAnisotropicShader_NV20.cpp, hwAnisotropicShader_NV20.h, hwColorPerVertexShader.cpp, hwDecalBumpShader_NV20.cpp, hwDecalBumpShader_NV20.h, hwManagedTextureShader.cpp, hwPhongShader.cpp, hwPhongShader.h, hwPhongShaderBehavior.cpp, hwPhongShaderBehavior.h, hwReflectBumpShader_NV20.cpp, hwReflectBumpShader_NV20.h, hwRefractReflectShader_NV20.cpp, hwRefractReflectShader_NV20.h, hwRenderPostEffect.cpp, hwToonShader_NV20.cpp, hwToonShader_NV20.h, hwUnlitShader.cpp, hwUnlitShader.h, iffInfoCmd.cpp, iffPixelCmd.cpp, iffPpmCmd.cpp, iffreader.cpp, iffreader.h, instanceCallbackCmd.cpp, instancerListCmd.cpp, interpShader.cpp, intersectCmd.cpp, intersectOnNurbsSurfaceCmd.cpp, intersectOnNurbsSurfaceCmd.h, jitterNode.cpp, jlcVcrDevice.cpp, lambertShader.cpp, lassoTool.cpp, latticeNoise.cpp, latticeNoise.h, latticeNoiseCmd.cpp, latticeNoiseNode.cpp, lavaShader.cpp, lepTranslator.cpp, lightShader.cpp, lineManip.cpp, lineManip.h, lineManipContainer.cpp, lineManipContainer.h, listLightLinksCmd.cpp, listPolyHolesCmd.cpp, lockEvent.cpp, marqueeTool.cpp, maTranslator.cpp, meshMapUtils.cpp, meshMapUtils.h, meshOpCmd.cpp, meshOpCmd.h, meshOpFty.h, meshOpFtyAction.cpp, meshOpMain.cpp, meshOpNode.cpp, meshOpNode.h, meshRemapCmd.cpp, meshRemapCmd.h, meshRemapTool.cpp, meshRemapTool.h, meshReorderCmd.cpp, meshReorderCmd.h, meshReorderPlugin.cpp, meshReorderTool.cpp, meshReorderTool.h, mixtureShader.cpp, motionPathCmd.cpp, motionTraceCmd.cpp, moveCurveCVsCmd.cpp, moveManip.cpp, moveNumericTool.cpp, moveTool.cpp, MTexture.cpp, multiCurveNode.cpp, narrowPolyViewer.cpp, narrowPolyViewer.h, narrowPolyViewerCmd.cpp, narrowPolyViewerCmd.h, narrowPolyViewerMain.cpp, nodeCreatedCBCmd.cpp, nodeCreatedCBCmd.h, nodeInfoCmd.cpp, nodeMessageCmd.cpp, NodeMonitor.cpp, NodeMonitor.h, noiseShader.cpp, objExport.cpp, offsetNode.cpp, OpenEXR.cpp, OpenGLViewportRenderer.cpp, OpenGLViewportRenderer.h, OpenGLViewportRendererPlugin.cpp, ownerEmitter.cpp, ownerEmitter.h, particleAttrNode.cpp, particleAttrNode.h, particleAttrNodeMain.cpp, particlePathsCmd.cpp, particleSystemInfoCmd.cpp, peltOverlapCmd.cpp, pfxInfoCmd.cpp, phongShader.cpp, pickCmd.cpp, pluginCallbacks.cpp, pluginMain.cpp, pnTrianglesNode.cpp, pnTrianglesNode.h, pointOnMeshCmd.cpp, pointOnMeshCmd.h, pointOnMeshInfoNode.cpp, pointOnMeshInfoNode.h, pointOnMeshInfoPlugin.cpp, pointOnSubdNode.cpp, pointOnSubdNode.h, polyExporter.cpp, polyExporter.h, polyMessageCmd.cpp, polyModifierCmd.cpp, polyModifierCmd.h, polyModifierFty.h, polyPrimitiveCmd.cpp, polyRawExporter.cpp, polyRawExporter.h, polyRawWriter.cpp, polyRawWriter.h, polyTrgNode.cpp, polyWriter.cpp, polyWriter.h, polyX3DExporter.cpp, polyX3DExporter.h, polyX3DWriter.cpp, polyX3DWriter.h, progressWindowCmd.cpp, quadricShape.cpp, readAndWrite.cpp, referenceQueryCmd.cpp, renderAccessNode.cpp, renderViewInteractiveRenderCmd.cpp, renderViewRenderCmd.cpp, renderViewRenderRegionCmd.cpp, rockingTransform.cpp, rockingTransform.h, rockingTransformCheck.cpp, rockingTransformCheck.h, rockingTransformCheckMain.cpp, rockingTransformMain.cpp, rotateManip.cpp, sampleCmd.cpp, sampleParticles.cpp, scanDagCmd.cpp, scanDagSyntax.cpp, ShadingConnection.cpp, shadowMatteShader.cpp, ShapeMonitor.cpp, shellNode.cpp, shiftNode.cpp, simpleEmitter.cpp, simpleEmitter.h, simpleFluidEmitter.cpp, simpleFluidEmitter.h, simpleImageFile.cpp, simpleLoftNode.cpp, simpleSolverNode.cpp, simpleSpring.cpp, simpleSpring.h, sineNode.cpp, slopeShader.cpp, slopeShaderBehavior.cpp, slopeShaderBehavior.h, slopeShaderNode.cpp, slopeShaderNode.h, solidCheckerShader.cpp, spiralAnimCurveCmd.cpp, splitUVCmd.cpp, splitUVCmd.h, splitUVFty.h, splitUVFtyAction.cpp, splitUVMain.cpp, splitUVNode.cpp, splitUVNode.h, squareScaleManip.cpp, squareScaleManip.h, squareScaleManipContext.cpp, squareScaleManipContext.h, stringFormatNode.cpp, surfaceBumpManip.cpp, surfaceCreate.cpp, surfaceCreateCmd.cpp, surfaceTwist.cpp, surfaceTwistCmd.cpp, sweptEmitter.cpp, sweptEmitter.h, swissArmyManip.cpp, testNobjectNode.cpp, testNobjectNode.h, testNucleusNode.cpp, testNucleusNode.h, threadTestCmd.cpp, threadTestWithLocksCmd.cpp, tiffFloatReader.cpp, torusField.cpp, torusField.h, transCircleNode.cpp, translateCmd.cpp, undoRedoMsgCmd.cpp, userMsgCmd.cpp, viewCallbackTest.cpp, viewCaptureCmd.cpp, volumeLightCmd.cpp, volumeShader.cpp, weightListNode.cpp, whatisCmd.cpp, XmlGeometryCache.cpp, yTwistNode.cpp, and zoomCameraCmd.cpp.

`#include <MStatus.h>`

List of all members.

## Public Types
enum | MStatusCode { kSuccess = 0, kFailure, kInsufficientMemory, kInvalidParameter, kLicenseFailure, kUnknownParameter, kNotImplemented, kNotFound, kEndOfFile }
| Available Status Codes. More...
## Public Member Functions
| MStatus ()
| The default class constructor.
| MStatus (MStatusCode)
| The constructor that takes a MStatus::MStatusCode.
| MStatus (const MStatus &)
| The copy constructor of the class.
MStatus & | operator= (const MStatus &rhs)
| The copy operator of the class.
bool | operator== (const MStatus &rhs) const
| The equivalence operator that takes another MStatus object.
bool | operator== (const MStatusCode rhs) const
| The equivalence operator that takes a MStatus::MStatusCode.
bool | operator!= (const MStatus &rhs) const
| The not equal operator for MStatus.
bool | operator!= (const MStatusCode rhs) const
| The not equal operator that takes a MStatus::MStatusCode.
bool | error () const
| Determines whether there is an error.
void | clear ()
| Clear error codes from the MStatus instance.
MStatusCode | statusCode () const
| Retrieve the type of error that occurred, as specified in the MStatusCode enumeration.
MString | errorString () const
| This method returns the internal error message as a MString object.
void | perror (const char *) const
| This method prints the error string preceded by a string supplied by the user to the standard error stream.
void | perror (const MString &) const
| The second version of the perror() method.
void | set (bool status, unsigned char statusCode, unsigned char internalStatusCode)
| Internal use only.
void | setSuccess ()
| The method is called interally by Maya to set the status as success.
| operator bool () const
| NO SCRIPT SUPPORT.
## Friends
OPENMAYA_EXPORT std::ostream & | operator<< (std::ostream &, MStatus &)
| NO SCRIPT SUPPORT.
OPENMAYA_EXPORT bool | operator== (const MStatus::MStatusCode code, const MStatus &status)
| NO SCRIPT SUPPORT.
OPENMAYA_EXPORT bool | operator!= (const MStatus::MStatusCode code, const MStatus &status)
| NO SCRIPT SUPPORT.

## Member Enumeration Documentation

enum MStatusCode

Search for all occurrences

Available Status Codes.

Enumerator:

  kSuccess | The operation was successful. Search for all occurrences
  kFailure | The operation failed. Search for all occurrences
  kInsufficientMemory | The operation failed due to insufficient memory. Search for all occurrences
  kInvalidParameter | An invalid parameter was provided. Search for all occurrences
  kLicenseFailure | Application is not licensed for the attempted operation. Search for all occurrences
  kUnknownParameter | Returned by MPxNode::compute for unrecognised plugs. Search for all occurrences
  kNotImplemented | Search for all occurrences
  kNotFound | Search for all occurrences
  kEndOfFile | Search for all occurrences

## Constructor & Destructor Documentation

MStatus | ( |  | ) | `[inline]`

The default class constructor.

It initializes the internal detailed status code to kSuccess.

MStatus | ( | MStatus::MStatusCode | status | ) |

The constructor that takes a MStatus::MStatusCode.

Initializes the internal detailed status code to status

Parameters:

  [in] | status | The initial detailed status code.

MStatus | ( | const MStatus & | status | ) | `[inline]`

The copy constructor of the class.

Initialize a new MStatus object with the values from another MStatus object.

Parameters:

  [in] | status | The target MStatus object.

## Member Function Documentation

MStatus & operator= | ( | const MStatus & | rhs | ) | `[inline]`

The copy operator of the class.

Parameters:

  [in] | rhs | The MStatus object to copy from.

Returns:
  A reference to the MStatus object that has been initialized.

bool operator== | ( | const MStatus & | rhs | ) | const`[inline]`

The equivalence operator that takes another MStatus object.

Parameters:

  [in] | rhs | A reference to the target object.

Returns:
  - true the two MStatus objects are equal.
  - false the two MStatus objects are not equal.

bool operator== | ( | const MStatusCode | rhs | ) | const`[inline]`

The equivalence operator that takes a MStatus::MStatusCode.

Parameters:

  [in] | rhs | a MStatus::MStatusCode, e.g. MS::kSuccess.

Returns:
  - true the object has the given detailed status code.
  - false the object does not have the given detailed status code.

bool operator!= | ( | const MStatus & | rhs | ) | const`[inline]`

The not equal operator for MStatus.

Parameters:

  [in] | rhs | a reference to the target object for comparison.

Returns:
  - true the two MStatus objects are not equal.
  - false the two MStatus objects are equal.

bool operator!= | ( | const MStatusCode | rhs | ) | const`[inline]`

The not equal operator that takes a MStatus::MStatusCode.

Parameters:

  [in] | rhs | a MStatus::MStatusCode, e.g. MS::kSuccess.

Returns:
  - true the object does not have the given detailed status code.
  - false the object has the given detailed status code.

bool error | ( |  | ) | const`[inline]`

Search for all occurrences

Determines whether there is an error.

Returns:
  - true an error has occured.
  - false the operation was successful

Examples:
  dagMessageCmd.cpp, geometrySurfaceConstraint.cpp, and nodeCreatedCBCmd.cpp.

void clear | ( |  | ) | `[inline]`

Search for all occurrences

Clear error codes from the MStatus instance.

After this call, it will behave as if it contained MS::kSuccess.

Examples:
  apiMeshGeom.h, cgfxShaderCmd.cpp, cgfxShaderNode.cpp, filteredAsciiFile.cpp, helix2Cmd.cpp, meshRemapCmd.cpp, meshReorderCmd.cpp, narrowPolyViewer.cpp, narrowPolyViewerCmd.cpp, splitUVCmd.cpp, and XmlGeometryCache.cpp.

MStatus::MStatusCode statusCode | ( |  | ) | const`[inline]`

Search for all occurrences

Retrieve the type of error that occurred, as specified in the MStatusCode enumeration.

Returns:
  The type of error that occurred.

Examples:
  scanDagCmd.cpp, and scanDagSyntax.cpp.

MString errorString | ( |  | ) | const

Search for all occurrences

This method returns the internal error message as a MString object.

Returns:
  A MString object which contains the error string.

Examples:
  GLSLShaderNode.cpp, and nodeCreatedCBCmd.cpp.

void perror | ( | const char * | preString | ) | const

Search for all occurrences

This method prints the error string preceded by a string supplied by the user to the standard error stream.

Parameters:

  [in] | preString | A pointer to char that points to a null terminated string.

Examples:
  affectsNode.cpp, animCubeNode.cpp, animImportExport.cpp, animInfoCmd.cpp, arcLenNode.cpp, asciiToBinary.cpp, AshliPluginMain.cpp, blindComplexDataCmd.cpp, blindDataPluginMain.cpp, blindDoubleDataCmd.cpp, blindShortDataCmd.cpp, buildRotationNode.cpp, cgfxShaderCmd.cpp, cgfxVector.cpp, circleNode.cpp, cleanPerFaceAssignmentPluginMain.cpp, closestPointOnCurvePlugin.cpp, closestPointOnNurbsSurfaceCmd.cpp, clothPaintAttrCmd.cpp, clusterWeightFunction.cpp, conditionTest.cpp, convertBumpCmd.cpp, convertEdgesToFacesCmd.cpp, convertVerticesToEdgesCmd.cpp, convertVerticesToFacesCmd.cpp, createClipCmd.cpp, curvedArrowsNode.cpp, customAttrManip.cpp, customImagePlane.cpp, cvColorNode.cpp, cvPosCmd.cpp, D3DResourceManager.cpp, D3DViewportRenderer.cpp, D3DViewportRendererPlugin.cpp, dagPoseInfoCmd.cpp, deletedMsgCmd.cpp, dynExprField.cpp, eventTest.cpp, exampleMRampAttribute.cpp, exportJointClusterDataCmd.cpp, exportSkinClusterDataCmd.cpp, fileIOMsgCmd.cpp, findFileTexturesCmd.cpp, fluidInfoCmd.cpp, footPrintManip.cpp, footPrintNode.cpp, fullLoftNode.cpp, genericAttributeNode.cpp, geometryCacheConverter.cpp, geometrySurfaceConstraint.cpp, getAttrAffectsCmd.cpp, helix2Cmd.cpp, helixTool.cpp, helloWorld.cpp, hwAnisotropicShader_NV20.cpp, hwDecalBumpShader_NV20.cpp, hwPhongShader.cpp, hwReflectBumpShader_NV20.cpp, hwRefractReflectShader_NV20.cpp, hwToonShader_NV20.cpp, hwUnlitShader.cpp, iffInfoCmd.cpp, iffPixelCmd.cpp, iffPpmCmd.cpp, intersectOnNurbsSurfaceCmd.cpp, jitterNode.cpp, jlcVcrDevice.cpp, lassoTool.cpp, latticeNoise.cpp, latticeNoiseNode.cpp, lepTranslator.cpp, lineManip.cpp, lineManipContainer.cpp, lockEvent.cpp, meshOpMain.cpp, meshOpNode.cpp, meshReorderPlugin.cpp, motionPathCmd.cpp, motionTraceCmd.cpp, moveCurveCVsCmd.cpp, moveNumericTool.cpp, moveTool.cpp, narrowPolyViewer.cpp, narrowPolyViewerMain.cpp, nodeCreatedCBCmd.cpp, nodeInfoCmd.cpp, OpenGLViewportRenderer.cpp, OpenGLViewportRendererPlugin.cpp, ownerEmitter.cpp, particleAttrNodeMain.cpp, particlePathsCmd.cpp, particleSystemInfoCmd.cpp, peltOverlapCmd.cpp, pfxInfoCmd.cpp, pickCmd.cpp, pnTrianglesNode.cpp, pointOnMeshInfoPlugin.cpp, pointOnSubdNode.cpp, polyPrimitiveCmd.cpp, polyRawExporter.cpp, polyX3DExporter.cpp, progressWindowCmd.cpp, readAndWrite.cpp, referenceQueryCmd.cpp, renderViewInteractiveRenderCmd.cpp, renderViewRenderCmd.cpp, renderViewRenderRegionCmd.cpp, rockingTransformCheckMain.cpp, rockingTransformMain.cpp, sampleCmd.cpp, sampleParticles.cpp, scanDagCmd.cpp, scanDagSyntax.cpp, shellNode.cpp, simpleEmitter.cpp, simpleFluidEmitter.cpp, simpleLoftNode.cpp, simpleSolverNode.cpp, simpleSpring.cpp, sineNode.cpp, spiralAnimCurveCmd.cpp, splitUVMain.cpp, splitUVNode.cpp, squareScaleManip.cpp, surfaceCreate.cpp, surfaceCreateCmd.cpp, surfaceTwist.cpp, surfaceTwistCmd.cpp, sweptEmitter.cpp, swissArmyManip.cpp, testNobjectNode.cpp, testNucleusNode.cpp, torusField.cpp, transCircleNode.cpp, translateCmd.cpp, undoRedoMsgCmd.cpp, userMsgCmd.cpp, viewCallbackTest.cpp, and zoomCameraCmd.cpp.

void perror | ( | const MString & | preString | ) | const

Search for all occurrences

The second version of the perror() method.

This method takes a reference to a MString as the parameter. It prints the error string preceded by the string supplied by the user to the standard error stream.

Parameters:

  [in] | preString | a reference to a MString object that contains the prefix string.

void set | ( | bool | status,
|  | unsigned char | statusCode,
|  | unsigned char | internalStatusCode
| ) |  | `[inline]`

Search for all occurrences

Internal use only.

The method is called interally by Maya to construct MStatus objects.

It should not be called from plugins.

Parameters:

  [in] | status | true or false
  [in] | statusCode | an element of MStatusCode
  [in] | internalStatusCode | an internal Maya error code

Examples:
  cvColorNode.cpp, GLSLShaderNode.cpp, and weightListNode.cpp.

void setSuccess | ( |  | ) | `[inline]`

Search for all occurrences

The method is called interally by Maya to set the status as success.

It should not be called from plugins.

operator bool | ( |  | ) | const`[inline]`

NO SCRIPT SUPPORT.

The conversion operator that converts a MStatus object to bool.

The result it returns will be true if the MStatus does not contain an error, and false if it does.

## Friends And Related Function Documentation

OPENMAYA_EXPORT std::ostream& operator<< | ( | std::ostream & | out,
|  | MStatus & | status
| ) |  | `[friend]`

NO SCRIPT SUPPORT.

This method outputs the detailed status code as well as the internal error description. The format of the output is "(errNumber): errorDescriptiveText".

Parameters:

  [in] | out | The ostream object that the output should be directed to.
  [in] | status | The MStatus object.

Returns:
  A reference to the ostream object.

MStatus MStatus MStatus MStatus MStatus MStatus MStatus MStatus MStatus MStatus
MStatus MStatus MStatus MStatus MStatus MStatus MStatus MStatus MStatus MStatus