A while ago, I added the ability to store extension aliases in a text file, and load that text file (and register the aliases within) with a single function call to Registry. If you search Registry.cpp for addFileExtensionAlias, you should see this.

Personally, I'd like to extend this so that such a file can be loaded simply by setting an environment variable that specifies the alias file. The Registry constructor would look for the environment variable and (if set) load the file and register the aliases. This would allow aliases to be registered without modifying OSG or application code. Is anyone else interested in such a change? If so, I'll code it and submit it.

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



Farshid Lashkari wrote:
Hi Rick,

You can call addFileExtensionAlias() within your own program. I would recommend doing that instead of modifying the OSG source. I've written a plugin that handles multiple extensions, so I use this technique successfully within my OSG app. Here is the code you would insert into your application:

osgDB::Registry::instance()->addFileExtensionAlias("csg",   "nsm");

If you are creating your own application that uses the plugin, then I don't see a problem with this solution.

However, if you are trying to add support for these extensions to a 3rd party application, then this solution won't work. In this case, I would suggest creating a separate plugin called osgdb_csg.dll that forwards the loading to the original osgdb_nsm.dll plugin, therefore avoiding duplicating the code in two different files.

Cheers,
Farshid

On Fri, Jul 31, 2009 at 10:05 AM, Rick Pingry <[email protected]> wrote:
Hey guys,

Thanks for the replies.  I can do those, but both answers concern me a bit.

The idea of needing to modify the osgDB/Registry.cpp file directly does not make sense to me.  Why should I need to recompile the OSG source to get a plugin working?  Isn't that the purpose of plugins to NOT have to modify and recompile the original source code?

I wonder if I couldn't add the line to my own plugin source code, but I have a feeling it wouldn't work because I bet the plugin does not get loaded at all, and therefore the addFileExtensionAlias("csg", "nsm"); would not get called either.

As for creating another DLL.  I could do that and I know it would work, but it does kind of confuse me.  If OSG only uses the naming convention to determine which plugin to look at, why have all of the extra functionality I mentioned before?  I suppose because someone might have added the addFileExtensionAlias call, but it seems to me that the plugin should be able to do something like that itself.

Anyway,
Thanks very much for you thoughts and ideas.
I will reply again with whatever I come up with.
-- Rick

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





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


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


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

Reply via email to