You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
Added a global event for when some package are migrated. This can be used for hotfixes and as extension point for systems to react or add stuff to the migration. Other changes that were required for the new migration: Level streaming is now aware that the world might be part of a instanced package. When it validate that file for the streamed world exist it will use the path from the package linker of the world package. The level postload function now prefer to use the Instancing Context package remapping from its linker to determine where it should load some of its external UActorFolder. The StringTableEditorModule was modified to be able to properly react to the migration. This change will still require some change in a future release to reduce its memory usage. #rb Francis.Hurteau #jira UE-162943, UE-161367, UE-161364, UE-161359, UE-161357, UE-161355, UE-161354, UE-145342 #preflight 6358419f2e6690262abbce83 #lockdown jeanmichel.dignard [CL 22798574 by julien stjean in ue5-main branch]
185 lines
6.0 KiB
C++
185 lines
6.0 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "Internationalization/Text.h"
|
|
#include "Containers/UnrealString.h"
|
|
#include "UObject/GCObject.h"
|
|
|
|
class UPackage;
|
|
class UAssetToolsImpl;
|
|
|
|
namespace UE::AssetTools
|
|
{
|
|
|
|
namespace Private
|
|
{
|
|
struct FPackageMigrationImpl;
|
|
}
|
|
|
|
struct ASSETTOOLS_API FPackageMigrationContext : public FGCObject
|
|
{
|
|
enum class EPackageMigrationStep;
|
|
|
|
EPackageMigrationStep GetCurrentStep() const;
|
|
|
|
// Notify the user that files where migrated. It should tell the user what was migrated and where it is in the destination.
|
|
void AddSucessfullMigrationMessage(const FText& InMessage);
|
|
|
|
// Notify the user that some asset may require some extra work to fully migrate
|
|
void AddWarningMigrationMessage(const FText& InMessage);
|
|
|
|
// Notify the user that some asset couldn't be migrated
|
|
void AddErrorMigrationMessage(const FText& InMessage);
|
|
|
|
struct FScopedMountPoint;
|
|
const FScopedMountPoint& GetDestinationMountPoint() const;
|
|
|
|
struct FMigrationPackageData;
|
|
// Return the data associated to a package that is migrated
|
|
const TArray<FMigrationPackageData>& GetMigrationPackagesData() const;
|
|
|
|
// Return the array of non instanced package where moved because they were in the way of the migration
|
|
const TArray<UPackage*>& GetMovedOutOfTheWayPackages() const;
|
|
|
|
enum class EPackageMigrationStep
|
|
{
|
|
// Called before the migration begin
|
|
BeginMigration,
|
|
// Called after the non external packages to migrate where processed
|
|
PostAssetMigrationPackageDataCreated,
|
|
// Called after the non external packages to migrate where processed
|
|
PostExternalMigrationPackageDataCreated,
|
|
// Called after all the package that might be in the way for the migration where move
|
|
InTheWayPackagesMoved,
|
|
// Called after the instanced package where created with their load linker setup being already set to load the right file
|
|
InstancedPackagesCreated,
|
|
// Called after the instanced package where loaded
|
|
InstancedPackagesLoaded,
|
|
// Called after the instanced package were saved into the destination
|
|
InstancedPackagesSaved,
|
|
// Called after the instanced package were removed
|
|
PostCleaningInstancedPackages,
|
|
// Called at the end of the migration. After the in the way package where restored but before the log is processed
|
|
EndMigration
|
|
};
|
|
|
|
// Utility to manage the temp mount point if needed and to help convert the paths during the migration
|
|
struct ASSETTOOLS_API FScopedMountPoint
|
|
{
|
|
public:
|
|
FScopedMountPoint() = delete;
|
|
FScopedMountPoint(const FScopedMountPoint&) = delete;
|
|
FScopedMountPoint& operator=(const FScopedMountPoint&) = delete;
|
|
|
|
FScopedMountPoint(FScopedMountPoint&&) = default;
|
|
FScopedMountPoint& operator=(FScopedMountPoint&&) = default;
|
|
|
|
const FString& GetRootPath() const;
|
|
const FString& GetContentPath() const;
|
|
|
|
FString GetMigratedPackageFilename(const FString& LongPackageName, const FStringView& InExtension) const;
|
|
|
|
// Get name of package when moved under the destination mount point
|
|
FString GetNewPackageNameForMigration(const FString& LongPackageName) const;
|
|
|
|
private:
|
|
friend UAssetToolsImpl;
|
|
friend FPackageMigrationContext;
|
|
friend UE::AssetTools::Private::FPackageMigrationImpl;
|
|
|
|
FScopedMountPoint(FString&& InRootPath, FString&& InContentPath);
|
|
~FScopedMountPoint();
|
|
|
|
FString RootPath;
|
|
FString ContentPath;
|
|
bool bHasMountedANewMountPoint = false;
|
|
};
|
|
|
|
// The data associated to an package that take part of the migration process.
|
|
struct ASSETTOOLS_API FMigrationPackageData
|
|
{
|
|
const FString& GetInstancedPackageName() const;
|
|
const FString& GetOriginalPackageName() const;
|
|
const FString& GetDestinationFilename() const;
|
|
|
|
UPackage* GetInstancedPackage() const;
|
|
|
|
// Tell the migration that package must be loaded
|
|
bool bNeedInstancedLoad = false;
|
|
|
|
// Tell the migration that the package must migrated by save
|
|
bool bNeedToBeSaveMigrated = false;
|
|
|
|
FMigrationPackageData(const FString& InInstancedPackageName, const FString& InOriginalPackageName, const FString& InDestinationFilename);
|
|
|
|
private:
|
|
friend UAssetToolsImpl;
|
|
friend FPackageMigrationContext;
|
|
friend UE::AssetTools::Private::FPackageMigrationImpl;
|
|
|
|
FString InstancedPackageName;
|
|
FString OriginalPackageName;
|
|
|
|
FString DestinationFilename;
|
|
UPackage* InstancedPackage = nullptr;
|
|
};
|
|
|
|
FPackageMigrationContext(const FPackageMigrationContext&) = delete;
|
|
FPackageMigrationContext(FPackageMigrationContext&&) = delete;
|
|
FPackageMigrationContext operator=(const FPackageMigrationContext&) = delete;
|
|
FPackageMigrationContext operator=(FPackageMigrationContext&&) = delete;
|
|
|
|
|
|
virtual void AddReferencedObjects( FReferenceCollector& Collector ) override;
|
|
|
|
virtual FString GetReferencerName() const override;
|
|
|
|
private:
|
|
|
|
friend UAssetToolsImpl;
|
|
friend UE::AssetTools::Private::FPackageMigrationImpl;
|
|
|
|
// Move a package out of the way for the duration of the migration
|
|
void MoveInTheWayPackage(UPackage* Package);
|
|
|
|
FPackageMigrationContext(FScopedMountPoint&& InMountPoint);
|
|
|
|
~FPackageMigrationContext() = default;
|
|
|
|
// Helper to move existing package out of the way during the migration
|
|
struct ASSETTOOLS_API FScopedTemporalyMovedPackage
|
|
{
|
|
public:
|
|
FScopedTemporalyMovedPackage(UPackage* InPackageToMove);
|
|
|
|
~FScopedTemporalyMovedPackage();
|
|
|
|
UPackage* PackageToMove = nullptr;
|
|
FString OriginalName;
|
|
};
|
|
|
|
EPackageMigrationStep CurrentStep;
|
|
|
|
// Message of the for the successfully migrated asset
|
|
TArray<FText> MigratedPackageMessages;
|
|
|
|
// Message to warn the user that some extra step may be required from him to complete the migration
|
|
TArray<FText> WarningMessage;
|
|
|
|
// General Error messages of the migration
|
|
TArray<FText> ErrorMessages;
|
|
|
|
FScopedMountPoint DestinationMountPoint;
|
|
|
|
// Helper for the package that were moved because they were in the way of migrated packages
|
|
TArray<FScopedTemporalyMovedPackage> TemporalyMovedPackages;
|
|
|
|
// The package that have been moved during the migration
|
|
TArray<UPackage*> PackagesThatWhereMoved;
|
|
|
|
// The data associated to the packages that take part of the migration process.
|
|
TArray<FMigrationPackageData> MigrationPackagesData;
|
|
};
|
|
|
|
} |