Solved importing for more that 1 package and avoid propmap creation if no props found
This commit is contained in:
parent
a9eafaba25
commit
b7c670f638
|
@ -88,6 +88,7 @@ TArray<AStaticMeshActor *> UCookAssetsCommandlet::AddMeshesToWorld(
|
||||||
}
|
}
|
||||||
|
|
||||||
AssetsObjectLibrary->AddToRoot();
|
AssetsObjectLibrary->AddToRoot();
|
||||||
|
AssetsObjectLibrary->ClearLoaded();
|
||||||
AssetsObjectLibrary->LoadAssetDataFromPaths(AssetsPathsDirectories);
|
AssetsObjectLibrary->LoadAssetDataFromPaths(AssetsPathsDirectories);
|
||||||
AssetsObjectLibrary->LoadAssetsFromAssetData();
|
AssetsObjectLibrary->LoadAssetsFromAssetData();
|
||||||
|
|
||||||
|
@ -133,7 +134,7 @@ TArray<AStaticMeshActor *> UCookAssetsCommandlet::AddMeshesToWorld(
|
||||||
return SpawnedMeshes;
|
return SpawnedMeshes;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UCookAssetsCommandlet::DestroyWorldSpawnedActors(TArray<AStaticMeshActor *> &SpawnedActors)
|
void UCookAssetsCommandlet::DestroySpawnedActorsInWorld(TArray<AStaticMeshActor *> &SpawnedActors)
|
||||||
{
|
{
|
||||||
for (auto Actor : SpawnedActors)
|
for (auto Actor : SpawnedActors)
|
||||||
{
|
{
|
||||||
|
@ -299,26 +300,32 @@ int32 UCookAssetsCommandlet::Main(const FString &Params)
|
||||||
SaveWorld(AssetData, PackageParams.Name, Map.Path, Map.Name);
|
SaveWorld(AssetData, PackageParams.Name, Map.Path, Map.Name);
|
||||||
|
|
||||||
// Remove spawned actors from world to keep equal as BaseMap
|
// Remove spawned actors from world to keep equal as BaseMap
|
||||||
DestroyWorldSpawnedActors(SpawnedActors);
|
DestroySpawnedActorsInWorld(SpawnedActors);
|
||||||
|
|
||||||
MapPathData.Append(Map.Path + TEXT("/") + Map.Name + TEXT("+"));
|
MapPathData.Append(Map.Path + TEXT("/") + Map.Name + TEXT("+"));
|
||||||
}
|
}
|
||||||
|
|
||||||
FString MapName("PropsMap");
|
if (AssetsPaths.PropsPaths.Num() > 0)
|
||||||
FString WorldDestPath = TEXT("/Game/") + PackageParams.Name +
|
{
|
||||||
TEXT("/Maps/") + MapName;
|
FString MapName("PropsMap");
|
||||||
|
FString WorldDestPath = TEXT("/Game/") + PackageParams.Name +
|
||||||
|
TEXT("/Maps/") + MapName;
|
||||||
|
|
||||||
MapPathData.Append(WorldDestPath + TEXT("/") + MapName);
|
MapPathData.Append(WorldDestPath + TEXT("/") + MapName);
|
||||||
|
|
||||||
// Save Map Path File for further use
|
// Save Map Path File for further use
|
||||||
FString SaveDirectory = FPaths::ProjectContentDir() + 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);
|
SaveStringTextToFile(SaveDirectory, FileName, MapPathData, true);
|
||||||
|
|
||||||
// Add props in a single Base Map
|
// Add props in a single Base Map
|
||||||
AddMeshesToWorld(AssetsPaths.PropsPaths, false);
|
TArray<AStaticMeshActor *> SpawnedActors = AddMeshesToWorld(AssetsPaths.PropsPaths, false);
|
||||||
|
|
||||||
SaveWorld(AssetData, PackageParams.Name, WorldDestPath, MapName);
|
SaveWorld(AssetData, PackageParams.Name, WorldDestPath, MapName);
|
||||||
|
|
||||||
|
DestroySpawnedActorsInWorld(SpawnedActors);
|
||||||
|
MapObjectLibrary->ClearLoaded();
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,7 +92,7 @@ public:
|
||||||
*/
|
*/
|
||||||
bool SaveWorld(FAssetData &AssetData, FString &PackageName, FString &DestPath, FString &WorldName);
|
bool SaveWorld(FAssetData &AssetData, FString &PackageName, FString &DestPath, FString &WorldName);
|
||||||
|
|
||||||
void DestroyWorldSpawnedActors(TArray<AStaticMeshActor *> &SpawnedActors);
|
void DestroySpawnedActorsInWorld(TArray<AStaticMeshActor *> &SpawnedActors);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Path of all the Assets contained in the package to cook
|
* Get Path of all the Assets contained in the package to cook
|
||||||
|
|
|
@ -234,13 +234,13 @@ def import_assets_from_json_list(json_list):
|
||||||
import_assets(package_name, dirname, props, maps)
|
import_assets(package_name, dirname, props, maps)
|
||||||
move_uassets(package_name, maps)
|
move_uassets(package_name, maps)
|
||||||
|
|
||||||
if not package_name:
|
if not package_name:
|
||||||
print("No Packages JSONs found, nothing to import. Exiting.")
|
print("No Packages JSONs found, nothing to import. Skipping package.")
|
||||||
exit(0)
|
continue
|
||||||
|
|
||||||
# Prepare cooking of package
|
# Prepare cooking of package
|
||||||
prepare_cook_commandlet(package_name)
|
prepare_cook_commandlet(package_name)
|
||||||
print() # Fixes a ugly artifact after the commandlet output
|
print() # Fixes a ugly artifact after the commandlet output
|
||||||
|
|
||||||
|
|
||||||
def move_uassets(package_name, maps):
|
def move_uassets(package_name, maps):
|
||||||
|
|
Loading…
Reference in New Issue