Re: [osg-users] Problem with ReadWriterOSG.cpp and osgDB::setDataFilePathList
HI Morgan, Earlier this week I checked in a new osgDB::FindFileCallback that can be used to override the standard osgDB::findDataFile()/findLibraryFile() mechanism. You can now assign a FindFileCallack to an osgDB::Options object (was osgDB::ReaderWriter::Options) or to the osgDB::Registry singleton. You'll find the new callback defined in include/osgDB/Callbacks in the svn/trunk version of the OSG. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Problem with ReadWriterOSG.cpp and osgDB::setDataFilePathList
Hi Morgan, Adding a ReaderWriter::Option::OptionsString entry would probably be the most straight forward way to hint to the plugins not include the local file directory when searching. Feel free to add the necessary code to OSG plugin and submit the changes to the osg-submissions list. Cheers, Robert. On Wed, Apr 29, 2009 at 3:43 PM, Morgan Willis wrote: > Hi All, > > > > I have an issue with loading .osg files. I would like to be able to specify > the directories from which the internally referenced files of a .osg file > are loaded. This can largely be achieved by using > osgDB::setDataFilePathList or setting the database path on an instance of > ReaderWriter::Options when calling osgDB::readNodeFile. However I have a > problem. Internally referenced files in the same directory as the .osg file > (current directory) will always be preferred to those in other directories > specified on the data path list even if the current directory is on the data > path list. This is causing me problems when trying to do resource > localisation in the following way: > > > > The directory Test (see below) contains a default version of bar.png, > directories fr-FR and en-GB containing localised versions of bar.png and > foo.osg that references bar.png. > > > > Test > > foo.osg > > bar.png > > fr-FR > > bar.png > > en-GB > > bar.png > > > > What I would like to happen is that bar.png in fr-FR is loaded instead of > the default when the data path is setup as (Test/fr-FR/,Test/). If bar.png > doesn’t exist in the localised directory then the default is loaded. What > is stopping this happening is the following line in > .../src/osgPlugins/ReadWriterOSG.cpp > > > > local_opt->getDatabasePathList().push_front(osgDB::getFilePath(fileName)); > > > > This always adds the directory of the .osg file to the front of the data > path list so internally referenced files will always be loaded from that > directory irrespective of how the data path has initially been constructed. > > > > There are a number of ways ReadWriterOSG.cpp could be changed to resolve > this issue: > > 1. Only add the directory of the .osg file if it isn’t already on the > data path. > > 2. Add a flag to ReaderWriter::Options to indicate that the directory > should not be added to the path. > > 3. Some combination of 1 and 2. > > This logic could be put into ReaderWriter::Options to make it available to > other plugins. > > > > Any ideas? > > > > Thanks, > > > > Morgan. > > > > ___ > 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] Problem with ReadWriterOSG.cpp and osgDB::setDataFilePathList
Hi All, I have an issue with loading .osg files. I would like to be able to specify the directories from which the internally referenced files of a .osg file are loaded. This can largely be achieved by using osgDB::setDataFilePathList or setting the database path on an instance of ReaderWriter::Options when calling osgDB::readNodeFile. However I have a problem. Internally referenced files in the same directory as the .osg file (current directory) will always be preferred to those in other directories specified on the data path list even if the current directory is on the data path list. This is causing me problems when trying to do resource localisation in the following way: The directory Test (see below) contains a default version of bar.png, directories fr-FR and en-GB containing localised versions of bar.png and foo.osg that references bar.png. Test foo.osg bar.png fr-FR bar.png en-GB bar.png What I would like to happen is that bar.png in fr-FR is loaded instead of the default when the data path is setup as (Test/fr-FR/,Test/). If bar.png doesn't exist in the localised directory then the default is loaded. What is stopping this happening is the following line in .../src/osgPlugins/ReadWriterOSG.cpp local_opt->getDatabasePathList().push_front(osgDB::getFilePath(fileName) ); This always adds the directory of the .osg file to the front of the data path list so internally referenced files will always be loaded from that directory irrespective of how the data path has initially been constructed. There are a number of ways ReadWriterOSG.cpp could be changed to resolve this issue: 1. Only add the directory of the .osg file if it isn't already on the data path. 2. Add a flag to ReaderWriter::Options to indicate that the directory should not be added to the path. 3. Some combination of 1 and 2. This logic could be put into ReaderWriter::Options to make it available to other plugins. Any ideas? Thanks, Morgan. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org