Livery over MP: Difference between revisions

From FlightGear wiki
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 1: Line 1:
[[Image:Livery_selection_dialog.jpg|thumb|270px|The livery selection dialog of the [[Sikorsky S76C]].]]
[[Image:Livery_selection_dialog.jpg|thumb|270px|The livery selection dialog of the [[Sikorsky S76C]].]]


On this page we describe how you make use of a script to get a livery selection dialog in [[FlightGear]]. To get new liveries into [[FlightGear CVS]], you need to have them availabe with this script.
On this page we describe how you make use of a script to get a '''livery selection dialog''' for a [[Aircraft|plane]] in [[FlightGear]]. To get new liveries into [[FlightGear CVS]], you need to have them availabe with this script.


The examples are based on the [[Sikorsky S76C]].
The examples are based on the [[Sikorsky S76C]].
Line 14: Line 14:
===Files===
===Files===
====Models/Liveries====
====Models/Liveries====
For every livery we need to make a file. Let's say we got a Rescue livery, we than need to make a file called Rescue.xml into our Models/Liveries directory.
For every livery we need to make a file. Let's say we got a Rescue livery, we than need to make a file called Rescue.xml into our <tt>Models/Liveries directory</tt>.


  <?xml version="1.0"?><nowiki>
  <?xml version="1.0"?><nowiki>
Line 31: Line 31:


====s76c.xml====
====s76c.xml====
The first part is related to the nasal script. </tt>("Aircraft/Sikorsky-76C/Models/Liveries", 10)<tt> points FlightGear to the directory where we store our liveries. This is a different directory for every plane, but there should be only one folder for one plane, containing all the liveries for that plane.
The first part is related to the nasal script. <tt>("Aircraft/Sikorsky-76C/Models/Liveries", 10)</tt> points FlightGear to the directory where we store our liveries. This is a different directory for every plane, but there should be only one folder for one plane, containing all the liveries for that plane.


  <nasal>
  <nasal>
Line 73: Line 73:
   <variant type="int">1</variant>
   <variant type="int">1</variant>
  </model>
  </model>
To make a nice button in the [[menubar]] we need to add the following code, just above the <tt></sim></tt> tag.
<menubar>
  <default>
  <menu n="10">
    <label>S76C++</label>
    <enabled type="bool">true</enabled>
    <item>
    <label>Select Livery</label>
    <binding>
      <command>nasal</command>
      <script>aircraft.livery.dialog.toggle()</script>
    </binding>
    </item>
  </menu>
  </default>
</menubar>


[[Category:Aircraft enhancement]]
[[Category:Aircraft enhancement]]
[[Category:Modeling]]
[[Category:Modeling]]

Revision as of 15:47, 8 October 2008

The livery selection dialog of the Sikorsky S76C.

On this page we describe how you make use of a script to get a livery selection dialog for a plane in FlightGear. To get new liveries into FlightGear CVS, you need to have them availabe with this script.

The examples are based on the Sikorsky S76C.

Before we start

There are a few files we need to make (or edit), namely:

  • s76c-set.xml
  • Models/s76c.xml
  • Nasal/S76C.nas

We also have to make a new directory to store our liveries in. Let's make it Aircraft/Sikorsky-76C/Models/Liveries.

Files

Models/Liveries

For every livery we need to make a file. Let's say we got a Rescue livery, we than need to make a file called Rescue.xml into our Models/Liveries directory.

<?xml version="1.0"?>

<PropertyList>
 <sim>
  <model>
   <livery>
    <name type="string">Rescue</name>
    <index type="int">0</index>
    <texture>S76livery0.rgb</texture>
   </livery>
  </model>
 </sim>
</PropertyList>

s76c.xml

The first part is related to the nasal script. ("Aircraft/Sikorsky-76C/Models/Liveries", 10) points FlightGear to the directory where we store our liveries. This is a different directory for every plane, but there should be only one folder for one plane, containing all the liveries for that plane.

<nasal>
 <load>
  var livery_update = aircraft.livery_update.new("Aircraft/Sikorsky-76C/Models/Liveries", 10);
 </load>

 <unload>
  livery_update.stop();
 </unload>
</nasal>

The second part is very important and probably the hardest of all. We need to set which parts of the model should change when you select a new livery. To find the object-names, you could make use of software like Blender or AC3D. The <texture>S76livery.rgb</texture> part points FlightGear to the livery that should be shown on startup.

<animation>
 <type>material</type>
  <object-name>LHgeardoor</object-name>
  <object-name>RHgeardoor</object-name>
  <object-name>S76C</object-name>
  <object-name>RF.door</object-name>
  <object-name>LF.door</object-name>
  <object-name>Rr.Door</object-name>
  <object-name>Lr.Door</object-name>
  <object-name>RHbaggage</object-name>
  <object-name>LHbaggage</object-name>
  <object-name>RHfrtgeardoor</object-name>
  <object-name>LHfrtgeardoor</object-name>
  <property-base>/sim/model/livery</property-base>
  <texture-prop>texture</texture-prop>
  <texture>S76livery.rgb</texture>
</animation>

S76C.nas

The only thing you might change in the nasal file is the directory of the liveries.

aircraft.livery.init("Aircraft/Sikorsky-76C/Models/Liveries", "sim/model/livery/name", "sim/model/livery/index");

s76c-set.xml

<model>
 <path>Aircraft/Sikorsky-76C/Models/s76c.xml</path>
 <variant type="int">1</variant>
</model>

To make a nice button in the menubar we need to add the following code, just above the </sim> tag.

<menubar>
 <default>
  <menu n="10">
   <label>S76C++</label>
   <enabled type="bool">true</enabled>
   <item>
    <label>Select Livery</label>
    <binding>
     <command>nasal</command>
     <script>aircraft.livery.dialog.toggle()</script>
    </binding>
   </item>
  </menu>
 </default>
</menubar>