OpenFlight uses UserData internally to pass material/shader/etc pools to
external references. Once the model is returned from the plugin, that data
is irrelevant.

OpenFlight also attaches the lat/long location of the model (taken from the
header record) to the top-level node before returning the model. Once the
app gets the model from the plugin, the app can take the lat/long info and
then that data is also irrelevant.

Nonetheless, I've often felt it would be useful to have user data be a
std::map<std::string,osg::Referenced*>, so that you could attach multiple
user datas to an Object and key them with a string, thus avoiding collisions
in most cases.

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



> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of 
> Bill Prendergast
> Sent: Wednesday, February 07, 2007 3:33 PM
> To: osg users
> Subject: RE: [osg-users] Node tag field
> 
> >> I was wondering if it would be feasible to add a 
> Referenced* member 
> >> variable to osg::Node in the OSG base that could be used 
> for arbitrary information tagging?
> 
> > Would :
> >   osg::Object::setUserData(Referenced*) be what you are looking for?
> > osg::Node subclasses from osg::Object so has the same user data too.
> 
> 
> Is "user data" safe for general use?
> 
> When I grep through the source for "setUserData", I get hits 
> besides the actual definitions of the UserData functions.  
> For example (osg V1.2):
> 
> osgPlugins/flt/FltFile.cpp:
>    model->setUserData( loc.get() );
> 
> osgPlugins/OpenFlight/PrimaryRecords.cpp:
>    _header->setUserData( loc );
> 
> osgPlugins/OpenFlight/PrimaryRecords.cpp:
>    _external->setUserData(new ParentPools...
> 
> osgPlugins/OpenFlight/ReaderWriterFLT.cpp:
>    _options->setUserData( node.getUserData() );
> 
> OpenSceneGraph/src/osgSim/Impostor.cpp:
>    cv->setUserData(impostorSpriteManager);
> 
> OpenSceneGraph/src/osgSim/LightPointNode.cpp:
>    rg->setUserData(drawable);
> 
> (more)
> 
> Quite admittedly, I haven't opened each of these files and 
> tracked down the usage (it may not even be the same "user 
> data" field as in the nodes).
> 
> However, when I originally wanted to use "user data", I got 
> scared off by this light search thinking "oh, looks like OSG 
> uses this field so it's not necessarily available for my use".
> 
> Is there a chance that user data may get stomped on by some 
> of the OSG functions?
> 
> Thanks,
> 
> Bill
> 
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://openscenegraph.net/mailman/listinfo/osg-users
> http://www.openscenegraph.org/

_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to