本文整理汇总了C++中Application::ExecuteCommand方法的典型用法代码示例。如果您正苦于以下问题:C++ Application::ExecuteCommand方法的具体用法?C++ Application::ExecuteCommand怎么用?C++ Application::ExecuteCommand使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Application
的用法示例。
在下文中一共展示了Application::ExecuteCommand方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: VMFImport
void VMFImport()
{
Application app;
CStatus st;
Property prop;
prop = app.GetActiveSceneRoot().GetProperties().GetItem( L"VMFImportProperty" );
if (!prop.IsValid())
prop = app.GetActiveSceneRoot().AddProperty( L"VMFImportProperty" ) ;
CValueArray args(5);
args[0] = prop;
args[1] = L"";
args[2] = L"VMFImportProperty";
args[3] = (long)4;
args[4] = true;
CValue ret;
st = app.ExecuteCommand(L"InspectObj",args,ret);
if ( CStatus::OK == st ) {
//
// FileName
//
char l_szFilename[MAX_PATH];
memset ( l_szFilename,0,MAX_PATH );
Parameter parm = prop.GetParameters().GetItem(L"Filename" );
CString str = parm.GetValue();
const wchar_t * p = str.GetWideString();
wcstombs( l_szFilename, p, wcslen (p));
parm = prop.GetParameters().GetItem(L"TexturePath" );
str = parm.GetValue();
p = str.GetWideString();
wcstombs( ___gTexturePathOverride, p, wcslen (p));
//
// Bools
//
parm = prop.GetParameters().GetItem(L"UseMaterials");
g_iImportMaterials = (bool) parm.GetValue();
if (l_szFilename && strlen( l_szFilename ) > 0)
{
CMapParser p;
p.Read ( l_szFilename );
p.ConvertToSemanticLayer();
}
else
{
XSILogMessage ( L"Error - Invalid file specified", XSI::siErrorMsg );
}
}
}
示例2: DeleteObj
void DeleteObj( const CValue& in_inputobj )
{
Application app;
CValueArray args(1);
CValue retval;
long i(0);
args[i++]= in_inputobj;
CStatus st = app.ExecuteCommand( L"DeleteObj", args, retval );
return;
}
示例3: siOnActivateEvent_OnEvent
// Callback for the siOnActivateEvent event.
SICALLBACK siOnActivateEvent_OnEvent( CRef& in_ctxt )
{
Context ctxt( in_ctxt );
//Application().LogMessage(L"siOnActivateEvent_OnEvent called",siVerboseMsg);
//Application().LogMessage(L"State: " + CString(ctxt.GetAttribute(L"State")),siVerboseMsg);
bool bState = ctxt.GetAttribute(L"State");
if(bState)
{
CustomProperty prop = app.GetActiveSceneRoot().GetProperties().GetItem(L"AppLink_3DCoat");
if (prop.IsValid())
{
if(prop.GetParameter("bEvent").GetValue())
{
CString s_CoatLocation = prop.GetParameter(L"coatLocation").GetValue();
CString exportPath = CUtils::BuildPath(s_CoatLocation, L"export.txt");
CString objPath;
std::ifstream fileref(exportPath.GetAsciiString());
bool bfile = false;
if(fileref.good())
{
std::string row;
std::getline(fileref, row);
objPath = row.c_str();
bfile = true;
}
fileref.close();
if(bfile)
{
UIToolkit uitool = Application().GetUIToolkit();
LONG out;
uitool.MsgBox(L"Import file?", siMsgOkCancel|siMsgInformation|MB_APPLMODAL, L"", (LONG) out);
if(out == siMsgOk)
{
app.LogMessage(L"Start Import!");
CValueArray args(2);
args[0] = objPath;
args[1] = prop.GetParameterValue( L"bReplace" );
CValue noret;
app.ExecuteCommand( L"Coat3DImport", args, noret ) ;
}
}
}
}
}
// Return value is ignored as this event can not be aborted.
return CStatus::OK;
}
示例4: coatClicked
SICALLBACK coatClicked( CRef& in_ref)
{
CustomProperty prop = Get3DCoatProp();
CValue retVal;
CValueArray args(5);
args[0] = prop;
args[3] = (LONG)siLock;
app.ExecuteCommand( L"InspectObj", args, retVal );
return CStatus::OK;
}
示例5: Popup
CStatus Popup( const CString& in_inputobjs, const CString& in_keywords, const CString& in_title, const CValue& /*number*/ in_mode, bool in_throw )
{
Application app;
CValueArray args(5);
CValue retval;
long i(0);
args[i++]= in_inputobjs;
args[i++]= in_keywords;
args[i++]= in_title;
args[i++]= in_mode;
args[i++]= in_throw;
return app.ExecuteCommand( L"InspectObj", args, retval );
}
示例6: AppLink_3DCoat_PPGEvent
SICALLBACK AppLink_3DCoat_PPGEvent( const CRef& in_ctxt )
{
//Application app;
PPGEventContext ctxt( in_ctxt ) ;
CustomProperty prop = ctxt.GetSource();
PPGEventContext::PPGEvent eventID = ctxt.GetEventID() ;
//CString s_ExeLocation = prop.GetParameter(L"coatExe").GetValue();
if ( eventID == PPGEventContext::siOnInit )
{
CString s_ExportLocation = prop.GetParameter(L"tempLocation").GetValue();
CString s_CoatLocation = prop.GetParameter(L"coatLocation").GetValue();
Plugin pl(app.GetPlugins().GetItem(L"AppLink_3DCoat_Plugin"));
pluginPath = CUtils::BuildPath(app.GetInstallationPath(pl.GetOrigin()), L"AppLink_3DCoat", L"Application", L"Plugins");
if(prop.GetParameter(L"tempLocation").GetValue() == L"")
{
Project prj = app.GetActiveProject();
Scene scn = prj.GetActiveScene();
CString tempPath = CUtils::BuildPath(app.GetInstallationPath(siProjectPath), L"3DCoat", scn.GetName(), scn.GetName() + L".obj");
prop.GetParameter(L"tempLocation").PutValue(tempPath);
prop.GetParameter(L"tempLocation").PutCapabilityFlag(siReadOnly, true);
}
if(prop.GetParameter(L"coatLocation").GetValue() == L"")
{
TCHAR Path[MAX_PATH];
if(SUCCEEDED(SHGetFolderPath(NULL, CSIDL_PERSONAL, NULL, 0, Path)))
{
CString exchPath = CUtils::BuildPath(Path, L"3D-CoatV3", L"Exchange");
prop.GetParameter(L"coatLocation").PutValue(exchPath);
}
}
//prop.GetParameter(L"bImpNorm").PutCapabilityFlag(siNotInspectable, true);
//prop.GetParameter(L"bImpNewMat").PutCapabilityFlag(siReadOnly, true);
ctxt.PutAttribute(L"Refresh",true);
}
else if ( eventID == PPGEventContext::siButtonClicked )
{
CValue buttonPressed = ctxt.GetAttribute( L"Button" );
CString tempLocation = prop.GetParameter(L"tempLocation").GetValue();
CString coatLocation = prop.GetParameter(L"coatLocation").GetValue();
if( buttonPressed.GetAsText() == L"Coat3DExport" )
{
CustomProperty in_pset = ctxt.GetSource();
if(CUtils::EnsureFolderExists(tempLocation, true))
{
CValueArray args(6);
args[0] = tempLocation;
args[1] = coatLocation;
args[2] = in_pset.GetParameterValue( L"typePaint" );
//args[3] = in_pset.GetParameterValue( L"bCopyTexE" );
args[3] = in_pset.GetParameterValue( L"bExpMat" );
args[4] = in_pset.GetParameterValue( L"bExpUV" );
args[5] = in_pset.GetParameterValue( L"bExpNorm" );
CValue retVal;
app.ExecuteCommand( L"Coat3DExport", args, retVal );
CString exeLocation = prop.GetParameter(L"exeLocation").GetValue();
bool bStart = prop.GetParameter(L"bStart").GetValue();
if(exeLocation != L"" && bStart)
{
if(!Find3DCoat())
{
if((int)::ShellExecute(NULL, TEXT("open"), exeLocation.GetAsciiString(), NULL, NULL, SW_SHOWNORMAL) <= 32)
{
app.LogMessage(L"3D-Coat.exe not found!", siWarningMsg);
}
}
else
{
app.LogMessage(L"3D-Coat.exe is run!", siWarningMsg);
}
}
}
else
{
app.LogMessage(L"Note temp path exists!", siErrorMsg);
}
}
else if( buttonPressed.GetAsText() == L"Coat3DImport" )
{
CustomProperty in_pset = ctxt.GetSource();
CString exportPath = CUtils::BuildPath(coatLocation, L"export.txt");
CString objPath;
std::ifstream mfrExportTxt;
mfrExportTxt.open (exportPath.GetAsciiString());//c:\Documents and Settings\user\My Documents\3D-CoatV3\Exchange\export.txt
//.........这里部分代码省略.........