Skip to content

Commit

Permalink
missed a spot
Browse files Browse the repository at this point in the history
  • Loading branch information
atenfyr committed Jul 15, 2024
1 parent c20aeda commit e1c2046
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions UAssetAPI/PropertyTypes/Structs/StructPropertyData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,23 +139,15 @@ private int WriteOnce(AssetBinaryWriter writer)
return Value[0].Write(writer, false);
}

private int WriteNTPL(AssetBinaryWriter writer, bool skipFirst = false)
private int WriteNTPL(AssetBinaryWriter writer)
{
int here = (int)writer.BaseStream.Position;
if (Value != null)

List<PropertyData> allDat = Value;
MainSerializer.GenerateUnversionedHeader(ref allDat, StructType, FName.DefineDummy(writer.Asset, writer.Asset.InternalAssetPath + ((Ancestry?.Ancestors?.Count ?? 0) == 0 ? string.Empty : ("." + Ancestry.Parent))), writer.Asset)?.Write(writer);
foreach (var t in allDat)
{
List<PropertyData> allDat = Value;
if (skipFirst)
{
allDat = new List<PropertyData>();
allDat.AddRange(Value);
allDat.RemoveAt(0);
}
MainSerializer.GenerateUnversionedHeader(ref allDat, StructType, FName.DefineDummy(writer.Asset, writer.Asset.InternalAssetPath + ((Ancestry?.Ancestors?.Count ?? 0) == 0 ? string.Empty : ("." + Ancestry.Parent))), writer.Asset)?.Write(writer);
foreach (var t in allDat)
{
MainSerializer.Write(t, writer, true);
}
MainSerializer.Write(t, writer, true);
}
if (!writer.Asset.HasUnversionedProperties) writer.Write(new FName(writer.Asset, "None"));
return (int)writer.BaseStream.Position - here;
Expand Down Expand Up @@ -192,6 +184,8 @@ public override int Write(AssetBinaryWriter writer, bool includeHeader, Property
writer.WritePropertyGuid(PropertyGuid);
}

if (Value == null) Value = [];

bool hasCustomStructSerialization = DetermineIfSerializeWithCustomStructSerialization(writer.Asset, serializationContext, out RegistryEntry targetEntry);
if (targetEntry != null && hasCustomStructSerialization) return WriteOnce(writer);
if (Value.Count == 0 && !SerializeNone) return 0;
Expand Down

0 comments on commit e1c2046

Please sign in to comment.