Hi Robert, hi all,

After working weeks with our ComponentContainer/Metadata system, I must admit 
I'd love to see those meta written to the .osg file format (and being read 
from) without having to modify the OSG core. Same thing with other filetypes... 
Of course I can :
1. Create custom nodes such as "NodeWithMeta", "GroupWithMeta", 
"MatrixTransformWithMeta", etc., with appropriate DOT_OSG wrapper, but this is 
simply ugly!
2. Modify each reader/writer I want... ugly too.
3. Put all data in a separate file and create a pseudo-reader/writer that 
extracts/adds data. Less ugly... but still ugly.
Any idea?

And once again, don't you think supporting metadata ("Name, value") directly in 
the osg::Object wouldn't be nice?
Or could we code something like: "if UserData is an osg::Object (or another 
given type), read from/write to file using UserData->serialize()/unserialize()" 
in reader/writers?

Sukender
PVLE - Lightweight cross-platform game engine - http://pvle.sourceforge.net/

----- "Sukender" <[email protected]> a écrit :

> Hi Robert,
> 
> Well, this is exactly what I just coded... :) However, do you think
> this kind of general purpose code would fit the OSG goal?
> 
> Sukender
> PVLE - Lightweight cross-platform game engine -
> http://pvle.sourceforge.net/
> 
> ----- Mail Original -----
> De: "Robert Osfield" <[email protected]>
> À: "OpenSceneGraph Users" <[email protected]>
> Envoyé: Vendredi 14 Août 2009 14h05:26 GMT +01:00 Amsterdam / Berlin /
> Berne / Rome / Stockholm / Vienne
> Objet: Re: [osg-users] Suggestion: Add components in nodes
> (aggregation)
> 
> Hi Sukender,
> 
> The way I'd tackle something like this would be to have a
> ComponentContainer subclass from osg::Referenced, and then just
> directly attach this to the Node/Object/Drawable/StateSet via the
> existing UserData field.  The intention of the UserData is to
> facilitate this type of user extension of the scene graph.
> 
> Robert.
> 
> On Thu, Aug 13, 2009 at 12:26 PM, Sukender<[email protected]> 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
> >
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to