You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
Add a special check for persisting deleted assets.
#jira UE-133226 #rb francis.hurteau #ROBOMERGE-AUTHOR: jason.walter #ROBOMERGE-SOURCE: CL 18309060 in //UE5/Release-5.0/... via CL 18309098 #ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469) [CL 18309139 by jason walter in ue5-release-engine-test branch]
This commit is contained in:
@@ -288,6 +288,50 @@ bool FConcertClientPackageManager::HasSessionChanges() const
|
||||
return bHasSessionChanges;
|
||||
}
|
||||
|
||||
TOptional<FString> FConcertClientPackageManager::GetValidPackageSessionPath(FName PackageName) const
|
||||
{
|
||||
#if WITH_EDITOR
|
||||
FString Filename;
|
||||
if (FPackageName::DoesPackageExist(PackageName.ToString(), &Filename))
|
||||
{
|
||||
return Filename;
|
||||
}
|
||||
return GetDeletedPackagePath(PackageName);
|
||||
#else
|
||||
return {};
|
||||
#endif
|
||||
}
|
||||
|
||||
TOptional<FString> FConcertClientPackageManager::GetDeletedPackagePath(FName PackageName) const
|
||||
{
|
||||
#if WITH_EDITOR
|
||||
check(SandboxPlatformFile.IsValid());
|
||||
FConcertSandboxPlatformFile* PlatformFile = SandboxPlatformFile.Get();
|
||||
auto ShouldPersistPackageWithExtension = [PlatformFile](const FString& PackageName, const FString& Extension) -> TOptional<FString>
|
||||
{
|
||||
FString FullPath;
|
||||
if (FPackageName::TryConvertLongPackageNameToFilename(PackageName, FullPath, Extension))
|
||||
{
|
||||
if (PlatformFile->DeletedPackageExistsInNonSandbox(FullPath))
|
||||
{
|
||||
return MoveTemp(FullPath);
|
||||
}
|
||||
}
|
||||
return {};
|
||||
};
|
||||
FString PackageNameAsString = PackageName.ToString();
|
||||
if (TOptional<FString> AsMap = ShouldPersistPackageWithExtension(PackageNameAsString, FPackageName::GetMapPackageExtension()))
|
||||
{
|
||||
return AsMap;
|
||||
}
|
||||
if (TOptional<FString> AsAsset = ShouldPersistPackageWithExtension(PackageNameAsString, FPackageName::GetAssetPackageExtension()))
|
||||
{
|
||||
return AsAsset;
|
||||
}
|
||||
#endif
|
||||
return {};
|
||||
}
|
||||
|
||||
bool FConcertClientPackageManager::PersistSessionChanges(TArrayView<const FName> InPackagesToPersist, ISourceControlProvider* SourceControlProvider, TArray<FText>* OutFailureReasons)
|
||||
{
|
||||
#if WITH_EDITOR
|
||||
@@ -295,12 +339,11 @@ bool FConcertClientPackageManager::PersistSessionChanges(TArrayView<const FName>
|
||||
{
|
||||
// Transform all the package names into actual filenames
|
||||
TArray<FString, TInlineAllocator<8>> FilesToPersist;
|
||||
FString Filename;
|
||||
for (const FName& PackageName : InPackagesToPersist)
|
||||
{
|
||||
if (FPackageName::DoesPackageExist(PackageName.ToString(), &Filename))
|
||||
if (TOptional<FString> ValidPath = GetValidPackageSessionPath(PackageName))
|
||||
{
|
||||
FilesToPersist.Add(MoveTemp(Filename));
|
||||
FilesToPersist.Add(MoveTemp(ValidPath.GetValue()));
|
||||
}
|
||||
}
|
||||
return SandboxPlatformFile->PersistSandbox(FilesToPersist, SourceControlProvider, OutFailureReasons);
|
||||
|
||||
@@ -90,6 +90,11 @@ public:
|
||||
*/
|
||||
bool HasSessionChanges() const;
|
||||
|
||||
/**
|
||||
* Returns the full path to the package if it is valid.
|
||||
*/
|
||||
TOptional<FString> GetValidPackageSessionPath(FName PackageName) const;
|
||||
|
||||
/**
|
||||
* Persist the session changes from the package name list and prepare it for source control submission.
|
||||
*/
|
||||
@@ -100,7 +105,6 @@ public:
|
||||
*/
|
||||
FOnConcertClientPackageTooLargeError& OnConcertClientPackageTooLargeError() { return OnPackageTooLargeErrorDelegate; }
|
||||
|
||||
|
||||
/**
|
||||
* Returns true if the named package is participating in a package reload.
|
||||
*/
|
||||
@@ -108,6 +112,11 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
* Returns a full path for given package name if it was deleted and exists on the non-sandbox area.
|
||||
*/
|
||||
TOptional<FString> GetDeletedPackagePath(FName PackageName) const;
|
||||
|
||||
/**
|
||||
* Apply the package filters on the package info
|
||||
* @return true if the package info passes the filter.
|
||||
|
||||
@@ -276,6 +276,17 @@ TArray<FName> FConcertClientWorkspace::GatherSessionChanges(bool IgnorePersisted
|
||||
return SessionChangedPackageNames.Array();
|
||||
}
|
||||
|
||||
TOptional<FString> FConcertClientWorkspace::GetValidPackageSessionPath(FName PackageName) const
|
||||
{
|
||||
#if WITH_EDITOR
|
||||
if (PackageManager)
|
||||
{
|
||||
return PackageManager->GetValidPackageSessionPath(MoveTemp(PackageName));
|
||||
}
|
||||
#endif
|
||||
return {};
|
||||
}
|
||||
|
||||
bool FConcertClientWorkspace::PersistSessionChanges(TArrayView<const FName> InPackagesToPersist, ISourceControlProvider* SourceControlProvider, TArray<FText>* OutFailureReasons)
|
||||
{
|
||||
bool bSuccess = false;
|
||||
|
||||
@@ -39,6 +39,7 @@ public:
|
||||
virtual TFuture<FConcertResourceLockResponse> UnlockResources(TArray<FName> InResourceNames) override;
|
||||
virtual bool HasSessionChanges() const override;
|
||||
virtual TArray<FName> GatherSessionChanges(bool IgnorePersisted = true) override;
|
||||
virtual TOptional<FString> GetValidPackageSessionPath(FName PackageName) const override;
|
||||
virtual bool PersistSessionChanges(TArrayView<const FName> InPackagesToPersist, ISourceControlProvider* SourceControlProvider, TArray<FText>* OutFailureReasons = nullptr) override;
|
||||
virtual bool HasLiveTransactionSupport(UPackage* InPackage) const override;
|
||||
virtual bool ShouldIgnorePackageDirtyEvent(class UPackage* InPackage) const override;
|
||||
|
||||
@@ -187,6 +187,19 @@ const TCHAR* FConcertSandboxPlatformFile::GetName() const
|
||||
return GetTypeName();
|
||||
}
|
||||
|
||||
bool FConcertSandboxPlatformFile::DeletedPackageExistsInNonSandbox(FString InFilename) const
|
||||
{
|
||||
const FConcertSandboxPlatformFilePath ResolvedPath = ToSandboxPath(MoveTemp(InFilename));
|
||||
if (ResolvedPath.HasSandboxPath())
|
||||
{
|
||||
if (IsPathDeleted(ResolvedPath))
|
||||
{
|
||||
return LowerLevel->FileExists(*ResolvedPath.GetNonSandboxPath());
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool FConcertSandboxPlatformFile::FileExists(const TCHAR* Filename)
|
||||
{
|
||||
const FConcertSandboxPlatformFilePath ResolvedPath = ToSandboxPath(Filename);
|
||||
@@ -1131,7 +1144,7 @@ void FConcertSandboxPlatformFile::UnregisterContentMountPath(const FString& InCo
|
||||
|
||||
FConcertSandboxPlatformFilePath FConcertSandboxPlatformFile::ToSandboxPath(FString InFilename, const bool bEvenIfDisabled) const
|
||||
{
|
||||
return ToSandboxPath_Absolute(FPaths::ConvertRelativePathToFull(InFilename), bEvenIfDisabled);
|
||||
return ToSandboxPath_Absolute(FPaths::ConvertRelativePathToFull(MoveTemp(InFilename)), bEvenIfDisabled);
|
||||
}
|
||||
|
||||
FConcertSandboxPlatformFilePath FConcertSandboxPlatformFile::ToSandboxPath_Absolute(FString InFilename, const bool bEvenIfDisabled) const
|
||||
@@ -1157,7 +1170,7 @@ FConcertSandboxPlatformFilePath FConcertSandboxPlatformFile::ToSandboxPath_Absol
|
||||
|
||||
FConcertSandboxPlatformFilePath FConcertSandboxPlatformFile::FromSandboxPath(FString InFilename) const
|
||||
{
|
||||
return FromSandboxPath_Absolute(FPaths::ConvertRelativePathToFull(InFilename));
|
||||
return FromSandboxPath_Absolute(FPaths::ConvertRelativePathToFull(MoveTemp(InFilename)));
|
||||
}
|
||||
|
||||
FConcertSandboxPlatformFilePath FConcertSandboxPlatformFile::FromSandboxPath_Absolute(FString InFilename) const
|
||||
|
||||
@@ -200,6 +200,11 @@ public:
|
||||
*/
|
||||
TArray<FString> GatherSandboxChangedFilenames() const;
|
||||
|
||||
/**
|
||||
* Returns true if the given package file exists on non sandbox path.
|
||||
*/
|
||||
bool DeletedPackageExistsInNonSandbox(FString InFilename) const;
|
||||
|
||||
private:
|
||||
struct FDirectoryItem
|
||||
{
|
||||
|
||||
@@ -107,6 +107,13 @@ public:
|
||||
*/
|
||||
virtual TArray<FName> GatherSessionChanges(bool IgnorePersisted = true) = 0;
|
||||
|
||||
/**
|
||||
* Returns the full path to the package if it is a valid package session change.
|
||||
* @param PackageName the package to check.
|
||||
* @return the full path to the package if it is valid.
|
||||
*/
|
||||
virtual TOptional<FString> GetValidPackageSessionPath(FName PackageName) const = 0;
|
||||
|
||||
/** Persist the session changes from the package list and prepare it for source control submission */
|
||||
virtual bool PersistSessionChanges(TArrayView<const FName> InPackageToPersist, ISourceControlProvider* SourceControlProvider, TArray<FText>* OutFailureReasonMap = nullptr) = 0;
|
||||
|
||||
|
||||
@@ -606,23 +606,19 @@ bool FConcertWorkspaceUI::PromptPersistSessionChanges()
|
||||
if (ClientWorkspacePin.IsValid())
|
||||
{
|
||||
// Get source control status of packages
|
||||
TArray<FName> PackageNames;
|
||||
TArray<FString> PackageFilenames;
|
||||
TArray<FName> PackageNames;
|
||||
TArray<FSourceControlStateRef> States;
|
||||
PackageNames = ClientWorkspacePin->GatherSessionChanges();
|
||||
FString Filename;
|
||||
for (auto It = PackageNames.CreateIterator(); It; ++It)
|
||||
TArray<FName> CandidatePackages = ClientWorkspacePin->GatherSessionChanges();
|
||||
for (FName PackageName : CandidatePackages)
|
||||
{
|
||||
if (FPackageName::DoesPackageExist(It->ToString(), &Filename))
|
||||
if (TOptional<FString> PackagePath = ClientWorkspacePin->GetValidPackageSessionPath(PackageName))
|
||||
{
|
||||
PackageFilenames.Add(FPaths::ConvertRelativePathToFull(MoveTemp(Filename)));
|
||||
}
|
||||
// if the package file does not exist locally, remove it from the persist list, the db contains transaction data on file not propagated through Multi-User.
|
||||
else
|
||||
{
|
||||
It.RemoveCurrent();
|
||||
PackageFilenames.Add(PackagePath.GetValue());
|
||||
PackageNames.Add(PackageName);
|
||||
}
|
||||
}
|
||||
|
||||
ECommandResult::Type Result = ISourceControlModule::Get().GetProvider().GetState(PackageFilenames, States, EStateCacheUsage::ForceUpdate);
|
||||
// The dummy Multi-User source control provider always succeed and always return proxy states.
|
||||
ensure(Result == ECommandResult::Succeeded);
|
||||
@@ -633,7 +629,7 @@ bool FConcertWorkspaceUI::PromptPersistSessionChanges()
|
||||
PersistItems.Add(MakeShared<FConcertPersistItem>(PackageNames[Index], States[Index]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
TSharedRef<SWindow> NewWindow = SNew(SWindow)
|
||||
.Title(LOCTEXT("PersistSubmitWindowTitle", "Persist & Submit Files"))
|
||||
.SizingRule(ESizingRule::UserSized)
|
||||
|
||||
Reference in New Issue
Block a user