1
0
Fork 0

New feature: Allow the loading of shared models that are not located inside

the base package, but are maintained in the SVN repository of the custom
scenery project.
This commit is contained in:
durk 2009-10-04 07:59:07 +00:00 committed by Tim Moore
parent 4023bdaf26
commit b40321380d
2 changed files with 18 additions and 4 deletions

View file

@ -34,7 +34,7 @@ XMLLoader::~XMLLoader() {}
void XMLLoader::load(FGAirportDynamics* d) { void XMLLoader::load(FGAirportDynamics* d) {
FGAirportDynamicsXMLLoader visitor(d); FGAirportDynamicsXMLLoader visitor(d);
if (fgGetBool("/sim/traffic-manager/use-custom-scenery-data") == false) { if (fgGetBool("/sim/paths/use-custom-scenery-data") == false) {
SGPath parkpath( globals->get_fg_root() ); SGPath parkpath( globals->get_fg_root() );
parkpath.append( "/AI/Airports/" ); parkpath.append( "/AI/Airports/" );
parkpath.append( d->getId() ); parkpath.append( d->getId() );
@ -57,7 +57,7 @@ void XMLLoader::load(FGAirportDynamics* d) {
void XMLLoader::load(FGRunwayPreference* p) { void XMLLoader::load(FGRunwayPreference* p) {
FGRunwayPreferenceXMLLoader visitor(p); FGRunwayPreferenceXMLLoader visitor(p);
if (fgGetBool("/sim/traffic-manager/use-custom-scenery-data") == false) { if (fgGetBool("/sim/paths/use-custom-scenery-data") == false) {
SGPath rwyPrefPath( globals->get_fg_root() ); SGPath rwyPrefPath( globals->get_fg_root() );
rwyPrefPath.append( "AI/Airports/" ); rwyPrefPath.append( "AI/Airports/" );
rwyPrefPath.append( p->getId() ); rwyPrefPath.append( p->getId() );

View file

@ -236,13 +236,27 @@ void FGTileMgr::initialize_queue()
osg::Node* osg::Node*
FGTileMgr::loadTileModel(const string& modelPath, bool cacheModel) FGTileMgr::loadTileModel(const string& modelPath, bool cacheModel)
{ {
SGPath fullPath;
if (fgGetBool("/sim/paths/use-custom-scenery-data") == true) {
string_list sc = globals->get_fg_scenery();
for (string_list_iterator it = sc.begin(); it != sc.end(); ++it) {
SGPath tmpPath(*it);
tmpPath.append(modelPath);
if (tmpPath.exists()) {
fullPath = tmpPath;
break;
}
}
} else {
fullPath.append(modelPath);
}
osg::Node* result = 0; osg::Node* result = 0;
try { try {
if(cacheModel) if(cacheModel)
result = result =
SGModelLib::loadModel(modelPath, globals->get_props(), SGModelLib::loadModel(fullPath.str(), globals->get_props(),
new FGNasalModelData); new FGNasalModelData);
else else
result= result=
SGModelLib::loadPagedModel(modelPath, globals->get_props(), SGModelLib::loadPagedModel(modelPath, globals->get_props(),