From f2d2b8e8b14e63677a61d02175cc429eae4f71d2 Mon Sep 17 00:00:00 2001 From: ThorstenB Date: Fri, 3 Jun 2011 00:39:05 +0200 Subject: [PATCH] issue #281: tutorial's view direction messed-up/unusable by outside views When user switched to a different view mode (e.g. chase/helicopter/tower view) before or during a tutorial, everything went wrong... Need to control (save/restore/switch) the view number (view mode) during tutorials. Also adds an option to explicitly change view mode during a tutorial, i.e. tutorials can switch to tower view, chase view, ... now. --- Docs/README.tutorials | 3 +++ Nasal/tutorial.nas | 3 +++ Nasal/view.nas | 3 +++ 3 files changed, 9 insertions(+) diff --git a/Docs/README.tutorials b/Docs/README.tutorials index 1b9d494ad..e58a1623a 100644 --- a/Docs/README.tutorials +++ b/Docs/README.tutorials @@ -341,8 +341,11 @@ view to a new view position/direction. All parameters are optional. If, for example, only is set, then the view will only zoom in -- the direction and position will remain the same. This feature is meant for cockpit tutorials, where the pilot's view is directed to some switch or instrument. +view-number can be used to switch between different views, i.e. to tower-view, +copilot view etc. Default view-number is 0 (captain's view). + 0 0=captain's view, 1=copilot,... 20 positive is left -4 positive is up 0 positive is roll right diff --git a/Nasal/tutorial.nas b/Nasal/tutorial.nas index 85a4cf825..f086d2c2f 100644 --- a/Nasal/tutorial.nas +++ b/Nasal/tutorial.nas @@ -345,6 +345,9 @@ var set_view = func(node = nil) { node != nil or return; var v = node.getChild("view"); if (v != nil) { + # when changing view direction, switch to view 0 (captain's view), + # unless another view is explicitly specified + v.initNode("view-number", 0, "INT", 0); view.point.move(v); return 1; } diff --git a/Nasal/view.nas b/Nasal/view.nas index f94ae02b5..0cdab4466 100644 --- a/Nasal/view.nas +++ b/Nasal/view.nas @@ -593,6 +593,9 @@ var point = { }, move : func(prop, time = nil) { prop != nil or return; + var n = prop.getNode("view-number"); + if (n != nil) + setprop("/sim/current-view/view-number",n.getValue()); foreach (var a; keys(me.axes)) { var n = prop.getNode(a); me.axes[a].reset();