Question

I'm making a video game using Ogre3d. I load the .scene file with the most recent tinyxml dotscene loader. Now I want to save the modified scene back to the .scene file. Can someone give me an example or an hint on how to do that?

Was it helpful?

Solution

You need to code the exact reverse process:

  1. Loop over all relevant scene objects and for each one add the needed TiXmlElements to a TiXmlDocument.
  2. At the end, save out the TiXmlDocument.

This TinyXml Tutorial shows the needed code parts in terms of XML generation.

A real-world example is Ogitor (an WYSIWYG Ogre editor), where each editor object has a method TiXmlElement* CXXXEditor::exportDotScene(TiXmlElement *pParent) that moves all relevant attributes/states into the TinyXml structures before it then gets saved into a file.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top