Ignoring OpenDrive in 'PropsMap' & fixed MapPaths

This commit is contained in:
Marc Garcia Puig 2019-06-27 15:05:39 +02:00 committed by Néstor Subirón
parent 7f2ad73d02
commit b3537a5df1
2 changed files with 15 additions and 11 deletions

View File

@ -146,12 +146,17 @@ bool UCookAssetsCommandlet::SaveWorld(FAssetData &AssetData, FString &DestPath,
World->MarkPackageDirty(); World->MarkPackageDirty();
World->GetOuter()->MarkPackageDirty(); World->GetOuter()->MarkPackageDirty();
// Filling the map stuff (Code only applied for maps) // @TODO: find a better solution
AOpenDriveActor *OpenWorldActor = // Hardcoded so it will ignore the PropMaps umap that doesn't contains OpenDrive info
CastChecked<AOpenDriveActor>(World->SpawnActor(AOpenDriveActor::StaticClass(), if (World->GetName() != "PropsMap")
new FVector(), NULL)); {
OpenWorldActor->BuildRoutes(WorldName); // Filling the map stuff (Code only applied for maps)
OpenWorldActor->AddSpawners(); AOpenDriveActor *OpenWorldActor =
CastChecked<AOpenDriveActor>(World->SpawnActor(AOpenDriveActor::StaticClass(),
new FVector(), NULL));
OpenWorldActor->BuildRoutes(WorldName);
OpenWorldActor->AddSpawners();
}
// Saving the package // Saving the package
FString PackageFileName = FPackageName::LongPackageNameToFilename(PackageName, FString PackageFileName = FPackageName::LongPackageNameToFilename(PackageName,
@ -267,11 +272,9 @@ int32 UCookAssetsCommandlet::Main(const FString &Params)
} }
// Save Map Path File for further use // Save Map Path File for further use
FString SaveDirectory = FString("/Game/") + PackageParams.Name + TEXT("/Config"); FString SaveDirectory = FPaths::ProjectContentDir() + PackageParams.Name + TEXT("/Config");
FString FileName = FString("MapPaths.txt"); FString FileName = FString("MapPaths.txt");
SaveStringTextToFile(SaveDirectory, FileName, MapPathData, true);
// TODO: This throws a weird error when saving, we need to fix it
// SaveStringTextToFile(SaveDirectory, FileName, MapPathData, true);
// Add props in a single Base Map // Add props in a single Base Map
AddMeshesToWorld(AssetsPaths.PropsPaths, false); AddMeshesToWorld(AssetsPaths.PropsPaths, false);

View File

@ -21,6 +21,7 @@ import subprocess
# Global variables # Global variables
IMPORT_SETTING_FILENAME = "importsetting.json" IMPORT_SETTING_FILENAME = "importsetting.json"
SCRIPT_NAME = os.path.basename(__file__)
@contextmanager @contextmanager
@ -57,7 +58,7 @@ def invoke_commandlet(name, arguments):
editor_path = "%s/Engine/Binaries/%s/UE4Editor" % (ue4_path, sys_name) editor_path = "%s/Engine/Binaries/%s/UE4Editor" % (ue4_path, sys_name)
uproject_path = os.path.join(os.getcwd(), "..", "Unreal", "CarlaUE4", "CarlaUE4.uproject") uproject_path = os.path.join(os.getcwd(), "..", "Unreal", "CarlaUE4", "CarlaUE4.uproject")
full_command = "%s %s -run=%s %s" % (editor_path, uproject_path, name, arguments) full_command = "%s %s -run=%s %s" % (editor_path, uproject_path, name, arguments)
print("\nRunning command:\n$ " + full_command + '\n') print("\n[" + str(SCRIPT_NAME) + "] Running command:\n$ " + full_command + '\n')
subprocess.check_call([full_command], shell=True) subprocess.check_call([full_command], shell=True)