Fixed bugs

- All actors from all maps where spawned in each map
- World was completely dark when playing imported map
This commit is contained in:
Manish 2019-07-08 14:52:38 +02:00 committed by Néstor Subirón
parent f3bfb0c05b
commit c036bc75d9
3 changed files with 24 additions and 20 deletions

View File

@ -66,7 +66,8 @@ void UCookAssetsCommandlet::LoadWorld(FAssetData &AssetData)
TArray<AStaticMeshActor *> UCookAssetsCommandlet::AddMeshesToWorld(
const TArray<FString> &AssetsPaths,
bool bUseCarlaMaterials)
bool bUseCarlaMaterials,
bool bIsPropsMap)
{
TArray<AStaticMeshActor *> SpawnedMeshes;
@ -74,21 +75,21 @@ TArray<AStaticMeshActor *> UCookAssetsCommandlet::AddMeshesToWorld(
// Remove the meshes names from the original path, so LoadAssetDataFromPaths
// can be used
TArray<FString> AssetsPathsDirectories;
for (auto AssetPath : AssetsPaths)
TArray<FString> AssetsPathsDirectories = AssetsPaths;
if (bIsPropsMap)
{
FString Dir;
AssetPath.Split(
TEXT("/"),
&Dir,
nullptr,
ESearchCase::Type::IgnoreCase,
ESearchDir::Type::FromEnd);
AssetsPathsDirectories.Add(Dir);
for (auto &AssetPath : AssetsPathsDirectories)
{
AssetPath.Split(
TEXT("/"),
&AssetPath,
nullptr,
ESearchCase::Type::IgnoreCase,
ESearchDir::Type::FromEnd);
}
}
AssetsObjectLibrary->AddToRoot();
AssetsObjectLibrary->ClearLoaded();
AssetsObjectLibrary->LoadAssetDataFromPaths(AssetsPathsDirectories);
AssetsObjectLibrary->LoadAssetsFromAssetData();
@ -129,6 +130,7 @@ TArray<AStaticMeshActor *> UCookAssetsCommandlet::AddMeshesToWorld(
}
}
}
AssetsObjectLibrary->ClearLoaded();
World->MarkPackageDirty();
return SpawnedMeshes;
@ -313,13 +315,8 @@ int32 UCookAssetsCommandlet::Main(const FString &Params)
MapPathData.Append(WorldDestPath + TEXT("/") + MapName);
// Save Map Path File for further use
FString SaveDirectory = FPaths::ProjectContentDir() + PackageParams.Name + TEXT("/Config");
FString FileName = FString("MapPaths.txt");
SaveStringTextToFile(SaveDirectory, FileName, MapPathData, true);
// Add props in a single Base Map
TArray<AStaticMeshActor *> SpawnedActors = AddMeshesToWorld(AssetsPaths.PropsPaths, false);
TArray<AStaticMeshActor *> SpawnedActors = AddMeshesToWorld(AssetsPaths.PropsPaths, false, true);
SaveWorld(AssetData, PackageParams.Name, WorldDestPath, MapName);
@ -327,6 +324,10 @@ int32 UCookAssetsCommandlet::Main(const FString &Params)
MapObjectLibrary->ClearLoaded();
}
// Save Map Path File for further use
FString SaveDirectory = FPaths::ProjectContentDir() + PackageParams.Name + TEXT("/Config");
FString FileName = FString("MapPaths.txt");
SaveStringTextToFile(SaveDirectory, FileName, MapPathData, true);
return 0;
}
#endif

View File

@ -82,7 +82,10 @@ public:
* materials to fix a known bug
* in RoadRunner.
*/
TArray<AStaticMeshActor *> AddMeshesToWorld(const TArray<FString> &AssetsPaths, bool bUseCarlaMaterials);
TArray<AStaticMeshActor *> AddMeshesToWorld(
const TArray<FString> &AssetsPaths,
bool bUseCarlaMaterials,
bool bIsPropsMap = false);
/**
* Save a given Asset containing a World into a given path with a given name.

View File

@ -32,7 +32,7 @@ while true; do
done
#Tar.gz the stuff
for filepath in `find ExportedAssets/ -type f -name "*.tar.gz"`; do
for filepath in `find Import/ -type f -name "*.tar.gz"`; do
tar --keep-newer-files -xvf ${filepath}
done