Correctly preparing assets for cooking on package

This commit is contained in:
Marc Garcia Puig 2019-07-09 12:30:17 +02:00 committed by Néstor Subirón
parent 6eab6969f1
commit 0afdfbbeea
2 changed files with 17 additions and 19 deletions

View File

@ -216,7 +216,6 @@ def import_assets(package_name, json_dirname, props, maps):
generate_package_file(package_name, props, maps)
def import_assets_from_json_list(json_list):
maps = []
package_name = ""
@ -237,10 +236,6 @@ def import_assets_from_json_list(json_list):
print("No Packages JSONs found, nothing to import. Skipping package.")
continue
# Prepare cooking of package
prepare_cook_commandlet(package_name)
print() # Fixes a ugly artifact after the commandlet output
def move_uassets(package_name, maps):
for umap in maps:
@ -270,13 +265,6 @@ def move_uassets(package_name, maps):
shutil.move(os.path.join(origin_path, filename), os.path.join(terrain_dir, filename))
def prepare_cook_commandlet(package_name):
commandlet_name = "PrepareAssetsForCooking"
commandlet_arguments = "-PackageName=%s" % package_name
invoke_commandlet(commandlet_name, commandlet_arguments)
def main():
import_folder = os.path.join(CARLA_ROOT_PATH, "Import")
json_list = get_packages_json_list(import_folder)

View File

@ -13,6 +13,7 @@ USAGE_STRING="Usage: $0 [-h|--help] [--no-zip] [--clean-intermediate] [--package
PACKAGES="Carla"
DO_TARBALL=true
DO_CLEAN_INTERMEDIATE=false
PROPS_MAP_NAME=PropsMap
OPTS=`getopt -o h --long help,no-zip,clean-intermediate,packages: -n 'parse-options' -- "$@"`
@ -197,20 +198,29 @@ for PACKAGE_NAME in "${PACKAGES[@]}" ; do if [[ ${PACKAGE_NAME} != "Carla" ]] ;
mkdir -p ${BUILD_FOLDER}
PACKAGE_FILE=${PACKAGE_PATH}/Config/${PACKAGE_NAME}.Package.json
MAP_LIST_FILE=${PACKAGE_PATH}/Config/MapPaths.txt
MAPS_TO_COOK=$(<${MAP_LIST_FILE})
log "Cooking package '${PACKAGE_NAME}'..."
pushd "${CARLAUE4_ROOT_FOLDER}" > /dev/null
# Prepare cooking of package
${UE4_ROOT}/Engine/Binaries/Linux/UE4Editor "${CARLAUE4_ROOT_FOLDER}/CarlaUE4.uproject" \
-run=PrepareAssetsForCooking -PackageName=${PACKAGE_NAME}
PACKAGE_FILE=${PACKAGE_PATH}/Config/${PACKAGE_NAME}.Package.json
MAP_LIST_FILE=${PACKAGE_PATH}/Config/MapPaths.txt
MAPS_TO_COOK=$(<${MAP_LIST_FILE})
# Cook maps
${UE4_ROOT}/Engine/Binaries/Linux/UE4Editor "${CARLAUE4_ROOT_FOLDER}/CarlaUE4.uproject" \
-run=cook -map="${MAPS_TO_COOK}" -cooksinglepackage -targetplatform="LinuxNoEditor" \
-OutputDir="${BUILD_FOLDER}"
PROP_MAP_FOLDER="${PACKAGE_PATH}/Maps/${PROPS_MAP_NAME}"
if [ -d ${PROP_MAP_FOLDER} ] ; then
rm -Rf ${PROP_MAP_FOLDER}
fi
popd >/dev/null
if ${DO_TARBALL} ; then
@ -233,7 +243,7 @@ for PACKAGE_NAME in "${PACKAGES[@]}" ; do if [[ ${PACKAGE_NAME} != "Carla" ]] ;
MAP_NAME=${XODR_FILE_PATH##*/}
XODR_FILE_PATH=${XODR_FILE_PATH%/*}/OpenDrive/${MAP_NAME}.xodr
if [ -f "$XODR_FILE_PATH" ] ; then
if [ -f "${XODR_FILE_PATH}" ] ; then
OUT_XODR_DIR="${BUILD_FOLDER}/CarlaUE4/Content/${PACKAGE_NAME}/Maps/${MAP_NAME}/OpenDrive/"
# Create the xodr out folder if does not exist
@ -248,7 +258,7 @@ for PACKAGE_NAME in "${PACKAGES[@]}" ; do if [[ ${PACKAGE_NAME} != "Carla" ]] ;
rm -Rf "./CarlaUE4/Metadata"
rm -Rf "./CarlaUE4/Plugins"
rm -Rf "./CarlaUE4/Content/${PACKAGE_NAME}/Maps/PropsMap"
rm -Rf "./CarlaUE4/Content/${PACKAGE_NAME}/Maps/${PROPS_MAP_NAME}"
rm -f "./CarlaUE4/AssetRegistry.bin"
tar -czvf ${DESTINATION} *