Search aircraft dirs when loading AI models. Thanks to Thorsten Brehm for the catch.
This commit is contained in:
parent
94a3471956
commit
0d7769ae72
1 changed files with 17 additions and 8 deletions
|
@ -194,17 +194,26 @@ void FGAIBase::Transform() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FGAIBase::init(bool search_in_AI_path) {
|
bool FGAIBase::init(bool search_in_AI_path) {
|
||||||
osg::ref_ptr<osgDB::ReaderWriter::Options> opt=
|
|
||||||
new osgDB::ReaderWriter::Options(*osgDB::Registry::instance()->getOptions());
|
|
||||||
|
|
||||||
|
string f;
|
||||||
if(search_in_AI_path)
|
if(search_in_AI_path)
|
||||||
{
|
{
|
||||||
SGPath ai_path(globals->get_fg_root());
|
// setup a modified Options strucutre, with only the $fg-root/AI defined;
|
||||||
ai_path.append("AI");
|
// we'll check that first, then give the normal search logic a chance.
|
||||||
opt->getDatabasePathList().push_front(ai_path.str());
|
// this ensures that models in AI/ are preferred to normal models, where
|
||||||
|
// both exist.
|
||||||
|
osg::ref_ptr<osgDB::ReaderWriter::Options>
|
||||||
|
opt(osg::clone(osgDB::Registry::instance()->getOptions(), osg::CopyOp::SHALLOW_COPY));
|
||||||
|
|
||||||
|
SGPath ai_path(globals->get_fg_root(), "AI");
|
||||||
|
opt->setDatabasePath(ai_path.str());
|
||||||
|
|
||||||
|
f = osgDB::findDataFile(model_path, opt.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
string f = osgDB::findDataFile(model_path, opt.get());
|
if (f.empty()) {
|
||||||
|
f = simgear::SGModelLib::findDataFile(model_path);
|
||||||
|
}
|
||||||
|
|
||||||
if(f.empty())
|
if(f.empty())
|
||||||
f = fgGetString("/sim/multiplay/default-model", default_model);
|
f = fgGetString("/sim/multiplay/default-model", default_model);
|
||||||
|
|
Loading…
Add table
Reference in a new issue