this is basically a re-purposed rip-off of the getSceneNodeByID routine.
Code: Select all
bool GameApp::FindPhysicsNodes(scene::ISceneNode* start){
if (start == 0)
start = Irr_SceneMgr->getRootSceneNode();
//this should be a big switch that makes the different kinds of bodies for different ID's
//does this even need a return value??
int ID = start->getID();
switch(ID){
case 1:
cout<<"found a one"<<endl;
cout<<"got mesh name:"<<GetMeshNameFromNode(start).c_str()<<endl;
break;
case 2:
cout<<"found a two"<<endl;
cout<<"got mesh name:"<<GetMeshNameFromNode(start).c_str()<<endl;
break;
default:
cout<<"found an unknown type!!"<<endl;
}
scene::ISceneNode* node = 0;
const core::list<scene::ISceneNode*>& list = start->getChildren();
core::list<scene::ISceneNode*>::Iterator it = list.begin();
for (; it!=list.end(); ++it)
{
FindPhysicsNodes(*it);
}
return false;
}
core::stringc GameApp::GetMeshNameFromNode(scene::ISceneNode* node){
io::IFileSystem * FS = Irr_Device->getFileSystem();
io::IAttributes* attribs = FS->createEmptyAttributes();
if (attribs){
node->serializeAttributes(attribs);
// get the mesh name out
core::stringc mesh_name = attribs->getAttributeAsString("Mesh");
attribs->drop();
return mesh_name;
}else{
return "NULL";
}
}