MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / enumDTSForImport

Function enumDTSForImport

Engine/source/T3D/assets/assetImporter.cpp:1334–1419  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1332}
1333
1334static 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 }

Callers 2

processShapeAssetMethod · 0.85

Calls 14

avarFunction · 0.85
dSprintfFunction · 0.85
getDiffuseTextureMethod · 0.80
setItemValueMethod · 0.80
getFunction · 0.50
loadMethod · 0.45
removeItemMethod · 0.45
insertItemMethod · 0.45
sizeMethod · 0.45
c_strMethod · 0.45
getMaterialNameMethod · 0.45
getPathMethod · 0.45

Tested by

no test coverage detected