Improved naming

Added support for importing multiple files
This commit is contained in:
Daniel Novillo Villarejo 2019-01-24 12:57:14 +01:00 committed by nsubiron
parent 0730688e48
commit 56fc04e490
8 changed files with 68 additions and 12 deletions

View File

@ -0,0 +1,41 @@
<h1>Importing and exporting maps for distribution builds</h1>
!!! important
The given scripts only works if the files are kept in the folders
detailed below and on Linux.
This method and its scripts are aimed to reducing the size of the distribution
build, allowing to import maps on distributed builds with a script, exporting
them with yet another script from the editor.
<h4>How to export a map</h4>
The current script only work for content placed into the
"CarlaRoot/Unreal/CarlaUE4/Content/Carla/ExportedMaps" folder, inside the unreal's project
structure. Once all the changes are saved in the editor and the maps to export
are located in that folder, running
```sh
make export-maps
```
will clean, cook and pack the necessary assets with the maps. Please, note that
there is no way of knowing what assets are on the project-to-import-to, so the
final package will usually contain assets needed for the current project to work
even though they might not be directly used in the exported map. Also, the maps
referenced inside the Editor Properties will be exported due to the current way
of cooking provided by Unreal.
Once the script is completed, the packed file can be found under ExportedMaps in
the project's root.
<h4>How to import a map</h4>
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,
by running
```sh
./ImportMaps.sh
```
the content will get extracted and located properly where the executable can reach it. All
the imported maps can be loaded by passing the convenient argument to the CarlaUE4.sh script.

View File

@ -26,6 +26,7 @@
* [Running in a Docker](carla_docker.md)
* [How to make a new map with RoadRunner](how_to_make_a_new_map.md)
* [How to link Epic's Automotive Materials](epic_automotive_materials.md)
* [How to export and import maps to distribution builds](export_import_dist.md)
<h3>Contributing</h3>

View File

@ -119,6 +119,13 @@ if ${BUILD_CARLAUE4} ; then
log "Build CarlaUE4 project."
make CarlaUE4Editor
#Providing the user with the ExportedMaps folder
EXPORTED_MAPS="${CARLAUE4_ROOT_FOLDER}/Content/Carla/ExportedMaps"
if [ ! -d "${EXPORTED_MAPS}" ]; then
mkdir "${EXPORTED_MAPS}"
fi
fi
# ==============================================================================

View File

@ -16,7 +16,7 @@ fi
# -- Parse arguments -----------------------------------------------------------
# ==============================================================================
DOC_STRING="Build and packs CarlaUE4's UserContent"
DOC_STRING="Build and packs CarlaUE4's ExportedMaps"
USAGE_STRING="Usage: $0 [-h|--help] [-d|--dir] <outdir> [-f|--file] <filename>"
@ -48,10 +48,10 @@ while true; do
done
if [ -z "${OUTPUT_DIRECTORY}" ]; then
OUTPUT_DIRECTORY="${PWD}/UserContent"
OUTPUT_DIRECTORY="${PWD}/ExportedMaps"
fi
if [ -z "${FILE_NAME}" ]; then
FILE_NAME="CookedUserContent"
FILE_NAME="CookedExportedMaps"
fi
# ==============================================================================
@ -74,7 +74,7 @@ log "Current project directory: '${PWD}'"
MAP_LIST=""
for filepath in `find ${PWD}/Content/ -type f -name "*.umap"`; do
if [[ $filepath == *"/UserContent/"* ]]; then
if [[ $filepath == *"/ExportedMaps/"* ]]; then
filepath="/Game/"${filepath#"${PWD}/Content/"}
if [ -z "${MAP_LIST}" ]; then
MAP_LIST=$filepath
@ -138,5 +138,5 @@ rm -Rf ${BUILD_FOLDER}/LinuxNoEditor
# -- ...and we are done --------------------------------------------------------
# ==============================================================================
log "UserContent created at ${DESTINATION}"
log "ExportedMaps created at ${DESTINATION}"
log "Success!"

View File

@ -32,8 +32,8 @@ hard-clean:
@${CARLA_BUILD_TOOLS_FOLDER}/BuildLibCarla.sh --clean
@echo "To force recompiling dependencies run: rm -Rf ${CARLA_BUILD_FOLDER}"
build-usercontent:
@${CARLA_BUILD_TOOLS_FOLDER}/BuildUserContentUE4.sh ${ARGS}
export-maps:
@${CARLA_BUILD_TOOLS_FOLDER}/ExportMaps.sh ${ARGS}
check: LibCarla PythonAPI
@${CARLA_BUILD_TOOLS_FOLDER}/Check.sh --all $(ARGS)

View File

@ -93,7 +93,7 @@ if $DO_COPY_FILES ; then
pushd ${CARLA_ROOT_FOLDER} >/dev/null
mkdir "${DESTINATION}/UserContent"
mkdir "${DESTINATION}/ExportedMaps"
copy_if_changed "./LICENSE" "${DESTINATION}/LICENSE"
copy_if_changed "./CHANGELOG.md" "${DESTINATION}/CHANGELOG"
@ -109,7 +109,7 @@ if $DO_COPY_FILES ; then
copy_if_changed "./PythonAPI/spawn_npc.py" "${DESTINATION}/spawn_npc.py"
copy_if_changed "./PythonAPI/tutorial.py" "${DESTINATION}/tutorial.py"
copy_if_changed "./PythonAPI/vehicle_gallery.py" "${DESTINATION}/vehicle_gallery.py"
copy_if_changed "./Util/InjectUserContent.sh" "${DESTINATION}/InjectUserContent.sh"
copy_if_changed "./Util/ImportMaps.sh" "${DESTINATION}/ImportMaps.sh"
popd >/dev/null

12
Util/InjectUserContent.sh → Util/ImportMaps.sh Normal file → Executable file
View File

@ -16,7 +16,7 @@ fi
# -- Parse arguments -----------------------------------------------------------
# ==============================================================================
DOC_STRING="Unpack and copy over CarlaUE4's UserContent"
DOC_STRING="Unpack and copy over CarlaUE4's Exported Maps"
USAGE_STRING="Usage: $0 [-h|--help] [-d|--dir] <outdir> [-f|--file] <filename>"
@ -47,6 +47,12 @@ while true; do
esac
done
#Tar.gz the stuff
tar --keep-newer-files -xvf UserContent/CookedUserContent.tar.gz
if [ -z "${FILE_NAME}" ]; then
FILE_NAME="CookedExportedMaps"
fi
#Tar.gz the stuff
for filepath in `find ExportedMaps/ -type f -name "*.tar.gz"`; do
tar --keep-newer-files -xvf ExportedMaps/${filepath}.tar.gz
done

View File

@ -21,6 +21,7 @@ pages:
- 'Running in a Docker': 'carla_docker.md'
- "How to make a new map with RoadRunner": 'how_to_make_a_new_map.md'
- "How to link Epic's Automotive Materials": 'epic_automotive_materials.md'
- "How to export and import maps to distribution builds": 'export_import_dist.md'
- Contributing:
- 'Contribution guidelines': 'CONTRIBUTING.md'
- 'Coding standard': 'coding_standard.md'