Hello,
I can't find any mechanism that allows storing custom data per ISceneNode. IAttributeExchangingObject which is base class for ISceneNode, contains only method for serialization and deserialization of parameters like rotation, position scale etc. but there is not any method for custom data. I understand its main purpose is saving and loading scenes from different file formats. But, If user could read/write any data for any ISceneNode it would give features for easy integration with physics library, netwotk library etc. Storing this metadata inside irrlicht XML file will give great tool for storing custom node data. My second idea is to create some metadata registry with ISceneNode ID as key and some std::map with parameters as value. Main advantage of this solution is that it doesn't modify any existing API. What do You think about this?
ISceneNodel custom data
Re: ISceneNodel custom data
Yeah, there is no mechanism for custom data is scenenodes. So using a map (or any other kind of lookup) is also the way I do stuff. Thought you have to be a little bit careful as ID's are also used in collision (for purely historical reasons...). So if you need that as well you have to be careful. 2 other choices are using names (can be slow) or pointers (in which case you have to be careful when releasing/creating pointers as pointer addresses can be re-used).
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
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Re: ISceneNodel custom data
Using callbacks during scene node destruction may provide mechanism for removing unused pointers from map, so storing pointers as key would be a good solution.
However Irrlicht should provide some functions like setProperty(name, value) and getProperty(name) on ISceneNode for general purpose properties. Irrlicht XML could be used as storage for many non-grpahics properties for meshes.
However Irrlicht should provide some functions like setProperty(name, value) and getProperty(name) on ISceneNode for general purpose properties. Irrlicht XML could be used as storage for many non-grpahics properties for meshes.
Re: ISceneNodel custom data
If you feel confidant in your skills, you could add all what you need to the ISceneNode source, recompile, and have all those by yourself, as far as you don't touch anything vital to Irrlicht (such as removing/altering crucial methods), anything goes But it is true that Irrlicht could use some justice in that custom property setting matter
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
Re: ISceneNodel custom data
Yes, I wrote some setters and getters and extended data seerialization and deserialization, so values could be saved into XML irrlicht file.
I'll publish code after I refactor it.
I'll publish code after I refactor it.