Remove the scenery path mangling.
Requires a matching SG commit for correct operation.
This commit is contained in:
parent
780e0f5a02
commit
e64a2db5a0
5 changed files with 18 additions and 30 deletions
|
@ -331,7 +331,7 @@ SGPath FGGlobals::find_data_dir(const std::string& pathSuffix) const
|
|||
|
||||
void FGGlobals::append_fg_scenery (const PathList &paths)
|
||||
{
|
||||
BOOST_FOREACH(const SGPath& path, paths) {
|
||||
for (const SGPath& path : paths) {
|
||||
append_fg_scenery(path);
|
||||
}
|
||||
}
|
||||
|
@ -363,32 +363,11 @@ void FGGlobals::append_fg_scenery (const SGPath &path)
|
|||
// needed to load Models from this scenery path
|
||||
simgear::ResourceManager::instance()->addBasePath(abspath.local8BitStr(),
|
||||
simgear::ResourceManager::PRIORITY_DEFAULT);
|
||||
|
||||
simgear::Dir dir(abspath);
|
||||
SGPath terrainDir(dir.file("Terrain"));
|
||||
SGPath objectsDir(dir.file("Objects"));
|
||||
|
||||
// this code used to add *either* the base dir, OR add the
|
||||
// Terrain and Objects subdirs, but the conditional logic was commented
|
||||
// out, such that all three dirs are added. Unfortunately there's
|
||||
// no information as to why the change was made.
|
||||
fg_scenery.push_back(abspath);
|
||||
unmangled_fg_scenery.push_back(abspath);
|
||||
extra_read_allowed_paths.push_back(abspath);
|
||||
|
||||
if (terrainDir.exists()) {
|
||||
fg_scenery.push_back(terrainDir);
|
||||
}
|
||||
|
||||
if (objectsDir.exists()) {
|
||||
fg_scenery.push_back(objectsDir);
|
||||
}
|
||||
|
||||
// insert a marker for FGTileEntry::load(), so that
|
||||
// FG_SCENERY=A:B becomes list ["A/Terrain", "A/Objects", "",
|
||||
// "B/Terrain", "B/Objects", ""]
|
||||
fg_scenery.push_back(SGPath());
|
||||
|
||||
// make scenery dirs available to Nasal
|
||||
SGPropertyNode* n = sim->getChild("fg-scenery", propIndex++, true);
|
||||
n->setStringValue(abspath.utf8Str());
|
||||
|
@ -411,9 +390,7 @@ void FGGlobals::append_read_allowed_paths(const SGPath &path)
|
|||
void FGGlobals::clear_fg_scenery()
|
||||
{
|
||||
fg_scenery.clear();
|
||||
unmangled_fg_scenery.clear();
|
||||
fgGetNode("/sim", true)->removeChildren("fg-scenery");
|
||||
|
||||
}
|
||||
|
||||
// The 'path' argument to this method must come from trustworthy code, because
|
||||
|
|
|
@ -111,7 +111,6 @@ private:
|
|||
|
||||
// Roots of FlightGear scenery tree
|
||||
PathList fg_scenery;
|
||||
PathList unmangled_fg_scenery;
|
||||
// Paths Nasal is allowed to read
|
||||
PathList extra_read_allowed_paths;
|
||||
|
||||
|
@ -240,7 +239,6 @@ public:
|
|||
void set_terrasync_dir (const SGPath &path);
|
||||
|
||||
const PathList &get_fg_scenery () const { return fg_scenery; }
|
||||
const PathList &get_unmangled_fg_scenery () const { return unmangled_fg_scenery; }
|
||||
const PathList &get_extra_read_allowed_paths () const { return extra_read_allowed_paths; }
|
||||
/**
|
||||
* Add a scenery directory
|
||||
|
|
|
@ -2583,7 +2583,7 @@ void Options::showVersion() const
|
|||
cout << "FG_HOME=" << globals->get_fg_home().utf8Str() << endl;
|
||||
cout << "FG_SCENERY=";
|
||||
|
||||
PathList scn = globals->get_unmangled_fg_scenery();
|
||||
PathList scn = globals->get_fg_scenery();
|
||||
cout << SGPath::join(scn, &SGPath::pathListSep) << endl;
|
||||
cout << "SimGear version: " << SG_STRINGIZE(SIMGEAR_VERSION) << endl;
|
||||
cout << "OSG version: " << osgGetVersion() << endl;
|
||||
|
@ -2623,8 +2623,7 @@ void Options::printJSONReport() const
|
|||
cJSON_AddStringToObject(configNode, "FG_HOME",
|
||||
globals->get_fg_home().utf8Str().c_str());
|
||||
|
||||
cJSON *sceneryPathsNode = p->createJSONArrayFromPathList(
|
||||
globals->get_unmangled_fg_scenery());
|
||||
cJSON *sceneryPathsNode = p->createJSONArrayFromPathList(globals->get_fg_scenery());
|
||||
cJSON_AddItemToObject(configNode, "scenery paths", sceneryPathsNode);
|
||||
|
||||
cJSON *aircraftPathsNode = p->createJSONArrayFromPathList(
|
||||
|
|
|
@ -1029,7 +1029,7 @@ NavDataCache::DatFilesGroupInfo NavDataCache::NavDataCachePrivate::findDatFiles(
|
|||
SGPath visitedPath; // to avoid duplicates and time wasting
|
||||
const string datFilesSubDir = "NavData/" +
|
||||
NavDataCache::datTypeStr[datFileType];
|
||||
const PathList& sceneryPaths = globals->get_unmangled_fg_scenery();
|
||||
const PathList& sceneryPaths = globals->get_fg_scenery();
|
||||
result.datFileType = datFileType;
|
||||
result.totalSize = 0;
|
||||
|
||||
|
|
|
@ -185,6 +185,20 @@ void FGTileMgr::reinit()
|
|||
_options->setPluginStringData("SimGear::LOD_RANGE_DETAILED", fgGetString("/sim/rendering/static-lod/detailed", boost::lexical_cast<string>(SG_OBJECT_RANGE_DETAILED)));
|
||||
_options->setPluginStringData("SimGear::RENDER_BUILDING_MESH", fgGetBool("/sim/rendering/building-mesh", false) ? "true" : "false");
|
||||
|
||||
string_list scenerySuffixes;
|
||||
for (auto node : fgGetNode("/sim/rendering/", true)->getChildren("scenery-path-suffix")) {
|
||||
if (node->getBoolValue("enabled", true)) {
|
||||
scenerySuffixes.push_back(node->getStringValue("name"));
|
||||
}
|
||||
}
|
||||
|
||||
if (scenerySuffixes.empty()) {
|
||||
// if preferences didn't load, use some default
|
||||
scenerySuffixes = {"Objects", "Terrain"}; // defaut values
|
||||
}
|
||||
|
||||
_options->setSceneryPathSuffixes(scenerySuffixes);
|
||||
|
||||
if (state != Start)
|
||||
{
|
||||
// protect against multiple scenery reloads and properly reset flags,
|
||||
|
|
Loading…
Reference in a new issue