Fix FSoftObjectPathFixupArchive not recursing into outered objects

#rb jeanfrancois.dube
#preflight 618d4d54e96ba2832153b68e

#ROBOMERGE-AUTHOR: patrick.enfedaque
#ROBOMERGE-SOURCE: CL 18154376 in //UE5/Release-5.0/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0 -> Release-Engine-Staging) (v889-18060218)

[CL 18154398 by patrick enfedaque in ue5-release-engine-staging branch]
This commit is contained in:
patrick enfedaque
2021-11-11 13:11:23 -05:00
parent 4a0d6b50c2
commit 2298893518
3 changed files with 14 additions and 27 deletions

View File

@@ -8,6 +8,7 @@
#include "HAL/ThreadSingleton.h"
#include "UObject/Class.h"
#include "UObject/ObjectPtr.h"
#include "UObject/UObjectHash.h"
/**
* A struct that contains a string reference to an object, either a top level asset or a subobject.
@@ -469,11 +470,17 @@ struct FSoftObjectPathFixupArchive : public FArchiveUObject
{
}
FArchive& operator<<(FSoftObjectPath& Value)
FArchive& operator<<(FSoftObjectPath& Value) override
{
FixupFunction(Value);
return *this;
}
void Fixup(UObject* Root)
{
Root->Serialize(*this);
ForEachObjectWithOuter(Root, [this](UObject* InObject) { InObject->Serialize(*this); });
}
TFunction<void(FSoftObjectPath&)> FixupFunction;
};

View File

@@ -300,7 +300,7 @@ AActor* FWorldPartitionActorDesc::Load() const
{
if (SoftObjectPathFixupArchive)
{
Actor->Serialize(*SoftObjectPathFixupArchive);
SoftObjectPathFixupArchive->Fixup(Actor);
}
}
else

View File

@@ -113,34 +113,14 @@ void FWorldPartitionLevelHelper::RemapLevelSoftObjectPaths(ULevel* InLevel, UWor
check(InLevel);
check(InWorldPartition);
struct FSoftPathFixupSerializer : public FArchiveUObject
FSoftObjectPathFixupArchive FixupSerializer([InWorldPartition](FSoftObjectPath& Value)
{
FSoftPathFixupSerializer(UWorldPartition* InWorldPartition)
: WorldPartition(InWorldPartition)
if(!Value.IsNull())
{
this->SetIsSaving(true);
this->ArShouldSkipBulkData = true;
InWorldPartition->RemapSoftObjectPath(Value);
}
FArchive& operator<<(FSoftObjectPath& Value)
{
if (!Value.IsNull())
{
WorldPartition->RemapSoftObjectPath(Value);
}
return *this;
}
UWorldPartition* WorldPartition;
};
FSoftPathFixupSerializer FixupSerializer(InWorldPartition);
TArray<UObject*> SubObjects;
GetObjectsWithOuter(InLevel, SubObjects);
for (UObject* Object : SubObjects)
{
Object->Serialize(FixupSerializer);
}
});
FixupSerializer.Fixup(InLevel);
}
/**