Talk:Canvas ND framework

From FlightGear wiki
Revision as of 19:35, 23 April 2014 by Hooray (talk | contribs) (→‎Refactoring (05/2014): new section)
Jump to navigation Jump to search

Versioning

As more and more aircraft start adopting the framework, we should consider adding some "versioning" support, so that people can request a certain version and assume a certain API that won't change over time. TheTom is already doing this in the Canvas APIs - and we basically need a similar mechanism, so that the APIs can evolve, without breaking unmaintained aircraft - redneck and omega95 were extremely frustrated with the lack of backwards compatibility when the route manager/fplan APIs were reworked, because they didn't have the time to update their aircraft - so this is a valid point and we should make sure that we're not causing any unnecessary frustration here. I am proposing a hash/namespace-based lookup for APIs, unless Philosopher can convince me that we need something more sophisticated than that...

var VersionedAPIContainer = {};
VersionedAPIContainer.new = func(version);
...


var NavDisplay = {};
NavDisplay[ "1.0" ] = VersioonedAPIContainer.new( "1.0" );

...

# request a certain API version
var ND = NavDisplay["1.0"];
ND.new();

it may make sense to come up with a generic framework for API versioning (possibly by looking at Tom's work) and using the same approach to also support versioning at the MapStructure level itself. Ideally, multiple instances of different versions could co-exist without issues.

This unsigned comment was added by Hooray (Talk | contribs) 21:39–21:41, 30 January 2014 (UTC)

Refined Setup Instructions

DrDavid and some others reported still having issues integrating the system - probably because there are some more steps involved than detailed in the article, I don't do aircraft development - so I cannot help too much here .

But here's something that 5H1N0B1 put together to help other aircraft developers, you may want to review/extend or proof-read this a bit and add it to the wiki once you are satisfied (I don't know if anything's missing?):

Yes indeed. The integration is very very simple...

0) Have a update compiled version of flightgear.

1) Have the 3D model in this way : 3D MFD ->

           - a) 3D Border (border of the screen, with scew etc)
           - b) 3D Button/swith, molette, turnable button
           - c) A 3D Screen object, with :
                       - perfect size
                       - Single texture, -> with perfect siez
                       - Perfect size of the UVmap

2) Copy pasta ND.nas 2.1)Add the ND.nas in your basis xml file at Nasal part. ( <file>Aircraft/Mirage-2000/Models/Interior/Panel/Instruments/Center-mfd/ND.nas</file> in file "m2000-5-base.xml" line 646)

3) Edit ND.nas :

             -a) Rename the screen to match with the object in 1)c) 
             -b) If it a single mfd, you do not need another object, so suppress the line (when it's calling the object itself)
             -c) Keep the properties name -> it's just ok. We just need to input it with xml button in 1)b)

4) Code the xml itself. Really simple, it's just playing with properties : for example this for airport property :

<!--######################## Airports ############################-->
<animation>
    <type>pick</type>
    <object-name>bt-h1</object-name>
    <visible>true</visible>
    <action>
        <button>0</button>
        <binding>
         <command>property-toggle</command>
         <property>/instrumentation/efis/inputs/arpt</property>
        </binding>
    </action>
</animation>

Or here again for the range selection :

  <animation>
    <type>pick</type>
    <object-name>trim1</object-name>
    <action>
      <button>4</button>
      <!--  scroll up -->
      <repeatable>false</repeatable>   
      <binding>
                <command>property-cycle</command>
                <property>/instrumentation/efis/inputs/range-nm</property>
                <value>10</value>
                <value>20</value>
                <value>40</value>
                <value>80</value>
                <value>160</value>
                <value>320</value>
      </binding>   
    </action>
  </animation>

  <animation>
    <type>pick</type>
    <object-name>trim1</object-name>
    <action>
      <button>3</button>
      <!--  scroll up -->
      <repeatable>false</repeatable>
  
      <binding>
                <command>property-cycle</command>
                <property>/instrumentation/efis/inputs/range-nm</property>
                <value>320</value>
                <value>160</value>
                <value>80</value>
                <value>40</value>
                <value>20</value>
                <value>10</value>              
      </binding>   
    </action>
  </animation>

5) Then you can optionnaly put this  :

  <animation>
	<type>pick</type>
	<object-name>blackbkd</object-name>
	<action>
		<button>0</button>
		<repeatable>false</repeatable>
		<binding>
			<command>nasal</command>
			<script>mirage2000.showNd();</script>
		</binding>
	</action>
</animation>

Where 'blackbkd' is the screen 1)c). This last thing allow you to open a dialog box with what the actual canvas should display in your 1)c) screen. This is very usefull to check all the differents step when something isn't working well.

If this can help : This is a link with the canvas friendly mirage 2000. (The updated one). [url]https://dl.dropboxusercontent.com/u/109132916/Mirage-2000.tar.gz[/url] The mfd thing is all in Mirage-2000\Models\Interior\Panel\Instruments\Center-mfd

Normally following these step, you should have a working Mfd. (This can be nearly copy pasta in the wiki...if it's enough detailed)

Friendly

5H1N0B1

Refactoring (05/2014)