ottom
09-23-2006, 10:07 AM
Hello,
I am stucked on the following mystical problem: here is a simple code that just outputs the current status in words. In the first part I use a nested if-query, in the second part I use a switch-case-query.
As you see the Status is previously set to MStatus::kSuccess. Thus the expected result in the output window is:
ifStatus = kSuccess
caStatus = kSuccess
But the actual result is mysterious:
ifStatus = kSuccess
caStatus = kFailure
How is it possible that the switch-case-query returns something different than the if-query? Note, there is no call to any intrinsic Maya-command inbetween that could change the status.
Status = MStatus::kSuccess;
if(Status == MStatus::kEndOfFile) {
cout << "ifStatus = kEndOfFile" << endl; }
else if(Status == MStatus::kFailure) {
cout << "ifStatus = kFailure" << endl; }
else if(Status == MStatus::kInsufficientMemory) {
cout << "ifStatus = kInsufficientMemory" << endl; }
else if(Status == MStatus::kInvalidParameter) {
cout << "ifStatus = kInvalidParameter" << endl; }
else if(Status == MStatus::kLicenseFailure) {
cout << "ifStatus = kLicenseFailure" << endl; }
else if(Status == MStatus::kNotFound) {
cout << "ifStatus = kNotFound" << endl; }
else if(Status == MStatus::kNotImplemented) {
cout << "ifStatus = kNotImplemented" << endl; }
else if(Status == MStatus::kSuccess) {
cout << "ifStatus = kSuccess" << endl; }
else if(Status == MStatus::kUnknownParameter) {
cout << "ifStatus = kUnknownParameter" << endl; }
else {
cout << "Status = ?" << endl; }
switch(Status)
{
case MStatus::kEndOfFile :
cout << "caStatus = kEndOfFile" << endl; break;
case MStatus::kFailure :
cout << "caStatus = kFailure" << endl; break;
case MStatus::kInsufficientMemory :
cout << "caStatus = kInsufficientMemory" << endl; break;
case MStatus::kInvalidParameter :
cout << "caStatus = kInvalidParameter" << endl; break;
case MStatus::kLicenseFailure :
cout << "caStatus = kLicenseFailure" << endl; break;
case MStatus::kNotFound :
cout << "caStatus = kNotFound" << endl; break;
case MStatus::kNotImplemented :
cout << "caStatus = kNotImplemented" << endl; break;
case MStatus::kSuccess :
cout << "caStatus = kSuccess" << endl; break;
case MStatus::kUnknownParameter :
cout << "caStatus = kUnknownParameter" << endl; break;
}
You can change the first line to Status = MStatus::kFailure; than in the output window appears the following:
caStatus = kFailure
ifStatus = kSuccess
What do not I see here?!
I am stucked on the following mystical problem: here is a simple code that just outputs the current status in words. In the first part I use a nested if-query, in the second part I use a switch-case-query.
As you see the Status is previously set to MStatus::kSuccess. Thus the expected result in the output window is:
ifStatus = kSuccess
caStatus = kSuccess
But the actual result is mysterious:
ifStatus = kSuccess
caStatus = kFailure
How is it possible that the switch-case-query returns something different than the if-query? Note, there is no call to any intrinsic Maya-command inbetween that could change the status.
Status = MStatus::kSuccess;
if(Status == MStatus::kEndOfFile) {
cout << "ifStatus = kEndOfFile" << endl; }
else if(Status == MStatus::kFailure) {
cout << "ifStatus = kFailure" << endl; }
else if(Status == MStatus::kInsufficientMemory) {
cout << "ifStatus = kInsufficientMemory" << endl; }
else if(Status == MStatus::kInvalidParameter) {
cout << "ifStatus = kInvalidParameter" << endl; }
else if(Status == MStatus::kLicenseFailure) {
cout << "ifStatus = kLicenseFailure" << endl; }
else if(Status == MStatus::kNotFound) {
cout << "ifStatus = kNotFound" << endl; }
else if(Status == MStatus::kNotImplemented) {
cout << "ifStatus = kNotImplemented" << endl; }
else if(Status == MStatus::kSuccess) {
cout << "ifStatus = kSuccess" << endl; }
else if(Status == MStatus::kUnknownParameter) {
cout << "ifStatus = kUnknownParameter" << endl; }
else {
cout << "Status = ?" << endl; }
switch(Status)
{
case MStatus::kEndOfFile :
cout << "caStatus = kEndOfFile" << endl; break;
case MStatus::kFailure :
cout << "caStatus = kFailure" << endl; break;
case MStatus::kInsufficientMemory :
cout << "caStatus = kInsufficientMemory" << endl; break;
case MStatus::kInvalidParameter :
cout << "caStatus = kInvalidParameter" << endl; break;
case MStatus::kLicenseFailure :
cout << "caStatus = kLicenseFailure" << endl; break;
case MStatus::kNotFound :
cout << "caStatus = kNotFound" << endl; break;
case MStatus::kNotImplemented :
cout << "caStatus = kNotImplemented" << endl; break;
case MStatus::kSuccess :
cout << "caStatus = kSuccess" << endl; break;
case MStatus::kUnknownParameter :
cout << "caStatus = kUnknownParameter" << endl; break;
}
You can change the first line to Status = MStatus::kFailure; than in the output window appears the following:
caStatus = kFailure
ifStatus = kSuccess
What do not I see here?!
