Merging WED's overlay-only DSFs with Ortho4XP constructed DSFs

By Ryan Romanchuk
On

The problem

  1. Exporting from WED exports a binary dsf file with embedded property sim/overlay 1. Import ignores and drops all other valid properties to the spec besides overlay definitions.
  2. There is no easy way to version control or collaborate across the full spec as WED obfuscates it's internal state via the xml and directly writes to binary dsf

Brute forcing your way back to the rendering engine

Use DSFTool to merge your layout-only dsf from WED with n+1 other .dsf files using DSFTool --dsf2text layout.dsf mesh.dsf combined.txt This process is not automatic, so it requires taking the resulting text file and manually removing sim/overlay def and de-duplicating and moving PROPERTY headers according to spec.

#!/usr/bin/env bash
set -euxo pipefail;

MESH=/Volumes/ryan_exfat/O4XP/Simventure_BASE_MESH/Earth\ nav\ data/+40-090
OVERLAY=/Volumes/ryan_exfat/O4XP/yOrtho4XP_Overlays/Earth\ nav\ data/+40-090

WED_EARTH_NAV=~/X-Plane\ 11/Custom\ Scenery/KOSH\ Final\ MASTER/Earth\ nav\ data
WED_DSF="$WED_EARTH_NAV"/+40-090

FINAL_EARTH_NAV=~/X-Plane\ 11/Custom\ Scenery/Simventure2021/Earth\ nav\ data
FINAL_DSF="$FINAL_EARTH_NAV"/+40-090

ls -lah "$MESH"
ls -lah "$OVERLAY"
ls -lah "$WED_DSF"
ls -lah "$FINAL_DSF"

read -n 1 -p "Combine?"
#./DSFTool --dsf2text "$MESH"/+43-089.dsf "$OVERLAY"/+43-089.dsf "$WED_DSF"/+43-089.dsf 4389.txt
./DSFTool --dsf2text "$MESH"/+43-089.dsf "$WED_DSF"/+43-089.dsf 4389.txt
head -n20 4389.txt
sed -i.bak -e '1,3d' -e '/^PROPERTY/d' 4389.txt

./DSFTool --dsf2text "$MESH"/+43-090.dsf  "$OVERLAY"/+43-090.dsf "$WED_DSF"/+43-090.dsf 4390.txt
head -n20 4390.txt
sed -i.bak -e '1,3d' -e '/^PROPERTY/d' 4390.txt

./DSFTool --dsf2text "$MESH"/+44-089.dsf "$OVERLAY"/+43-090.dsf "$WED_DSF"/+44-089.dsf 4489.txt
head -n20 4489.txt
sed -i.bak -e '1,3d' -e '/^PROPERTY/d' 4489.txt

cat << EOF > 4389.out.txt
A
800
DSF2TEXT

PROPERTY sim/planet earth
PROPERTY sim/creation_agent WorldEditor2.3.1r1
PROPERTY laminar/internal_revision 0
PROPERTY sim/filter/aptid KOSH
PROPERTY sim/filter/aptid WS17

PROPERTY sim/west -89
PROPERTY sim/east -88
PROPERTY sim/south 43
PROPERTY sim/north 44

EOF
cat 4389.txt >> 4389.out.txt
rm 4389.txt

cat << EOF > 4390.out.txt
A
800
DSF2TEXT

PROPERTY sim/planet earth
PROPERTY sim/creation_agent WorldEditor2.3.1r1
PROPERTY laminar/internal_revision 0

PROPERTY sim/west -90
PROPERTY sim/east -89
PROPERTY sim/south 43
PROPERTY sim/north 44
EOF
cat 4390.txt >> 4390.out.txt
rm 4390.txt

cat << EOF > 4489.out.txt
A
800
DSF2TEXT

PROPERTY sim/planet earth
PROPERTY sim/creation_agent WorldEditor2.3.1r1
PROPERTY laminar/internal_revision 0

PROPERTY sim/west -89
PROPERTY sim/east -88
PROPERTY sim/south 44
PROPERTY sim/north 45
EOF
cat 4489.txt >> 4489.out.txt
rm 4489.txt

read  -n 1 -p "Publish?"
rm -rf "$FINAL_DSF"/*
mv "$WED_EARTH_NAV"/apt.dat "$FINAL_EARTH_NAV"/apt.dat
rm -rf "$WED_EARTH_NAV"/*


read  -n 1 -p "export 4389 base mesh?"
./DSFTool --text2dsf 4389.out.txt +43-089.dsf
./DSFTool --text2dsf 4390.out.txt +43-090.dsf
./DSFTool --text2dsf 4489.out.txt +44-089.dsf

# ./DSFTool --text2dsf 4389.out.txt "$FINAL_DSF"/+43-089.dsf
# read  -n 1 -p "export 4390 base mesh?"
# ./DSFTool --text2dsf 4390.out.txt "$FINAL_DSF"/+43-090.dsf
# read  -n 1 -p "export 4489 base mesh?"
# ./DSFTool --text2dsf 4489.out.txt "$FINAL_DSF"/+44-089.dsf

read  -n 1 -p "Clean up?"
rm *.txt *.bak
talk