Hi,

OK, I managed to achieve a similar behavior by modifying the ReadFileCallback:

[code]
#include <osgViewer/Viewer>
#include <osgDB/Registry>
#include <iostream>
#include <osg/ProxyNode>

class MyReadFileCallback : public osgDB::Registry::ReadFileCallback
{
public:
    virtual osgDB::ReaderWriter::ReadResult readNode(const std::string& 
fileName, const osgDB::ReaderWriter::Options* options)
    {
        osgDB::ReaderWriter::ReadResult res = 
osgDB::Registry::instance()->readNodeImplementation(fileName,options);
        if(res.notFound() || res.notHandled() || res.error())
        {
           OSG_WARN << "DatabasePager could not load file, stopped trying: " << 
fileName << std::endl;
           osgDB::ReaderWriter::ReadResult notfound(new osg::Node(), 
osgDB::ReaderWriter::ReadResult::FILE_LOADED);
           notfound.getNode()->setName("Not found");
           return notfound;
        }
        return res;
    }
};


int main(int argc, char ** argv)
{
    osgDB::Registry::instance()->setReadFileCallback(new MyReadFileCallback());

    osg::ProxyNode* proxynode = new osg::ProxyNode();
    proxynode->setFileName(0, "NOTFOUND.ive");

    osg::ArgumentParser arguments(&argc,argv);
    osgViewer::Viewer viewer(arguments);
    viewer.setSceneData(proxynode);
    return viewer.run();
}
[/code]

This increases my framerate a little because I have a faulty model that kept 
spamming the database pager with file not found-caused reloads.

I still think that it would make sense to treat local file not founds a little 
different than the current way. I stumbled on the reload issue by chance when I 
implemented a ReadFileCallback, my application did constant reloading all the 
time without me noticing!

Thank you!

Cheers,
Martin

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





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

Reply via email to