]> git.mxchange.org Git - simgear.git/commitdiff
Add fg_root and cwd to the search path for loaded models
authorTorsten Dreyer <torsten@t3r.de>
Fri, 27 Nov 2015 10:11:42 +0000 (11:11 +0100)
committerTorsten Dreyer <torsten@t3r.de>
Fri, 27 Nov 2015 10:11:42 +0000 (11:11 +0100)
ref: http://sourceforge.net/p/flightgear/mailman/message/34650992/

simgear/scene/model/modellib.cxx

index 4b3ae1d691ba1131eddb9458c1b3f23ef2300bc2..691788348bd2a4bee370437463623f3e4aa994ea 100644 (file)
@@ -54,6 +54,7 @@ SGModelLib::panel_func SGModelLib::static_panelFunc = NULL;
 void SGModelLib::init(const string &root_dir, SGPropertyNode* root)
 {
     osgDB::Registry::instance()->getDataFilePathList().push_front(root_dir);
+    osgDB::Registry::instance()->getOptions()->getDatabasePathList().push_front(root_dir);
     static_propRoot = root;
 }
 
@@ -114,6 +115,7 @@ SGModelLib::loadModel(const string &path,
 {
     osg::ref_ptr<SGReaderWriterOptions> opt;
     opt = SGReaderWriterOptions::copyOrCreate(osgDB::Registry::instance()->getOptions());
+    opt->getDatabasePathList().push_front( osgDB::getFilePath(path) );
     opt->setPropertyNode(prop_root ? prop_root: static_propRoot.get());
     opt->setModelData(data);
     
@@ -136,8 +138,10 @@ SGModelLib::loadDeferredModel(const string &path, SGPropertyNode *prop_root,
     proxyNode->setLoadingExternalReferenceMode(osg::ProxyNode::DEFER_LOADING_TO_DATABASE_PAGER);
     proxyNode->setFileName(0, path);
 
+
     osg::ref_ptr<SGReaderWriterOptions> opt;
     opt = SGReaderWriterOptions::copyOrCreate(osgDB::Registry::instance()->getOptions());
+    opt->getDatabasePathList().push_front( osgDB::getFilePath(path) );
     opt->setPropertyNode(prop_root ? prop_root: static_propRoot.get());
     opt->setModelData(data);
     opt->setLoadPanel(static_panelFunc);