I have always been able to register an extension alias by calling
addFileExtensionAlias directly from my code, the calling readNodeFile
passing in a file name using the alias.
I have never tried the asserts that you are using.
If this is broke, this is a new breakage. Perhaps by debugging the code,
you can determine what's going wrong?
Paul Martz
Skew Matrix Software LLC
_http://www.skew-matrix.com_ <http://www.skew-matrix.com/>
+1 303 859 9466
Jan Pečiva wrote:
Hi Robert,
Extension alias certainly does work
Yes and no. It works in Registry.cpp by
Registry::addFileExtensionAlias(from,to);
But
Registry::addFileExtensionAlias("my_new_ext","osg");
will certainly not work. You have to go to
osgPlugin/osg/ReaderWriterOSG.cpp and put
supportsExtension("my_new_ext","My new extension");
to the OSGReaderWriter constructor. And that is sick idea - you have to
hack osgPlugin sources to create extensions aliases. No way around. This
is the painful point.
It is simple to test the problem on few lines:
assert(osgDB::Registry::instance()->getReaderWriterForExtension("iv")
!= NULL);
osgDB::Registry::instance()->addFileExtensionAlias("ivx", "iv");
assert(osgDB::Registry::instance()->getReaderWriterForExtension("ivx")
!= NULL);
Unless
supportsExtension("ivx","Inventor format");
is put to ReaderWriterIV constructor, the second assert ALWAYS fails.
John
Robert Osfield wrote:
Hi John,
Extension alias certainly does work - it's used all the time by osgDB,
go look inside src/osgDB/Registry.cpp to see lots of examples of it in
action. What is happening at your end I can't guess, I don't have
your code.
Robert.
On Mon, Dec 14, 2009 at 2:08 PM, Jan Pečiva <pec...@fit.vutbr.cz> wrote:
Robert,
thanks for the comment, however it does not work. Do I need to
extend/patch
OSG?
An investigation showed that many plugins check once again in readNode
method whether the extension is accepted. At this moment, ivx is
refused. I
am not sure, but the explicit alias that user makes should be
stronger than
what plugin thinks about itself. Reasons: Sometimes, software developers
just decide to change file extension while the format stays the same.
The
application for interiors design may want to use "int" extension
while file
format is still osg, or whatever. I think, OSG should allow to do that.
Ideas?
I suggest to change
bool ReaderWriter::acceptsExtension(const std::string& extension)
const;
to accept even the extensions added by:
osgDB::Registry::instance()->addFileExtensionAlias(from,to);
Comments?
Thx,
John
Robert Osfield wrote:
Hi John,
On Mon, Dec 14, 2009 at 1:17 PM, Jan Pečiva <pec...@fit.vutbr.cz>
wrote:
Question: Is is possible to register the ivx alias?
You have two options, to preload your plugin so it gets tried before
any other plugin so can intercept and handle all .iv file reads, or to
use an osgDB::Registry file extension alias. The later is probably
the neatest solution can be done via:
osgDB::Registry::instance()->addFileExtensionAlias("iv","ivx");
Robert.
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org