void CPaneHierarchy::RefreshHierarchy() { m_wndTreeHierarchy.DeleteAllItems(); uint32 count = gEnv->pGameObjSystem->getGameObjectCount(); uint32 realcount = 0; uint32 fullcount = 0; for( uint32 i=0; i < count; ++i) { IGameObject* go = gEnv->pGameObjSystem->GetGameObjectById(i); if (go && go->getParent() == NULL && go->getGameObjectSuperClass() != eGOClass_SYSTEM) { //HTREEITEM hItem = m_wndTreeHierarchy.InsertItem( go->getName().c_str() ); RefreshChild(go, NULL); } } }
//----------------------------------------------------------------------- void gkSceneBuilder::saveSceneToFile( const TCHAR* filename ) { float estTime = gEnv->pTimer->GetAsyncCurTime(); IRapidXmlAuthor author; // initialize the doc [12/4/2011 Kaiming] author.initializeSceneWrite(); CRapidXmlAuthorNode* head = author.createRapidXmlNode(_T("GameKnifeScene")); head->AddAttribute(_T("author"), _T("gkENGINE RapidXml Author")); head->AddAttribute(_T("version"), _T("1.0.0")); head->AddAttribute(_T("level"), filename); ////////////////////////////////////////////////////////////////////////// // 导出地形 ITerrianSystem* terrian = gEnv->p3DEngine->getTerrian(); if (terrian) { CRapidXmlAuthorNode* terrianNode = author.createRapidXmlNode(_T("Terrian")); terrian->Save( terrianNode ); } CRapidXmlAuthorNode* root = author.createRapidXmlNode(_T("SceneObjects")); uint32 count = gEnv->pGameObjSystem->getGameObjectCount(); uint32 realcount = 0; uint32 fullcount = 0; for( uint32 i=0; i < count; ++i) { IGameObject* go = gEnv->pGameObjSystem->GetGameObjectById(i); if (go && go->getParent() == NULL && go->getGameObjectSuperClass() != eGOClass_SYSTEM) { CObjectNode* authorNode = author.createObjectNode(root); exportChildInfo(go, authorNode, &author, fullcount); realcount++; fullcount++; } } root->AddAttribute(_T("TopLevelCount"), (int)realcount); root->AddAttribute(_T("AllCount"), (int)fullcount); author.writeToFile(filename); // write the same name tod file [1/8/2012 Kaiming] gkStdString relScenePath = gkGetGameRelativePath(filename); TCHAR todfilename[MAX_PATH]; _tcscpy_s(todfilename, relScenePath.c_str()); todfilename[_tcslen(todfilename) - 4] = 0; _tcscat_s(todfilename, _T(".tod")); gEnv->p3DEngine->getTimeOfDay()->saveTODSequence(todfilename); estTime = gEnv->pTimer->GetAsyncCurTime() - estTime; // gkLogMessage(_T("Scene [ %s ] saved successfully. Use %.4f seconds."), filename, estTime); // gkLogMessage(_T("TOD [ %s ] saved successfully. Use %.4f seconds."), todfilename, estTime); }