assimpShapeLoader.cpp 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511
  1. //-----------------------------------------------------------------------------
  2. // Copyright (c) 2012 GarageGames, LLC
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to
  6. // deal in the Software without restriction, including without limitation the
  7. // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  8. // sell copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  20. // IN THE SOFTWARE.
  21. //-----------------------------------------------------------------------------
  22. /*
  23. Resource stream -> Buffer
  24. Buffer -> Collada DOM
  25. Collada DOM -> TSShapeLoader
  26. TSShapeLoader installed into TSShape
  27. */
  28. //-----------------------------------------------------------------------------
  29. #include "platform/platform.h"
  30. #include "ts/assimp/assimpShapeLoader.h"
  31. #include "ts/assimp/assimpAppNode.h"
  32. #include "ts/assimp/assimpAppMesh.h"
  33. #include "ts/assimp/assimpAppMaterial.h"
  34. #include "ts/assimp/assimpAppSequence.h"
  35. #include "core/util/tVector.h"
  36. #include "core/strings/findMatch.h"
  37. #include "core/stream/fileStream.h"
  38. #include "core/fileObject.h"
  39. #include "ts/tsShape.h"
  40. #include "ts/tsShapeInstance.h"
  41. #include "materials/materialManager.h"
  42. #include "console/persistenceManager.h"
  43. #include "ts/tsShapeConstruct.h"
  44. #include "core/util/zip/zipVolume.h"
  45. #include "gfx/bitmap/gBitmap.h"
  46. #include "gui/controls/guiTreeViewCtrl.h"
  47. // assimp include files.
  48. #include <assimp/cimport.h>
  49. #include <assimp/scene.h>
  50. #include <assimp/postprocess.h>
  51. #include <assimp/types.h>
  52. #include <assimp/config.h>
  53. #include <exception>
  54. #include <assimp/Importer.hpp>
  55. MODULE_BEGIN( AssimpShapeLoader )
  56. MODULE_INIT_AFTER( ShapeLoader )
  57. MODULE_INIT
  58. {
  59. TSShapeLoader::addFormat("DirectX X", "x");
  60. TSShapeLoader::addFormat("Autodesk FBX", "fbx");
  61. TSShapeLoader::addFormat("Blender 3D", "blend" );
  62. TSShapeLoader::addFormat("3ds Max 3DS", "3ds");
  63. TSShapeLoader::addFormat("3ds Max ASE", "ase");
  64. TSShapeLoader::addFormat("Wavefront Object", "obj");
  65. TSShapeLoader::addFormat("Industry Foundation Classes (IFC/Step)", "ifc");
  66. TSShapeLoader::addFormat("Stanford Polygon Library", "ply");
  67. TSShapeLoader::addFormat("AutoCAD DXF", "dxf");
  68. TSShapeLoader::addFormat("LightWave", "lwo");
  69. TSShapeLoader::addFormat("LightWave Scene", "lws");
  70. TSShapeLoader::addFormat("Modo", "lxo");
  71. TSShapeLoader::addFormat("Stereolithography", "stl");
  72. TSShapeLoader::addFormat("AC3D", "ac");
  73. TSShapeLoader::addFormat("Milkshape 3D", "ms3d");
  74. TSShapeLoader::addFormat("TrueSpace COB", "cob");
  75. TSShapeLoader::addFormat("TrueSpace SCN", "scn");
  76. TSShapeLoader::addFormat("Ogre XML", "xml");
  77. TSShapeLoader::addFormat("Irrlicht Mesh", "irrmesh");
  78. TSShapeLoader::addFormat("Irrlicht Scene", "irr");
  79. TSShapeLoader::addFormat("Quake I", "mdl" );
  80. TSShapeLoader::addFormat("Quake II", "md2" );
  81. TSShapeLoader::addFormat("Quake III Mesh", "md3");
  82. TSShapeLoader::addFormat("Quake III Map/BSP", "pk3");
  83. TSShapeLoader::addFormat("Return to Castle Wolfenstein", "mdc");
  84. TSShapeLoader::addFormat("Doom 3", "md5" );
  85. TSShapeLoader::addFormat("Valve SMD", "smd");
  86. TSShapeLoader::addFormat("Valve VTA", "vta");
  87. TSShapeLoader::addFormat("Starcraft II M3", "m3");
  88. TSShapeLoader::addFormat("Unreal", "3d");
  89. TSShapeLoader::addFormat("BlitzBasic 3D", "b3d" );
  90. TSShapeLoader::addFormat("Quick3D Q3D", "q3d");
  91. TSShapeLoader::addFormat("Quick3D Q3S", "q3s");
  92. TSShapeLoader::addFormat("Neutral File Format", "nff");
  93. TSShapeLoader::addFormat("Object File Format", "off");
  94. TSShapeLoader::addFormat("PovRAY Raw", "raw");
  95. TSShapeLoader::addFormat("Terragen Terrain", "ter");
  96. TSShapeLoader::addFormat("3D GameStudio (3DGS)", "mdl");
  97. TSShapeLoader::addFormat("3D GameStudio (3DGS) Terrain", "hmp");
  98. TSShapeLoader::addFormat("Izware Nendo", "ndo");
  99. TSShapeLoader::addFormat("gltf", "gltf");
  100. TSShapeLoader::addFormat("gltf binary", "glb");
  101. }
  102. MODULE_END;
  103. //-----------------------------------------------------------------------------
  104. AssimpShapeLoader::AssimpShapeLoader()
  105. {
  106. mScene = NULL;
  107. }
  108. AssimpShapeLoader::~AssimpShapeLoader()
  109. {
  110. }
  111. void AssimpShapeLoader::releaseImport()
  112. {
  113. aiReleaseImport(mScene);
  114. }
  115. void AssimpShapeLoader::enumerateScene()
  116. {
  117. TSShapeLoader::updateProgress(TSShapeLoader::Load_ReadFile, "Reading File");
  118. Con::printf("[ASSIMP] Attempting to load file: %s", shapePath.getFullPath().c_str());
  119. // Post-Processing
  120. unsigned int ppsteps =
  121. Con::getBoolVariable("$Assimp::ConvertToLeftHanded", false) ? aiProcess_ConvertToLeftHanded : 0 |
  122. Con::getBoolVariable("$Assimp::CalcTangentSpace", false) ? aiProcess_CalcTangentSpace : 0 |
  123. Con::getBoolVariable("$Assimp::JoinIdenticalVertices", false) ? aiProcess_JoinIdenticalVertices : 0 |
  124. Con::getBoolVariable("$Assimp::ValidateDataStructure", false) ? aiProcess_ValidateDataStructure : 0 |
  125. Con::getBoolVariable("$Assimp::ImproveCacheLocality", false) ? aiProcess_ImproveCacheLocality : 0 |
  126. Con::getBoolVariable("$Assimp::RemoveRedundantMaterials", false) ? aiProcess_RemoveRedundantMaterials : 0 |
  127. Con::getBoolVariable("$Assimp::FindDegenerates", false) ? aiProcess_FindDegenerates : 0 |
  128. Con::getBoolVariable("$Assimp::FindInvalidData", false) ? aiProcess_FindInvalidData : 0 |
  129. Con::getBoolVariable("$Assimp::GenUVCoords", false) ? aiProcess_GenUVCoords : 0 |
  130. Con::getBoolVariable("$Assimp::TransformUVCoords", false) ? aiProcess_TransformUVCoords : 0 |
  131. Con::getBoolVariable("$Assimp::FindInstances", false) ? aiProcess_FindInstances : 0 |
  132. Con::getBoolVariable("$Assimp::LimitBoneWeights", false) ? aiProcess_LimitBoneWeights : 0 |
  133. Con::getBoolVariable("$Assimp::OptimizeMeshes", false) ? aiProcess_OptimizeMeshes | aiProcess_OptimizeGraph : 0 |
  134. 0;
  135. if(Con::getBoolVariable("$Assimp::FlipUVs", true))
  136. ppsteps |= aiProcess_FlipUVs;
  137. if(Con::getBoolVariable("$Assimp::FlipWindingOrder", false))
  138. ppsteps |= aiProcess_FlipWindingOrder;
  139. if(Con::getBoolVariable("$Assimp::Triangulate", true))
  140. ppsteps |= aiProcess_Triangulate;
  141. if (Con::getBoolVariable("$Assimp::OptimizeMeshes", false))
  142. ppsteps |= aiProcess_OptimizeMeshes | aiProcess_OptimizeGraph;
  143. if (Con::getBoolVariable("$Assimp::SplitLargeMeshes", false))
  144. ppsteps |= aiProcess_SplitLargeMeshes;
  145. //aiProcess_SortByPType | // make 'clean' meshes which consist of a single typ of primitives
  146. aiPropertyStore* props = aiCreatePropertyStore();
  147. //aiSetImportPropertyInteger(props, AI_CONFIG_IMPORT_TER_MAKE_UVS, 1);
  148. //aiSetImportPropertyInteger(props, AI_CONFIG_PP_SBP_REMOVE, (aiProcessPreset_TargetRealtime_Quality
  149. // | aiProcess_FlipWindingOrder | aiProcess_FlipUVs
  150. // | aiProcess_CalcTangentSpace
  151. // | aiProcess_FixInfacingNormals)
  152. // & ~aiProcess_RemoveRedundantMaterials);
  153. //aiSetImportPropertyInteger(props, AI_CONFIG_GLOB_MEASURE_TIME, 1);
  154. //aiSetImportPropertyFloat(props, AI_CONFIG_PP_GSN_MAX_SMOOTHING_ANGLE, 80.f);
  155. //aiSetImportPropertyInteger(props,AI_CONFIG_PP_PTV_KEEP_HIERARCHY,1);
  156. struct aiLogStream shapeLog;
  157. shapeLog = aiGetPredefinedLogStream(aiDefaultLogStream_FILE, "assimp.log");
  158. aiAttachLogStream(&shapeLog);
  159. #ifdef TORQUE_DEBUG
  160. aiEnableVerboseLogging(true);
  161. #endif
  162. //c = aiGetPredefinedLogStream(aiDefaultLogStream_STDOUT, NULL);
  163. //aiAttachLogStream(&c);
  164. // Attempt to import with Assimp.
  165. //mScene = importer.ReadFile(shapePath.getFullPath().c_str(), (aiProcessPreset_TargetRealtime_Quality | aiProcess_FlipWindingOrder | aiProcess_FlipUVs | aiProcess_CalcTangentSpace)
  166. // & ~aiProcess_RemoveRedundantMaterials);
  167. mScene = (aiScene*)aiImportFileExWithProperties(shapePath.getFullPath().c_str(), ppsteps, NULL, props);
  168. aiReleasePropertyStore(props);
  169. if ( mScene )
  170. {
  171. Con::printf("[ASSIMP] Mesh Count: %d", mScene->mNumMeshes);
  172. Con::printf("[ASSIMP] Material Count: %d", mScene->mNumMaterials);
  173. // Load all the materials.
  174. for ( U32 i = 0; i < mScene->mNumMaterials; i++ )
  175. AppMesh::appMaterials.push_back(new AssimpAppMaterial(mScene->mMaterials[i]));
  176. // Setup LOD checks
  177. detectDetails();
  178. // Define the root node, and process down the chain.
  179. AssimpAppNode* node = new AssimpAppNode(mScene, mScene->mRootNode, 0);
  180. if (!processNode(node))
  181. delete node;
  182. // Check for animations and process those.
  183. processAnimations();
  184. }
  185. else
  186. {
  187. TSShapeLoader::updateProgress(TSShapeLoader::Load_Complete, "Import failed");
  188. Con::printf("[ASSIMP] Import Error: %s", aiGetErrorString());
  189. }
  190. aiDetachLogStream(&shapeLog);
  191. }
  192. void AssimpShapeLoader::processAnimations()
  193. {
  194. for(U32 n = 0; n < mScene->mNumAnimations; ++n)
  195. {
  196. Con::printf("[ASSIMP] Animation Found: %s", mScene->mAnimations[n]->mName.C_Str());
  197. AssimpAppSequence* newAssimpSeq = new AssimpAppSequence(mScene->mAnimations[n]);
  198. appSequences.push_back(newAssimpSeq);
  199. }
  200. }
  201. void AssimpShapeLoader::computeBounds(Box3F& bounds)
  202. {
  203. TSShapeLoader::computeBounds(bounds);
  204. // Check if the model origin needs adjusting
  205. bool adjustCenter = Con::getBoolVariable("$Assimp::adjustCenter", false); //ColladaUtils::getOptions().adjustCenter
  206. bool adjustFloor = Con::getBoolVariable("$Assimp::adjustFloor", false); //ColladaUtils::getOptions().adjustFloor
  207. if (bounds.isValidBox() && (adjustCenter || adjustFloor))
  208. {
  209. // Compute shape offset
  210. Point3F shapeOffset = Point3F::Zero;
  211. if (adjustCenter)
  212. {
  213. bounds.getCenter(&shapeOffset);
  214. shapeOffset = -shapeOffset;
  215. }
  216. if (adjustFloor)
  217. shapeOffset.z = -bounds.minExtents.z;
  218. // Adjust bounds
  219. bounds.minExtents += shapeOffset;
  220. bounds.maxExtents += shapeOffset;
  221. // Now adjust all positions for root level nodes (nodes with no parent)
  222. for (S32 iNode = 0; iNode < shape->nodes.size(); iNode++)
  223. {
  224. if (!appNodes[iNode]->isParentRoot())
  225. continue;
  226. // Adjust default translation
  227. shape->defaultTranslations[iNode] += shapeOffset;
  228. // Adjust animated translations
  229. for (S32 iSeq = 0; iSeq < shape->sequences.size(); iSeq++)
  230. {
  231. const TSShape::Sequence& seq = shape->sequences[iSeq];
  232. if (seq.translationMatters.test(iNode))
  233. {
  234. for (S32 iFrame = 0; iFrame < seq.numKeyframes; iFrame++)
  235. {
  236. S32 index = seq.baseTranslation + seq.translationMatters.count(iNode)*seq.numKeyframes + iFrame;
  237. shape->nodeTranslations[index] += shapeOffset;
  238. }
  239. }
  240. }
  241. }
  242. }
  243. }
  244. void AssimpShapeLoader::updateMaterialsScript(const Torque::Path &path)
  245. {
  246. Torque::Path scriptPath(path);
  247. scriptPath.setFileName("materials");
  248. scriptPath.setExtension("cs");
  249. // First see what materials we need to update
  250. PersistenceManager persistMgr;
  251. for ( U32 iMat = 0; iMat < AppMesh::appMaterials.size(); iMat++ )
  252. {
  253. AssimpAppMaterial *mat = dynamic_cast<AssimpAppMaterial*>( AppMesh::appMaterials[iMat] );
  254. if ( mat )
  255. {
  256. Material *mappedMat;
  257. if ( Sim::findObject( MATMGR->getMapEntry( mat->getName() ), mappedMat ) )
  258. {
  259. // Only update existing materials if forced to
  260. if ( ColladaUtils::getOptions().forceUpdateMaterials )
  261. persistMgr.setDirty( mappedMat );
  262. }
  263. else
  264. {
  265. // Create a new material definition
  266. persistMgr.setDirty( mat->createMaterial( scriptPath ), scriptPath.getFullPath() );
  267. }
  268. }
  269. }
  270. if ( persistMgr.getDirtyList().empty() )
  271. return;
  272. persistMgr.saveDirty();
  273. }
  274. /// Check if an up-to-date cached DTS is available for this DAE file
  275. bool AssimpShapeLoader::canLoadCachedDTS(const Torque::Path& path)
  276. {
  277. return false;
  278. // Generate the cached filename
  279. Torque::Path cachedPath(path);
  280. cachedPath.setExtension("cached.dts");
  281. // Check if a cached DTS newer than this file is available
  282. FileTime cachedModifyTime;
  283. if (Platform::getFileTimes(cachedPath.getFullPath(), NULL, &cachedModifyTime))
  284. {
  285. bool forceLoadDAE = Con::getBoolVariable("$assimp::forceLoad", false);
  286. FileTime daeModifyTime;
  287. if (!Platform::getFileTimes(path.getFullPath(), NULL, &daeModifyTime) ||
  288. (!forceLoadDAE && (Platform::compareFileTimes(cachedModifyTime, daeModifyTime) >= 0) ))
  289. {
  290. // DAE not found, or cached DTS is newer
  291. return true;
  292. }
  293. }
  294. return false;
  295. }
  296. bool AssimpShapeLoader::ignoreNode(const String& name)
  297. {
  298. // Do not add AssimpFbx dummy nodes to the TSShape. See: Assimp::FBX::ImportSettings::preservePivots
  299. // https://github.com/assimp/assimp/blob/master/code/FBXImportSettings.h#L116-L135
  300. if (name.find("_$AssimpFbx$_") != String::NPos)
  301. return true;
  302. return false;
  303. }
  304. void AssimpShapeLoader::detectDetails()
  305. {
  306. // Set LOD option
  307. bool singleDetail = true;
  308. switch (Con::getIntVariable("$Assimp::lodType", 0))
  309. {
  310. case ColladaUtils::ImportOptions::DetectDTS:
  311. // Check for a baseXX->startXX hierarchy at the top-level, if we find
  312. // one, use trailing numbers for LOD, otherwise use a single size
  313. for (S32 iNode = 0; singleDetail && (iNode < mScene->mRootNode->mNumChildren); iNode++) {
  314. aiNode* node = mScene->mRootNode->mChildren[iNode];
  315. if (node && dStrStartsWith(node->mName.C_Str(), "base")) {
  316. for (S32 iChild = 0; iChild < node->mNumChildren; iChild++) {
  317. aiNode* child = node->mChildren[iChild];
  318. if (child && dStrStartsWith(child->mName.C_Str(), "start")) {
  319. singleDetail = false;
  320. break;
  321. }
  322. }
  323. }
  324. }
  325. break;
  326. case ColladaUtils::ImportOptions::SingleSize:
  327. singleDetail = true;
  328. break;
  329. case ColladaUtils::ImportOptions::TrailingNumber:
  330. singleDetail = false;
  331. break;
  332. default:
  333. break;
  334. }
  335. AssimpAppMesh::fixDetailSize(singleDetail, Con::getIntVariable("$Assimp::singleDetailSize", 2));
  336. }
  337. //-----------------------------------------------------------------------------
  338. /// This function is invoked by the resource manager based on file extension.
  339. TSShape* assimpLoadShape(const Torque::Path &path)
  340. {
  341. // TODO: add .cached.dts generation.
  342. // Generate the cached filename
  343. Torque::Path cachedPath(path);
  344. cachedPath.setExtension("cached.dts");
  345. // Check if an up-to-date cached DTS version of this file exists, and
  346. // if so, use that instead.
  347. if (AssimpShapeLoader::canLoadCachedDTS(path))
  348. {
  349. FileStream cachedStream;
  350. cachedStream.open(cachedPath.getFullPath(), Torque::FS::File::Read);
  351. if (cachedStream.getStatus() == Stream::Ok)
  352. {
  353. TSShape *shape = new TSShape;
  354. bool readSuccess = shape->read(&cachedStream);
  355. cachedStream.close();
  356. if (readSuccess)
  357. {
  358. #ifdef TORQUE_DEBUG
  359. Con::printf("Loaded cached shape from %s", cachedPath.getFullPath().c_str());
  360. #endif
  361. return shape;
  362. }
  363. else
  364. delete shape;
  365. }
  366. Con::warnf("Failed to load cached shape from %s", cachedPath.getFullPath().c_str());
  367. }
  368. if (!Torque::FS::IsFile(path))
  369. {
  370. // File does not exist, bail.
  371. return NULL;
  372. }
  373. AssimpShapeLoader loader;
  374. TSShape* tss = loader.generateShape(path);
  375. if (tss)
  376. {
  377. TSShapeLoader::updateProgress(TSShapeLoader::Load_Complete, "Import complete");
  378. Con::printf("[ASSIMP] Shape created successfully.");
  379. // Cache the model to a DTS file for faster loading next time.
  380. FileStream dtsStream;
  381. if (dtsStream.open(cachedPath.getFullPath(), Torque::FS::File::Write))
  382. {
  383. Con::printf("Writing cached shape to %s", cachedPath.getFullPath().c_str());
  384. tss->write(&dtsStream);
  385. }
  386. loader.updateMaterialsScript(path);
  387. }
  388. loader.releaseImport();
  389. return tss;
  390. }
  391. DefineEngineFunction(GetShapeInfo, GuiTreeViewCtrl*, (String filePath), ,
  392. "Returns a list of supported shape formats in filter form.\n"
  393. "Example output: DSQ Files|*.dsq|COLLADA Files|*.dae|")
  394. {
  395. Assimp::Importer importer;
  396. GuiTreeViewCtrl* treeObj = new GuiTreeViewCtrl();
  397. treeObj->registerObject();
  398. Torque::Path path = Torque::Path(filePath);
  399. // Attempt to import with Assimp.
  400. const aiScene* shapeScene = importer.ReadFile(path.getFullPath().c_str(), (aiProcessPreset_TargetRealtime_Quality | aiProcess_CalcTangentSpace)
  401. & ~aiProcess_RemoveRedundantMaterials & ~aiProcess_GenSmoothNormals);
  402. //Populate info
  403. S32 meshItem = treeObj->insertItem(0, "Shape", String::ToString("%i", shapeScene->mNumMeshes));
  404. S32 matItem = treeObj->insertItem(0, "Materials", String::ToString("%i", shapeScene->mNumMaterials));
  405. S32 animItem = treeObj->insertItem(0, "Animations", String::ToString("%i", shapeScene->mNumAnimations));
  406. S32 lightsItem = treeObj->insertItem(0, "Lights", String::ToString("%i", shapeScene->mNumLights));
  407. S32 texturesItem = treeObj->insertItem(0, "Textures", String::ToString("%i", shapeScene->mNumTextures));
  408. //S32 meshItem = ->insertItem(0, "Cameras", String::ToString("%s", shapeScene->mNumCameras));
  409. //Details!
  410. for (U32 i = 0; i < shapeScene->mNumMeshes; i++)
  411. {
  412. treeObj->insertItem(meshItem, String::ToString("%s", shapeScene->mMeshes[i]->mName.C_Str()));
  413. }
  414. for (U32 i = 0; i < shapeScene->mNumMaterials; i++)
  415. {
  416. aiMaterial* aiMat = shapeScene->mMaterials[i];
  417. aiString matName;
  418. aiMat->Get(AI_MATKEY_NAME, matName);
  419. aiString texPath;
  420. aiMat->GetTexture(aiTextureType::aiTextureType_DIFFUSE, 0, &texPath);
  421. treeObj->insertItem(matItem, String::ToString("%s", matName.C_Str()), String::ToString("%s", texPath.C_Str()));
  422. }
  423. for (U32 i = 0; i < shapeScene->mNumAnimations; i++)
  424. {
  425. treeObj->insertItem(animItem, String::ToString("%s", shapeScene->mAnimations[i]->mName.C_Str()));
  426. }
  427. /*for (U32 i = 0; i < shapeScene->mNumLights; i++)
  428. {
  429. treeObj->insertItem(lightsItem, String::ToString("%s", shapeScene->mLights[i]->mType));
  430. }*/
  431. return treeObj;
  432. }