Hi,
I have 3ds file which was build from several object. After loading this file in
OSG I need to split this file into its objects and save every node on the
drive. In order to do that I've written recursive function which is running on
scene tree and save every osg::Geode structure in separate file.
When I load each of separate files in order to recreate the scene the original
node location was not saved and all objects are shifted (see attachments).
What is wrong? How Can I solve this issue?
Code:
void SplitScene(osg::Node* currNode)
{
osg::Group* currGroup;
std::string className = "Geode";
if (!currNode)
return;
currGroup = currNode->asGroup();
if (currGroup)
{
for (unsigned int i = 0 ; i < currGroup->getNumChildren(); i ++)
{
if (currGroup->getChild(i)->className() == className )
{
osgDB::writeNodeFile(*(currGroup->getChild(i)),currGroup->getChild(i)->getName()+".ive");
//alernativly
//osgDB::writeNodeFile(*(currGroup),currGroup->getChild(i)->getName()+".ive");
return;
}
else
SplitScene(currGroup->getChild(i));
}
}
else
return;
}
Thank you!
Cheers,
Danny
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=22269#22269
Attachments:
http://forum.openscenegraph.org//files/screen_shot_1_135.gif
http://forum.openscenegraph.org//files/screen_shot_0_145.gif
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org