Fixed strange deletion and saving order

This commit is contained in:
Michele Bianchi 2020-01-16 18:06:51 +09:00 committed by Marc Garcia Puig
parent bac38b5339
commit dcc299cfb6
2 changed files with 0 additions and 22 deletions

View File

@ -89,12 +89,6 @@ void MoveFiles(const TArray<UObject *> &Assets, const FString &DestPath)
new(AssetsAndNames) FAssetRenameData(Asset, DestPath, Asset->GetName()); new(AssetsAndNames) FAssetRenameData(Asset, DestPath, Asset->GetName());
} }
std::cerr << "These are the assets we are going to move: " << std::endl;
for (const auto& asset: AssetsAndNames) {
std::cerr << "\tFrom: " << TCHAR_TO_ANSI(*asset.OldObjectPath.GetAssetPathString()) << std::endl;
std::cerr << "\tTo: " << TCHAR_TO_ANSI(*asset.NewObjectPath.GetAssetPathString()) << std::endl;
}
if (AssetsAndNames.Num() > 0) if (AssetsAndNames.Num() > 0)
{ {
AssetToolsModule.Get().RenameAssetsWithDialog(AssetsAndNames); AssetToolsModule.Get().RenameAssetsWithDialog(AssetsAndNames);
@ -124,7 +118,6 @@ void UMoveAssetsCommandlet::MoveAssetsFromMapForSemanticSegmentation(
AssetDataMap.Add(Paths, {}); AssetDataMap.Add(Paths, {});
} }
std::cerr << "Time to move " << MapContents.Num() << " assets." << std::endl;
for (const auto &MapAsset : MapContents) for (const auto &MapAsset : MapContents)
{ {
@ -135,17 +128,12 @@ void UMoveAssetsCommandlet::MoveAssetsFromMapForSemanticSegmentation(
FString AssetName; FString AssetName;
MapAsset.AssetName.ToString(AssetName); MapAsset.AssetName.ToString(AssetName);
std::cerr << "Moving Object: " << TCHAR_TO_ANSI(*ObjectName) << std::endl;
std::cerr << "Moving Asset: " << TCHAR_TO_ANSI(*AssetName) << std::endl;
if (SrcPath.Len()) if (SrcPath.Len())
{ {
const FString CurrentPackageName = MeshAsset->GetOutermost()->GetName(); const FString CurrentPackageName = MeshAsset->GetOutermost()->GetName();
std::cerr << "Package name: " << TCHAR_TO_ANSI(*CurrentPackageName) << std::endl;
std::cerr << "Source path: " << TCHAR_TO_ANSI(*SrcPath) << std::endl;
if (!ensure(CurrentPackageName.StartsWith(SrcPath))) if (!ensure(CurrentPackageName.StartsWith(SrcPath)))
{ {
continue; continue;
@ -172,7 +160,6 @@ void UMoveAssetsCommandlet::MoveAssetsFromMapForSemanticSegmentation(
for (const auto &Elem : AssetDataMap) for (const auto &Elem : AssetDataMap)
{ {
FString DestPath = TEXT("/Game/") + PackageName + TEXT("/Static/") + Elem.Key + "/" + MapName; FString DestPath = TEXT("/Game/") + PackageName + TEXT("/Static/") + Elem.Key + "/" + MapName;
std::cerr << "Now moving all " << TCHAR_TO_ANSI(*Elem.Key) << " to " << TCHAR_TO_ANSI(*DestPath) << std::endl;
MoveFiles(Elem.Value, DestPath); MoveFiles(Elem.Value, DestPath);
} }
} }

View File

@ -222,10 +222,6 @@ bool UPrepareAssetsForCookingCommandlet::SaveWorld(
SavePackage(PackagePath, Package); SavePackage(PackagePath, Package);
} }
#if WITH_EDITOR
UEditorLoadingAndSavingUtils::SaveMap(World, PackagePath);
#endif
return bPackageSaved; return bPackageSaved;
} }
@ -320,11 +316,6 @@ bool UPrepareAssetsForCookingCommandlet::SavePackage(const FString &PackagePath,
FString PackageFileName = FPackageName::LongPackageNameToFilename(PackagePath, FString PackageFileName = FPackageName::LongPackageNameToFilename(PackagePath,
FPackageName::GetMapPackageExtension()); FPackageName::GetMapPackageExtension());
if (FPaths::FileExists(*PackageFileName))
{
// Will not save package if it already exists
return false;
}
return UPackage::SavePackage(Package, World, EObjectFlags::RF_Public | EObjectFlags::RF_Standalone, return UPackage::SavePackage(Package, World, EObjectFlags::RF_Public | EObjectFlags::RF_Standalone,
*PackageFileName, GError, nullptr, true, true, SAVE_NoError); *PackageFileName, GError, nullptr, true, true, SAVE_NoError);
} }