// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies. // EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null // Eden.AutoMorpher.ClothInstance using System; using System.Collections.Generic; using UnityEngine; [Serializable] public class ClothInstance { public SkinnedMeshRenderer smr; public Mesh editableMesh; public Mesh bakedMesh; public Matrix4x4 worldNoScale; public Vector3[] worldVertices; public Vector3[] minDistanceVector; public float[] minDistance; public Vector3[] deltas; public Vector3[] deltasLocal; public List[] vertexAdjacency; public List> equivalentVertices; public bool[] isInsideVertex; public bool[] excludedVertices; public bool[] isLeftLegVertex; public bool[] isRightLegVertex; public Vector3[] bakedWorldNormals; public Vector4[] bakedWorldTangents; public Dictionary> humanoidMatchedBones; public ClothInstance(SkinnedMeshRenderer clotheSMR, bool duplicateMesh = true) { this.smr = clotheSMR; if (duplicateMesh) { string name = this.smr.sharedMesh.name; this.editableMesh = UnityEngine.Object.Instantiate(clotheSMR.sharedMesh); this.editableMesh.name = name + "_EditableMesh"; this.smr.sharedMesh = this.editableMesh; } else { this.editableMesh = this.smr.sharedMesh; } this.UpdateWorldVertices(); int vertexCount = this.editableMesh.vertexCount; this.minDistanceVector = (Vector3[])(object)new Vector3[vertexCount]; this.deltas = (Vector3[])(object)new Vector3[vertexCount]; this.minDistance = new float[vertexCount]; this.isInsideVertex = new bool[vertexCount]; this.excludedVertices = new bool[vertexCount]; this.isLeftLegVertex = new bool[vertexCount]; this.isRightLegVertex = new bool[vertexCount]; this.humanoidMatchedBones = new Dictionary>(); this.vertexAdjacency = this.BuildVertexAdjacency(this.editableMesh); this.BuildEquivalentVerticesFromWorld(); } public void UpdateWorldVertices() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) if (this.bakedMesh == null) { this.bakedMesh = new Mesh(); } else { this.bakedMesh.Clear(); } this.smr.BakeMesh(this.bakedMesh); int vertexCount = this.editableMesh.vertexCount; Vector3 lossyScale = ((Component)this.smr).transform.lossyScale; Vector3 val = new Vector3(1f / Mathf.Max(lossyScale.x, 1E-08f), 1f / Mathf.Max(lossyScale.y, 1E-08f), 1f / Mathf.Max(lossyScale.z, 1E-08f)); this.worldNoScale = ((Component)this.smr).transform.localToWorldMatrix * Matrix4x4.Scale(val); this.worldVertices = (Vector3[])(object)new Vector3[vertexCount]; this.deltasLocal = (Vector3[])(object)new Vector3[vertexCount]; for (int i = 0; i < vertexCount; i++) { this.worldVertices[i] = this.worldNoScale.MultiplyPoint3x4(this.bakedMesh.vertices[i]); this.deltasLocal[i] = Vector3.zero; } Vector3[] normals = this.bakedMesh.normals; Vector4[] tangents = this.bakedMesh.tangents; this.bakedWorldNormals = (Vector3[])(object)new Vector3[vertexCount]; if (tangents != null && tangents.Length == vertexCount) { this.bakedWorldTangents = (Vector4[])(object)new Vector4[vertexCount]; } else { this.bakedWorldTangents = null; } for (int j = 0; j < vertexCount; j++) { Vector3[] array = this.bakedWorldNormals; int num = j; Vector3 val2 = ((Component)this.smr).transform.TransformDirection(normals[j]); array[num] = val2.normalized; if (this.bakedWorldTangents != null) { val2 = ((Component)this.smr).transform.TransformDirection(new Vector3(tangents[j].x, tangents[j].y, tangents[j].z)); Vector3 normalized = val2.normalized; this.bakedWorldTangents[j] = new Vector4(normalized.x, normalized.y, normalized.z, tangents[j].w); } } } public List[] BuildVertexAdjacency(Mesh mesh, float seamThreshold = 0.0001f, float proximityThreshold = 0f) { //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0367: Unknown result type (might be due to invalid IL or missing references) //IL_036c: Unknown result type (might be due to invalid IL or missing references) //IL_0370: Unknown result type (might be due to invalid IL or missing references) //IL_037f: Unknown result type (might be due to invalid IL or missing references) //IL_038e: Unknown result type (might be due to invalid IL or missing references) //IL_03a4: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_03b8: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_03ee: Unknown result type (might be due to invalid IL or missing references) //IL_03f3: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_0461: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_046f: Unknown result type (might be due to invalid IL or missing references) //IL_0471: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0511: Unknown result type (might be due to invalid IL or missing references) //IL_0516: Unknown result type (might be due to invalid IL or missing references) //IL_0490: Unknown result type (might be due to invalid IL or missing references) //IL_0495: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_052b: Unknown result type (might be due to invalid IL or missing references) //IL_0530: Unknown result type (might be due to invalid IL or missing references) //IL_0532: Unknown result type (might be due to invalid IL or missing references) //IL_0537: Unknown result type (might be due to invalid IL or missing references) //IL_04ad: Unknown result type (might be due to invalid IL or missing references) //IL_04b2: Unknown result type (might be due to invalid IL or missing references) //IL_04b4: Unknown result type (might be due to invalid IL or missing references) //IL_04b9: Unknown result type (might be due to invalid IL or missing references) if (mesh == null) { throw new AutoMorpherException("Mesh is Missing", "[VertexAdjacencyUtil] BuildVertexAdjacency\n - mesh is null"); } int vertexCount = mesh.vertexCount; int[] triangles = mesh.triangles; Vector3[] vertices = mesh.vertices; List[] array = new List[vertexCount]; for (int i = 0; i < vertexCount; i++) { array[i] = new List(); } int num = triangles.Length / 3; for (int j = 0; j < num; j++) { int num2 = triangles[j * 3]; int num3 = triangles[j * 3 + 1]; int num4 = triangles[j * 3 + 2]; AddNeighbor(array, num2, num3); AddNeighbor(array, num3, num2); AddNeighbor(array, num3, num4); AddNeighbor(array, num4, num3); AddNeighbor(array, num4, num2); AddNeighbor(array, num2, num4); } Vector3 val4; if (seamThreshold > 0f) { float num5 = seamThreshold * 2f; float num6 = seamThreshold * seamThreshold; Dictionary> dictionary = new Dictionary>(); Vector3Int key = default(Vector3Int); for (int k = 0; k < vertexCount; k++) { Vector3 val = vertices[k]; key = new Vector3Int(Mathf.FloorToInt(val.x / num5), Mathf.FloorToInt(val.y / num5), Mathf.FloorToInt(val.z / num5)); if (!dictionary.TryGetValue(key, out var value)) { value = (dictionary[key] = new List()); } value.Add(k); } Vector3Int val2 = default(Vector3Int); foreach (KeyValuePair> item in dictionary) { Vector3Int key2 = item.Key; List value2 = item.Value; for (int l = -1; l <= 1; l++) { for (int m = -1; m <= 1; m++) { for (int n = -1; n <= 1; n++) { if (l < 0 || (l == 0 && m < 0) || (l == 0 && m == 0 && n < 0)) { continue; } val2 = new(key2.x + l, key2.y + m, key2.z + n); if (!dictionary.TryGetValue(val2, out var value3)) { continue; } if (val2 == key2) { for (int num7 = 0; num7 < value2.Count; num7++) { int num8 = value2[num7]; Vector3 val3 = vertices[num8]; for (int num9 = num7 + 1; num9 < value2.Count; num9++) { int num10 = value2[num9]; val4 = vertices[num10] - val3; if (val4.sqrMagnitude <= num6) { AddNeighbor(array, num8, num10); AddNeighbor(array, num10, num8); } } } continue; } for (int num11 = 0; num11 < value2.Count; num11++) { int num12 = value2[num11]; Vector3 val5 = vertices[num12]; for (int num13 = 0; num13 < value3.Count; num13++) { int num14 = value3[num13]; val4 = vertices[num14] - val5; if (val4.sqrMagnitude <= num6) { AddNeighbor(array, num12, num14); AddNeighbor(array, num14, num12); } } } } } } } } if (proximityThreshold > 0f) { float num15 = proximityThreshold * 2f; float num16 = proximityThreshold * proximityThreshold; Dictionary> dictionary2 = new Dictionary>(); Vector3Int key3 = default(Vector3Int); for (int num17 = 0; num17 < vertexCount; num17++) { Vector3 val6 = vertices[num17]; key3 = new Vector3Int(Mathf.FloorToInt(val6.x / num15), Mathf.FloorToInt(val6.y / num15), Mathf.FloorToInt(val6.z / num15)); if (!dictionary2.TryGetValue(key3, out var value4)) { value4 = (dictionary2[key3] = new List()); } value4.Add(num17); } Vector3Int val7 = default(Vector3Int); foreach (KeyValuePair> item2 in dictionary2) { Vector3Int key4 = item2.Key; List value5 = item2.Value; for (int num18 = -1; num18 <= 1; num18++) { for (int num19 = -1; num19 <= 1; num19++) { for (int num20 = -1; num20 <= 1; num20++) { if (num18 < 0 || (num18 == 0 && num19 < 0) || (num18 == 0 && num19 == 0 && num20 < 0)) { continue; } val7 = new Vector3Int(key4.x + num18, key4.y + num19, key4.z + num20); if (!dictionary2.TryGetValue(val7, out var value6)) { continue; } if (val7 == key4) { for (int num21 = 0; num21 < value5.Count; num21++) { int num22 = value5[num21]; Vector3 val8 = vertices[num22]; for (int num23 = num21 + 1; num23 < value5.Count; num23++) { int num24 = value5[num23]; val4 = vertices[num24] - val8; if (val4.sqrMagnitude <= num16) { AddNeighbor(array, num22, num24); AddNeighbor(array, num24, num22); } } } continue; } for (int num25 = 0; num25 < value5.Count; num25++) { int num26 = value5[num25]; Vector3 val9 = vertices[num26]; for (int num27 = 0; num27 < value6.Count; num27++) { int num28 = value6[num27]; val4 = vertices[num28] - val9; if (val4.sqrMagnitude <= num16) { AddNeighbor(array, num26, num28); AddNeighbor(array, num28, num26); } } } } } } } } return array; void AddNeighbor(List[] adj, int from, int to) { List list3 = adj[from]; if (!list3.Contains(to)) { list3.Add(to); } } } public void ApplyWorldVerticesToMesh() { //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: Unknown result type (might be due to invalid IL or missing references) //IL_0303: Unknown result type (might be due to invalid IL or missing references) //IL_0308: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_0326: Unknown result type (might be due to invalid IL or missing references) //IL_032b: Unknown result type (might be due to invalid IL or missing references) //IL_030e: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Unknown result type (might be due to invalid IL or missing references) //IL_0319: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_037e: Unknown result type (might be due to invalid IL or missing references) //IL_0380: Unknown result type (might be due to invalid IL or missing references) //IL_0385: Unknown result type (might be due to invalid IL or missing references) //IL_039f: Unknown result type (might be due to invalid IL or missing references) //IL_03a4: Unknown result type (might be due to invalid IL or missing references) //IL_03aa: Unknown result type (might be due to invalid IL or missing references) //IL_03b1: Unknown result type (might be due to invalid IL or missing references) //IL_03b8: Unknown result type (might be due to invalid IL or missing references) //IL_03d1: Unknown result type (might be due to invalid IL or missing references) //IL_03d6: Unknown result type (might be due to invalid IL or missing references) //IL_038b: Unknown result type (might be due to invalid IL or missing references) //IL_0391: Unknown result type (might be due to invalid IL or missing references) //IL_0396: Unknown result type (might be due to invalid IL or missing references) //IL_039b: Unknown result type (might be due to invalid IL or missing references) if (this.editableMesh == null || this.smr == null || this.worldVertices == null) { return; } Mesh val = this.editableMesh; int vertexCount = val.vertexCount; Vector3[] vertices = val.vertices; SkinningUtil skinningUtil = new SkinningUtil(); Vector3[] array = null; int blendShapeCount = val.blendShapeCount; if (blendShapeCount > 0) { array = (Vector3[])(object)new Vector3[vertexCount]; Vector3[] array2 = new Vector3[vertexCount]; Vector3[] array3 = new Vector3[vertexCount]; Vector3[] array4 = new Vector3[vertexCount]; for (int i = 0; i < blendShapeCount; i++) { float blendShapeWeight = this.smr.GetBlendShapeWeight(i); if (Mathf.Approximately(blendShapeWeight, 0f)) { continue; } int num = val.GetBlendShapeFrameCount(i) - 1; float blendShapeFrameWeight = val.GetBlendShapeFrameWeight(i, num); val.GetBlendShapeFrameVertices(i, num, array2, array3, array4); float num2 = ((blendShapeFrameWeight != 0f) ? (blendShapeWeight / blendShapeFrameWeight) : 0f); if (!Mathf.Approximately(num2, 0f)) { for (int j = 0; j < vertexCount; j++) { ref Vector3 reference = ref array[j]; reference += array2[j] * num2; } } } } for (int k = 0; k < vertexCount; k++) { Vector3 val2 = skinningUtil.WorldPosToBindPos_Full(this.smr, val, k, this.worldVertices[k]); if (array != null) { val2 -= array[k]; } vertices[k] = val2; } val.vertices = vertices; Vector3[] array5 = null; Vector3[] array6 = null; if (blendShapeCount > 0) { array5 = (Vector3[])(object)new Vector3[vertexCount]; array6 = (Vector3[])(object)new Vector3[vertexCount]; Vector3[] array7 = (Vector3[])(object)new Vector3[vertexCount]; Vector3[] array8 = (Vector3[])(object)new Vector3[vertexCount]; Vector3[] array9 = (Vector3[])(object)new Vector3[vertexCount]; for (int l = 0; l < blendShapeCount; l++) { float blendShapeWeight2 = this.smr.GetBlendShapeWeight(l); if (Mathf.Approximately(blendShapeWeight2, 0f)) { continue; } int num3 = val.GetBlendShapeFrameCount(l) - 1; float blendShapeFrameWeight2 = val.GetBlendShapeFrameWeight(l, num3); val.GetBlendShapeFrameVertices(l, num3, array7, array8, array9); float num4 = ((blendShapeFrameWeight2 != 0f) ? (blendShapeWeight2 / blendShapeFrameWeight2) : 0f); if (!Mathf.Approximately(num4, 0f)) { for (int m = 0; m < vertexCount; m++) { ref Vector3 reference2 = ref array5[m]; reference2 += array8[m] * num4; ref Vector3 reference3 = ref array6[m]; reference3 += array9[m] * num4; } } } } if (this.bakedWorldNormals == null || this.bakedWorldNormals.Length != vertexCount) { return; } Vector3[] array10 = (Vector3[])(object)new Vector3[vertexCount]; bool flag = this.bakedWorldTangents != null && this.bakedWorldTangents.Length == vertexCount; Vector4[] array11 = (Vector4[])(object)(flag ? new Vector4[vertexCount] : null); Vector3 targetWorldDir = default(Vector3); for (int n = 0; n < vertexCount; n++) { Vector3 val3 = skinningUtil.WorldDirToBindDir_Full(this.smr, val, n, this.bakedWorldNormals[n]); if (array5 != null) { val3 -= array5[n]; } array10[n] = val3.normalized; if (flag) { targetWorldDir = new Vector3(this.bakedWorldTangents[n].x, this.bakedWorldTangents[n].y, this.bakedWorldTangents[n].z); Vector3 val4 = skinningUtil.WorldDirToBindDir_Full(this.smr, val, n, targetWorldDir); if (array6 != null) { val4 -= array6[n]; } val4 = val4.normalized; array11[n] = new Vector4(val4.x, val4.y, val4.z, this.bakedWorldTangents[n].w); } } val.normals = array10; if (array11 != null) { val.tangents = array11; } } public void BuildEquivalentVerticesFromWorld(float maxDistance = 1E-05f) { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) if (this.worldVertices == null || this.worldVertices.Length == 0) { Debug.LogWarning((object)"[ClothInstance] BuildEquivalentVerticesFromWorld: worldVertices is null or empty. Call UpdateWorldVertices() first."); return; } int num = this.worldVertices.Length; if (this.equivalentVertices == null) { this.equivalentVertices = new List>(); } else { this.equivalentVertices.Clear(); } float num2 = maxDistance * maxDistance; Dictionary> dictionary = new Dictionary>(); Vector3Int key = default(Vector3Int); for (int i = 0; i < num; i++) { Vector3 val = this.worldVertices[i]; key = new Vector3Int(Mathf.FloorToInt(val.x / maxDistance), Mathf.FloorToInt(val.y / maxDistance), Mathf.FloorToInt(val.z / maxDistance)); if (!dictionary.TryGetValue(key, out var value)) { value = (dictionary[key] = new List()); } value.Add(i); } foreach (KeyValuePair> item in dictionary) { List value2 = item.Value; int count = value2.Count; if (count < 2) { continue; } int[] parent = new int[count]; for (int j = 0; j < count; j++) { parent[j] = j; } for (int k = 0; k < count; k++) { int num3 = value2[k]; Vector3 val2 = this.worldVertices[num3]; for (int l = k + 1; l < count; l++) { int num4 = value2[l]; Vector3 val3 = this.worldVertices[num4]; Vector3 val4 = val2 - val3; if (val4.sqrMagnitude <= num2) { Union(k, l); } } } Dictionary> dictionary2 = new Dictionary>(); for (int m = 0; m < count; m++) { int key2 = Find(m); if (!dictionary2.TryGetValue(key2, out var value3)) { value3 = (dictionary2[key2] = new List()); } value3.Add(value2[m]); } foreach (List value4 in dictionary2.Values) { if (value4.Count >= 2) { this.equivalentVertices.Add(value4); } } int Find(int x) { if (parent[x] != x) { parent[x] = Find(parent[x]); } return parent[x]; } void Union(int a, int b) { int num5 = Find(a); int num6 = Find(b); if (num5 != num6) { parent[num6] = num5; } } } } ~ClothInstance() { this.Dispose(); } public void Dispose() { if (this.bakedMesh != null) { UnityEngine.Object.DestroyImmediate(this.bakedMesh); this.bakedMesh = null; } this.worldVertices = null; this.minDistanceVector = null; this.minDistance = null; this.deltas = null; this.deltasLocal = null; this.isInsideVertex = null; this.excludedVertices = null; this.isLeftLegVertex = null; this.isRightLegVertex = null; this.vertexAdjacency = null; if (this.equivalentVertices != null) { for (int i = 0; i < this.equivalentVertices.Count; i++) { this.equivalentVertices[i]?.Clear(); } this.equivalentVertices.Clear(); this.equivalentVertices = null; } this.humanoidMatchedBones = null; this.smr = null; this.editableMesh = null; } }