Using a keyword in the description string would allow the exporter to filter
these strings out before writing Comment records. Great idea.

Back when I first started using OSG, I suggested replacing the current
UserData and DescriptionList mechanisms with some type of key-value std::map
based scheme. We had already been using such a scheme in our app at my
former employer. Robert didn't like the idea, but I don't remember the
details. Seems like such a scheme would allow multiple UserData per object,
which would be nice. On the other hand, it does require that operator<() be
declared for any object stored in the map, which can be a pain to have to
define.

Paul Martz
Skew Matrix Software LLC
http://www.skew-matrix.com
+1 303 859 9466

-----Original Message-----
From: osg-users-boun...@lists.openscenegraph.org
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Peter
Amstutz
Sent: Monday, April 27, 2009 8:41 AM
To: OpenSceneGraph Users
Subject: Re: [osg-users] determine record type from OpenFlight files?

I haven't looked at how DescriptionList is used in other parts of OSG, but
my thought was to use it with a key prefix, so the record type and other
metadata would be stored like "OpenFlight_Record=Geometry" or
"OpenFlight_Record=Road" or "OpenFlight_isTerrain=True".  To avoid the
problem you describe, the OpenFlight exporter will need to be aware of the
DescriptionList entries produced by the importer.

More generally, is there a particular reason for DescriptionList to be an
array of strings and not an associative array, like pair<string, 
string> (or even a map, but that is a slightly heavier data structure)?  
As I mentioned I need to store custom attributes alongside scene graph nodes
and presently I am using UserData for this -- which is actually rather
problematic because UserData is not saved to the .ive file.  
Right now I merge the custom attributes from a separate XML file, but I
frequently have problems getting the external attributes file and scene
graph to line up (various things like to add container nodes at the top of
the scene graph, so the attributes file will be off by a node or two).

Thanks,
- Peter

Paul Martz wrote:
> I just realized... One issue with DescriptionList is that the 
> OpenFlight plugin uses it for Comment record data. This is really only 
> a problem if you load a FLT file, store the record type in the 
> DescriptionList, and then export it back out. Your record type data 
> would then be exported as comment records, which is probably not what you
want.
>
> I don't really see this as a showstopper issue though. Go for it.
>
> Paul Martz
> Skew Matrix Software LLC
> http://www.skew-matrix.com
> +1 303 859 9466
>
> -----Original Message-----
> From: osg-users-boun...@lists.openscenegraph.org
> [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Peter 
> Amstutz
> Sent: Friday, April 24, 2009 11:38 AM
> To: OpenSceneGraph Users
> Subject: Re: [osg-users] determine record type from OpenFlight files?
>
> Hmm, I never noticed the "DescriptionList" feature before -- I presume 
> DescriptionList gets saved to and loaded from .osg and .ive files?  
> That would simplify some other work I did to add custom attributes to 
> nodes (which I acomplished using UserData, but it is a bit more
complicated).
>
> I will take a look at the OpenFlight importer.
>
> Thanks,
> Peter
>   
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to