Hi Paul,
You are right, I simply did not recognize, that descriptions also can be stored 
in drawable (maybe because addDescription() is implemented in osg::Node)! So 
for Face it would be possible to store the description in the drawable itself, 
but for Mesh we still have to store the desciption in the geode.

In the OpenFlight-plugin the change would be very small, in Face::readRecord():
the line:
_geode->addDescription(ss.str());
changes to:
_geometry->getOrCreateUserDataContainer()->getDescriptions().push_back(ss.str());

For the user of the SMC, it would be little more difficult, because he should 
not only check the descriptions of geodes for SMC, but also the drawables, but 
the flexibility will get bigger, because he can have different SMC per drawable 
in the same geode.

On the other way, if we look into code of Face::readRecord() in the switch (and 
some lines below) where the Geode (or Billboard) will be allocated, we can see, 
a Geode always will only contain one single drawable.

Conclusion
If we store the description always in the geode, the user has it a little bit 
easier, but can not have different SMC per drawable in the same geode.
If we store the description for faces in the drawable, the user has it a little 
bit more complicated to examine the SMC and could have different SMC per 
drawable in future (when OpenFlight-plugin is supporting more than 1 drawable 
per geode for Face).

Actually I am unsure, which solution should be favorised, but the solution with 
SMC per drawable is (in my view) more future-oriented.

@Robert Osfield: what do you think and who is finally responsible for merging 
this part of code to OSG?

-WeSee

Paul Martz wrote:
> The the email I quoted. I was just wondering if there was a reason to limit 
> storing of SMCs in the description lists of Geodes only. It appears that SMCs 
> could be stored in the descriptions of any Node type.
> -Paul
> 
> 
> On 11/27/2012 9:56 AM, We See wrote:
> 
> > Hi Paul,
> > Yes, DescriptionLists are part of UserDataContainer and are implemented in 
> > osg::Node, so descriptions can be added to every class inherited from 
> > osg::Node.
> > But what has it to do with the SMC extension of OpenFlight-plugin?
> > -WeSee
> > 
> > Paul Martz wrote:
> > 
> > > DescriptionLists are part of UserDataContainer now, right? So they could 
> > > be
> > > attached to any Node, not just Geode.
> > > -Paul
> > > 
> > > 
> > > On 11/16/2012 5:35 AM, WeSee wrote:
> > > 
> > > 
> > > > Hi guys,
> > > > 
> > > > I am very proud to present my first contribution to OSG. It is a small 
> > > > extension
> > > > of the OpenFlight-plugin for reading Surface Material Codes and adding 
> > > > this code
> > > > as description to the geode.
> > > > 
> > > > I have seen, the OpenFlight-Load does not support the Surface Material 
> > > > Code
> > > > (SMC) attribute. Therefore all Surface Mateial Codes of models in 
> > > > flt-Format
> > > > will be lost when reading into OSG. So I made a change in the 
> > > > OpenFlight plugin,
> > > > which reads the SMC and adds a description to the geode (the OSG-nodes 
> > > > have no
> > > > such element). The description will be: ‘SMC:<surfaceCode>’. Example: 
> > > > if the
> > > > surface-code is 1234, the description will be ‘SMC:1234’.
> > > > 
> > > > Adding this desciption can be enabled/disabled with the import-option
> > > > ‚preserveNonOsgAttrsAsDescription’ (default is disabled). If it is set, 
> > > > the
> > > > description will be added, if it is not set, SMC will be ignored (=>  
> > > > like it was
> > > > without this change). It would make sense to describe this new option 
> > > > in the
> > > > wiki-page:
> > > > http://www.openscenegraph.org/projects/osg/wiki/Support/KnowledgeBase/OpenFlight.
> > > > 
> > > > I tested this change with a lot of flt-models containing different SMC 
> > > > and it
> > > > worked flawless.
> > > > 
> > > > The base for my changes was OSG-3.0.1.
> > > > 
> > > > Following changes I made:
> > > > 
> > > > src/osgPlugins/OpenFlight/Document.h&  Document.cpp:
> > > > 
> > > > New member-variable bool _preserveNonOsgAttrsAsDescription which will 
> > > > be set to
> > > > false in the constructor and getter/setter-methods for it added
> > > > (getPreserveNonOsgAttrsAsDescription() and 
> > > > setPreserveNonOsgAttrsAsDescription())
> > > > 
> > > > src/osgPlugins/OpenFlight/ReaderWriterFLT.cpp:
> > > > 
> > > > In the constructor FLTReaderWriter()preserveNonOsgAttrsAsDescription 
> > > > will be
> > > > declared as import-option
> > > > 
> > > > In readNode() the new option preserveNonOsgAttrsAsDescription will be 
> > > > read and
> > > > set (also an OSG_DEBUG will be made)
> > > > 
> > > > src/osgPlugins/OpenFlight/GeometryRecords.cpp:
> > > > 
> > > > In Face::readRecord() the surface will be read and if
> > > > preserveNonOsgAttrsAsDescription-option is set, the description will be
> > > > generated and added to the geode
> > > > 
> > > > In Mesh::readRecord() the surface will be read and if
> > > > preserveNonOsgAttrsAsDescription-option is set, the description will be
> > > > generated and added to the geode
> > > > 
> > > > I hope you can add this to the trunc, otherwise please inform me why 
> > > > this is not
> > > > possible.
> > > > 
> > > > Cheers
> > > > 
> > > > WeSee
> > > > 
> > > > 
> > > > 
> > > > _______________________________________________
> > > > osg-submissions mailing list
> > > > 
> > > > http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
> > > > 
> > > > 
> > > _______________________________________________
> > > osg-submissions mailing list
> > > 
> > > http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
> > > 
> > > ------------------
> > > Post generated by Mail2Forum
> > > 
> > 
> > 
> > ------------------
> > Read this topic online here:
> > http://forum.openscenegraph.org/viewtopic.php?p=51253#51253
> > 
> > 
> > 
> > 
> > 
> > _______________________________________________
> > osg-submissions mailing list
> > 
> > http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
> > 
> _______________________________________________
> osg-submissions mailing list
> 
> http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
> 
>  ------------------
> Post generated by Mail2Forum


------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=51259#51259





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

Reply via email to