Hi Robert,
my apologies for previous submission. I haven't tested the code thorough
enough. Hopefully this one's ok :).
Why I came across seeking alias extension is because I have been building osg
nodekit which uses osg serialization framework. Now to make a distinction from
osg2 format I tried to alias extension and that's where I ran into trouble.
Actually I was misleaded by method addFileExtensionAlias.
My previous submission tried to use same _extAliasMap for aliasing but it
resulted in two level aliases. (for instance xyz->osgt->osg ). Mixing user
aliases and system plugin aliases lead to bug in my previous submission.
Attached submission extends OSG functionallity to support User-Defined alias
extensions.
Registry::addFileExtensionAlias remains untouched.
Registry::addUserAliasExtension can be used to alias any extension to any
existing supported plugin extension. This is actually equivalent to
supportsExtension() call inside each ReaderWriter class. Each ReaderWriter
checks also for user alias through acceptsExtension method.
Calling 'Registry::addUserFileExtensionAlias("xyz","osgt")' will tell framework
to open *.xyz the same way os *.osgt. ReaderWriterOsg2 checks for alias through
getUserFileExtensionAlias to get correct supported
extension(osgb,osgt,osgx,osg2).
All plugins should work normally with user-defined aliases( although I have not
tested all of them ).
Usage:
osgDB::Registry::instance()->addUserFileExtensionAlias("myimage","jpg");
//myimage will be handled with plugin that handles jpg extension (plugin name
jpeg )
osgDB::Registry::instance()->addUserFileExtensionAlias("mygt","osgt"); // when
loading mygt ReaderWriterOsg2 will check for alias and set option to Ascii
based on aliased extensions osgt
osgDB::Registry::instance()->addUserFileExtensionAlias("mygb","osgb");
Cheers,
Miha
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=52807#52807
Attachments:
http://forum.openscenegraph.org//files/openscenegraph_458.zip
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org