make system and aircraft views configurable in Menu->Views->View Options.
These are then skipped with view.stepView(n), unless the second, optional argument is set to 1: view.stepView(n, 1); Whether a view is enabled or not, is saved in $FG_ROOT/.fgfs/autosave.xml (system views) or $FG_ROOT/.fgfs/aircraft-data/<aircraft>.xml
This commit is contained in:
parent
d6be4c8303
commit
10c875f75e
4 changed files with 104 additions and 22 deletions
|
@ -70,14 +70,19 @@ var resetViewDir = func {
|
|||
}
|
||||
|
||||
##
|
||||
# Handler. Step to the next view.
|
||||
# Handler. Step to the next (force=1) or next enabled view.
|
||||
#
|
||||
var stepView = func(n) {
|
||||
var i = getprop("/sim/current-view/view-number") + n;
|
||||
var stepView = func(n, force = 0) {
|
||||
var i = getprop("/sim/current-view/view-number");
|
||||
while (1) {
|
||||
i += n;
|
||||
if (i < 0)
|
||||
i = size(views) - 1;
|
||||
elsif (i >= size(views))
|
||||
i = 0;
|
||||
if (!i or force or (var e = views[i].getNode("enabled")) == nil or e.getValue())
|
||||
break;
|
||||
}
|
||||
setprop("/sim/current-view/view-number", i);
|
||||
|
||||
# And pop up a nice reminder
|
||||
|
|
72
gui/dialogs/view.xml
Normal file
72
gui/dialogs/view.xml
Normal file
|
@ -0,0 +1,72 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<PropertyList>
|
||||
<name>view</name>
|
||||
<modal>false</modal>
|
||||
<layout>vbox</layout>
|
||||
|
||||
<text>
|
||||
<label>Configure Active Views</label>
|
||||
</text>
|
||||
|
||||
<hrule/>
|
||||
|
||||
<nasal>
|
||||
<open>
|
||||
var group = cmdarg().getNode("group");
|
||||
var ac = getprop("/sim/aircraft");
|
||||
group.removeChildren("checkbox");
|
||||
group.removeChildren("hrule");
|
||||
group.removeChildren("text");
|
||||
var system = 1;
|
||||
foreach (var v; view.views) {
|
||||
var index = v.getIndex();
|
||||
if (index == 0 or index >= 200)
|
||||
continue;
|
||||
|
||||
if (index >= 100) {
|
||||
if (system) {
|
||||
group.getNode("hrule", 1);
|
||||
var t = group.getNode("text", 1);
|
||||
t.getNode("label", 1).setValue("\"" ~ ac ~ "\" Specific Views");
|
||||
system = 0;
|
||||
}
|
||||
aircraft.data.add(v.getPath() ~ "/enabled");
|
||||
}
|
||||
if (v.getNode("enabled") == nil)
|
||||
v.getNode("enabled", 1).setBoolValue(1);
|
||||
|
||||
var target = group.getChild("checkbox", index, 1);
|
||||
props.copy(group.getNode("checkbox-template"), target);
|
||||
target.getNode("label").setValue(v.getNode("name").getValue());
|
||||
target.getNode("property").setValue(v.getPath() ~ "/enabled");
|
||||
}
|
||||
</open>
|
||||
</nasal>
|
||||
|
||||
<group>
|
||||
<layout>vbox</layout>
|
||||
<halign>center</halign>
|
||||
|
||||
<checkbox-template>
|
||||
<halign>left</halign>
|
||||
<label><!----></label>
|
||||
<property><!----></property>
|
||||
<binding>
|
||||
<command>dialog-apply</command>
|
||||
</binding>
|
||||
</checkbox-template>
|
||||
</group>
|
||||
|
||||
<button>
|
||||
<legend>Close</legend>
|
||||
<default>true</default>
|
||||
<key>Esc</key>
|
||||
<binding>
|
||||
<command>dialog-apply</command>
|
||||
</binding>
|
||||
<binding>
|
||||
<command>dialog-close</command>
|
||||
</binding>
|
||||
</button>
|
||||
</PropertyList>
|
|
@ -19,16 +19,6 @@
|
|||
</binding>
|
||||
</item>
|
||||
|
||||
<!--
|
||||
<item>
|
||||
<label>Load Aircraft</label>
|
||||
<binding>
|
||||
<command>dialog-show</command>
|
||||
<dialog-name>aircraft</dialog-name>
|
||||
</binding>
|
||||
</item>
|
||||
-->
|
||||
|
||||
<item>
|
||||
<label>Reset</label>
|
||||
<binding>
|
||||
|
@ -117,7 +107,15 @@
|
|||
</item>
|
||||
|
||||
<item>
|
||||
<label>Rendering options</label>
|
||||
<label>View Options</label>
|
||||
<binding>
|
||||
<command>dialog-show</command>
|
||||
<dialog-name>view</dialog-name>
|
||||
</binding>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<label>Rendering Options</label>
|
||||
<binding>
|
||||
<command>dialog-show</command>
|
||||
<dialog-name>rendering</dialog-name>
|
||||
|
@ -156,7 +154,6 @@
|
|||
</binding>
|
||||
</item>
|
||||
|
||||
|
||||
<item>
|
||||
<label>Chat</label>
|
||||
<binding>
|
||||
|
@ -463,6 +460,7 @@
|
|||
<command>dump-scenegraph</command>
|
||||
</binding>
|
||||
</item>
|
||||
|
||||
</menu>
|
||||
|
||||
<menu>
|
||||
|
|
|
@ -260,6 +260,7 @@ Started September 2000 by David Megginson, david@megginson.com
|
|||
|
||||
<view>
|
||||
<name>Cockpit View</name>
|
||||
<enabled type="bool" userarchive="y">true</enabled>
|
||||
<type>lookfrom</type>
|
||||
<internal type="bool">false</internal>
|
||||
<config>
|
||||
|
@ -283,6 +284,7 @@ Started September 2000 by David Megginson, david@megginson.com
|
|||
|
||||
<view>
|
||||
<name>Helicopter View</name>
|
||||
<enabled type="bool" userarchive="y">true</enabled>
|
||||
<type>lookat</type>
|
||||
<config>
|
||||
<from-model type="bool">false</from-model>
|
||||
|
@ -308,6 +310,7 @@ Started September 2000 by David Megginson, david@megginson.com
|
|||
|
||||
<view>
|
||||
<name>Chase View</name>
|
||||
<enabled type="bool" userarchive="y">true</enabled>
|
||||
<type>lookat</type>
|
||||
<config>
|
||||
<from-model type="bool">false</from-model>
|
||||
|
@ -337,6 +340,7 @@ Started September 2000 by David Megginson, david@megginson.com
|
|||
|
||||
<view>
|
||||
<name>Tower View</name>
|
||||
<enabled type="bool" userarchive="y">true</enabled>
|
||||
<type>lookat</type>
|
||||
<config>
|
||||
<eye-lat-deg-path>/sim/tower/latitude-deg</eye-lat-deg-path>
|
||||
|
@ -360,6 +364,7 @@ Started September 2000 by David Megginson, david@megginson.com
|
|||
|
||||
<view>
|
||||
<name>Tower View Look From</name>
|
||||
<enabled type="bool" userarchive="y">true</enabled>
|
||||
<type>lookfrom</type>
|
||||
<config>
|
||||
<eye-lat-deg-path>/sim/tower/latitude-deg</eye-lat-deg-path>
|
||||
|
@ -380,6 +385,7 @@ Started September 2000 by David Megginson, david@megginson.com
|
|||
|
||||
<view>
|
||||
<name>Chase View wo yaw</name>
|
||||
<enabled type="bool" userarchive="y">true</enabled>
|
||||
<type>lookat</type>
|
||||
<config>
|
||||
<from-model type="bool">false</from-model>
|
||||
|
@ -402,6 +408,7 @@ Started September 2000 by David Megginson, david@megginson.com
|
|||
|
||||
<view>
|
||||
<name>Fly-By View</name>
|
||||
<enabled type="bool" userarchive="y">true</enabled>
|
||||
<type>lookat</type>
|
||||
<config>
|
||||
<eye-lon-deg-path>/sim/viewer/longitude-deg</eye-lon-deg-path>
|
||||
|
|
Loading…
Reference in a new issue