Hi,

maybe you are looking for userData? Grep the include dir for userData or UserData.

jp

Sukender wrote:
Hi all,

I'm working on a project that needs to add various data/metadata to the nodes. 
I was wondering:
1. Does something already exists for this (more flexible than the description 
string list)?
2. How would you implement this?

Personnally, I was looking towards aggregation. See 
http://cowboyprogramming.com/2007/01/05/evolve-your-heirachy/ and other similar 
articles to know what I mean. So I suggest to add something to nodes, using a 
compile-time option (in order to be able to turn it on or off when running 
CMake). For instance, there would be:
- A Component abstract class (a very simple one)
- A list of components in nodes (directly in the Node class, or by making Node 
inherit from something like a ComponentContainer class). Something like the 
nodes list in osg::Group sounds good (as it will be familiar to OSG users).
- And a ComponentManager class, which references the components (weak references) by type, so that 
you can easily and quickly iterate over all "Physics" components, "AI" 
components, or whatever-components.

That way, you may add whaterver component you need to any node. Say you need to add a meta to a node? 
Create a MetaComponent (Name + value), and call node->addComponent(new MetaComponent("Creation 
date", "2009-08-13"));

I already coded something, but it's not really clean right now. Depending on 
your answers and on the moment my code will be cleaned, I'll send code to 
osg-submissions.

Thanks.

Sukender
PVLE - Lightweight cross-platform game engine - http://pvle.sourceforge.net/
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

--
This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html.

This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. MailScanner thanks Transtec Computers for their support.

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to