Page 1 of 1

smgr->saveScene()

Posted: Thu May 31, 2012 2:43 pm
by WWebber
I create some nodes with "smgr->addAnimatedMeshSceneNode(AMesh)" but saveScene() does not save them at all.
CIrrMeshWriter::writeMesh() is never being called. What I'm not understanding?

Re: smgr->saveScene()

Posted: Thu May 31, 2012 5:30 pm
by rubenwardy
saveScene saves a XML of the scene nodes, but not their textures or models, or any file you have loaded eg: heightmaps

Am i understanding your question correctly?

Re: smgr->saveScene()

Posted: Thu May 31, 2012 5:58 pm
by CuteAlien
SceneWriter only writes scene-information which is indeed a problem for custom creates meshes. I think the following workaround could work - but never tried it myself:
1. Add your custom meshes to the meshcache with a name (IMeshCache::addMesh)
2. Create meshwriter (ISceneManager::createMeshWriter)
3. Write all your custom-meshes to file with the same name you used when you added them to the meshcache.
4. Save your scene.

Alternatively Collada is slowly getting there to be able to save mesh- and sceneinformation. So you could give it a try (use newest trunk - it's a lot better in that respect than Irrlicht 1.7). But it's also not yet perfect (actually I'm stuck on a Collada-problem for a while already - how to save scenenodes which share a mesh but have different materials - something I thought I fixed, but no other tool I found could load it - so either they are all broken (definitely a possibility when you're talking about Collada) or I'm still doing something wrong).

Re: smgr->saveScene()

Posted: Sat Jun 02, 2012 12:40 pm
by WWebber
Thanks for the answer.
Ok. This works!
But what is now the best for reloading? I see that in the scene .IRR file there are already properties for each animatedscenenode which seem to be duplicated in each exported mesh file.
On the other hand just loading the scene IRR file does not load the mesh data. Should these be loaded before - although the scene IRR file holds the references? Shall I rather create my own scene file?

Weber