Recurse through the adding nodes and geometry to the GuiTreeView control
| 46 | |
| 47 | // Recurse through the <visual_scene> adding nodes and geometry to the GuiTreeView control |
| 48 | static 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++) |
no test coverage detected