From 0d623d5f5eea8b9ea6b3d80ba42d220872d3fb85 Mon Sep 17 00:00:00 2001 From: Erik Hofman Date: Mon, 21 Mar 2016 11:53:19 +0100 Subject: [PATCH] Add the option to the Debug menu to save the video configuration file --- Nasal/video.nas | 47 ++++++++++++++++++++++++++++++++++++++++ Translations/en/menu.xml | 1 + Translations/nl/menu.xml | 1 + gui/menubar.xml | 8 +++++++ 4 files changed, 57 insertions(+) create mode 100644 Nasal/video.nas diff --git a/Nasal/video.nas b/Nasal/video.nas new file mode 100644 index 000000000..5b93937f9 --- /dev/null +++ b/Nasal/video.nas @@ -0,0 +1,47 @@ +print("A"); + +var save = func() +{ + var _props = [ + "random-objects", + "random-vegetation", + "random-vegetation-shadows", + "random-vegetation-normals", + "vegetation-density", + "random-buildings", + "building-density", + "point-sprites", + "particles", + "clouds3d-enable", + "clouds3d-vis-range", + "clouds3d-detail-range", + "clouds3d-density", + "shadows/enabled"]; + var sprop = props.globals.getNode("/sim/rendering/"); + var dprop = props.globals.getNode("/tmp/rendering/", 1); + props.copy(sprop.getNode("shaders"), dprop.getNode("shaders", 1), 1); + foreach (var p; _props) { + var src = sprop.getNode(p); + var dest = dprop.getNode(p, 1); + var type = src.getType(); + var val = src.getValue(); + if(type == "ALIAS" or type == "NONE") return; + elsif(type == "BOOL") dest.setBoolValue(val); + elsif(type == "INT" or type == "LONG") dest.setIntValue(val); + elsif(type == "FLOAT" or type == "DOUBLE") dest.setDoubleValue(val); + else dest.setValue(val); + dest.setAttribute(src.getAttribute()); + } + + var fg_home = getprop("/sim/fg-home"); + var renderer = getprop("/sim/rendering/gl-renderer"); + var file = renderer; + var pos = find("x86/", renderer); + if (pos == -1) pos = find("/", renderer); + if (pos == -1) pos = find(" (", renderer); + if (pos != -1) file = substr(renderer, 0, int(pos)); + + var path = fg_home ~ "/Export/" ~ file ~ ".xml"; + io.write_properties( path, dprop); + gui.popupTip("Configuration is written to:\n" ~ path, 6); +} diff --git a/Translations/en/menu.xml b/Translations/en/menu.xml index f8491ff61..a5411d386 100644 --- a/Translations/en/menu.xml +++ b/Translations/en/menu.xml @@ -108,6 +108,7 @@ Print Rendering Statistics Cycle On-Screen Statistics Monitor System Performance + Save Video Configuration Browse Internal Properties Logging Local Weather (Test) diff --git a/Translations/nl/menu.xml b/Translations/nl/menu.xml index 6ad8339e5..50f5b5f6c 100644 --- a/Translations/nl/menu.xml +++ b/Translations/nl/menu.xml @@ -117,6 +117,7 @@ Weergavestatistieken printen Blader door schermstatiestieken Monitor systeemprestaties + Bewaar Video configuratie Blader door interne eigenschappen Logging Local weather (test) diff --git a/gui/menubar.xml b/gui/menubar.xml index 6639704be..e58d25951 100644 --- a/gui/menubar.xml +++ b/gui/menubar.xml @@ -718,6 +718,14 @@ + + write-video-config + + nasal + + + + property-browser