Skip to content

Commit 1e106d1

Browse files
committed
generate guid for submeshes
1 parent bfe4690 commit 1e106d1

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

CathodeLib/Scripts/CATHODE/Models.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,11 +1090,15 @@ public class Submesh : IEquatable<Submesh>
10901090

10911091
public byte[] Data = new byte[0];
10921092

1093+
//I've added in unique GUIDs to help track submeshes even if their properties are identical, which can happen, E.G. for LV426 NPC spacesuits.
1094+
private Guid guid = Guid.NewGuid();
1095+
10931096
public static bool operator ==(Submesh x, Submesh y)
10941097
{
10951098
if (ReferenceEquals(x, null)) return ReferenceEquals(y, null);
10961099
if (ReferenceEquals(y, null)) return ReferenceEquals(x, null);
10971100
if (ReferenceEquals(x, y)) return true;
1101+
if (x.guid != y.guid) return false;
10981102
#if UNITY_EDITOR || UNITY_STANDALONE_WIN
10991103
if (x.MinBounds != y.MinBounds) return false;
11001104
if (x.MaxBounds != y.MaxBounds) return false;
@@ -1153,6 +1157,7 @@ public override int GetHashCode()
11531157
hashCode = hashCode * -1521134295 + IndexCount.GetHashCode();
11541158
hashCode = hashCode * -1521134295 + (Bones?.GetHashCode() ?? 0);
11551159
hashCode = hashCode * -1521134295 + (Data?.GetHashCode() ?? 0);
1160+
hashCode = hashCode * -1521134295 + guid.GetHashCode();
11561161
return hashCode;
11571162
}
11581163

0 commit comments

Comments
 (0)