Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
209 changes: 209 additions & 0 deletions UAssetAPI/CustomVersions/CustomVersions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -935,6 +935,177 @@ public enum FFortniteMainBranchObjectVersion
[Introduced(EngineVersion.VER_UE5_7)]
LandscapeAdvancedWeightBlending,

/// <summary>Add support for FastGeo transformer setting assets</summary>
[Introduced(EngineVersion.VER_UE5_8)]
FastGeoTransformerSettingAssets,

/// <summary>UAF can now generate procedural systems for assets</summary>
[Introduced(EngineVersion.VER_UE5_8)]
UAFProceduralSystems,

/// <summary>Firefight: version 228 was introduced and backed out, adding it back to allow assets created in the meantime to load</summary>
[Introduced(EngineVersion.VER_UE5_8)]
Firefight_228,

/// <summary>Add default runtime state to FDataLayerInstanceDesc</summary>
[Introduced(EngineVersion.VER_UE5_8)]
WorldPartitionDataLayerDefaultRuntimeState,

/// <summary>Introducing FGuid to UAF variable entries</summary>
[Introduced(EngineVersion.VER_UE5_8)]
UAFVariablesGuid,

/// <summary>Introducing FGuid cached to FAnimNext(Soft)VariableReference</summary>
[Introduced(EngineVersion.VER_UE5_8)]
UAFVariableReferenceGUID,

/// <summary>Unified source color settings between img media &amp; media io</summary>
[Introduced(EngineVersion.VER_UE5_8)]
MediaColorSettingsUnification,

/// <summary>Changed behavior of the String Operation metadata node in PCG for Substring and Matches</summary>
[Introduced(EngineVersion.VER_UE5_8)]
PCGMetadataOpStringTypeChange,

/// <summary>Compress LiveLink SubSection data</summary>
[Introduced(EngineVersion.VER_UE5_8)]
LiveLinkCompressSubSectionData,

/// <summary>Added option to quantize chaos tri mesh BVH's per-face bounds</summary>
[Introduced(EngineVersion.VER_UE5_8)]
OptionalQuantizePerFaceBoundsInChaosTriMeshBVH,

/// <summary>Add Dataflow Graph Topology Guid to UE::Dataflow:FGraph</summary>
[Introduced(EngineVersion.VER_UE5_8)]
DataflowAddGraphTopologyGuid,

/// <summary>Add material usage flag for mesh deformers</summary>
[Introduced(EngineVersion.VER_UE5_8)]
AddMeshDeformerUsageFlag,

/// <summary>Add landscape texture patch alpha override for height/weight patches</summary>
[Introduced(EngineVersion.VER_UE5_8)]
LandscapeTexturePatchAlphaOverride,

/// <summary>For SpawnActor/AddComponent, allow template to be used for the spawned actor.</summary>
[Introduced(EngineVersion.VER_UE5_8)]
PCGAllowTemplateWhenSpawningFromAttribute,

/// <summary>Chaos collision filters extension from 32 to 64 bit</summary>
[Introduced(EngineVersion.VER_UE5_8)]
CollisionFilter64Bit,

/// <summary>Add the concept of UAFAssetData</summary>
[Introduced(EngineVersion.VER_UE5_8)]
UAFAssetData,

/// <summary>Add an additional rotation offset to root motion modifier and deprecate the 'Opposite' rotation methods</summary>
[Introduced(EngineVersion.VER_UE5_8)]
RootMotionModifierRotationOffset,

/// <summary>Update PolyBezierSpline internal storage structure to use 3 control points per segment instead of 4</summary>
[Introduced(EngineVersion.VER_UE5_8)]
PolyBezierSplineAnchorTripleLayout,

/// <summary>Repairing verse data where we introduced -0.0 value when we flipped the coordinate system</summary>
[Introduced(EngineVersion.VER_UE5_8)]
VerseRepairDataWithMinusZeroValue,

/// <summary>Add new enum property to composite (plugin) UCompositePassColorKeyer to control keying settings</summary>
[Introduced(EngineVersion.VER_UE5_8)]
CompositePassKeyerSource,

/// <summary>OpenColorIO library update to v2.5.1 which transitions from ACES 1.3 to ACES 2.0 defaults</summary>
[Introduced(EngineVersion.VER_UE5_8)]
OpenColorIOv251,

/// <summary>Reparameterize Spline in SplineComponent based on SplineCurves parameterization</summary>
[Introduced(EngineVersion.VER_UE5_8)]
SplineComponentReparameterizeOnLoad,

/// <summary>Deprecating support for external UPackage storing UAF asset entries</summary>
[Introduced(EngineVersion.VER_UE5_8)]
DeprecateUAFExternalPackages,

/// <summary>RigVM object pins hold an object ptr</summary>
[Introduced(EngineVersion.VER_UE5_8)]
RigVMPinDefaultValueObjectPtr,

/// <summary>AnimSequenceTracks now have timestamps</summary>
[Introduced(EngineVersion.VER_UE5_8)]
AnimSequenceTrackTimestamps,

/// <summary>Outdated version bump that was kept for data integrity.</summary>
[Introduced(EngineVersion.VER_UE5_8)]
PCG_PropertyBagHierarchySupport_Outdated,

/// <summary>PCG Graph's Instanced Property Bags now support Hierarchy Editor, post loading existing data into new format</summary>
[Introduced(EngineVersion.VER_UE5_8)]
PCG_PropertyBagHierarchySupport,

/// <summary>Introduce per-proxy overridable landscape grass</summary>
[Introduced(EngineVersion.VER_UE5_8)]
OverridableLandscapeGrassTypes,

/// <summary>AnimSequenceTransformProviderData now has bounds.</summary>
[Introduced(EngineVersion.VER_UE5_8)]
AnimSequenceTransformProviderBounds,

/// <summary>UEnum now have Underlyingtype</summary>
[Introduced(EngineVersion.VER_UE5_8)]
EnumUnderlyingType,

/// <summary>Composite layer name deprecation</summary>
[Introduced(EngineVersion.VER_UE5_8)]
Composite_LayerNameDeprecation,

/// <summary>FDynamicMeshAttributeSet has triangle labels</summary>
[Introduced(EngineVersion.VER_UE5_8)]
DynamicMeshAttributesTriangleLabels,

/// <summary>Remove RF_Public on entity components and subobjects</summary>
[Introduced(EngineVersion.VER_UE5_8)]
FixPublicEntityComponentsAndSubobjects,

/// <summary>Added override flag for Physical Material</summary>
[Introduced(EngineVersion.VER_UE5_8)]
AddPhysMatOverrideFlag,

/// <summary>Added context DevNotes for translators to FText</summary>
[Introduced(EngineVersion.VER_UE5_8)]
AddDevNotesToFText,

/// <summary>Added default color override for PCG Mesh Sampler and fix bounds in PCG Subdivide Spline</summary>
[Introduced(EngineVersion.VER_UE5_8)]
PCGMeshSamplerDefaultColorPCGSubdivideSplineBoundsFixes,

/// <summary>Serializable dynamic delegate payloads</summary>
[Introduced(EngineVersion.VER_UE5_8)]
DynamicDelegatePayloads,

/// <summary>Compact representation of serializable dynamic delegate payloads which avoids shifting binary data</summary>
[Introduced(EngineVersion.VER_UE5_8)]
CompactDynamicDelegatePayloads,

/// <summary>Added bone attachment serialization for UInstancedSkinnedMeshComponent</summary>
[Introduced(EngineVersion.VER_UE5_8)]
InstancedSkinnedMeshBoneAttachments,

/// <summary>Added toggle to show/hide per-pin attribute creation settings on PCG Custom HLSL nodes</summary>
[Introduced(EngineVersion.VER_UE5_8)]
PCGCustomHLSLAttributeCreationSettingsToggle,

/// <summary>Converting FPCGMetadataAttribute&lt;T&gt; to Generic attributes.</summary>
[Introduced(EngineVersion.VER_UE5_8)]
ConvertFPCGMetadataAttributeToGenericAttributes,

/// <summary>Merging PCG Metadata Attribute base and Generic ones.</summary>
[Introduced(EngineVersion.VER_UE5_8)]
MergePCGMetadataAttributeBaseAndGeneric,

/// <summary>AnimSequenceTransformProviderData supports multiple layers</summary>
[Introduced(EngineVersion.VER_UE5_8)]
AnimSequenceTransformProviderLayers,
[Introduced(EngineVersion.VER_UE4_AUTOMATIC_VERSION_PLUS_ONE)]
VersionPlusOne,
[Introduced(EngineVersion.VER_UE4_AUTOMATIC_VERSION)]
Expand Down Expand Up @@ -1802,6 +1973,17 @@ public enum FFortniteReleaseBranchCustomObjectVersion
CommonUIPlatformNamingUpgradeOption,

/// <summary>-----new versions can be added above this line-------------------------------------------------</summary>
/// <summary>Add new fictitious forces modes to the cloth simulation</summary>
[Introduced(EngineVersion.VER_UE5_8)]
ChaosClothAddNewFictitiousForcesModes,

/// <summary>Updated how blend spaces calculate the effective animation length of the sample point</summary>
[Introduced(EngineVersion.VER_UE5_8)]
BlendSpaceUpdatedSamplePointAnimationLengthDerivation,

/// <summary>Fix to make the override option to "Use Half Precision" work in Material Editor when the cvar r.Mobile.FloatPrecisionMode=2</summary>
[Introduced(EngineVersion.VER_UE5_8)]
MaterialHalfPrecisionFixup,
[Introduced(EngineVersion.VER_UE4_AUTOMATIC_VERSION_PLUS_ONE)]
VersionPlusOne,

Expand Down Expand Up @@ -2060,6 +2242,33 @@ public enum FUE5ReleaseStreamObjectVersion
AddSimulationPropertySupportToClothUSDImportNodeV2,

/// <summary>-----new versions can be added above this line-------------------------------------------------</summary>
/// <summary>Audio section: add bRepeating property alongside legacy bLooping</summary>
[Introduced(EngineVersion.VER_UE5_8)]
AudioSectionRepeating,

/// <summary>mesh_part: Serialize body/shape associations separately, new Verse interface serialization, enforce unique shape names</summary>
[Introduced(EngineVersion.VER_UE5_8)]
MeshPartAssetUserDataBodyShapeSeparateAndInterfaceFNameAndUniqueShapeNames,

/// <summary>USkeleton no longer serializes the FSmartNameContainer legacy payload; drained only for assets older than this version</summary>
[Introduced(EngineVersion.VER_UE5_8)]
RemovedSmartNameContainerPayload,

/// <summary>Composite plugin: UCompositeDepthMeshComponent's default StaticMesh is no longer set on the CDO</summary>
[Introduced(EngineVersion.VER_UE5_8)]
CompositeDepthMeshDefaultRemovedFromCDO,

/// <summary>Add RotationBlendSpace enum to FAnimNode_BlendProfileLayeredBlend, replacing bMeshSpaceRotationBlend</summary>
[Introduced(EngineVersion.VER_UE5_8)]
BlendProfileLayeredBlendRotationSpace,

/// <summary>Add guarding against negative blend times in AlphaBlends</summary>
[Introduced(EngineVersion.VER_UE5_8)]
AlphaBlendNegativeBlendTimeGuard,

/// <summary>Audio section: add bPlayUntilFinished property and stop using CompletionMode for play/stop decisions</summary>
[Introduced(EngineVersion.VER_UE5_8)]
AudioSectionPlayUntilFinished,
[Introduced(EngineVersion.VER_UE4_AUTOMATIC_VERSION_PLUS_ONE)]
VersionPlusOne,

Expand Down
28 changes: 28 additions & 0 deletions UAssetAPI/ExportTypes/EnumExport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,21 @@ public enum ECppForm
EnumClass
}

/// <summary>
/// The underlying type of an enum (UEnum::EUnderlyingType), serialized as of UE 5.8.
/// </summary>
public enum EEnumUnderlyingType : byte
{
int8,
int16,
int32,
int64,
uint8,
uint16,
uint32,
uint64
}

/// <summary>
/// Reflection data for an enumeration.
/// </summary>
Expand All @@ -24,6 +39,9 @@ public class UEnum
/// <summary>How the enum was originally defined.</summary>
public ECppForm CppForm = ECppForm.Regular;

/// <summary>The underlying type of the enum. Serialized as of <see cref="FFortniteMainBranchObjectVersion.EnumUnderlyingType"/> (UE 5.8).</summary>
public EEnumUnderlyingType UnderlyingType = EEnumUnderlyingType.int64;

public void Read(AssetBinaryReader reader, UAsset asset)
{
if (asset.ObjectVersion < ObjectVersion.VER_UE4_TIGHTLY_PACKED_ENUMS)
Expand Down Expand Up @@ -65,6 +83,11 @@ public void Read(AssetBinaryReader reader, UAsset asset)
{
CppForm = (ECppForm)reader.ReadByte();
}

if (asset.GetCustomVersion<FFortniteMainBranchObjectVersion>() >= FFortniteMainBranchObjectVersion.EnumUnderlyingType)
{
UnderlyingType = (EEnumUnderlyingType)reader.ReadByte();
}
}

public void Write(AssetBinaryWriter writer, UAsset asset)
Expand Down Expand Up @@ -104,6 +127,11 @@ public void Write(AssetBinaryWriter writer, UAsset asset)
{
writer.Write((byte)CppForm);
}

if (asset.GetCustomVersion<FFortniteMainBranchObjectVersion>() >= FFortniteMainBranchObjectVersion.EnumUnderlyingType)
{
writer.Write((byte)UnderlyingType);
}
}

public UEnum()
Expand Down
14 changes: 12 additions & 2 deletions UAssetAPI/FieldTypes/FField.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,20 @@ public class FField
[JsonConverter(typeof(TMapJsonConverter<FName, FString>))]
public TMap<FName, FString> MetaDataMap;

/// <summary>
/// Whether or not FField flags are serialized for the given asset.
/// As of UE 5.8, FField::Serialize no longer serializes FlagsPrivate into filter-editor-only (i.e. cooked) packages.
/// </summary>
public static bool SerializesFieldFlags(UAsset asset)
{
if (!asset.IsFilterEditorOnly) return true;
return asset.GetEngineVersion() < EngineVersion.VER_UE5_8;
}

public virtual void Read(AssetBinaryReader reader)
{
Name = reader.ReadFName();
Flags = (EObjectFlags)reader.ReadUInt32();
Flags = SerializesFieldFlags(reader.Asset) ? (EObjectFlags)reader.ReadUInt32() : 0;

if (!reader.Asset.IsFilterEditorOnly && !reader.Asset.PackageFlags.HasFlag(EPackageFlags.PKG_Cooked))
{
Expand All @@ -36,7 +46,7 @@ public virtual void Read(AssetBinaryReader reader)
public virtual void Write(AssetBinaryWriter writer)
{
writer.Write(Name);
writer.Write((uint)Flags);
if (SerializesFieldFlags(writer.Asset)) writer.Write((uint)Flags);

if (!writer.Asset.IsFilterEditorOnly && !writer.Asset.PackageFlags.HasFlag(EPackageFlags.PKG_Cooked))
{
Expand Down
21 changes: 11 additions & 10 deletions UAssetAPI/UAsset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -825,6 +825,11 @@ public EngineVersion GetEngineVersion()
private static EngineVersion GetIntroducedFromCustomVersionValue(Type customVersionType, int val)
{
var nm = Enum.GetName(customVersionType, val);
if (nm == "VersionPlusOne" || nm == "LatestVersion")
{
// the LatestVersion/VersionPlusOne aliases can share values with real entries; prefer the real entry so its IntroducedAttribute is used
nm = Enum.GetNames(customVersionType).FirstOrDefault(candidate => candidate != "VersionPlusOne" && candidate != "LatestVersion" && (int)Enum.Parse(customVersionType, candidate) == val);
}
if (nm == null) return EngineVersion.UNKNOWN;
var attributes = customVersionType.GetMember(nm)?[0]?.GetCustomAttributes(typeof(IntroducedAttribute), false);
if (attributes == null || attributes.Length <= 0) return EngineVersion.UNKNOWN;
Expand Down Expand Up @@ -900,15 +905,11 @@ public static int GuessCustomVersionFromTypeAndEngineVersion(EngineVersion chose

// remove VersionPlusOne and LatestVersion entries, which are redundant
// we absolutely need to remove LatestVersion because it's a duplicate of another entry, so the order of the two is not guaranteed; LatestVersion might come first
string[] allVals = new string[allValsRaw.Length - 2];
int j = 0;
for (int i = 0; i < allValsRaw.Length; i++)
{
if (allValsRaw[i] != "VersionPlusOne" && allValsRaw[i] != "LatestVersion")
{
allVals[j++] = allValsRaw[i];
}
}
// sort by actual numeric value so we walk entries newest-first even for enums that don't start at 0 (Enum.GetNames sorts by unsigned value, which puts negative sentinels last)
var allVals = allValsRaw
.Where(nm => nm != "VersionPlusOne" && nm != "LatestVersion")
.OrderBy(nm => Convert.ToInt64(Enum.Parse(typ, nm)))
.ToArray();

for (int i = allVals.Length - 1; i >= 0; i--)
{
Expand All @@ -927,7 +928,7 @@ public static int GuessCustomVersionFromTypeAndEngineVersion(EngineVersion chose
cachedCustomVersionReflectionData[cacheKey] = attributeIntroducedVersion;
}

if (attributeIntroducedVersion != EngineVersion.UNKNOWN && chosenVersion >= attributeIntroducedVersion) return i;
if (attributeIntroducedVersion != EngineVersion.UNKNOWN && chosenVersion >= attributeIntroducedVersion) return Convert.ToInt32(Enum.Parse(typ, val));
}
return -1;
}
Expand Down