1# Lockheed 1049H
2#
3# Custom 1049H routines for seat support
4#
5# Gary Neely aka 'Buckaroo'
6#
7
8
9var current_z		= props.globals.getNode("/sim/current-view/z-offset-m");
10var current_y		= props.globals.getNode("/sim/current-view/y-offset-m");
11var current_pitch	= props.globals.getNode("/sim/current-view/pitch-offset-deg");
12
13var default_z		= props.globals.getNode("/systems/seat/defaults/z-offset-m");
14var default_y		= props.globals.getNode("/systems/seat/defaults/y-offset-m");
15var default_pitch	= props.globals.getNode("/systems/seat/defaults/pitch-offset-deg");
16
17var view_z		= props.globals.getNode("/sim/view/config/z-offset-m");
18var view_y		= props.globals.getNode("/sim/view/config/y-offset-m");
19var view_pitch		= props.globals.getNode("/sim/view/config/pitch-offset-deg");
20
21var preset_z		= props.globals.getNode("/systems/seat/presets/z-offset-m");
22var preset_y		= props.globals.getNode("/systems/seat/presets/y-offset-m");
23var preset_pitch	= props.globals.getNode("/systems/seat/presets/pitch-offset-deg");
24
25var enable_presets	= props.globals.getNode("/systems/seat/presets/enable-presets");
26
27var seat_pilot_offset_z	= props.globals.getNode("/systems/seat/pilot-z-offset-m");
28
29
30# Calculate offset for moving pilot's seat forward-back according to custom preferences;
31#   current view settings - default view settings = offset along z (+x in Blender)
32# The offset is used for a cockpit animation.
33
34var seat_pilot_update = func {
35  seat_pilot_offset_z.setValue(current_z.getValue()-default_z.getValue());
36  preset_z.setValue(current_z.getValue());
37  preset_y.setValue(current_y.getValue());
38  preset_pitch.setValue(current_pitch.getValue());
39}
40
41
42# Reset viewing properties to aircraft configuration settings.
43
44var seat_pilot_defaults = func {
45  current_z.setValue(default_z.getValue());
46  current_y.setValue(default_y.getValue());
47  current_pitch.setValue(default_pitch.getValue());
48  seat_pilot_offset_z.setValue(0);
49}
50
51#var seat_pilot_defaults = func {
52#  current_view_z.setValue(default_view_z.getValue());
53#  current_view_y.setValue(default_view_y.getValue());
54#  current_view_pitch.setValue(default_view_pitch.getValue());
55#  seat_pilot_offset_z.setValue(0);
56#}
57
58
59var seat_load_presets = func {
60  view_z.setValue(preset_z.getValue());
61  view_y.setValue(preset_y.getValue());
62  view_pitch.setValue(preset_pitch.getValue());
63}
64