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/current-view/goal-heading-offset-deg",
         cviews[curr].getNode("heading").getValue());
   setprop("/sim/view/cockpit-view-number", curr);

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


In preferences.xml

<view>
  <name>Interanl View</name>
  <type>lookfrom</type>
  <internal type="bool">true</internal>
  <config>
    <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>

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

In keyboard.xml

<key n="86">
 <name>V</name>
 <desc>Scroll through cockpit views.</desc>
 <binding>
  <command>nasal</command>
  <script>view.stepCockpitView(1)</script>
 </binding>
</key>




----- Original Message ----- From: "Dave Culp" <[EMAIL PROTECTED]>
To: "FlightGear developers discussions" <flightgear-devel@flightgear.org>
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?

Thanks,

Dave





_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@flightgear.org
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d

Reply via email to