}
+static bool
+do_set_scenery_paths(const SGPropertyNode* arg)
+{
+ SGPropertyNode* sim = fgGetNode("/sim", true);
+ sim->removeChildren("fg-scenery");
+
+ globals->clear_fg_scenery();
+
+ std::string terrasyncPath(fgGetString("/sim/terrasync/scenery-dir"));
+ bool seenTerrasyncPath = false;
+
+ simgear::PropertyList paths = arg->getChildren("path");
+ for (size_t i = 0; i < paths.size(); ++i) {
+ std::string s = paths[i]->getStringValue();
+ if (s == terrasyncPath) {
+ seenTerrasyncPath = true;
+ }
+
+ globals->append_fg_scenery(s);
+ }
+
+ if (fgGetBool("/sim/terrasync/enabled") && !seenTerrasyncPath) {
+ globals->append_fg_scenery(terrasyncPath);
+ }
+
+ if (paths.empty()) {
+ // no scenery paths set *at all*, use the data in FG_ROOT
+ SGPath root(globals->get_fg_root());
+ root.append("Scenery");
+ globals->append_fg_scenery(root.str());
+ }
+
+ return true;
+}
+
////////////////////////////////////////////////////////////////////////
// Command setup.
////////////////////////////////////////////////////////////////////////
{ "print-visible-scene", do_print_visible_scene_info },
{ "reload-shaders", do_reload_shaders },
{ "reload-materials", do_materials_reload },
-
+ { "set-scenery-paths", do_set_scenery_paths },
+
{ "profiler-start", do_profiler_start },
{ "profiler-stop", do_profiler_stop },
void FGGlobals::append_fg_scenery (const std::string &paths)
{
-// fg_scenery.clear();
SGPropertyNode* sim = fgGetNode("/sim", true);
// find first unused fg-scenery property in /sim
} // of path list iteration
}
+void FGGlobals::clear_fg_scenery()
+{
+ fg_scenery.clear();
+}
+
void FGGlobals::append_aircraft_path(const std::string& path)
{
SGPath dirPath(path);
inline const string_list &get_fg_scenery () const { return fg_scenery; }
void append_fg_scenery (const std::string &scenery);
+ void clear_fg_scenery();
+
const string_list& get_aircraft_paths() const { return fg_aircraft_dirs; }
void append_aircraft_path(const std::string& path);
void append_aircraft_paths(const std::string& path);