Board index FlightGear Development Canvas

kuifje09's FGPlot Development

Canvas is FlightGear's new fully scriptable 2D drawing system that will allow you to easily create new instruments, HUDs and even GUI dialogs and custom GUI widgets, without having to write C++ code and without having to rebuild FlightGear.

Re: kuifje09's FGPlot Development

Postby TheTom » Tue Jun 18, 2013 6:08 pm

I've now reverted my commit as this is already possible. Just write the path for a property to an "output" tag for every component which should be plotted and you are done.
TheTom
 
Posts: 321
Joined: Sun Oct 09, 2011 10:20 am

Re: kuifje09's FGPlot Development

Postby kuifje09 » Tue Jun 18, 2013 7:10 pm

Hello TheTom,

Would be nice if it is indeed already possible, but in what file is the output-tag to be found/enabled.
All I know is, set the debug tag in a specific part of i.e. Citation-autopilot.xml then the values blonging to this controler are output to the stdout of flightgear. i.e: cout << " Yn:" << fixed << setprecision( 3 ) << y_n as can be read in the source of pid/pi/filter-controler.cxx.

This would mean I missed someting somewhere and have been wrestling something which could be achieved easy.

I just reread this doc:
http://www.flightgear.org/Docs/XMLAutopilot/XMLAutopilot.html
But as in the "autopilot".xml or in this doc, there is no way to see the internal values as far I do understand.
Last edited by kuifje09 on Tue Jun 18, 2013 7:19 pm, edited 1 time in total.
kuifje09
 
Posts: 579
Joined: Tue May 17, 2011 8:51 pm

Re: kuifje09's FGPlot Development

Postby Hooray » Tue Jun 18, 2013 7:17 pm

I haven't yet checked myself, but if access to these AP debugging values requires modifications of the AP.xml file, the original commit would seem preferable for the time being, because unless Torsten's original plans, we cannot currently instantiate or parametrize an instantiated autopilot from Nasal space - so requiring files to be modified vs. simply setting a boolean property would not be ideal for aircraft developers wanting to tune their FDM/AP through fgplot.
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11836
Joined: Tue Mar 25, 2008 8:40 am

Re: kuifje09's FGPlot Development

Postby kuifje09 » Tue Jun 18, 2013 7:33 pm

Hi Hooray, I am afraid I do not understand what you try to say, my english is not very good I think.
But, if someone want to tune his autopilot, you do need to see the internals of the autopilot. Currently you can only see those internals if you change and recompile the autopilot, and thus flightgear. I did it a few times , but you still need external programs to view those values. And what realy helps is viewing those values in a graphic. Or is that jus what you try to say? ( then if to stepsize is too big or resolution bad chosen you could mis noise or unwanted spikes, but that is a second problem.. )
kuifje09
 
Posts: 579
Joined: Tue May 17, 2011 8:51 pm

Re: kuifje09's FGPlot Development

Postby Hooray » Tue Jun 18, 2013 8:42 pm

see Tom's previous reply: he already committed a patch that would implement what you posted, but then figured out that you can do that already through a corresponding <output> tag - which sounds great, but which would seem like a restriction if this cannot be set at runtime without editing/reloading the AP, which is what I was trying to say.


For the sake of completeness, Tom's response:
TheTom wrote:It works the same, both with and without the patch. Only the names have been different. Every autopilot component has an input and one or more output properties. Normally it should be enough to just plot the output property of each component which should be inspected. If there is no output property defined in the ap.xml the according component won't be of much use, as its output would not be able to be used by anything.

You can not modify anything at runtime. Just edit the ap.xml and reload it: http://wiki.flightgear.org/Howto:Design ... Pre-design
Last edited by Hooray on Thu Jun 20, 2013 2:38 pm, edited 1 time in total.
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11836
Joined: Tue Mar 25, 2008 8:40 am

Re: kuifje09's FGPlot Development

Postby kuifje09 » Tue Jun 18, 2013 9:04 pm

Hi TheTome and Hooray, Sorry but I must have gone mad... I seriuosly don't know how I would see the debug-values without editing the C-source.
However if you want to see those values you must do it by the ap.xml, because you only want to see values for 1 controler at a time. Or, there should be a possibility to have an identification for i.e. pid-1 , pid-2 ... because you can have more pid controlers active at once. ( one for the cource and one for the altitude and so on ) On the other hand viewing them all at once would make, at least me, crazy.
Can someone give an example of how to make those values visible ? I realy don't see how else , then with the debug-tag per controler in the ap.xml.

b.t.w. I have the needed sources on my system. Problem was, it seems not to be possible to get them all at once. so did some 1 by 1. thats ok now.
kuifje09
 
Posts: 579
Joined: Tue May 17, 2011 8:51 pm

Re: kuifje09's FGPlot Development

Postby TheTom » Tue Jun 18, 2013 9:18 pm

Every autopilot component has one or more <output> tags (see eg. http://wiki.flightgear.org/Howto:Design_an_autopilot). You now just have to read this property for the plot.

Eg. consider the following filter:
Code: Select all
<filter>
  <name>AP:Pitch sample and hold</name>
  <debug>false</debug>
  <enable>
   <condition>
    <not>
     <property>/autopilot/locks/roc-lock</property>
    </not>
   </condition>
  </enable>
  <type>gain</type>
  <gain>1.0</gain>
  <input>/orientation/pitch-deg</input>
  <output>/autopilot/internal/target-pitch-deg</output>
 </filter>


You can now read and plot the property "/autopilot/internal/target-pitch-deg".
TheTom
 
Posts: 321
Joined: Sun Oct 09, 2011 10:20 am

Re: kuifje09's FGPlot Development

Postby kuifje09 » Thu Jun 20, 2013 2:28 pm

Hello TheTom, I undestand it well, this way it must be usable for most of us...
kuifje09
 
Posts: 579
Joined: Tue May 17, 2011 8:51 pm

Re: kuifje09's FGPlot Development

Postby kuifje09 » Thu Jun 20, 2013 2:38 pm

Alright, this is my latest version now, cleaned up a bit, removed unneeded code, and better readable.
Name of chosen line is now also visual in plotting window.

fgplot.xml
Code: Select all
<?xml version="1.0"?>
<!--

Set the multythreading to of when it is still off, in the
 $FG_ROOT/preferences.xml
for better performance.

add to $FGHOME/Translations/en/menu.xml
direct under
<equipment>Equipment</equipment>

  <fgplot>Fgplot</fgplot>

add to $FGHOME/gui/menubar.xml
direct under
<name>equipment</name>

<item>
  <name>fgplot</name>
    <binding>
      <command>dialog-show</command>
         <dialog-name>fgplot</dialog-name>
    </binding>
<item>

Now you can choose from menubar in equipment fgplot.
-->

<PropertyList>
  <name>fgplot</name>
  <modal>false</modal>
  <!--layout>hbox</layout-->
  <resizable>false</resizable>
  <x>0</x> <!-- x runs to right -->
  <y>0</y> <!-- y runs to up -->
  <width>825</width>
  <height>311</height>  <!-- 301 + 5*2 -->
  <color>
       <red>0.2</red>
       <green>0.2</green>
       <blue>0.2</blue>
       <alpha>0.5</alpha>  <!-- a little bit of transparency -->
  </color>

 
  <group>

   <!-- space for the butons and labels and the canvas -->
   <layout>hbox</layout>
   <!--halign>fill</halign-->
   <default-padding>5</default-padding>
   <!--empty><stretch>true</stretch></empty-->
   <color>
      <red>0.2</red>
      <green>0.2</green>
      <blue>0.2</blue>
   </color>
 
   <text>
      <label>fgplot</label>
        <x>0</x>
        <y>285</y>
        <width>5</width>
        <height>15</height>
   </text>
   
<!-- Buttons for start-stop-quit -->
   <button>
      <legend>&gt;</legend>
      <!--equal>true</equal-->
      <x>60</x>
      <y>285</y>
      <width>15</width>
      <height>15</height>
      <binding>
        <command>nasal</command>
          <script><![CDATA[
              var a = getprop("/gui/fgplot/running") or 0;
              if(a == 0){
                 setprop("/gui/fgplot/running",1);
                 dotPlot();
              };]]>
         </script>
      </binding>
   </button>
   <button>
      <legend>-</legend>
      <!--equal>true</equal-->
      <x>80</x>
      <y>285</y>
      <width>15</width>
      <height>15</height>
      <binding>
        <command>nasal</command>
          <script>setprop("/gui/fgplot/running",0);</script>
      </binding>
   </button>
   <button>
      <legend>X</legend>
      <!--equal>true</equal-->
      <x>100</x>
      <y>285</y>
      <width>15</width>
      <height>15</height>
      <key>Esc</key>
      <binding>
        <command>nasal</command>
          <script>setprop("/gui/fgplot/running",0);</script>
      </binding>
      <binding>
        <command>dialog-close</command>
      </binding>
   </button>

<!-- option to set transparency of the plot-area -->
   <checkbox>
     <label>transparent</label>
     <!--pref-width>100</pref-width-->
     <x>10</x>
     <y>265</y>
     <width>12</width>
     <height>12</height>
     <property>/gui/fgplot/transparency</property>
       <live>true</live>
       <binding>
         <command>nasal</command>
            <script>
               SetTransparency();
         </script>
       </binding>
   </checkbox>

<!-- options choose which of the 6 lines are visible -->
   <checkbox>
     <label></label>
     <color>
       <red>1.0</red>
       <green>0.0</green>
       <blue>0.0</blue>
     </color>
     <x>10</x>
     <y>245</y>
     <width>12</width>
     <height>12</height>
     <property>/gui/fgplot/line[0]</property>
       <live>true</live>
       <binding>
         <command>nasal</command>
         <script>SetLine(0);</script>
       </binding>
   </checkbox>
   <text>
     <label>.</label>
        <property>/gui/fgplot/name[0]</property>
        <live>true</live>
     <x>20</x>
     <y>240</y>
   </text>
   <checkbox>
     <label></label>
     <color>
       <red>0.0</red>
       <green>1.0</green>
       <blue>0.0</blue>
     </color>
     <x>10</x>
     <y>225</y>
     <width>12</width>
     <height>12</height>
     <property>/gui/fgplot/line[1]</property>
       <live>true</live>
       <binding>
         <command>nasal</command>
         <script>SetLine(1);</script>
       </binding>
   </checkbox>
   <text>
     <label>.</label>
        <property>/gui/fgplot/name[1]</property>
        <live>true</live>
     <x>20</x>
     <y>220</y>
   </text>
   <checkbox>
     <label></label>
     <color>
       <red>0.0</red>
       <green>0.0</green>
       <blue>1.0</blue>
     </color>
     <x>10</x>
     <y>205</y>
     <width>12</width>
     <height>12</height>
     <property>/gui/fgplot/line[2]</property>
       <live>true</live>
       <binding>
         <command>nasal</command>
         <script>SetLine(2);</script>
       </binding>
   </checkbox>
   <text>
     <label>.</label>
        <property>/gui/fgplot/name[2]</property>
        <live>true</live>
     <x>20</x>
     <y>200</y>
   </text>
   <checkbox>
     <label></label>
     <color>
       <red>1.0</red>
       <green>0.5</green>
       <blue>0.5</blue>
     </color>
     <x>10</x>
     <y>185</y>
     <width>10</width>
     <height>10</height>
     <property>/gui/fgplot/line[3]</property>
       <live>true</live>
       <binding>
         <command>nasal</command>
         <script>SetLine(3);</script>
       </binding>
   </checkbox>
   <text>
     <label>.</label>
        <property>/gui/fgplot/name[3]</property>
        <live>true</live>
     <x>20</x>
     <y>180</y>
   </text>
   <checkbox>
     <label></label>
     <color>
       <red>0.0</red>
       <green>0.5</green>
       <blue>0.5</blue>
     </color>
     <x>10</x>
     <y>165</y>
     <width>12</width>
     <height>12</height>
     <property>/gui/fgplot/line[4]</property>
       <live>true</live>
       <binding>
         <command>nasal</command>
         <script>SetLine(4);</script>
       </binding>
   </checkbox>
   <text>
     <label>.</label>
        <property>/gui/fgplot/name[4]</property>
        <live>true</live>
     <x>20</x>
     <y>160</y>
   </text>
   <checkbox>
     <label></label>
     <color>
       <red>0.5</red>
       <green>0.5</green>
       <blue>1.0</blue>
     </color>
     <x>10</x>
     <y>145</y>
     <width>12</width>
     <height>12</height>
     <property>/gui/fgplot/line[5]</property>
       <live>true</live>
       <binding>
         <command>nasal</command>
         <script>SetLine(5);</script>
       </binding>
   </checkbox>
   <text>
     <label>.</label>
        <property>/gui/fgplot/name[5]</property>
        <live>true</live>
     <x>20</x>
     <y>140</y>
   </text>

<!-- selector for property to plot -->
   <button>
     <legend>Properties</legend>
     <x>10</x>
     <y>10</y>
     <width>105</width>
     <height>20</height>
       <binding>
          <command>dialog-show</command>
          <dialog-name>property-selector</dialog-name>
       </binding>
       <binding>
          <command>nasal</command>
          <!-- signal user-set properties -->
          <script>setprop("/gui/fgplot/userdefined",1);</script>
       </binding>
   </button>

<!-- now only settable vis the property tree , but still left in source -->
<!-- version setting for test -->
<!--
   <text>
     <label>Version</label>
     <x>10</x>
     <y>70</y>
     <width>10</width>
     <height>10</height>
   </text>
   <button>
     <legend>0</legend>
     <x>10</x>
     <y>40</y>
     <width>20</width>
     <height>20</height>
       <binding>
         <command>nasal</command>
         <script>
             setprop("/gui/fgplot/version",0);
             print("using version 0");
         </script>
       </binding>
   </button>
   <button>
     <legend>1</legend>
     <x>40</x>
     <y>40</y>
     <width>20</width>
     <height>20</height>
       <binding>
         <command>nasal</command>
            <script>
             setprop("/gui/fgplot/version",1);
             print("using version 1");
            </script>
       </binding>
   </button>
   <button>
     <legend>2</legend>
     <x>70</x>
     <y>40</y>
     <width>20</width>
     <height>20</height>
       <binding>
         <command>nasal</command>
            <script>
             setprop("/gui/fgplot/version",2);
             print("using version 2");
         </script>
       </binding>
   </button>
-->

<!-- this is where we draw on -->
<canvas>
  <name>fgplot</name>
  <x>130</x> <!-- save space for buttons on the left -->
  <y>5</y>
  <layout>hbox</layout>
  <!--valign>fill</valign-->
  <!--halign>fill</halign-->
  <!--stretch>true</stretch-->
  <width>685</width>  <!-- width is 685, but will contain 800 positions ??? -->
  <height>301</height>    <!-- how is that posible -->

<!-- all the nasal coding below -->
<nasal>     

  <load> <!-- when the fgplot is loaded ?? == pressed equipment-fgplot -->
  <![CDATA[

  # general values to have something at startup.
  var setProps = func () {
     var a = getprop("/gui/fgplot/running") or 0;
     if(a == 0) {
     setprop("/gui/fgplot/name[0]","fdm-head.rror-deg");
     setprop("/gui/fgplot/name[1]","heading-.rror-deg");
     setprop("/gui/fgplot/name[2]","true-hea.rror-deg");
     setprop("/gui/fgplot/name[3]","nav1-course-error");
     setprop("/gui/fgplot/name[4]","nav1-hea.rror-deg");
     setprop("/gui/fgplot/name[5]","nav1-tra.rror-deg");
     setprop("/gui/fgplot/prop[0]","/autopilot/internal/fdm-heading-bug-error-deg");
     setprop("/gui/fgplot/prop[1]","/autopilot/internal/heading-bug-error-deg");
     setprop("/gui/fgplot/prop[2]","/autopilot/internal/true-heading-error-deg");
     setprop("/gui/fgplot/prop[3]","/autopilot/internal/nav1-course-error");
     setprop("/gui/fgplot/prop[4]","/autopilot/internal/nav1-heading-error-deg");
     setprop("/gui/fgplot/prop[5]","/autopilot/internal/nav1-track-error-deg");
     for( var j = 0 ; 6 > j ; j += 1)
         setprop("/gui/fgplot/factor["~j~"]",-1);
     for( var j = 0 ; 6 > j ; j += 1)
         setprop("/gui/fgplot/top["~j~"]",360);
     for( var j = 0 ; 6 > j ; j += 1)
         setprop("/gui/fgplot/line["~j~"]",1);
     setprop("/gui/fgplot/running",0);
     setprop("/gui/fgplot/version",1);
     setprop("/gui/fgplot/plot",0);
     setprop("/gui/fgplot/transparency",0.0);
  #   gui.popupTip("Properties set",3);
     };
  };

   setProps();
#   gui.popupTip("Properties set in LOAD",3);

   var SetTransparency = func () {
       if(getprop("/gui/fgplot/transparency")==1){
          my_canvas.setColorBackground(0,0,0,1); # Transparancy == last 0
          setprop("/gui/fgplot/transparency",0);
       } else {
          my_canvas.setColorBackground(0,0,0,0); # Transparancy == last 0
          setprop("/gui/fgplot/transparency",1);
       };
   };

   var SetLine = func (a) {
       # A property with a variable part must be a 2-step job.
       if(getprop("/gui/fgplot/line["~a~"]")==0){
          setprop("/gui/fgplot/line["~a~"]",1);
       } else {
          setprop("/gui/fgplot/line["~a~"]",0);
       };
   };

   # canvas-specific code here
   var my_canvas = canvas.get( cmdarg() ); # Handle to the parent canvas
   my_canvas.setColorBackground(0,0,0,1); # Transparancy when last digit == 0
 
   var root = my_canvas.createGroup();

   var graph = root.createChild("group");
 
   # center of the graph.
   var x_axis = graph.createChild("path", "x-axis")
   .moveTo(0, 151)        # start of centerline horizontaly
   .lineTo(800, 151)      # end of centerline hor. but ends too soon
   .setColor(0.8,0.8,0.8)
   .setStrokeLineWidth(1);
 
   #currently the center of the graph.
   var y1 = 151;

   var y = [ 151, 151 ];
   var Max = 800;
   var y0 = 0; # position of degrees in circle (only in testphase)
   var x0 = 0; # position on x-ax
   var i = 0;

   var pnts = {};
   for(var i = 0; i< 6 ; i+=1 ){
      pnts[i]={};
   };

   var plot = {};
   for(var i = 0; i< 6 ; i+=1 ){
      plot[i]={};
      for( var j = 0 ; j< 8 ; j+=1){
         plot[i][j] = graph.createChild("path", "data");
      };
   };

   for(i=0;i<8;i+=1){
      plot[0][i].setColor(1,0,0);
      plot[1][i].setColor(0,1,0);
      plot[2][i].setColor(0,0,1);
      plot[3][i].setColor(1,0.5,0.5);
      plot[4][i].setColor(0,0.5,0.5);
      plot[5][i].setColor(0.5,0.5,1);
   };
   
   var y0=0;
   x0=0;

var dotPlot = func () {

   var MyTimeout = func () {

   if(getprop("/gui/fgplot/running") == 1){

# Generated inside flightgear Should be a loop ?
   pnts[0][x0] = 151+getprop(getprop("/gui/fgplot/prop[0]"))*getprop("/gui/fgplot/factor[0]");
   pnts[1][x0] = 151+getprop(getprop("/gui/fgplot/prop[1]"))*getprop("/gui/fgplot/factor[1]");
   pnts[2][x0] = 151+getprop(getprop("/gui/fgplot/prop[2]"))*getprop("/gui/fgplot/factor[2]");
   pnts[3][x0] = 151+getprop(getprop("/gui/fgplot/prop[3]"))*getprop("/gui/fgplot/factor[3]");
   pnts[4][x0] = 151+getprop(getprop("/gui/fgplot/prop[4]"))*getprop("/gui/fgplot/factor[4]");
   pnts[5][x0] = 151+getprop(getprop("/gui/fgplot/prop[5]"))*getprop("/gui/fgplot/factor[5]");


### Version now only to be set via the property tree. version 2 is default/fastest
###  although it looks a bit ugly.
###
### version 1
   if(getprop("/gui/fgplot/version") == 0){

   for (var y = 0 ; y<8 ; y+=1){  # 8 pieces of lines
     for(i=0;i<6;i+=1){           # 6 lines
         if(x0 == 0){
            plot[i][y].reset().moveTo(x0-1,pnts[i][x0]);
         };
         if(getprop("/gui/fgplot/line["~i~"]") == 1){
            plot[i][y].lineTo(x0, pnts[i][x0]);
         };
     };
   };
     
### version 2
   } else if(getprop("/gui/fgplot/version") == 1){

   if(x0<100){
     if(x0 == 0){
       plot[0][0].reset().moveTo(x0-1,pnts[0][x0]);
       plot[1][0].reset().moveTo(x0-1,pnts[1][x0]);
       plot[2][0].reset().moveTo(x0-1,pnts[2][x0]);
       plot[3][0].reset().moveTo(x0-1,pnts[3][x0]);
       plot[4][0].reset().moveTo(x0-1,pnts[4][x0]);
       plot[5][0].reset().moveTo(x0-1,pnts[5][x0]);
     };
       if(getprop("/gui/fgplot/line[0]") == 1){
          plot[0][0].lineTo(x0, pnts[0][x0]);
       } else {
          plot[0][0].moveTo(x0, pnts[0][x0]);
       };
       if(getprop("/gui/fgplot/line[1]") == 1){
          plot[1][0].lineTo(x0, pnts[1][x0]);
       } else {
          plot[1][0].moveTo(x0, pnts[1][x0]);
       };
       if(getprop("/gui/fgplot/line[2]") == 1){
          plot[2][0].lineTo(x0, pnts[2][x0]);
       } else {
          plot[2][0].moveTo(x0, pnts[2][x0]);
       };
       if(getprop("/gui/fgplot/line[3]") == 1){
          plot[3][0].lineTo(x0, pnts[3][x0]);
       } else {
          plot[3][0].moveTo(x0, pnts[3][x0]);
       };
       if(getprop("/gui/fgplot/line[4]") == 1){
          plot[4][0].lineTo(x0, pnts[4][x0]);
       } else {
          plot[4][0].moveTo(x0, pnts[4][x0]);
       };
       if(getprop("/gui/fgplot/line[5]") == 1){
          plot[5][0].lineTo(x0, pnts[5][x0]);
       } else {
          plot[5][0].moveTo(x0, pnts[5][x0]);
       };
   } else if(x0<200){
     if(x0 == 100){
       plot[0][1].reset().moveTo(x0-1,pnts[0][x0]);
       plot[1][1].reset().moveTo(x0-1,pnts[1][x0]);
       plot[2][1].reset().moveTo(x0-1,pnts[2][x0]);
       plot[3][1].reset().moveTo(x0-1,pnts[3][x0]);
       plot[4][1].reset().moveTo(x0-1,pnts[4][x0]);
       plot[5][1].reset().moveTo(x0-1,pnts[5][x0]);
     };
       if(getprop("/gui/fgplot/line[0]") == 1){
          plot[0][1].lineTo(x0, pnts[0][x0]);
       } else {
          plot[0][1].moveTo(x0, pnts[0][x0]);
       };
       if(getprop("/gui/fgplot/line[1]") == 1){
          plot[1][1].lineTo(x0, pnts[1][x0]);
       } else {
          plot[1][1].moveTo(x0, pnts[1][x0]);
       };
       if(getprop("/gui/fgplot/line[2]") == 1){
          plot[2][1].lineTo(x0, pnts[2][x0]);
       } else {
          plot[2][1].moveTo(x0, pnts[2][x0]);
       };
       if(getprop("/gui/fgplot/line[3]") == 1){
          plot[3][1].lineTo(x0, pnts[3][x0]);
       } else {
          plot[3][1].moveTo(x0, pnts[3][x0]);
       };
       if(getprop("/gui/fgplot/line[4]") == 1){
          plot[4][1].lineTo(x0, pnts[4][x0]);
       } else {
          plot[4][1].moveTo(x0, pnts[4][x0]);
       };
       if(getprop("/gui/fgplot/line[5]") == 1){
          plot[5][1].lineTo(x0, pnts[5][x0]);
       } else {
          plot[5][1].moveTo(x0, pnts[5][x0]);
       };
   } else if(x0<300){
     if(x0 == 200){
       plot[0][2].reset().moveTo(x0-1,pnts[0][x0]);
       plot[1][2].reset().moveTo(x0-1,pnts[1][x0]);
       plot[2][2].reset().moveTo(x0-1,pnts[2][x0]);
       plot[3][2].reset().moveTo(x0-1,pnts[3][x0]);
       plot[4][2].reset().moveTo(x0-1,pnts[4][x0]);
       plot[5][2].reset().moveTo(x0-1,pnts[5][x0]);
     };
       if(getprop("/gui/fgplot/line[0]") == 1){
          plot[0][2].lineTo(x0, pnts[0][x0]);
       } else {
          plot[0][2].moveTo(x0, pnts[0][x0]);
       };
       if(getprop("/gui/fgplot/line[1]") == 1){
          plot[1][2].lineTo(x0, pnts[1][x0]);
       } else {
          plot[1][2].moveTo(x0, pnts[1][x0]);
       };
       if(getprop("/gui/fgplot/line[2]") == 1){
          plot[2][2].lineTo(x0, pnts[2][x0]);
       } else {
          plot[2][2].moveTo(x0, pnts[2][x0]);
       };
       if(getprop("/gui/fgplot/line[3]") == 1){
          plot[3][2].lineTo(x0, pnts[3][x0]);
       } else {
          plot[3][2].moveTo(x0, pnts[3][x0]);
       };
       if(getprop("/gui/fgplot/line[4]") == 1){
          plot[4][2].lineTo(x0, pnts[4][x0]);
       } else {
          plot[4][2].moveTo(x0, pnts[4][x0]);
       };
       if(getprop("/gui/fgplot/line[5]") == 1){
          plot[5][2].lineTo(x0, pnts[5][x0]);
       } else {
          plot[5][2].moveTo(x0, pnts[5][x0]);
       };
   } else if(x0<400){
     if(x0 == 300){
       plot[0][3].reset().moveTo(x0-1,pnts[0][x0]);
       plot[1][3].reset().moveTo(x0-1,pnts[1][x0]);
       plot[2][3].reset().moveTo(x0-1,pnts[2][x0]);
       plot[3][3].reset().moveTo(x0-1,pnts[3][x0]);
       plot[4][3].reset().moveTo(x0-1,pnts[4][x0]);
       plot[5][3].reset().moveTo(x0-1,pnts[5][x0]);
     };
       if(getprop("/gui/fgplot/line[0]") == 1){
          plot[0][3].lineTo(x0, pnts[0][x0]);
       } else {
          plot[0][3].moveTo(x0, pnts[0][x0]);
       };
       if(getprop("/gui/fgplot/line[1]") == 1){
          plot[1][3].lineTo(x0, pnts[1][x0]);
       } else {
          plot[1][3].moveTo(x0, pnts[1][x0]);
       };
       if(getprop("/gui/fgplot/line[2]") == 1){
          plot[2][3].lineTo(x0, pnts[2][x0]);
       } else {
          plot[2][3].moveTo(x0, pnts[2][x0]);
       };
       if(getprop("/gui/fgplot/line[3]") == 1){
          plot[3][3].lineTo(x0, pnts[3][x0]);
       } else {
          plot[3][3].moveTo(x0, pnts[3][x0]);
       };
       if(getprop("/gui/fgplot/line[4]") == 1){
          plot[4][3].lineTo(x0, pnts[4][x0]);
       } else {
          plot[4][3].moveTo(x0, pnts[4][x0]);
       };
       if(getprop("/gui/fgplot/line[5]") == 1){
          plot[5][3].lineTo(x0, pnts[5][x0]);
       } else {
          plot[5][3].moveTo(x0, pnts[5][x0]);
       };
   } else if(x0<500){
     if(x0 == 400){
       plot[0][4].reset().moveTo(x0-1,pnts[0][x0]);
       plot[1][4].reset().moveTo(x0-1,pnts[1][x0]);
       plot[2][4].reset().moveTo(x0-1,pnts[2][x0]);
       plot[3][4].reset().moveTo(x0-1,pnts[3][x0]);
       plot[4][4].reset().moveTo(x0-1,pnts[4][x0]);
       plot[5][4].reset().moveTo(x0-1,pnts[5][x0]);
     };
       if(getprop("/gui/fgplot/line[0]") == 1){
          plot[0][4].lineTo(x0, pnts[0][x0]);
       } else {
          plot[0][4].moveTo(x0, pnts[0][x0]);
       };
       if(getprop("/gui/fgplot/line[1]") == 1){
          plot[1][4].lineTo(x0, pnts[1][x0]);
       } else {
          plot[1][4].moveTo(x0, pnts[1][x0]);
       };
       if(getprop("/gui/fgplot/line[2]") == 1){
          plot[2][4].lineTo(x0, pnts[2][x0]);
       } else {
          plot[2][4].moveTo(x0, pnts[2][x0]);
       };
       if(getprop("/gui/fgplot/line[3]") == 1){
          plot[3][4].lineTo(x0, pnts[3][x0]);
       } else {
          plot[3][4].moveTo(x0, pnts[3][x0]);
       };
       if(getprop("/gui/fgplot/line[4]") == 1){
          plot[4][4].lineTo(x0, pnts[4][x0]);
       } else {
          plot[4][4].moveTo(x0, pnts[4][x0]);
       };
       if(getprop("/gui/fgplot/line[5]") == 1){
          plot[5][4].lineTo(x0, pnts[5][x0]);
       } else {
          plot[5][4].moveTo(x0, pnts[5][x0]);
       };
   } else if(x0<600){
     if(x0 == 500){
       plot[0][5].reset().moveTo(x0-1,pnts[0][x0]);
       plot[1][5].reset().moveTo(x0-1,pnts[1][x0]);
       plot[2][5].reset().moveTo(x0-1,pnts[2][x0]);
       plot[3][5].reset().moveTo(x0-1,pnts[3][x0]);
       plot[4][5].reset().moveTo(x0-1,pnts[4][x0]);
       plot[5][5].reset().moveTo(x0-1,pnts[5][x0]);
     };
       if(getprop("/gui/fgplot/line[0]") == 1){
          plot[0][5].lineTo(x0, pnts[0][x0]);
       } else {
          plot[0][5].moveTo(x0, pnts[0][x0]);
       };
       if(getprop("/gui/fgplot/line[1]") == 1){
          plot[1][5].lineTo(x0, pnts[1][x0]);
       } else {
          plot[1][5].moveTo(x0, pnts[1][x0]);
       };
       if(getprop("/gui/fgplot/line[2]") == 1){
          plot[2][5].lineTo(x0, pnts[2][x0]);
       } else {
          plot[2][5].moveTo(x0, pnts[2][x0]);
       };
       if(getprop("/gui/fgplot/line[3]") == 1){
          plot[3][5].lineTo(x0, pnts[3][x0]);
       } else {
          plot[3][5].moveTo(x0, pnts[3][x0]);
       };
       if(getprop("/gui/fgplot/line[4]") == 1){
          plot[4][5].lineTo(x0, pnts[4][x0]);
       } else {
          plot[4][5].moveTo(x0, pnts[4][x0]);
       };
       if(getprop("/gui/fgplot/line[5]") == 1){
          plot[5][5].lineTo(x0, pnts[5][x0]);
       } else {
          plot[5][5].moveTo(x0, pnts[5][x0]);
       };
   } else if(x0<700){
     if(x0 == 600){
       plot[0][6].reset().moveTo(x0-1,pnts[0][x0]);
       plot[1][6].reset().moveTo(x0-1,pnts[1][x0]);
       plot[2][6].reset().moveTo(x0-1,pnts[2][x0]);
       plot[3][6].reset().moveTo(x0-1,pnts[3][x0]);
       plot[4][6].reset().moveTo(x0-1,pnts[4][x0]);
       plot[5][6].reset().moveTo(x0-1,pnts[5][x0]);
     };
       if(getprop("/gui/fgplot/line[0]") == 1){
          plot[0][6].lineTo(x0, pnts[0][x0]);
       } else {
          plot[0][6].moveTo(x0, pnts[0][x0]);
       };
       if(getprop("/gui/fgplot/line[1]") == 1){
          plot[1][6].lineTo(x0, pnts[1][x0]);
       } else {
          plot[1][6].moveTo(x0, pnts[1][x0]);
       };
       if(getprop("/gui/fgplot/line[2]") == 1){
          plot[2][6].lineTo(x0, pnts[2][x0]);
       } else {
          plot[2][6].moveTo(x0, pnts[2][x0]);
       };
       if(getprop("/gui/fgplot/line[3]") == 1){
          plot[3][6].lineTo(x0, pnts[3][x0]);
       } else {
          plot[3][6].moveTo(x0, pnts[3][x0]);
       };
       if(getprop("/gui/fgplot/line[4]") == 1){
          plot[4][6].lineTo(x0, pnts[4][x0]);
       } else {
          plot[4][6].moveTo(x0, pnts[4][x0]);
       };
       if(getprop("/gui/fgplot/line[5]") == 1){
          plot[5][6].lineTo(x0, pnts[5][x0]);
       } else {
          plot[5][6].moveTo(x0, pnts[5][x0]);
       };
   } else if(x0<800){
     if(x0 == 700){
       plot[0][7].reset().moveTo(x0-1,pnts[0][x0]);
       plot[1][7].reset().moveTo(x0-1,pnts[1][x0]);
       plot[2][7].reset().moveTo(x0-1,pnts[2][x0]);
       plot[3][7].reset().moveTo(x0-1,pnts[3][x0]);
       plot[4][7].reset().moveTo(x0-1,pnts[4][x0]);
       plot[5][7].reset().moveTo(x0-1,pnts[5][x0]);
     };
       if(getprop("/gui/fgplot/line[0]") == 1){
          plot[0][7].lineTo(x0, pnts[0][x0]);
       } else {
          plot[0][7].moveTo(x0, pnts[0][x0]);
       };
       if(getprop("/gui/fgplot/line[1]") == 1){
          plot[1][7].lineTo(x0, pnts[1][x0]);
       } else {
          plot[1][7].moveTo(x0, pnts[1][x0]);
       };
       if(getprop("/gui/fgplot/line[2]") == 1){
          plot[2][7].lineTo(x0, pnts[2][x0]);
       } else {
          plot[2][7].moveTo(x0, pnts[2][x0]);
       };
       if(getprop("/gui/fgplot/line[3]") == 1){
          plot[3][7].lineTo(x0, pnts[3][x0]);
       } else {
          plot[3][7].moveTo(x0, pnts[3][x0]);
       };
       if(getprop("/gui/fgplot/line[4]") == 1){
          plot[4][7].lineTo(x0, pnts[4][x0]);
       } else {
          plot[4][7].moveTo(x0, pnts[4][x0]);
       };
       if(getprop("/gui/fgplot/line[5]") == 1){
          plot[5][7].lineTo(x0, pnts[5][x0]);
       } else {
          plot[5][7].moveTo(x0, pnts[5][x0]);
       };
   };

### version 3
   } else if(getprop("/gui/fgplot/version") == 2){

   if(x0<100){
#      print("x0 under 100");

     for(i=0;i<6;i+=1){
       if(x0 == 0){
         plot[i][0].reset().moveTo(x0-1,pnts[i][x0]);
       };
       if(getprop("/gui/fgplot/line["~i~"]") == 1){
          plot[i][0].lineTo(x0, pnts[i][x0]);
       } else {
          plot[i][0].moveTo(x0,pnts[i][x0]);
       };
     };

   } else if(x0<200){
#    print("x0 under 200");

     for(i=0;i<6;i+=1){
       if(x0 == 100){
         plot[i][1].reset().moveTo(x0-1,pnts[i][x0]);
       };
       if(getprop("/gui/fgplot/line["~i~"]") == 1){
          plot[i][1].lineTo(x0, pnts[i][x0]);
       } else {
          plot[i][1].moveTo(x0,pnts[i][x0]);
       };
     };

   } else if(x0<300){
#    print("x0 under 300");

     for(i=0;i<6;i+=1){
       if(x0 == 200){
         plot[i][2].reset().moveTo(x0-1,pnts[i][x0]);
       };
       if(getprop("/gui/fgplot/line["~i~"]") == 1){
          plot[i][2].lineTo(x0, pnts[i][x0]);
       } else {
          plot[i][2].moveTo(x0,pnts[i][x0]);
       };
     };

   } else if(x0<400){
#    print("x0 under 400");

     for(i=0;i<6;i+=1){
       if(x0 == 300){
         plot[i][3].reset().moveTo(x0-1,pnts[i][x0]);
       };
       if(getprop("/gui/fgplot/line["~i~"]") == 1){
          plot[i][3].lineTo(x0, pnts[i][x0]);
       } else {
          plot[i][3].moveTo(x0,pnts[i][x0]);
       };
     };

   } else if(x0<500){
#    print("x0 under 500");

     for(i=0;i<6;i+=1){
       if(x0 == 400){
         plot[i][4].reset().moveTo(x0-1,pnts[i][x0]);
       };
       if(getprop("/gui/fgplot/line["~i~"]") == 1){
          plot[i][4].lineTo(x0, pnts[i][x0]);
       } else {
          plot[i][4].moveTo(x0,pnts[i][x0]);
       };
     };

   } else if(x0<600){
#    print("x0 under 600");

     for(i=0;i<6;i+=1){
       if(x0 == 500){
         plot[i][5].reset().moveTo(x0-1,pnts[i][x0]);
       };
       if(getprop("/gui/fgplot/line["~i~"]") == 1){
          plot[i][5].lineTo(x0, pnts[i][x0]);
       } else {
          plot[i][5].moveTo(x0,pnts[i][x0]);
       };
     };

   } else if(x0<700){
#    print("x0 under 700");

     for(i=0;i<6;i+=1){
       if(x0 == 600){
         plot[i][6].reset().moveTo(x0-1,pnts[i][x0]);
       };
       if(getprop("/gui/fgplot/line["~i~"]") == 1){
          plot[i][6].lineTo(x0, pnts[i][x0]);
       } else {
          plot[i][6].moveTo(x0,pnts[i][x0]);
       };
     };

   } else if(x0<800){
#    print("x0 under 800");

     for(i=0;i<6;i+=1){
       if(x0 == 700){
         plot[i][7].reset().moveTo(x0-1,pnts[i][x0]);
       };
       if(getprop("/gui/fgplot/line["~i~"]") == 1){
          plot[i][7].lineTo(x0, pnts[i][x0]);
       } else {
          plot[i][7].moveTo(x0,pnts[i][x0]);
       };
     };

   };
 
  };

#   print(x0);
   x0 += 1;
   if(x0>=Max)x0=0;

  } else {

#print("plotting stopping");

     return ;
  };
  settimer(MyTimeout,0.05);

 };  # End function MyTimeout

 MyTimeout();

}; # End function dotplot

]]>
    </load>

  </nasal>
  </canvas>

  </group>

</PropertyList>


This is property-selector.xml
Code: Select all
<?xml version="1.0"?>

<PropertyList>
   <name>property-selector</name>
   <layout>vbox</layout>
   <resizable>true</resizable>
   <default-padding>3</default-padding>
        <color>
             <red>0.2</red>
             <green>0.2</green>
             <blue>0.2</blue>
             <alpha>0.7</alpha>  <!-- a little bit of transparency -->
        </color>

   <group>
      <layout>hbox</layout>
      <default-padding>1</default-padding>

      <button>
         <legend>&lt;</legend>
         <pref-width>14</pref-width>
         <pref-height>14</pref-height>
         <border>2</border>
      <!-- looks better in anthrax style -->
         <color>
            <red>0.34</red>
            <green>0.33</green>
            <blue>0.35</blue>
         </color>
      <!-- -->
         <binding>
            <command>nasal</command>
            <script>Pre_set()</script>
         </binding>
      </button>

      <empty><whatever/></empty>

      <text>
         <label>/</label>
         <property>/sim/gui/dialogs/property-selector/title</property>
         <live>true</live>
      </text>

      <empty><stretch>true</stretch></empty>

      <button>
         <legend>-</legend>
         <key>Esc</key>
         <pref-width>14</pref-width>
         <pref-height>14</pref-height>
         <border>2</border>
         <binding>
            <command>dialog-close</command>
         </binding>
      </button>
   </group>

   <hrule/>

   <property-list>
      <name>property-list</name>
        <color>
             <red>0.3</red>
             <green>0.3</green>
             <blue>0.3</blue>
        </color>
      <pref-height>250</pref-height>
      <pref-width>410</pref-width>
      <halign>fill</halign>
      <valign>fill</valign>
      <stretch>true</stretch>
      <property>/sim/gui/dialogs/property-selector/list</property>
      <binding>
         <command>dialog-apply</command>
         <object-name>property-list</object-name>
      </binding>
      <binding>
         <command>nasal</command>
         <script>select()</script>
      </binding>
   </property-list>

   <hrule/>

   <group>
      <layout>table</layout>
      <default-padding>1</default-padding>
      <!--pref-width>350</pref-width-->

                <radio>
                        <row>0</row>
                        <col>0</col>
                        <color>
                          <red>1.0</red>
                          <green>0.0</green>
                          <blue>0.0</blue>
                        </color>
                        <label>0</label>
              <halign>left</halign>
              <width>10</width>
                        <live>true</live>
                        <property>/sim/gui/dialogs/property-selector/sel[0]</property>
                        <binding>
                           <command>property-assign</command>
                           <property>/sim/gui/dialogs/property-selector/sel[0]</property>
                           <value>1</value>
                        </binding>
                        <binding>
                           <command>nasal</command>
                           <script>Set_Select(0);</script>
                        </binding>
                </radio>
                <radio>
                        <row>1</row>
                        <col>0</col>
                        <color>
                          <red>0.0</red>
                          <green>1.0</green>
                          <blue>0.0</blue>
                        </color>
                        <label>1</label>
              <halign>left</halign>
              <width>10</width>
                        <live>true</live>
                        <property>/sim/gui/dialogs/property-selector/sel[1]</property>
                        <binding>
                           <command>property-assign</command>
                           <property>/sim/gui/dialogs/property-selector/sel[1]</property>
                           <value>1</value>
                        </binding>
                        <binding>
                           <command>nasal</command>
                           <script>Set_Select(1);</script>
                        </binding>
                </radio>
                <radio>
                        <row>2</row>
                        <col>0</col>
                        <color>
                          <red>0.0</red>
                          <green>0.0</green>
                          <blue>1.0</blue>
                        </color>
                        <label>2</label>
              <halign>left</halign>
              <width>10</width>
                        <live>true</live>
                        <property>/sim/gui/dialogs/property-selector/sel[2]</property>
                        <binding>
                           <command>property-assign</command>
                           <property>/sim/gui/dialogs/property-selector/sel[2]</property>
                           <value>1</value>
                        </binding>
                        <binding>
                           <command>nasal</command>
                           <script>Set_Select(2);</script>
                        </binding>
                </radio>
                <radio>
                        <row>3</row>
                        <col>0</col>
                        <color>
                          <red>1.0</red>
                          <green>0.5</green>
                          <blue>0.5</blue>
                        </color>
                        <label>3</label>
              <halign>left</halign>
              <width>10</width>
                        <live>true</live>
                        <property>/sim/gui/dialogs/property-selector/sel[3]</property>
                        <binding>
                           <command>property-assign</command>
                           <property>/sim/gui/dialogs/property-selector/sel[3]</property>
                           <value>1</value>
                        </binding>
                        <binding>
                           <command>nasal</command>
                           <script>Set_Select(3);</script>
                        </binding>
                </radio>
                <radio>
                        <row>4</row>
                        <col>0</col>
                        <color>
                          <red>0.0</red>
                          <green>0.5</green>
                          <blue>0.5</blue>
                        </color>
                        <label>4</label>
              <halign>left</halign>
              <width>10</width>
                        <live>true</live>
                        <property>/sim/gui/dialogs/property-selector/sel[4]</property>
                        <binding>
                           <command>property-assign</command>
                           <property>/sim/gui/dialogs/property-selector/sel[4]</property>
                           <value>1</value>
                        </binding>
                        <binding>
                           <command>nasal</command>
                           <script>Set_Select(4);</script>
                        </binding>
                </radio>
                <radio>
                        <row>5</row>
                        <col>0</col>
                        <color>
                          <red>0.5</red>
                          <green>0.5</green>
                          <blue>1.0</blue>
                        </color>
                        <label>5</label>
              <halign>left</halign>
              <width>10</width>
                        <live>true</live>
                        <property>/sim/gui/dialogs/property-selector/sel[5]</property>
                        <binding>
                           <command>property-assign</command>
                           <property>/sim/gui/dialogs/property-selector/sel[5]</property>
                           <value>1</value>
                        </binding>
                        <binding>
                           <command>nasal</command>
                           <script>Set_Select(5);</script>
                        </binding>
                </radio>

      <text>
         <label>--</label>
                        <row>0</row>
                        <col>1</col>
                        <col>2</col>
                        <col>3</col>
                        <col>4</col>
                        <col>5</col>
                        <col>6</col>
         <live>true</live>
         <halign>left</halign>
         <property>/sim/gui/dialogs/property-selector/label[0]</property>
         <width>170</width>
      </text>
      <text>
         <label>--</label>
                        <row>1</row>
                        <col>1</col>
                        <col>2</col>
                        <col>3</col>
                        <col>4</col>
                        <col>5</col>
                        <col>6</col>
         <live>true</live>
         <halign>left</halign>
         <property>/sim/gui/dialogs/property-selector/label[1]</property>
         <pref-width>170</pref-width>
      </text>
      <text>
         <label>--</label>
                        <row>2</row>
                        <col>1</col>
                        <col>2</col>
                        <col>3</col>
                        <col>4</col>
                        <col>5</col>
                        <col>6</col>
         <live>true</live>
         <halign>left</halign>
         <property>/sim/gui/dialogs/property-selector/label[2]</property>
         <pref-width>170</pref-width>
      </text>
      <text>
         <label>--</label>
                        <row>3</row>
                        <col>1</col>
                        <col>2</col>
                        <col>3</col>
                        <col>4</col>
                        <col>5</col>
                        <col>6</col>
         <live>true</live>
         <halign>left</halign>
         <property>/sim/gui/dialogs/property-selector/label[3]</property>
         <pref-width>170</pref-width>
      </text>
      <text>
         <label>--</label>
                        <row>4</row>
                        <col>1</col>
                        <col>2</col>
                        <col>3</col>
                        <col>4</col>
                        <col>5</col>
                        <col>6</col>
         <live>true</live>
         <halign>left</halign>
         <property>/sim/gui/dialogs/property-selector/label[4]</property>
         <pref-width>170</pref-width>
      </text>
      <text>
         <label>--</label>
                        <row>5</row>
                        <col>1</col>
                        <col>2</col>
                        <col>3</col>
                        <col>4</col>
                        <col>5</col>
                        <col>6</col>
         <live>true</live>
         <halign>left</halign>
         <property>/sim/gui/dialogs/property-selector/label[5]</property>
         <pref-width>170</pref-width>
      </text>


      <input>
                        <row>0</row>
                        <col>7</col>
              <height>10</height>
                        <name>f0</name>
         <live>true</live>
         <halign>right</halign>
         <property>/sim/gui/dialogs/property-selector/input[0]</property>
                        <binding>
                           <command>dialog-apply</command>
                        </binding>
                        <binding>
                           <command>nasal</command>
                           <script>Set_Select(0);</script>
                        </binding>
         <width>50</width>
         <editable>true</editable>
      </input>
      <input>
                        <row>1</row>
                        <col>7</col>
              <height>10</height>
                        <name>f1</name>
         <live>true</live>
         <halign>right</halign>
         <property>/sim/gui/dialogs/property-selector/input[1]</property>
                        <binding>
                           <command>dialog-apply</command>
                        </binding>
                        <binding>
                           <command>nasal</command>
                           <script>Set_Select(1);</script>
                        </binding>
         <width>50</width>
         <editable>true</editable>
      </input>
      <input>
                        <row>2</row>
                        <col>7</col>
              <height>10</height>
                        <name>f2</name>
         <live>true</live>
         <halign>right</halign>
         <property>/sim/gui/dialogs/property-selector/input[2]</property>
                        <binding>
                           <command>dialog-apply</command>
                        </binding>
                        <binding>
                           <command>nasal</command>
                           <script>Set_Select(2);</script>
                        </binding>
         <width>50</width>
         <editable>true</editable>
      </input>
      <input>
                        <row>3</row>
                        <col>7</col>
              <height>10</height>
                        <name>f3</name>
         <live>true</live>
         <halign>right</halign>
         <property>/sim/gui/dialogs/property-selector/input[3]</property>
                        <binding>
                           <command>dialog-apply</command>
                        </binding>
                        <binding>
                           <command>nasal</command>
                           <script>Set_Select(3);</script>
                        </binding>
         <width>50</width>
         <editable>true</editable>
      </input>
      <input>
                        <row>4</row>
                        <col>7</col>
              <height>10</height>
                        <name>f4</name>
         <live>true</live>
         <halign>right</halign>
         <property>/sim/gui/dialogs/property-selector/input[4]</property>
                        <binding>
                           <command>dialog-apply</command>
                        </binding>
                        <binding>
                           <command>nasal</command>
                           <script>Set_Select(4);</script>
                        </binding>
         <width>50</width>
         <editable>true</editable>
      </input>
      <input>
                        <row>5</row>
                        <col>7</col>
              <height>10</height>
                        <name>f5</name>
         <live>true</live>
         <halign>right</halign>
         <property>/sim/gui/dialogs/property-selector/input[5]</property>
                        <binding>
                           <command>dialog-apply</command>
                        </binding>
                        <binding>
                           <command>nasal</command>
                           <script>Set_Select(5);</script>
                        </binding>
         <width>50</width>
         <editable>true</editable>
      </input>


   </group>

   <hrule/>

   <group>
      <layout>hbox</layout>
      <default-padding>1</default-padding>
      <button>
         <legend>Set</legend>
         <pref-width>100</pref-width>
         <default>true</default>
         <binding>
            <command>nasal</command>
            <script>set()</script>
         </binding>
      </button>
   </group>

   <nasal>
      <open>
         var self = cmdarg();
         var dlgname = self.getNode("name").getValue();
         var dlg = props.globals.getNode("/sim/gui/dialogs/" ~ dlgname, 1);
         var title = dlg.getNode("title", 1);
         var Line_Selected=0;
                        var mname = {};
                        var label = {};
                        var input = {};
                        var sel = {};
                        for( var i = 0 ; 6 > i ; i += 1){
            label[i] = dlg.getNode("label["~i~"]", 1);
            input[i] = dlg.getNode("input["~i~"]", 1);
            sel[i] = dlg.getNode("sel["~i~"]", 1);
                           if(sel[i] == 1)Line_Selected=i;
                        };
         var list = dlg.getNode("list", 1);
         var node = nil;         # selected node entry (props.Node)
         var dir = nil;          # current directory (string)
         var update_interval = 5;
         var root_title = "Internal Properties";
         var no_selection = "[none]";

         var update = func(w) {
            self.setValues({ "dialog-name": dlgname, "object-name": w });
            fgcommand("dialog-update", self);
         }

         var squeeze = func(s, n) {
            if (n >= size(s) or 7 > n )
               return s;

            var l = substr(s, 0, (n - 2) / 2);
            var r = substr(s, size(s) + size(l) + 3 - n);
            return l ~ "." ~ r;
         }

                        var basename = func(a) {
                            print ( split("/", a) );
                        }

         var select = func {
            var lst = list.getValue();
            node = props.globals.getNode(lst);
            if (node == nil) node = props.globals;

            setprop("/sim/gui/dialogs/property-selector/selected", node.getPath());

            if (node.getAttribute("children")) {
               dir = node.getPath();
               title.setValue(node.getPath() == "" ? root_title : lst);
               node = nil;
            } else {
               var name = node.getName();
                                   mname = name;
               var index = node.getIndex();
               var type = node.getType();
               if (index) name ~= "[" ~ index ~ "]";

               var value = 0;

                                   if((type == "INT") or (type == "DOUBLE") or (type == "BOOL")
                                                      or (type == "FLOAT")){
               label[Line_Selected].setValue(squeeze(dir ~"/"~ name, 80));
                                        input[Line_Selected].setValue(150);
                                   };
            };
         };

         var set = func {
                           var f=0;
             setprop("/gui/fgplot/prop["~Line_Selected~"]",
                                    label[Line_Selected].getValue() );
                           f=input[Line_Selected].getValue();
            setprop("/gui/fgplot/top["~Line_Selected~"]",f);
                           setprop("/gui/fgplot/factor["~Line_Selected~"]",(-150/f));
                           var name = basename(label[Line_Selected].getValue());
                           setprop("/gui/fgplot/name["~Line_Selected~"]",squeeze(mname, 18));
         }

         var Pre_set = func {
                           var i = 0;
                           var f = 0;
                           for( i = 0 ; 6 > i ; i += 1 ){
               setprop("/sim/gui/dialogs/property-selector/sel["~i~"]",0);
                label[i].setValue(getprop("/gui/fgplot/prop["~i~"]"));
                              f=getprop("/gui/fgplot/top["~i~"]");
                              setprop("/gui/fgplot/factor["~i~"]",(-150/f));
                input[i].setValue(f);
                           };
            setprop("/sim/gui/dialogs/property-selector/sel[0]",1);
                           Line_Selected=0;
         }

         var auto_update = func {
            list.setValue(dir);
            update("property-list");
            if (update_interval)
               settimer(auto_update, update_interval, 1);
         }

         dir = dlg.getNode("last") != nil ? dlg.getNode("last").getValue() : "/";
      
         var Set_Select = func(which) {
                            var i = 0;
              for( i = 0 ; 6 > i ; i += 1 )
            setprop("/sim/gui/dialogs/property-selector/sel["~i~"]",0);

              setprop("/sim/gui/dialogs/property-selector/sel["~which~"]",1);
              Line_Selected=which;
         }

         list.setValue(dir);
         select();
                        Pre_set();
         #auto_update(); # Don't know if this is needed, but can be handy.
      </open>

      <close>
         update_interval = 0;
         if (find("property-selector-", dlgname) >= 0)
            dlg.getParent().removeChildren(dlgname);
         else
            dlg.getNode("last", 1).setValue(dir);
      </close>
   </nasal>
</PropertyList>


If you have some questions, additions, ideas for better coding bugs.... please tell me.
Maby give a signal by a private message...
kuifje09
 
Posts: 579
Joined: Tue May 17, 2011 8:51 pm

Re: kuifje09's FGPlot Development

Postby TheTom » Thu Jun 27, 2013 9:28 pm

Try the following version (and update fgdata). I'm not able to see any change in framerate or time with it. It creates a continuously scrolling plot by adding one segment at the end of each path per frame and removing the first segment if too much segments are present (can be changed to keep a longer history for eg. zooming and scrolling).
Code: Select all
  <load> <!-- when the fgplot is loaded ?? == pressed equipment-fgplot -->
  <![CDATA[

  # general values to have something at startup.
  var setProps = func () {
     var a = getprop("/gui/fgplot/running") or 0;
     if(a == 0) {
     setprop("/gui/fgplot/name[0]","fdm-head.rror-deg");
     setprop("/gui/fgplot/name[1]","heading-.rror-deg");
     setprop("/gui/fgplot/name[2]","true-hea.rror-deg");
     setprop("/gui/fgplot/name[3]","nav1-course-error");
     setprop("/gui/fgplot/name[4]","nav1-hea.rror-deg");
     setprop("/gui/fgplot/name[5]","nav1-tra.rror-deg");
     setprop("/gui/fgplot/prop[0]","/autopilot/internal/fdm-heading-bug-error-deg");
     setprop("/gui/fgplot/prop[1]","/autopilot/internal/heading-bug-error-deg");
     setprop("/gui/fgplot/prop[2]","/autopilot/internal/true-heading-error-deg");
     setprop("/gui/fgplot/prop[3]","/autopilot/internal/nav1-course-error");
     setprop("/gui/fgplot/prop[4]","/autopilot/internal/nav1-heading-error-deg");
     setprop("/gui/fgplot/prop[5]","/autopilot/internal/nav1-track-error-deg");
     for( var j = 0 ; 6 > j ; j += 1)
     {
       setprop("/gui/fgplot/factor["~j~"]",-1);
       setprop("/gui/fgplot/top["~j~"]",360);
       setprop("/gui/fgplot/line["~j~"]",1);
     }
     setprop("/gui/fgplot/running",0);
     setprop("/gui/fgplot/version",1);
     setprop("/gui/fgplot/plot",0);
     setprop("/gui/fgplot/transparency",0.0);
  #   gui.popupTip("Properties set",3);
     };
  };
  setProps();
 
 
   var SetTransparency = func () {
       if(getprop("/gui/fgplot/transparency")==1){
          my_canvas.setColorBackground(0,0,0,1); # Transparancy == last 0
          setprop("/gui/fgplot/transparency",0);
       } else {
          my_canvas.setColorBackground(0,0,0,0); # Transparancy == last 0
          setprop("/gui/fgplot/transparency",1);
       };
   };

  var SetLine = func(a)
  {
    setprop("/gui/fgplot/line["~a~"]", !getprop("/gui/fgplot/line["~a~"]"));
  };

  # canvas-specific code here
  var my_canvas = canvas.get( cmdarg() ); # Handle to the parent canvas
  my_canvas.set("mipmapping", 1)
           .setColorBackground(0,0,0,1); # Transparancy when last digit == 0

  var root = my_canvas.createGroup();

  var graph = root.createChild("group");

  # center of the graph.
  var x_axis =
    graph.createChild("path", "x-axis")
         .moveTo(0, 151)        # start of centerline horizontaly
         .lineTo(800, 151)      # end of centerline hor. but ends too soon
         .setColor(0.8,0.8,0.8)
         .setStrokeLineWidth(1);

  var colors = [
    "#ff0000",
    "#00ff00",
    "#0000ff",
    "#ff8000",
    "#008080",
    "#8080ff"
  ];
  var num_plots = size(colors);
  var plots = setsize([], num_plots);
  for(var i = 0; i< num_plots; i+=1)
  plots[i] = graph.createChild("path", "data")
                  .set("stroke", colors[i])
                  .set("stroke-width", 2);

  var max_x = 800;
  var dx = 2;
  var cur_x = 0;
  var x_offset = max_x;

  var doPlot = func()
  {
    var MyTimeout = func()
    {
      if( getprop("/gui/fgplot/running") != 1 )
        return;

      for(var i = 0; i < 6; i += 1)
      {
        if( getprop("/gui/fgplot/line[" ~ i ~ "]") != 1 )
          continue;

        var y = getprop(getprop("/gui/fgplot/prop[" ~ i ~ "]")) * getprop("/gui/fgplot/factor[" ~ i ~ "]");
        if( cur_x == 0 )
          plots[i].moveTo(cur_x, y);
        else
          plots[i].lineTo(cur_x, y);
        plots[i].setTranslation(x_offset, 151);

        if( plots[i].getNumSegments() > max_x / dx )
          plots[i].pop_front();
      }

      x_offset -= dx;
      cur_x += dx;

      settimer(MyTimeout,0.1);
    };

    MyTimeout();
  };
  ]]>
  </load>
TheTom
 
Posts: 321
Joined: Sun Oct 09, 2011 10:20 am

Re: kuifje09's FGPlot Development

Postby kuifje09 » Fri Jun 28, 2013 10:11 pm

Hello TheTom, That cleared up the mist around the translation. I could not get it right.
Did some work and testing but far from satisfied. Currently the framerate drops from ~15 to ~10.
Will have a closer look stll, then I will post it again. ( made the stepsize user-selectable. a tricky part... )
kuifje09
 
Posts: 579
Joined: Tue May 17, 2011 8:51 pm

Re: kuifje09's FGPlot Development

Postby TheTom » Sat Jun 29, 2013 8:14 am

kuifje09 wrote in Fri Jun 28, 2013 10:11 pm:Did some work and testing but far from satisfied. Currently the framerate drops from ~15 to ~10.

Have you used the code exactly as I've posted it? I can not even see a change in frame spacing of 1ms while running all 6 plots...
TheTom
 
Posts: 321
Joined: Sun Oct 09, 2011 10:20 am

Re: kuifje09's FGPlot Development

Postby kuifje09 » Sat Jun 29, 2013 7:14 pm

I used it almost as you posted it. I found a typo in doPlot / dotPlot ( which I used in the xml ) and changed to 800 points.
Then I also added a feature to set the stepsize userselectable, 1 2 4 8 points a step.
But as soon lineplotting starts, the time used grows from 0.5 to ~30 max/mx ( in performance mon ) and then the frame rate has dropped from ~12 to ~8

Then I decided to get the delete of points out the nasal/xml and created a C-Prog to delete 100 points a time with SGprop...removeChild()
Although the delete seems to take no time, it does not help either.

If you do not delete the out-of-range points, time is running higer ever more....

But I have to review my changes. Do know what I've done wrong but it is taking more time while plotting is going on. While your model stops using more time when around those 30 Max/ms.
kuifje09
 
Posts: 579
Joined: Tue May 17, 2011 8:51 pm

Re: kuifje09's FGPlot Development

Postby kuifje09 » Sat Jun 29, 2013 7:50 pm

This is the somewhat modified version of TheTom. Obvious, more points is slower... But for those who like a rolling backwords plot, this one could be an example.... Or the faster/less points of TheTom.

This one still without the user-step-size.
Code: Select all
<?xml version="1.0"?>
<!--

Set the multythreading to of when it is still off, in the
 $FG_ROOT/preferences.xml
for better performance.

add to $FGHOME/Translations/en/menu.xml
direct under
<equipment>Equipment</equipment>

  <fgplot>Fgplot</fgplot>

add to $FGHOME/gui/menubar.xml
direct under
<name>equipment</name>

<item>
  <name>fgplot</name>
    <binding>
      <command>dialog-show</command>
         <dialog-name>fgplot</dialog-name>
    </binding>
<item>

Now you can choose from menubar in equipment fgplot.
-->

<PropertyList>
  <name>fgplot</name>
  <modal>false</modal>
  <!--layout>hbox</layout-->
  <resizable>false</resizable>
  <x>0</x> <!-- x runs to right -->
  <y>0</y> <!-- y runs to up -->
  <width>940</width>
  <height>311</height>  <!-- 301 + 5*2 -->
  <color>
       <red>0.2</red>
       <green>0.2</green>
       <blue>0.2</blue>
       <alpha>0.5</alpha>  <!-- a little bit of transparency -->
  </color>

 
  <group>

   <!-- space for the butons and labels and the canvas -->
   <layout>hbox</layout>
   <!--halign>fill</halign-->
   <default-padding>5</default-padding>
   <!--empty><stretch>true</stretch></empty-->
   <color>
      <red>0.2</red>
      <green>0.2</green>
      <blue>0.2</blue>
   </color>
 
   <text>
      <label>fgplot</label>
        <x>0</x>
        <y>285</y>
        <width>5</width>
        <height>15</height>
   </text>
   
<!-- Buttons for start-stop-quit -->
   <button>
      <legend>&gt;</legend>
      <!--equal>true</equal-->
      <x>60</x>
      <y>285</y>
      <width>15</width>
      <height>15</height>
      <binding>
        <command>nasal</command>
          <script><![CDATA[
              var a = getprop("/gui/fgplot/running") or 0;
              if(a == 0){
                 setprop("/gui/fgplot/running",1);
                 dotPlot();
              };]]>
         </script>
      </binding>
   </button>
   <button>
      <legend>-</legend>
      <!--equal>true</equal-->
      <x>80</x>
      <y>285</y>
      <width>15</width>
      <height>15</height>
      <binding>
        <command>nasal</command>
          <script>setprop("/gui/fgplot/running",0);</script>
      </binding>
   </button>
   <button>
      <legend>X</legend>
      <!--equal>true</equal-->
      <x>100</x>
      <y>285</y>
      <width>15</width>
      <height>15</height>
      <key>Esc</key>
      <binding>
        <command>nasal</command>
          <script>setprop("/gui/fgplot/running",0);</script>
      </binding>
      <binding>
        <command>dialog-close</command>
      </binding>
   </button>

<!-- option to set transparency of the plot-area -->
   <checkbox>
     <label>transparent</label>
     <!--pref-width>100</pref-width-->
     <x>10</x>
     <y>265</y>
     <width>12</width>
     <height>12</height>
     <property>/gui/fgplot/transparency</property>
       <live>true</live>
       <binding>
         <command>nasal</command>
            <script>
               SetTransparency();
         </script>
       </binding>
   </checkbox>

<!-- options choose which of the 6 lines are visible -->
   <checkbox>
     <label></label>
     <color>
       <red>1.0</red>
       <green>0.0</green>
       <blue>0.0</blue>
     </color>
     <x>10</x>
     <y>245</y>
     <width>12</width>
     <height>12</height>
     <property>/gui/fgplot/line[0]</property>
       <live>true</live>
       <binding>
         <command>nasal</command>
         <script>SetLine(0);</script>
       </binding>
   </checkbox>
   <text>
     <label>.</label>
        <property>/gui/fgplot/name[0]</property>
        <live>true</live>
     <x>20</x>
     <y>240</y>
   </text>
   <checkbox>
     <label></label>
     <color>
       <red>0.0</red>
       <green>1.0</green>
       <blue>0.0</blue>
     </color>
     <x>10</x>
     <y>225</y>
     <width>12</width>
     <height>12</height>
     <property>/gui/fgplot/line[1]</property>
       <live>true</live>
       <binding>
         <command>nasal</command>
         <script>SetLine(1);</script>
       </binding>
   </checkbox>
   <text>
     <label>.</label>
        <property>/gui/fgplot/name[1]</property>
        <live>true</live>
     <x>20</x>
     <y>220</y>
   </text>
   <checkbox>
     <label></label>
     <color>
       <red>0.0</red>
       <green>0.0</green>
       <blue>1.0</blue>
     </color>
     <x>10</x>
     <y>205</y>
     <width>12</width>
     <height>12</height>
     <property>/gui/fgplot/line[2]</property>
       <live>true</live>
       <binding>
         <command>nasal</command>
         <script>SetLine(2);</script>
       </binding>
   </checkbox>
   <text>
     <label>.</label>
        <property>/gui/fgplot/name[2]</property>
        <live>true</live>
     <x>20</x>
     <y>200</y>
   </text>
   <checkbox>
     <label></label>
     <color>
       <red>1.0</red>
       <green>0.5</green>
       <blue>0.5</blue>
     </color>
     <x>10</x>
     <y>185</y>
     <width>10</width>
     <height>10</height>
     <property>/gui/fgplot/line[3]</property>
       <live>true</live>
       <binding>
         <command>nasal</command>
         <script>SetLine(3);</script>
       </binding>
   </checkbox>
   <text>
     <label>.</label>
        <property>/gui/fgplot/name[3]</property>
        <live>true</live>
     <x>20</x>
     <y>180</y>
   </text>
   <checkbox>
     <label></label>
     <color>
       <red>0.0</red>
       <green>0.5</green>
       <blue>0.5</blue>
     </color>
     <x>10</x>
     <y>165</y>
     <width>12</width>
     <height>12</height>
     <property>/gui/fgplot/line[4]</property>
       <live>true</live>
       <binding>
         <command>nasal</command>
         <script>SetLine(4);</script>
       </binding>
   </checkbox>
   <text>
     <label>.</label>
        <property>/gui/fgplot/name[4]</property>
        <live>true</live>
     <x>20</x>
     <y>160</y>
   </text>
   <checkbox>
     <label></label>
     <color>
       <red>0.5</red>
       <green>0.5</green>
       <blue>1.0</blue>
     </color>
     <x>10</x>
     <y>145</y>
     <width>12</width>
     <height>12</height>
     <property>/gui/fgplot/line[5]</property>
       <live>true</live>
       <binding>
         <command>nasal</command>
         <script>SetLine(5);</script>
       </binding>
   </checkbox>
   <text>
     <label>.</label>
        <property>/gui/fgplot/name[5]</property>
        <live>true</live>
     <x>20</x>
     <y>140</y>
   </text>

<!-- selector for property to plot -->
   <button>
     <legend>Properties</legend>
     <x>10</x>
     <y>10</y>
     <width>105</width>
     <height>20</height>
       <binding>
          <command>dialog-show</command>
          <dialog-name>property-selector</dialog-name>
       </binding>
       <binding>
          <command>nasal</command>
          <!-- signal user-set properties -->
          <script>setprop("/gui/fgplot/userdefined",1);</script>
       </binding>
   </button>

<!-- this is where we draw on -->
<canvas>
  <name>fgplot</name>
  <x>130</x> <!-- save space for buttons on the left -->
  <y>5</y>
  <layout>hbox</layout>
  <!--valign>fill</valign-->
  <!--halign>fill</halign-->
  <!--stretch>true</stretch-->
  <width>800</width>  <!-- will contain 800 positions  -->
  <height>301</height> 

<!-- all the nasal coding below -->
<nasal>     

  <load> <!-- when the fgplot is loaded ?? == pressed equipment-fgplot -->
  <![CDATA[

  var dx = 1;
 
  # general values to have something at startup.
  var setProps = func () {
     var a = getprop("/gui/fgplot/running") or 0;
     if(a == 0) {
       setprop("/gui/fgplot/name[0]","fdm-head.rror-deg");
       setprop("/gui/fgplot/name[1]","heading-.rror-deg");
       setprop("/gui/fgplot/name[2]","true-hea.rror-deg");
       setprop("/gui/fgplot/name[3]","nav1-course-error");
       setprop("/gui/fgplot/name[4]","nav1-hea.rror-deg");
       setprop("/gui/fgplot/name[5]","nav1-tra.rror-deg");
       setprop("/gui/fgplot/prop[0]","/autopilot/internal/fdm-heading-bug-error-deg");
       setprop("/gui/fgplot/prop[1]","/autopilot/internal/heading-bug-error-deg");
       setprop("/gui/fgplot/prop[2]","/autopilot/internal/true-heading-error-deg");
       setprop("/gui/fgplot/prop[3]","/autopilot/internal/nav1-course-error");
       setprop("/gui/fgplot/prop[4]","/autopilot/internal/nav1-heading-error-deg");
       setprop("/gui/fgplot/prop[5]","/autopilot/internal/nav1-track-error-deg");
       for( var j = 0 ; 6 > j ; j += 1){
         setprop("/gui/fgplot/factor["~j~"]",-0.833334);
         setprop("/gui/fgplot/top["~j~"]",180);
         setprop("/gui/fgplot/line["~j~"]",1);
       };
       setprop("/gui/fgplot/running",0);
       setprop("/gui/fgplot/version",1);
       setprop("/gui/fgplot/plot",0);
       setprop("/gui/fgplot/transparency",0.0);
#       gui.popupTip("Properties set",3);
     };
  };
 
  setProps();

  var SetTransparency = func () {
      if(getprop("/gui/fgplot/transparency")==1){
         my_canvas.setColorBackground(0,0,0,1); # Transparancy == last 0
         setprop("/gui/fgplot/transparency",0);
      } else {
         my_canvas.setColorBackground(0,0,0,0); # Transparancy == last 0
         setprop("/gui/fgplot/transparency",1);
      };
  };

  # Toggle line on/off
  var SetLine = func(a)
  {
    setprop("/gui/fgplot/line["~a~"]", !getprop("/gui/fgplot/line["~a~"]"));
  };

  # canvas-specific code here
  var my_canvas = canvas.get( cmdarg() ); # Handle to the parent canvas
  my_canvas.set("mipmapping", 0)
           .setColorBackground(0,0,0,1); # Transparancy when last digit == 0

  var root = my_canvas.createGroup();

  var graph = root.createChild("group");

  # center of the graph.
  var x_axis = graph.createChild("path", "x-axis")
         .moveTo(0, 151)        # start of centerline horizontaly
         .lineTo(800, 151)      # end of centerline horizontaly
         .setColor(0.8,0.8,0.8)
         .setStrokeLineWidth(1);

  var colors = [
    "#ff0000",
    "#00ff00",
    "#0000ff",
    "#ff8000",
    "#008080",
    "#8080ff"
  ];
  var num_plots = size(colors);
  var plots = setsize([], num_plots);
  for(var i = 0; i< num_plots; i+=1)
      plots[i] = graph.createChild("path", "data")
                 .set("stroke", colors[i])
                 .set("stroke-width", 1);  # was 2

   # Now we need the path-number in the texture[?] too correct size of canvas
   var Txtr = 0;
   for(i=0;i<10;i+=1){
      if(getprop("/canvas/by-index/texture["~i~"]/name") == "fgplot"){
      Txtr = i;
   # then we can correct the view sizes. for correct pixel-value
      setprop("/canvas/by-index/texture["~Txtr~"]/view[0]",800);
      setprop("/canvas/by-index/texture["~Txtr~"]/view[1]",301);
      };
   };
   if(Txtr == 0){
      gui.popupTip("Texture.path for fgplot not found !",3);
      setprop("/gui/fgplot/running",0);
      dialog-close;
   };

  var max_x = 800;
  var cur_x = 0;
  var x_offset = max_x;
  var ToRemove = {};
  var y = 0;

  var dotPlot = func()
  {
    var MyTimeout = func()
    {
      if( getprop("/gui/fgplot/running") != 1 )
        return;

      for(var i = 0; i < 6; i += 1)
      {
        # we must keep scrolling so poke lines-off y = 0
        if( getprop("/gui/fgplot/line[" ~ i ~ "]") != 1 )
           y = 0;
        else
           y = getprop(getprop("/gui/fgplot/prop[" ~ i ~ "]")) * getprop("/gui/fgplot/factor[" ~ i ~ "]");

        if( cur_x == 0 )
          plots[i].moveTo(cur_x, y);
        else
          plots[i].lineTo(cur_x, y);

        plots[i].setTranslation(x_offset, 151);

        if( cur_x > max_x  ){
#          print(i~"--"~cur_x~"--"~x_offset);
        ToRemove[0] = (cur_x-800)/dx;
        ToRemove[1] = 2*ToRemove[0];
        ToRemove[2] = 1+ToRemove[1];
        var pathnum = i+1;

#        print ("/canvas/by-index/texture["~Txtr~"]/group/group/path["~pathnum~"]/cmd["~ToRemove[0]~"]");
        var Node = props.globals.getNode("/canvas/by-index/texture["~Txtr~"]/group/group/path["~pathnum~"]/cmd["~ToRemove[0]~"]").remove();

#   print ("/canvas/by-index/texture["~Txtr~"]/group/group/path["~pathnum~"]/coord["~ToRemove[1]~"]");
   var Node = props.globals.getNode("/canvas/by-index/texture["~Txtr~"]/group/group/path["~pathnum~"]/coord["~ToRemove[1]~"]").remove();

#   print ("/canvas/by-index/texture["~Txtr~"]/group/group/path["~pathnum~"]/coord["~ToRemove[2]~"]");
   var Node = props.globals.getNode("/canvas/by-index/texture["~Txtr~"]/group/group/path["~pathnum~"]/coord["~ToRemove[2]~"]").remove();
        };
       
      };

      x_offset -= dx;
      cur_x += dx;

      settimer(MyTimeout,0.1);
    };

    MyTimeout();
  };
  ]]>
  </load>

  </nasal>
  </canvas>

  </group>

</PropertyList>
kuifje09
 
Posts: 579
Joined: Tue May 17, 2011 8:51 pm

Re: kuifje09's FGPlot Development

Postby Hooray » Sat Jun 29, 2013 8:31 pm

You can use any of these (or a combination of them) to determine where the bottlenecks are:
  • performance monitor
  • Nasal's debug.benchmark()
  • OSG on-screen stats
  • built-in profiler
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11836
Joined: Tue Mar 25, 2008 8:40 am

PreviousNext

Return to Canvas

Who is online

Users browsing this forum: No registered users and 0 guests