- Added FAssetHeaderPatcher::FContext for storing data on how to perform a patch (which redirects to follow, string -> string replacement map). Allows for an extensibility point for encapsulating special case patching so we don't need to rely on string->string mappings exclusively
- Added `virtual FArchive& operator<<(FTopLevelAssetPath& Value)` to `FActorDescArchive` to allow for patching of FTopLevelAssetPath directly. Without this overload the FNames within a FTopLevelAssetPath would be patched one at a time losing all context about what the FNames are.
- Removed IAssetTools::GetAdditionalPatchCopyMappings, GetPatchCopyMappingsForRootRename, and PatchCopyPackageFile as these methods were internal and using the patcher directly should be preferred.
- Added some unit tests for the FAssetHeaderPatcherInner implementation works to codify the assumptions and expectations of the patcher implementation
Set use HeaderPatching as true by default for CopyProjectWithHeaderPatching. AdvancedCopy still disables header patching (to be enabled in a follow-up change)
#rnx
#rb Dave.Belanger
[FYI] Francis.Hurteau
#p4v-cherrypick 36706626, 36741243
[CL 36858806 by kevin macaulayvacher in 5.5 branch]
[FYI] kevin.macaulayvacher
Original CL Desc
-----------------------------------------------------------------
Changes FAssetHeaderPatcherInner to leverage the CoreRedirect system for resolving FNames in a package header, and string paths when context about the string itself is well known (i.e. we know the string data is a stringified ObjectPath/PackagePath, or ObjectName are deducible). We still make use of string scanning replacement mechanism but those are now constrained to only patching strings content specifically (e.g. Tag data)
- Added FAssetHeaderPatcher::FContext for storing data on how to perform a patch (which redirects to follow, string -> string replacement map). Allows for an extensibility point for encapsulating special case patching so we don't need to rely on string->string mappings exclusively
- Added `virtual FArchive& operator<<(FTopLevelAssetPath& Value)` to `FActorDescArchive` to allow for patching of FTopLevelAssetPath directly. Without this overload the FNames within a FTopLevelAssetPath would be patched one at a time losing all context about what the FNames are.
- Removed IAssetTools::GetAdditionalPatchCopyMappings, GetPatchCopyMappingsForRootRename, and PatchCopyPackageFile as these methods were internal and using the patcher directly should be preferred.
- Added some unit tests for the FAssetHeaderPatcherInner implementation works to codify the assumptions and expectations of the patcher implementation
New patching changes are left disabled by default
#rnx
#rb Dave.Belanger, JeanFrancois.Dube
[CL 36764539 by kevin macaulayvacher in 5.5 branch]
- Added FAssetHeaderPatcher::FContext for storing data on how to perform a patch (which redirects to follow, string -> string replacement map). Allows for an extensibility point for encapsulating special case patching so we don't need to rely on string->string mappings exclusively
- Added `virtual FArchive& operator<<(FTopLevelAssetPath& Value)` to `FActorDescArchive` to allow for patching of FTopLevelAssetPath directly. Without this overload the FNames within a FTopLevelAssetPath would be patched one at a time losing all context about what the FNames are.
- Removed IAssetTools::GetAdditionalPatchCopyMappings, GetPatchCopyMappingsForRootRename, and PatchCopyPackageFile as these methods were internal and using the patcher directly should be preferred.
- Added some unit tests for the FAssetHeaderPatcherInner implementation works to codify the assumptions and expectations of the patcher implementation
New patching changes are left disabled by default
#rnx
#rb Dave.Belanger, JeanFrancois.Dube
[CL 36764489 by kevin macaulayvacher in 5.5 branch]
- Rename IAssetTools::GetMappingsForRootPackageRename to GetPatchCopyMappingsForRootRename for clarity
#rb Francis.Hurteau, kevin.macaulayvacher
#rnx
[CL 35562044 by dave belanger in ue5-main branch]
Correction for External(Objects|Actors) path destination path generation.
#rb Francis.Hurteau, kevin.macaulayvacher, Richard.Malo
[CL 35418159 by andrew phillips in ue5-main branch]
- Now look for the optional GatherableTextData section when deserializing, patch the contents and write back out the data, patching up the summary size as necessary since this section does not have a fixed size based on item counts (i.e. it doesn't use the name table, so a string changes affect the size)
- Added additional mapping for VerseAssetPaths which appear in GeneratedTextData (e.g. /localhost/Normal/PackagePath/PackagePath)
#jira UE-216649
#rb Francis.Hurteau
#rnx
[CL 34614882 by kevin macaulayvacher in ue5-main branch]
[FYI] Yoan.StAmant
Original CL Desc
-----------------------------------------------------------------
Moved UserDefinedStruct to CoreUObject
#jira UE-216472
#rb Devin.Doucette
[CL 34486763 by gary yuan in ue5-main branch]
We now separate the passed in remapping paths to be categorized by plugin when considering mappings for external actors/objects.
#rb Dave.Belanger, Francis.Hurteau
#rnx
[CL 34317882 by kevin macaulayvacher in ue5-main branch]
Special handling is done to add mappings for src -> dst strings with and without a '_[0-9]+' suffix since this suffix comes from FNames and will be stripped from the NameTable. Since we want to patch the NameTable we need to ensure any mapping with such a suffix also has a mapping for when its suffix is stripped. The previous code attempted to do this however it was only providing a mapping where the Src string stripped off the suffix and incorrectly mapped to the Dst string that still had its suffix. This made any lookup into the NameTable appear as if a new entry should be added but could instead result in new entries being added to the table that are identical to pre-existing entries once the number suffix is stripped. You could also have multiple Src strings such as 'SrcName_1' and 'SrcName_2' be given a 'SrcName' -> 'DestName1', 'SrcName' -> 'DestName2' mapping which is ambiguous.
The new code does the following:
- Avoid creating FNames from input strings to check if the string contains a '_[0-9]+' suffix and instead does a reverse scan of the string. This avoids FName allocations and unnecessary string copies.
- Strips number suffixes from both Src and Dst when they exist, mapping the stripped versions of both to one another
- Only provides a PackageName mapping when SrcPackage and DstPackage don't match otherwise we do unnecessary stripping, lookups and patching
#rb Francis.Hurteau
#rnx
[CL 34180940 by kevin macaulayvacher in ue5-main branch]
We now break the passed in Long-form Package paths into their 2/3 parts, PackageRoot, PackagePath (might be empty) and PackageName, and create mappings from source -> destination only when the exact portions of the path map. Special handling is needed for the __ExternalActors__ and __ExternalObjects__ directories since remapping a package may require the subdirectories under __ExternalActors__ to need remapping as well, in addition to the SrcPackageRoot -> DstPackageRoot change.
#rb Dave.Belanger, Francis.Hurteau
#rnx
[CL 34126213 by kevin macaulayvacher in ue5-main branch]