CSL2XSB

Convert other CSL packages

The Python script CSL2XSB can do the following to your CSL models:

  • convert packages to work with LiveTraffic, tested with X-CSL, which is often used with X-IvAp

  • enable features like rotating props and rotors, rolling wheels, opening reversers, tested on the Bluebell package

It is not mandatory to run CSL2XSB, especially if you installed the Bluebell CSL packages only. If you are new to LiveTraffic you probably want to enjoy a few first steps first before returning back here. Then you might better understand why and if the features listed above are benficial for you.

LiveTraffic includes this script in the folder LiveTraffic/Resources. But it can also be downloaded separately. If interested in more details of what the script does see further down.

If you know how to work a command line and call a Python script then you'd probably better off with the description here.

The following tries to describe the necessary steps for beginners, i.e. it describes the one way I think is the most simplest:

  1. Install Python, a modern scripting language:

    1. Windows:

      1. On Python's download page, click on "Latest Python 3 release", scroll all the way to the end, and download "Windows x86-64 web-based installer" and run it.

      2. Important: Check (select) the option "Add Python 3.x to PATH" at the bottom of the "Install Python" window.

      3. Click on "Install Now". Python will install.

      4. When done, click "Close" in the "Setup was successfull" screen.

    2. MacOS: Download the latest "macOS 64-bit installer" from Python's download page and install it by double-clicking the downloaded .pkg file and following instructions.

    3. Linux: For Ubuntu and similar: sudo apt-get install python3

  2. Download the CSL package you want.

    1. X-CSL packages can be downloaded here. If you don't already have the package (e.g. because you use X-IvAp) then download and start the installer. The installer will not identify LiveTraffic as a supported plugin. Instead, from the menu select File > Select Custom Path and specify a path where the CSL packages are to be downloaded to and where they later can be updated.

    2. Download other packages as you like...

  3. Do not let CSL2XSB.py run on this original download. Always make a copy of the entire folder into a folder LiveTraffic can reach later, e.g. to <...>/LiveTraffic/Resources/X-CSL.

  4. Copy the CSL2XSB.py script into the same folder, i.e. into the base path of what you want to convert. With LiveTraffic v1.20 the script is included in the LiveTraffic/Resources folder, under which usually all CSL packages are located. That is a good place.

  5. Start CSL2XSB.py in interactive mode:

    1. Windows: Double-click CSL2XSB.py in the Windows explorer to start the script.

    2. MacOS:

      1. Open a terminal window by starting /Applications/Utilities/Terminal.app

      2. In the terminal, change to the directory where CSL2XSB.py is located, e.g. by entering: cd '/Applications/X-Plane 11/Resources/plugins/LiveTraffic/Resources' if your X-Plane installation is in /Applications/X-Plane 11. (You don't need to type all the folder names, enter 3-4 characters and hit [Tab] to extend to the full folder name.)

      3. Start the script by entering the command python3 CSL2XSB.py

    3. Linux:

      1. Open a terminal window

      2. In the terminal, change to the directory where CSL2XSB.py is located, e.g. by entering:

        cd '<path-to-XPlane>/Resources/plugins/LiveTraffic/Resources'

      3. Start the script by entering the command

        python3 CSL2XSB.py

  6. The script

    1. will ask you "Do you want to run CSL2XSB on the current directory "..."?". Enter "Y" and hit Enter.

    2. You will see messages about the folders being processed. You might see some warnings about not found texture files, which are problems in the underlying CSL package to be solved by their developers.

    3. When done the script waits for you to hit [Enter] so you have a chance to scroll through the messages.

  7. Start X-Plane/LiveTraffic, go to CSL Settings,

    1. enter the just converted path as a new CSL path next to the already existing ones,

    2. and click the save button to save the path and load the models.

    3. if you want to load that package automatically next time, verify there's a check mark in front next to Auto Load.

Script running after Double-Click
X-CSL path added to Settings > CSL > CSL Package Paths

How the Script Works

The script runs over all subdirectories and changes xsb_aircraft.txt and *.obj files it finds along the way, i.e. it changes your CSL packages. You can run it directly from LiveTraffic/Resources, then it will walk over all your CSL package under that folder.

CSL2XSB tries to keep the original copies of each file with additional extension .orig. When run again and again, it even runs based on these original files, so you can just run the script over and over again, e.g. to make use of new feature added to the script. Still, you want to keep a backup of your original files.

Convert Packages like X-CSL

The main task here is to resolve an additional parameter to the OBJ8 command in xsb_aircraft.txt, introduced in other forks of the multiplayer library. These parameters allow CSL package creators to ship just one .obj file with the plane model (say A320), but several textures for different liveries (say BAW, DLH, AAL...). The additional parameters define the necessary livery texture files. This saves a lot of space as only one .obj file is necessary.

This design approach is disputed and LiveTraffic doesn't support it. Instead, CSL2XSB

  • reads these additional parameters from xsb_aircraft.txt,

  • creates the required additional .obj files pointing to the various texture files, then

  • changes xsb_aircraft.txt to point to the newly created .obj files.

So it would create A320_BAW.obj, A320_DLH.obj, A320_AAL.obj, which are essentially just copies of the original A320.obj, with just two lines changed: those defining the texture. This eats a lot more space (an additional 1.2 GB for the full X-CSL package), but stays consistent with the original format.

Along the way, the script cleans up some common errors in the xsb_aircraft.txt file. For even more details see the README.md on GitHub.

Enable Features like Rotating Props / Rotors, Rolling Wheels...

The Bluebell package contains many models, which have originally been created for WorldTraffic. The models contain already features like rotating rotors, rolling wheels or opening reversers. Before LiveTraffic v1.20 there were simply no dataRefs available to control these animations. So Bluebell just left dataRefs alone, which couldn't be mapped to an original libxplanemp dataRef, so props or wheels didn't turn.

LiveTraffic now offers a few more animation control dataRefs. The script, technically quite simplistic, includes a replacement table to replace a WorldTraffic dataRef with the matching LiveTraffic dataRef, so that LiveTraffic now can control these animations.