Removal of MStatus return codes from .NET API

The MStatus class does not exist in the Maya .NET API. Functions that return an MStatus in C++ have been converted to void functions or return a boolean in C# to indicate special cases to Maya; for example, if Maya is expected to do processing in place of the plug-in. In the .NET API, these functions return true in place of MStatus.kSuccess and false otherwise.

The following function returns false instead of MStatus.kFailure:

The following functions return false instead of MStatus.kUnknownParameter:

The following functions return false instead of MStatus.kNotImplemented:

The following function returns false instead of MStatus.kNotFound

This behavior also applies to the Maya functions that a plug-in calls. For instance, a function that in C++ returns kFailure in case of a failure instead throws an exception of type ApplicationException in C#. The following are the possible types of exceptions:

When Maya calls a function of your plug-in (for example, the virtual method doIt() of a MPxCommand derived class), it always wraps the call with a try-catch clause. When it catches an exception thrown either by your function or by a Maya function that your function calls, a message box appears and displays the details of the exception, including the callstack, which may be very useful for debugging.


Thanks to this high-level try-catch, you do not have to wrap any call to a Maya function with a try-catch clause unless you want to react to an exception in a particular way.