smgr->saveScene()

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
WWebber
Posts: 16
Joined: Sun Feb 26, 2012 11:24 am

smgr->saveScene()

Post 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?
rubenwardy
Posts: 91
Joined: Mon Mar 05, 2012 4:51 pm
Location: Bristol, UK
Contact:

Re: smgr->saveScene()

Post 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?
CuteAlien
Admin
Posts: 9716
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: smgr->saveScene()

Post 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).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
WWebber
Posts: 16
Joined: Sun Feb 26, 2012 11:24 am

Re: smgr->saveScene()

Post 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
Post Reply