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, Alois Wismer 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
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to