MatthiasBuehlmann
07-15-2008, 12:20 PM
Hey There!
I'm reading the book "Complete Maya Programming" written by David Gould
something that confuses me a lot is that he uses throughout his whole book the following syntax to do error checking:
MStatus stat;
stat = someMayaFunction();
//errorchecking:
if(!stat)
MGlobal::displayWarning( "Some Error Message" );
however.. if i look at the enumerations, then i see that
MS::kSuccess = 0
MS::kFailure = 1
and all the other states are >1
so... by checking if(!stat) he is actually checking for success instead of checking for failure.
However - his plugins work if i compile them. so it seams i missed something.
Another thing is, that 'MStatus' is a class. this class contains the enumerations MStatusCode (MS::kSuccess for example is such an MStatusCode enumeration).
now - if a function has the returntype MStatus, it is legal to write
return MS::kSuccess;
inside this function.
But why? the return type is MStatus - so why can i return an enumeration which is actually nothing else then an integer?
you see... a lot of confusion. can you help me on that?
thank you
I'm reading the book "Complete Maya Programming" written by David Gould
something that confuses me a lot is that he uses throughout his whole book the following syntax to do error checking:
MStatus stat;
stat = someMayaFunction();
//errorchecking:
if(!stat)
MGlobal::displayWarning( "Some Error Message" );
however.. if i look at the enumerations, then i see that
MS::kSuccess = 0
MS::kFailure = 1
and all the other states are >1
so... by checking if(!stat) he is actually checking for success instead of checking for failure.
However - his plugins work if i compile them. so it seams i missed something.
Another thing is, that 'MStatus' is a class. this class contains the enumerations MStatusCode (MS::kSuccess for example is such an MStatusCode enumeration).
now - if a function has the returntype MStatus, it is legal to write
return MS::kSuccess;
inside this function.
But why? the return type is MStatus - so why can i return an enumeration which is actually nothing else then an integer?
you see... a lot of confusion. can you help me on that?
thank you
