For you SDK users, has anybody experienced flakey behavior calling custom
commands via Application.ExecuteCommand() in C++?
I can successfully call native Softimage commands such as InspectObj(), but
when I call custom commands it seems rather hit or miss. Some commands work,
others don't. I cannot find the magic bullet between those that work and those
which do not. I checked for explicitly defined return values as described in
the SDK docs, but that wasn't the case as all the custom commands are
structured the same. The most often encountered problem is I get an
unspecified error and my custom command never executes.
Example:
Command prototype:
XSI::CString TargetFileName = MyCommand( XSI::CString SourceFileName );
I call my custom command like this:
XSI::Application oApplication;
XSI::CValueArray aArguments(2);
aArguments[0] = SourceFileName;
aArguments[1] = XSI::CValue(); // value
returned by command
// call the command
XSI::CValue ErrorCode;
XSI::CStatus ErrorStatus;
ErrorStatus = oApplication.ExecuteCommand( L"MyCommand",
aArguments, ErrorCode );
XSI::CString TargetFileName = aArguments[1];
If ( ErrorStatus != XSI::CStatus::OK )
{
oApplication.LogMessage( L"ErrorCode: " +
(XSI::CString)ErrorCode, XSI::siErrorMsg );
oApplication.LogMessage( L"StatusCode: " + (XSI::CString)ErrorStatus.GetCode(),
XSI::siErrorMsg );
oApplication.LogMessage( L"StatusDescription: " +
(XSI::CString)ErrorStatus.GetDescription(), XSI::siErrorMsg );
oApplication.LogMessage( L"TargetFileName: " + TargetFileName, XSI::siErrorMsg
);
return( XSI::CStatus::Fail );
}
return( XSI::CStatus::OK );
Output:
// ERROR: ErrorCode:
// ERROR: StatusCode: -2147352562
// ERROR: StatusDescription: The operation has ended with an
undefined error.
// ERROR: TargetFileName:
Doesn't matter if my custom command is written in a scripting language or C++.
I get the same results.
Thanks,
Matt