hi all,
how to embed data such as level name, score, etc in .irr file?
Can I do that in irredit?
via smgr->saveScene()?
if there is away to do that, how to read them after file is saved?
embeding data in .irr files
you can make class (CLevel) that inherits ISceneUserDataSerializer,
that class should have to functions:
createUserData
OnReadUserData
when you call smgr->saveScene() createUserData is called for every scene node. you can store your data with one of the nodes, for example, if sceneNode->ID == 56, save embedded data.
Then later when you load your scene, OnreadUserData is called, simply check again if sceneNode->Id is 56, and read your data from it.
In irr file they will be stored like this:
<userData>
<attributes>
<string name="Homepage" value="www.mystic-peanut.com" />
</attributes>
</userData>
search "ISceneUserDataSerializer" for more info.
that class should have to functions:
createUserData
OnReadUserData
when you call smgr->saveScene() createUserData is called for every scene node. you can store your data with one of the nodes, for example, if sceneNode->ID == 56, save embedded data.
Then later when you load your scene, OnreadUserData is called, simply check again if sceneNode->Id is 56, and read your data from it.
In irr file they will be stored like this:
<userData>
<attributes>
<string name="Homepage" value="www.mystic-peanut.com" />
</attributes>
</userData>
search "ISceneUserDataSerializer" for more info.
The functions would actually be:
And yeah you could store extra data in the scene like this, it's a bit weird but doable. You'd have to write a scene node plugin for your CLevel to be able to store the data into the .irr file via IrrEdit though. Or write your own little app that would write it for you or edit the .irr file by hand i guess.
Code: Select all
//! Writes attributes of the scene node.
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0);
//! Reads attributes of the scene node.
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0);