From 978019be323e1775ef5f9152e3e117e2550293b9 Mon Sep 17 00:00:00 2001
From: Daniel Novillo <46670770+dnovillo-CVC@users.noreply.github.com>
Date: Tue, 11 Jun 2019 17:07:45 +0200
Subject: [PATCH] Fix prop loading on packaged builds (#1717)
---
Docs/export_import_dist.md | 4 ++--
Util/BuildTools/ExportFBX.sh | 10 ++++++++++
Util/BuildTools/Package.sh | 4 ++--
Util/{ImportMaps.sh => ImportAssets.sh} | 4 ++--
4 files changed, 16 insertions(+), 6 deletions(-)
rename Util/{ImportMaps.sh => ImportAssets.sh} (85%)
diff --git a/Docs/export_import_dist.md b/Docs/export_import_dist.md
index ca2362d64..2ded17a32 100644
--- a/Docs/export_import_dist.md
+++ b/Docs/export_import_dist.md
@@ -38,11 +38,11 @@ the project's root.
How to import a map
In order to do so, the file generated in the import phase has to be placed in a folder
-at the root of the distributed folder called "ExportedMaps". Once the zip is placed there,
+at the root of the distributed folder called "ExportedAssets". Once the zip is placed there,
by running
```sh
-./ImportMaps.sh
+./ImportAssets.sh
```
the content will get extracted and located properly where the executable can reach it. All
diff --git a/Util/BuildTools/ExportFBX.sh b/Util/BuildTools/ExportFBX.sh
index c309a7a93..388b1bac4 100755
--- a/Util/BuildTools/ExportFBX.sh
+++ b/Util/BuildTools/ExportFBX.sh
@@ -89,6 +89,16 @@ popd >/dev/null
DESTINATION=${BUILD_FOLDER}/${FILE_NAME}.tar.gz
SOURCE=${BUILD_FOLDER}/Cooked
+FILES=$(find ${CARLAUE4_ROOT_FOLDER}/Content -type f -name "*PropRegistry.json")
+
+mkdir -p ${SOURCE}/CarlaUE4/Content/Carla/Config
+for file in $FILES
+do
+ A="$(echo $file | grep -o 'Content\/.*' | cut -f2 -d/)"
+ mkdir -p ${SOURCE}/CarlaUE4/Content/${A}/Config
+ cp -rf $file ${SOURCE}/CarlaUE4/Content/${A}/Config
+done
+
pushd "${SOURCE}" >/dev/null
log "Packaging build."
diff --git a/Util/BuildTools/Package.sh b/Util/BuildTools/Package.sh
index c27474ec1..9f0c8ffb6 100755
--- a/Util/BuildTools/Package.sh
+++ b/Util/BuildTools/Package.sh
@@ -92,7 +92,7 @@ if $DO_COPY_FILES ; then
pushd ${CARLA_ROOT_FOLDER} >/dev/null
- mkdir -p "${DESTINATION}/ExportedMaps"
+ mkdir -p "${DESTINATION}/ExportedAssets"
echo "${REPOSITORY_TAG}" > ${DESTINATION}/VERSION
@@ -101,7 +101,7 @@ if $DO_COPY_FILES ; then
copy_if_changed "./Docs/release_readme.md" "${DESTINATION}/README"
copy_if_changed "./Docs/python_api.md" "${DESTINATION}/PythonAPI/python_api.md"
copy_if_changed "./Util/Docker/Release.Dockerfile" "${DESTINATION}/Dockerfile"
- copy_if_changed "./Util/ImportMaps.sh" "${DESTINATION}/ImportMaps.sh"
+ copy_if_changed "./Util/ImportAssets.sh" "${DESTINATION}/ImportAssets.sh"
copy_if_changed "./PythonAPI/carla/dist/*.egg" "${DESTINATION}/PythonAPI/carla/dist/"
copy_if_changed "./PythonAPI/carla/agents/" "${DESTINATION}/PythonAPI/carla/agents"
diff --git a/Util/ImportMaps.sh b/Util/ImportAssets.sh
similarity index 85%
rename from Util/ImportMaps.sh
rename to Util/ImportAssets.sh
index 2189cc1c2..c603e7594 100755
--- a/Util/ImportMaps.sh
+++ b/Util/ImportAssets.sh
@@ -4,7 +4,7 @@
# -- Parse arguments -----------------------------------------------------------
# ==============================================================================
-DOC_STRING="Unpack and copy over CarlaUE4's Exported Maps"
+DOC_STRING="Unpack and copy over CarlaUE4's Exported Assets"
USAGE_STRING="Usage: $0 [-h|--help] [-d|--dir] "
@@ -32,7 +32,7 @@ while true; do
done
#Tar.gz the stuff
-for filepath in `find ExportedMaps/ -type f -name "*.tar.gz"`; do
+for filepath in `find ExportedAssets/ -type f -name "*.tar.gz"`; do
tar --keep-newer-files -xvf ${filepath}
done