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

Function processNode

Engine/source/ts/collada/colladaImport.cpp:48–127  ·  view source on GitHub ↗

Recurse through the adding nodes and geometry to the GuiTreeView control

Source from the content-addressed store, hash-verified

46
47// Recurse through the <visual_scene> adding nodes and geometry to the GuiTreeView control
48static void processNode(GuiTreeViewCtrl* tree, domNode* node, S32 parentID, SceneStats& stats)
49{
50 stats.numNodes++;
51 S32 nodeID = tree->insertItem(parentID, _GetNameOrId(node), "node", "", 0, 0);
52
53 // Update mesh and poly counts
54 for (S32 i = 0; i < node->getContents().getCount(); i++)
55 {
56 domGeometry* geom = 0;
57 const char* elemName = "";
58
59 daeElement* child = node->getContents()[i];
60 switch (child->getElementType())
61 {
62 case COLLADA_TYPE::INSTANCE_GEOMETRY:
63 {
64 domInstance_geometry* instgeom = daeSafeCast<domInstance_geometry>(child);
65 if (instgeom)
66 {
67 geom = daeSafeCast<domGeometry>(instgeom->getUrl().getElement());
68 elemName = _GetNameOrId(geom);
69 }
70 break;
71 }
72
73 case COLLADA_TYPE::INSTANCE_CONTROLLER:
74 {
75 domInstance_controller* instctrl = daeSafeCast<domInstance_controller>(child);
76 if (instctrl)
77 {
78 domController* ctrl = daeSafeCast<domController>(instctrl->getUrl().getElement());
79 elemName = _GetNameOrId(ctrl);
80 if (ctrl && ctrl->getSkin())
81 geom = daeSafeCast<domGeometry>(ctrl->getSkin()->getSource().getElement());
82 else if (ctrl && ctrl->getMorph())
83 geom = daeSafeCast<domGeometry>(ctrl->getMorph()->getSource().getElement());
84 }
85 break;
86 }
87
88 case COLLADA_TYPE::INSTANCE_LIGHT:
89 stats.numLights++;
90 tree->insertItem(nodeID, _GetNameOrId(node), "light", "", 0, 0);
91 break;
92 }
93
94 if (geom && geom->getMesh())
95 {
96 const char* name = _GetNameOrId(node);
97 if ( dStrEqual( name, "null" ) || dStrEndsWith( name, "PIVOT" ) )
98 name = _GetNameOrId( daeSafeCast<domNode>(node->getParent()) );
99
100 stats.numMeshes++;
101 tree->insertItem(nodeID, name, "mesh", "", 0, 0);
102
103 for (S32 j = 0; j < geom->getMesh()->getTriangles_array().getCount(); j++)
104 stats.numPolygons += geom->getMesh()->getTriangles_array()[j]->getCount();
105 for (S32 j = 0; j < geom->getMesh()->getTristrips_array().getCount(); j++)

Callers 3

enumerateSceneMethod · 0.70
colladaImport.cppFile · 0.70
enumerateSceneMethod · 0.50

Calls 13

_GetNameOrIdFunction · 0.85
dStrEqualFunction · 0.85
dStrEndsWithFunction · 0.85
getContentsMethod · 0.80
insertItemMethod · 0.45
getCountMethod · 0.45
getElementTypeMethod · 0.45
getElementMethod · 0.45
getSkinMethod · 0.45
getSourceMethod · 0.45
getMorphMethod · 0.45
getMeshMethod · 0.45

Tested by

no test coverage detected