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

Defines

# Macros

## Defines
#define | DeclareSimpleCommand(_className, _vendor, _version)
| This macro expands to all the code necessary to create an undoable command except for the command's "doIt" method.
#define | DeclareSingle(_fnptr)
| The macro expands to all the code necessary to create a basic non-undoable command that calls "functionPtr" from its doIt method.
#define | CHECK_MSTATUS_AND_RETURN(_status, _retVal)
| Return if status is not MStatus::kSuccess.
#define | CHECK_MSTATUS_AND_RETURN_IT(_status)
| Return if status is not MStatus::kSuccess.
#define | CHECK_MSTATUS(_status)
| Output an error message if status is not kSuccess.
#define | MFAIL(_status)
| True if the status is not MStatus::kSuccess.

## Define Documentation

#define DeclareSimpleCommand | ( |  | _className,
|  |  | _vendor,
|  |  | _version
| ) |  |

Search for all occurrences

This macro expands to all the code necessary to create an undoable command except for the command's "doIt" method.

This macro expects as arguments the name of the class that will be derived from MPxCommand, the name of the organisation owning this code, and the version number of the plug-in.

In addition to the macro, a method with the following prototype needs to be implemented.

      MStatus className::doIt( const MArgList& )

The macro will generate a class with the given classname that is derived from MPxCommand. It will also generate the following methods:

      void* className::creator()
      MStatus initializePlugin( MObject )
      MStatus uninitializePlugin( MObject )

All methods inherited from MPxCommand such as `setResult`, `displayWarning`, and `displayError` are available.

Parameters:

  [in] | _className | Name of the class
  [in] | _vendor | Name of the organisation owning this command
  [in] | _version | Plug-in version number

Examples:
  cvExpandCmd.cpp, findFileTexturesCmd.cpp, findTexturesPerPolygonCmd.cpp, getAttrAffectsCmd.cpp, helixCmd.cpp, helloCmd.cpp, helloWorldCmd.cpp, instancerListCmd.cpp, listLightLinksCmd.cpp, listPolyHolesCmd.cpp, threadTestCmd.cpp, threadTestWithLocksCmd.cpp, viewCaptureCmd.cpp, volumeLightCmd.cpp, and whatisCmd.cpp.

#define DeclareSingle | ( |  | _fnptr | ) |

Search for all occurrences

The macro expands to all the code necessary to create a basic non-undoable command that calls "functionPtr" from its doIt method.

One limitation of using this macro is that since "functionPtr" is not a member of the class derived from MPxCommand, it cannot call methods (like `setResult`) that are inherited from that class.

This macro requires as argument a function with the prototype:

      MStatus functionPtr ( const MArgList& )

The macro will generate a class called _DoItCmd which is derived from MPxCommand. It also generate the following methods:

      void* _DoItCmd::creator()
      MStatus _DoItCmd::doIt( const MArgList& args )
      MStatus initializePlugin( MObject )
      MStatus uninitializePlugin( MObject )

Parameters:

  [in] | _fnptr | Command function pointer

#define CHECK_MSTATUS_AND_RETURN | ( |  | _status,
|  |  | _retVal
| ) |  |

Search for all occurrences

Return if status is not MStatus::kSuccess.

Output an error message and returns the value 'retVal' if status is not kSuccess.

Parameters:

  [in] | _status | The status code.
  [in] | _retVal | Return value when status if not kSuccess.

Examples:
  flipUVCmd.cpp, hairCollisionSolver.cpp, renderViewInteractiveRenderCmd.cpp, renderViewRenderCmd.cpp, and renderViewRenderRegionCmd.cpp.

#define CHECK_MSTATUS_AND_RETURN_IT | ( |  | _status | ) |

Search for all occurrences

Return if status is not MStatus::kSuccess.

Output an error message and returns the status if it is not kSuccess.

Parameters:

  [in] | _status | The status code.

Examples:
  flipUVCmd.cpp, flipUVMain.cpp, and stringFormatNode.cpp.

#define CHECK_MSTATUS | ( |  | _status | ) |

Search for all occurrences

Output an error message if status is not kSuccess.

Parameters:

  [in] | _status | The status code.

Examples:
  affectsNode.cpp, anisotropicShader.cpp, apiMeshCreator.cpp, AshliPluginMain.cpp, backfillShader.cpp, brickShader.cpp, cellShader.cpp, checkerShader.cpp, circleNode.cpp, clearcoat.cpp, compositingShader.cpp, contrastShader.cpp, cvColorShader.cpp, ddsFloatReader.cpp, depthShader.cpp, displacementShader.cpp, flameShader.cpp, gammaShader.cpp, genericAttributeNode.cpp, geomShader.cpp, hairCollisionSolver.cpp, hlslPluginMain.cpp, hwColorPerVertexShader.cpp, hwManagedTextureShader.cpp, interpShader.cpp, lambertShader.cpp, lavaShader.cpp, lightShader.cpp, mixtureShader.cpp, multiCurveNode.cpp, noiseShader.cpp, OpenEXR.cpp, phongShader.cpp, pluginMain.cpp, pointOnMeshInfoNode.cpp, progressWindowCmd.cpp, renderAccessNode.cpp, simpleImageFile.cpp, stringFormatNode.cpp, tiffFloatReader.cpp, and volumeShader.cpp.

#define MFAIL | ( |  | _status | ) |

Search for all occurrences

True if the status is not MStatus::kSuccess.

Parameters:

  [in] | _status | The status code.