From: Torsten Dreyer Date: Fri, 27 Nov 2015 10:11:42 +0000 (+0100) Subject: Add fg_root and cwd to the search path for loaded models X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=6be4ad27ee32dc00cfa92c229d6189b12498b097;p=simgear.git Add fg_root and cwd to the search path for loaded models ref: http://sourceforge.net/p/flightgear/mailman/message/34650992/ --- diff --git a/simgear/scene/model/modellib.cxx b/simgear/scene/model/modellib.cxx index 4b3ae1d6..69178834 100644 --- a/simgear/scene/model/modellib.cxx +++ b/simgear/scene/model/modellib.cxx @@ -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 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 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);