Hmmm.  I have something similar that works, but I don't see the important
  difference.  I copied/modifed stepView() to be a stepCockpitView().
  It does an explicit
     setprop("/sim/current-view/view-number", 0);
  which I believe forces a copyToCurrent() and an update(),
  but I'm not sure if that is the reason it works.

The "internal" flag is set for each defined view in the constructor and the view manager
 copies the flag from the currently used view in copyToCurrent().  Is there
 any chance the
   node.getChild("view-number").getValue() == "0"  is lying, .e.g.
   returning a zero when it cannot find a value?

For reference, here is what I use and it seems to work:

In view.nas

# Handler.  Step to the next in cockpit view.
# This assumes the cockpit is view 0
stepCockpitView = func {

   # switch to cockpit view
   setprop("/sim/current-view/view-number", 0);

   # determine the current cockpit view number
   curr = getprop("/sim/view/cockpit-view-number");
   cviews = props.globals.getNode("/sim/view").getChildren("cockpit-view");
   curr = curr + arg[0];
   if   (curr < 0)            { curr = size(cviews) - 1; }
   elsif(curr >= size(cviews)) { curr = 0; }
   setprop("/sim/view/cockpit-view-number", curr);

   # And pop up a nice reminder
   gui.popupTip( cviews[curr].getNode("name").getValue());

In preferences.xml

  <name>Interanl View</name>
  <internal type="bool">true</internal>
    <from-model type="bool">true</from-model>
    <from-model-idx type="int">0</from-model-idx>
    <ground-level-nearplane-m type="double">0.5f</ground-level-nearplane-m>
<default-field-of-view-deg type="double">55.0</default-field-of-view-deg>
    <default-pitch-deg type="double">0</default-pitch-deg>
    <default-heading-deg type="double">0</default-heading-deg>
    <front-direction-deg type="double">0</front-direction-deg>
    <front-left-direction-deg type="double">45</front-left-direction-deg>
    <left-direction-deg type="double">90</left-direction-deg>
    <back-left-direction-deg type="double">135</back-left-direction-deg>
    <back-direction-deg type="double">180</back-direction-deg>
    <back-right-direction-deg type="double">225</back-right-direction-deg>
    <right-direction-deg type="double">270</right-direction-deg>
<front-right-direction-deg type="double">315</front-right-direction-deg>

    <x-offset-m type="double">0</x-offset-m>
    <y-offset-m type="double">0.8</y-offset-m>
    <z-offset-m type="double">2.0</z-offset-m>

   <cockpit-view-number type="int">0</cockpit-view-number>
   <cockpit-number-views type="int">4</cockpit-number-views>
     <heading type="double">0</heading>
     <name>Front Right</name>
     <heading type="double">315</heading>
     <heading type="double">180</heading>
     <name>Front Left</name>
     <heading type="double">45</heading>

In keyboard.xml

<key n="86">
 <desc>Scroll through cockpit views.</desc>

----- Original Message ----- From: "Dave Culp" <[EMAIL PROTECTED]>
To: "FlightGear developers discussions" <>
Sent: Thursday, May 26, 2005 4:19 PM
Subject: [Flightgear-devel] 3D view goes away by itself

[ snip ]

It works fine on the ground, but about 10 seconds after takeoff the 3D side
views of the aircraft's engine/wing go away and never come back.  I check
through the property browser and all the values look unchanged.  It seems
like the "internal" boolean value must have changed, but the property browser
does not indicate a change (even after a refresh of course).

Any idea what causes the view to change by itself after takeoff?



Flightgear-devel mailing list

Reply via email to