| 1332 | } |
| 1333 | |
| 1334 | static bool enumDTSForImport(const char* shapePath, GuiTreeViewCtrl* tree) |
| 1335 | { |
| 1336 | // Check if a cached DTS is available => no need to import the collada file |
| 1337 | // if we can load the DTS instead |
| 1338 | Torque::Path path(shapePath); |
| 1339 | Resource<TSShape> dtsShape = ResourceManager::get().load(shapePath); |
| 1340 | |
| 1341 | if (!dtsShape) |
| 1342 | return false; |
| 1343 | |
| 1344 | // Initialize tree |
| 1345 | tree->removeItem(0); |
| 1346 | S32 nodesID = tree->insertItem(0, "Shape", "", "", 0, 0); |
| 1347 | S32 matsID = tree->insertItem(0, "Materials", "", "", 0, 0); |
| 1348 | S32 animsID = tree->insertItem(0, "Animations", "", "", 0, 0); |
| 1349 | |
| 1350 | SceneStats stats; |
| 1351 | |
| 1352 | // Query DOM for shape summary details |
| 1353 | for (S32 i = 0; i < dtsShape->objects.size(); i++) |
| 1354 | { |
| 1355 | tree->insertItem(nodesID, dtsShape->names[dtsShape->objects[i].nameIndex], "", "", 0, 0); |
| 1356 | stats.numMeshes++; |
| 1357 | } |
| 1358 | |
| 1359 | // Get material count |
| 1360 | for (S32 i = 0; i < dtsShape->materialList->size(); i++) |
| 1361 | { |
| 1362 | S32 matId = tree->insertItem(matsID, dtsShape->materialList->getMaterialName(i).c_str(), "", "", 0, 0); |
| 1363 | stats.numMaterials++; |
| 1364 | |
| 1365 | GFXTextureObject* difTex = dtsShape->materialList->getDiffuseTexture(i); |
| 1366 | if (difTex) |
| 1367 | { |
| 1368 | tree->insertItem(matId, difTex->getPath().c_str(), "", "", 0, 0); |
| 1369 | } |
| 1370 | } |
| 1371 | |
| 1372 | // Get animation count |
| 1373 | for (S32 i = 0; i < dtsShape->sequences.size(); i++) |
| 1374 | { |
| 1375 | tree->insertItem(animsID, dtsShape->names[dtsShape->sequences[i].nameIndex], "animation", "", 0, 0); |
| 1376 | stats.numClips++; |
| 1377 | } |
| 1378 | |
| 1379 | /*if (stats.numClips == 0) |
| 1380 | { |
| 1381 | // No clips => check if there are any animations (these will be added to a default clip) |
| 1382 | for (S32 i = 0; i < root->getLibrary_animations_array().getCount(); i++) |
| 1383 | { |
| 1384 | const domLibrary_animations* libraryAnims = root->getLibrary_animations_array()[i]; |
| 1385 | if (libraryAnims->getAnimation_array().getCount()) |
| 1386 | { |
| 1387 | stats.numClips = 1; |
| 1388 | tree->insertItem(animsID, "ambient", "animation", "", 0, 0); |
| 1389 | break; |
| 1390 | } |
| 1391 | } |
no test coverage detected