FSS E-Jets — Livery Converter
=============================

Converts an MSFS 2020 community livery into an MSFS 2024 pack for the
Flight Sim Studio E-Jets.

You need:
  - the original livery folder (the one you used to drop into Community)
  - the matching FSS aircraft in MSFS 2024 (E170 / E175 / E190 / E195 / freighter)

How to use
----------
1. Drop the old livery folder (or a .zip / .rar) onto FSS-Livery-Converter.bat
   — or double-click the bat and drop the pack onto the window.
   Nested Flightsim.to archives (zip in zip, rar, names with spaces) are fine.
2. Choose the aircraft and the variant the paint belongs to — the same
   name as in the sim (ERJ-190 LR, E75L STD, ERJ-190F AR, …).
   E175: E75L = long winglet, E75S = short. Freighters are AR only.
3. Click Convert — the new pack is written to Community2024.
   Textures are compiled to KTX2 with the bundled texconv (no MSFS SDK).
   Raw PNG does not override the fuselage in the sim.

The new pack is a paint, not a second aircraft. In the sim, pick the E-Jet
variant first (for example ERJ-190 LR), then pick your livery. The paint
only appears on the variant you pinned.

Custom overlay glTFs (livery decal meshes)
------------------------------------------
If your livery ships its own decal meshes (.gltf + .bin), the converter
migrates them automatically into `model.exterior/` and writes `livery.xml`.
Keep these rules in mind so MSFS 2024 loads the mesh cleanly:

1. Include the compiled `.gltf` and `.bin` inside the livery pack itself
   (for example in `model.<name>/` or `model.exterior/`). Do not only point
   at `..\..\E195\model.FSS\E195-FSS-Livery.gltf` or `E195-Europa-Livery.gltf`
   outside the pack — those old 2020 airframe overlays are not part of the
   base aircraft anymore. If your titles were painted on `DECALS_FSS` or
   `DECALS_EUROPA`, bake them onto `Fuselage_ALBD` or export your own decal
   mesh.
2. Ship a compiled MSFS glTF (`ASOBO_asset_optimized`), not a raw uncompiled
   Blender export. A 2020 package-built glTF works: the converter rewrites
   its image URIs from `.PNG.DDS` to `.png.ktx2` (`MSFT_texture_dds`) and
   converts every referenced decal texture into `texture.exterior/` as KTX2.
3. If your pack merges more than one custom glTF, the converter deduplicates
   colliding `ASOBO_unique_id` entries across the meshes automatically.
4. For a new native MSFS 2024 decal mesh from Blender, use the MSFS 2024
   glTF exporter (`ASOBO_material_geometry_decal` instead of the legacy 2020
   `ASOBO_material_blend_gbuffer`) and build it once through `fspackagetool`
   so the `.bin` and `.gltf` carry `ASOBO_asset_optimized`.

Notes
-----
- Extra overlay meshes the old pack shipped (any glTF inside the pack,
  however it was wired in model.cfg / MergeModel / a loose file) are copied
  into model.exterior and rewired to `.png.ktx2`. The airframe itself is not.
- Hangar thumbnails (`thumbnail/thumbnail.png`, `thumbnail_side.png`,
  `thumbnail_button.png`) are generated automatically from `thumbnail.jpg`.
- Titles that lived only on the old airframe overlay (no extra glTF in the
  pack) have to be painted onto the fuselage colour sheet.
- DDS and PNG are compressed with Microsoft texconv (DirectXTex, MIT licence)
  and wrapped as MSFS `.png.ktx2`. See vendor\DirectXTex-LICENSE.txt
- .rar / .7z are unpacked with bundled 7-Zip. See vendor\7zip-LICENSE.txt
- You do not need the MSFS SDK. We cannot ship Asobo's packagetool
  (SDK EULA); texconv plus the converter is the customer toolchain.
- A 2020 fuselage sheet may not match the 2024 unwrap. Titles that lived
  only on the old airframe overlay have to be painted onto the colour sheet.
