EdenAutoMorpherScript 추출 코드 정제

This commit is contained in:
2026-02-01 19:14:39 +09:00
parent 53a70d3c6e
commit 349976b787
42 changed files with 12616 additions and 12604 deletions

View File

@@ -1,58 +1,56 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // 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. // 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 // EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.AutoMorpherDev // Eden.AutoMorpher.AutoMorpherDev
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using Eden.AutoMorpher;
using UnityEngine;
public static class AutoMorpherDev public static class AutoMorpherDev
{ {
public readonly struct ScopeTimer : IDisposable public readonly struct ScopeTimer : IDisposable
{ {
private readonly bool _enabled; private readonly bool _enabled;
private readonly string _label; private readonly string _label;
private readonly Stopwatch _sw; private readonly Stopwatch _sw;
public ScopeTimer(bool enabled, string label) public ScopeTimer(bool enabled, string label)
{ {
_enabled = enabled; this._enabled = enabled;
_label = label; this._label = label;
if (enabled) if (enabled)
{ {
_sw = Stopwatch.StartNew(); this._sw = Stopwatch.StartNew();
} }
else else
{ {
_sw = null; this._sw = null;
} }
} }
public void Dispose() public void Dispose()
{ {
if (_enabled && _sw != null) if (this._enabled && this._sw != null)
{ {
_sw.Stop(); this._sw.Stop();
Debug.Log((object)$"[DevTimer] {_label}: {_sw.ElapsedMilliseconds} ms"); UnityEngine.Debug.Log((object)$"[DevTimer] {this._label}: {this._sw.ElapsedMilliseconds} ms");
} }
} }
} }
public static bool isDeveloperMode; public static bool isDeveloperMode;
public static void Log(string message) public static void Log(string message)
{ {
if (isDeveloperMode) if (isDeveloperMode)
{ {
Debug.Log((object)message); UnityEngine.Debug.Log((object)message);
} }
} }
public static ScopeTimer Profile(string label) public static ScopeTimer Profile(string label)
{ {
return new ScopeTimer(isDeveloperMode, label); return new ScopeTimer(isDeveloperMode, label);
} }
} }

View File

@@ -1,4 +1,4 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // 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. // 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 // EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.AutoMorpherException // Eden.AutoMorpher.AutoMorpherException
@@ -6,11 +6,11 @@ using System;
public class AutoMorpherException : Exception public class AutoMorpherException : Exception
{ {
public string title; public string title;
public AutoMorpherException(string title, string message) public AutoMorpherException(string title, string message)
: base(message) : base(message)
{ {
this.title = title; this.title = title;
} }
} }

View File

@@ -1,4 +1,4 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // 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. // 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 // EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.BakedBodyMesh // Eden.AutoMorpher.BakedBodyMesh
@@ -6,27 +6,27 @@ using UnityEngine;
public class BakedBodyMesh public class BakedBodyMesh
{ {
public SkinnedMeshRenderer smr; public SkinnedMeshRenderer smr;
public Mesh bakedMesh; public Mesh bakedMesh;
public BakedBodyMesh(SkinnedMeshRenderer _smr) public BakedBodyMesh(SkinnedMeshRenderer _smr)
{ {
//IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Expected O, but got Unknown //IL_0018: Expected O, but got Unknown
smr = _smr; this.smr = _smr;
bakedMesh = new Mesh(); this.bakedMesh = new Mesh();
smr.BakeMesh(bakedMesh); this.smr.BakeMesh(this.bakedMesh);
} }
public void ReBakeMesh() public void ReBakeMesh()
{ {
smr.BakeMesh(bakedMesh); this.smr.BakeMesh(this.bakedMesh);
} }
~BakedBodyMesh() ~BakedBodyMesh()
{ {
smr = null; this.smr = null;
bakedMesh = null; this.bakedMesh = null;
} }
} }

View File

@@ -1,238 +1,235 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // 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. // 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 // EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.BodyPoseMatchSetupUtil // Eden.AutoMorpher.BodyPoseMatchSetupUtil
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Eden.AutoMorpher;
using Eden.AutoMorpher.profile;
using UnityEngine; using UnityEngine;
public class BodyPoseMatchSetupUtil public class BodyPoseMatchSetupUtil
{ {
public void AdjustAvatarScaleByNeck(Transform avatarRoot, Dictionary<HumanBodyBones, HashSet<Transform>> humanBoneMap, float targetHeight) public void AdjustAvatarScaleByNeck(Transform avatarRoot, Dictionary<HumanBodyBones, HashSet<Transform>> humanBoneMap, float targetHeight)
{ {
//IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)avatarRoot == (Object)null) if ((Object)(object)avatarRoot == (Object)null)
{ {
Debug.LogWarning((object)"[AvatarBodyMatchUtil] NormalizeAvatarScaleByNeck: avatar == null"); Debug.LogWarning((object)"[AvatarBodyMatchUtil] NormalizeAvatarScaleByNeck: avatar == null");
return; return;
} }
Transform boneFromBoneMap = new BodyPoseMatch_CommonUtil().GetBoneFromBoneMap(humanBoneMap, (HumanBodyBones)9); Transform boneFromBoneMap = new BodyPoseMatch_CommonUtil().GetBoneFromBoneMap(humanBoneMap, (HumanBodyBones)9);
if ((Object)(object)boneFromBoneMap == (Object)null) if ((Object)(object)boneFromBoneMap == (Object)null)
{ {
Debug.LogWarning((object)("[AvatarBodyMatchUtil] " + ((Object)avatarRoot).name + " 에서 Neck 본을 찾지 못했습니다. 스케일 정규화를 건너뜁니다.")); Debug.LogWarning((object)("[AvatarBodyMatchUtil] " + ((Object)avatarRoot).name + " 에서 Neck 본을 찾지 못했습니다. 스케일 정규화를 건너뜁니다."));
return; return;
} }
Transform transform = ((Component)avatarRoot).transform; Transform transform = ((Component)avatarRoot).transform;
float num = boneFromBoneMap.position.y - transform.position.y; float num = boneFromBoneMap.position.y - transform.position.y;
if (Mathf.Approximately(num, 0f)) if (Mathf.Approximately(num, 0f))
{ {
Debug.LogWarning((object)$"[AvatarBodyMatchUtil] {((Object)avatarRoot).name} Neck Y가 0에 가까워 스케일 계산을 건너뜁니다. (neckY = {num})"); Debug.LogWarning((object)$"[AvatarBodyMatchUtil] {((Object)avatarRoot).name} Neck Y가 0에 가까워 스케일 계산을 건너뜁니다. (neckY = {num})");
return; return;
} }
float num2 = targetHeight / num; float num2 = targetHeight / num;
Vector3 localScale = transform.localScale; Vector3 localScale = transform.localScale;
localScale *= num2; localScale *= num2;
transform.localScale = localScale; transform.localScale = localScale;
} }
public GameObject CreateBodyProxy(Animator sourceAvatar, IReadOnlyList<SkinnedMeshRenderer> sourceBodyMeshes, out List<SkinnedMeshRenderer> proxyBodyMeshes, out Dictionary<Transform, Transform> sourceToProxy) public GameObject CreateBodyProxy(Animator sourceAvatar, IReadOnlyList<SkinnedMeshRenderer> sourceBodyMeshes, out List<SkinnedMeshRenderer> proxyBodyMeshes, out Dictionary<Transform, Transform> sourceToProxy)
{ {
//IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references)
proxyBodyMeshes = null; proxyBodyMeshes = null;
if ((Object)(object)sourceAvatar == (Object)null) if ((Object)(object)sourceAvatar == (Object)null)
{ {
Debug.LogError((object)"[AvatarBodyMatchUtil] CreateSourceBodyProxy: sourceAvatar == null"); Debug.LogError((object)"[AvatarBodyMatchUtil] CreateSourceBodyProxy: sourceAvatar == null");
sourceToProxy = new Dictionary<Transform, Transform>(); sourceToProxy = new Dictionary<Transform, Transform>();
return null; return null;
} }
GameObject clone = Object.Instantiate<GameObject>(((Component)sourceAvatar).gameObject); GameObject clone = Object.Instantiate<GameObject>(((Component)sourceAvatar).gameObject);
((Object)clone).name = ((Object)sourceAvatar).name + "_BodyProxy"; ((Object)clone).name = ((Object)sourceAvatar).name + "_BodyProxy";
HashSet<Transform> remainTransforms = new HashSet<Transform>(); HashSet<Transform> remainTransforms = new HashSet<Transform>();
remainTransforms.Add(clone.transform); remainTransforms.Add(clone.transform);
Animator component = clone.GetComponent<Animator>(); Animator component = clone.GetComponent<Animator>();
if ((Object)(object)component != (Object)null) if ((Object)(object)component != (Object)null)
{ {
((Behaviour)component).enabled = false; ((Behaviour)component).enabled = false;
remainTransforms.Add(((Component)component).transform); remainTransforms.Add(((Component)component).transform);
} }
if ((Object)(object)component != (Object)null && (Object)(object)component.avatar != (Object)null && component.avatar.isHuman) if ((Object)(object)component != (Object)null && (Object)(object)component.avatar != (Object)null && component.avatar.isHuman)
{ {
for (int i = 0; i < 55; i++) for (int i = 0; i < 55; i++)
{ {
HumanBodyBones val = (HumanBodyBones)i; HumanBodyBones val = (HumanBodyBones)i;
Transform boneTransform = component.GetBoneTransform(val); Transform boneTransform = component.GetBoneTransform(val);
if ((Object)(object)boneTransform != (Object)null) if ((Object)(object)boneTransform != (Object)null)
{ {
remainTransforms.Add(boneTransform); remainTransforms.Add(boneTransform);
} }
} }
} }
HashSet<Mesh> hashSet = new HashSet<Mesh>(); HashSet<Mesh> hashSet = new HashSet<Mesh>();
if (sourceBodyMeshes != null) if (sourceBodyMeshes != null)
{ {
foreach (SkinnedMeshRenderer sourceBodyMesh in sourceBodyMeshes) foreach (SkinnedMeshRenderer sourceBodyMesh in sourceBodyMeshes)
{ {
if (!((Object)(object)sourceBodyMesh == (Object)null) && !((Object)(object)sourceBodyMesh.sharedMesh == (Object)null)) if (!((Object)(object)sourceBodyMesh == (Object)null) && !((Object)(object)sourceBodyMesh.sharedMesh == (Object)null))
{ {
hashSet.Add(sourceBodyMesh.sharedMesh); hashSet.Add(sourceBodyMesh.sharedMesh);
} }
} }
} }
SkinnedMeshRenderer[] componentsInChildren = clone.GetComponentsInChildren<SkinnedMeshRenderer>(true); SkinnedMeshRenderer[] componentsInChildren = clone.GetComponentsInChildren<SkinnedMeshRenderer>(true);
List<SkinnedMeshRenderer> list = new List<SkinnedMeshRenderer>(); List<SkinnedMeshRenderer> list = new List<SkinnedMeshRenderer>();
SkinnedMeshRenderer[] array = componentsInChildren; SkinnedMeshRenderer[] array = componentsInChildren;
foreach (SkinnedMeshRenderer val2 in array) foreach (SkinnedMeshRenderer val2 in array)
{ {
if (!((Object)(object)val2 == (Object)null)) if (!((Object)(object)val2 == (Object)null))
{ {
Mesh sharedMesh = val2.sharedMesh; Mesh sharedMesh = val2.sharedMesh;
if (!((Object)(object)sharedMesh == (Object)null) && hashSet.Contains(sharedMesh)) if (!((Object)(object)sharedMesh == (Object)null) && hashSet.Contains(sharedMesh))
{ {
list.Add(val2); list.Add(val2);
} }
} }
} }
if (list.Count == 0) if (list.Count == 0)
{ {
Debug.LogWarning((object)"[AvatarBodyMatchUtil] CreateSourceBodyProxy: clone에서 동일 sharedMesh를 가진 BodyMesh를 찾지 못했습니다."); Debug.LogWarning((object)"[AvatarBodyMatchUtil] CreateSourceBodyProxy: clone에서 동일 sharedMesh를 가진 BodyMesh를 찾지 못했습니다.");
} }
if (list.Count > 0) if (list.Count > 0)
{ {
MeshClassifier meshClassifier = new MeshClassifier(); MeshClassifier meshClassifier = new MeshClassifier();
foreach (SkinnedMeshRenderer item in list) foreach (SkinnedMeshRenderer item in list)
{ {
if ((Object)(object)item == (Object)null) if ((Object)(object)item == (Object)null)
{ {
continue; continue;
} }
remainTransforms.Add(((Component)item).transform); remainTransforms.Add(((Component)item).transform);
HashSet<Transform> activeBones = meshClassifier.GetActiveBones(item); HashSet<Transform> activeBones = meshClassifier.GetActiveBones(item);
if (activeBones == null) if (activeBones == null)
{ {
string[] obj = new string[5] string[] obj = new string[5]
{ {
"[AvatarBodyMatchUtil] CreateSourceBodyProxy: clone smr '", "[AvatarBodyMatchUtil] CreateSourceBodyProxy: clone smr '",
((Object)item).name, ((Object)item).name,
"' has null bones array (mesh='", "' has null bones array (mesh='",
null, null,
null null
}; };
Mesh sharedMesh2 = item.sharedMesh; Mesh sharedMesh2 = item.sharedMesh;
obj[3] = ((sharedMesh2 != null) ? ((Object)sharedMesh2).name : null); obj[3] = ((sharedMesh2 != null) ? ((Object)sharedMesh2).name : null);
obj[4] = "')"; obj[4] = "')";
Debug.LogWarning((object)string.Concat(obj)); Debug.LogWarning((object)string.Concat(obj));
continue; continue;
} }
foreach (Transform item2 in activeBones) foreach (Transform item2 in activeBones)
{ {
if (!((Object)(object)item2 == (Object)null)) if (!((Object)(object)item2 == (Object)null))
{ {
remainTransforms.Add(item2); remainTransforms.Add(item2);
} }
} }
} }
} }
foreach (Transform item3 in remainTransforms.ToList()) foreach (Transform item3 in remainTransforms.ToList())
{ {
AddWithParents(item3); AddWithParents(item3);
} }
Transform[] componentsInChildren2 = clone.GetComponentsInChildren<Transform>(true); Transform[] componentsInChildren2 = clone.GetComponentsInChildren<Transform>(true);
for (int num = componentsInChildren2.Length - 1; num >= 0; num--) for (int num = componentsInChildren2.Length - 1; num >= 0; num--)
{ {
Transform val3 = componentsInChildren2[num]; Transform val3 = componentsInChildren2[num];
if (!((Object)(object)val3 == (Object)null) && !((Object)(object)val3 == (Object)(object)clone.transform) && !remainTransforms.Contains(val3)) if (!((Object)(object)val3 == (Object)null) && !((Object)(object)val3 == (Object)(object)clone.transform) && !remainTransforms.Contains(val3))
{ {
Object.DestroyImmediate((Object)(object)((Component)val3).gameObject); Object.DestroyImmediate((Object)(object)((Component)val3).gameObject);
} }
} }
proxyBodyMeshes = list; proxyBodyMeshes = list;
new BoneMatchUtil().BuildSourceToProxyBoneMap(sourceAvatar, component, out sourceToProxy); new BoneMatchUtil().BuildSourceToProxyBoneMap(sourceAvatar, component, out sourceToProxy);
return clone; return clone;
void AddWithParents(Transform t) void AddWithParents(Transform t)
{ {
while ((Object)(object)t != (Object)null && (Object)(object)t != (Object)(object)clone.transform) while ((Object)(object)t != (Object)null && (Object)(object)t != (Object)(object)clone.transform)
{ {
remainTransforms.Add(t); remainTransforms.Add(t);
t = t.parent; t = t.parent;
} }
} }
} }
public Vector3 GetComprehensiveScale(Transform rootT, Dictionary<HumanBodyBones, HashSet<Transform>> clothHumanoidBoneMap, ProfileData profileData) public Vector3 GetComprehensiveScale(Transform rootT, Dictionary<HumanBodyBones, HashSet<Transform>> clothHumanoidBoneMap, ProfileData profileData)
{ {
//IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references)
//IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references)
//IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references)
//IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_011b: 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_0123: Unknown result type (might be due to invalid IL or missing references)
//IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references)
//IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references)
//IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references)
//IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references)
//IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_015b: 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_0162: Unknown result type (might be due to invalid IL or missing references)
//IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references)
//IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)rootT == (Object)null) if ((Object)(object)rootT == (Object)null)
{ {
throw new AutoMorpherException("Root Transform is Missing", "[BodyPoseMatch_CommonUtil] GetComprehensiveScale\n - rootT is null"); throw new AutoMorpherException("Root Transform is Missing", "[BodyPoseMatch_CommonUtil] GetComprehensiveScale\n - rootT is null");
} }
if (profileData.bones == null || profileData.bones.Count == 0) if (profileData.bones == null || profileData.bones.Count == 0)
{ {
throw new AutoMorpherException("Profile Bones are Missing", "[BodyPoseMatch_CommonUtil] GetComprehensiveScale\n - profileData.bones is null or empty"); throw new AutoMorpherException("Profile Bones are Missing", "[BodyPoseMatch_CommonUtil] GetComprehensiveScale\n - profileData.bones is null or empty");
} }
Transform val = null; Transform val = null;
if (clothHumanoidBoneMap.TryGetValue((HumanBodyBones)0, out var value) && value != null && value.Count > 0) if (clothHumanoidBoneMap.TryGetValue((HumanBodyBones)0, out var value) && value != null && value.Count > 0)
{ {
foreach (Transform item in value) foreach (Transform item in value)
{ {
if ((Object)(object)item != (Object)null) if ((Object)(object)item != (Object)null)
{ {
val = item; val = item;
break; break;
} }
} }
} }
if ((Object)(object)val == (Object)null) if ((Object)(object)val == (Object)null)
{ {
throw new AutoMorpherException("Hip Transform is Missing", "[BodyPoseMatch_CommonUtil] GetComprehensiveScale\n - failed to get [hip] transform from clothHumanoidBoneMap"); throw new AutoMorpherException("Hip Transform is Missing", "[BodyPoseMatch_CommonUtil] GetComprehensiveScale\n - failed to get [hip] transform from clothHumanoidBoneMap");
} }
BoneData val2 = null; BoneData val2 = null;
for (int i = 0; i < profileData.bones.Count; i++) for (int i = 0; i < profileData.bones.Count; i++)
{ {
BoneData val3 = profileData.bones[i]; BoneData val3 = profileData.bones[i];
if (val3 != null && (int)val3.hBone == 0) if (val3 != null && (int)val3.hBone == 0)
{ {
val2 = val3; val2 = val3;
break; break;
} }
} }
if (val2 == null) if (val2 == null)
{ {
throw new AutoMorpherException("Hip Bone Data is Missing in Profile", "[BodyPoseMatch_CommonUtil] GetComprehensiveScale\n - profileData bones does not contain Hips"); throw new AutoMorpherException("Hip Bone Data is Missing in Profile", "[BodyPoseMatch_CommonUtil] GetComprehensiveScale\n - profileData bones does not contain Hips");
} }
Vector3 rootLocalScale = val2.rootLocalScale; Vector3 rootLocalScale = val2.rootLocalScale;
Vector3 lossyScale = rootT.lossyScale; Vector3 lossyScale = rootT.lossyScale;
Vector3 lossyScale2 = val.lossyScale; Vector3 lossyScale2 = val.lossyScale;
Vector3 val4 = default(Vector3); Vector3 val4 = new Vector3(lossyScale2.x / lossyScale.x, lossyScale2.y / lossyScale.y, lossyScale2.z / lossyScale.z);
((Vector3)(ref val4))._002Ector(lossyScale2.x / lossyScale.x, lossyScale2.y / lossyScale.y, lossyScale2.z / lossyScale.z); return new Vector3(val4.x / rootLocalScale.x, val4.y / rootLocalScale.y, val4.z / rootLocalScale.z);
return new Vector3(val4.x / rootLocalScale.x, val4.y / rootLocalScale.y, val4.z / rootLocalScale.z); }
}
} }

View File

@@ -1,133 +1,132 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // 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. // 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 // EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.BodyPoseMatchUtil // Eden.AutoMorpher.BodyPoseMatchUtil
using System.Collections.Generic; using System.Collections.Generic;
using Eden.AutoMorpher;
using UnityEngine; using UnityEngine;
public class BodyPoseMatchUtil public class BodyPoseMatchUtil
{ {
private WorldVertexUtil _worldVertexUtil; private WorldVertexUtil _worldVertexUtil;
private MeshClassifier meshClassifier; private MeshClassifier meshClassifier;
private BodyPoseMatch_CommonUtil poseMatchCommonUtil; private BodyPoseMatch_CommonUtil poseMatchCommonUtil;
private bool doDebug; private bool doDebug;
public BodyPoseMatchUtil() public BodyPoseMatchUtil()
{ {
_worldVertexUtil = new WorldVertexUtil(); this._worldVertexUtil = new WorldVertexUtil();
meshClassifier = new MeshClassifier(); this.meshClassifier = new MeshClassifier();
poseMatchCommonUtil = new BodyPoseMatch_CommonUtil(); this.poseMatchCommonUtil = new BodyPoseMatch_CommonUtil();
} }
public GameObject AutoAdjustBodyPose(GameObject sourceAvatar, IReadOnlyList<SkinnedMeshRenderer> sourceBodyMeshes, GameObject targetAvatar, IReadOnlyList<SkinnedMeshRenderer> targetBodyMeshes, out Dictionary<Transform, Transform> sourceToProxy, float neckTargetHeight = 1.5f, bool onlyScaling = false) public GameObject AutoAdjustBodyPose(GameObject sourceAvatar, IReadOnlyList<SkinnedMeshRenderer> sourceBodyMeshes, GameObject targetAvatar, IReadOnlyList<SkinnedMeshRenderer> targetBodyMeshes, out Dictionary<Transform, Transform> sourceToProxy, float neckTargetHeight = 1.5f, bool onlyScaling = false)
{ {
//IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references)
//IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references)
//IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references)
//IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references)
//IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references)
//IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references)
//IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references)
//IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references)
//IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references)
//IL_03a3: Unknown result type (might be due to invalid IL or missing references) //IL_03a3: Unknown result type (might be due to invalid IL or missing references)
//IL_03a8: Unknown result type (might be due to invalid IL or missing references) //IL_03a8: Unknown result type (might be due to invalid IL or missing references)
//IL_03c5: Unknown result type (might be due to invalid IL or missing references) //IL_03c5: Unknown result type (might be due to invalid IL or missing references)
//IL_03ca: Unknown result type (might be due to invalid IL or missing references) //IL_03ca: Unknown result type (might be due to invalid IL or missing references)
//IL_03e5: Unknown result type (might be due to invalid IL or missing references) //IL_03e5: Unknown result type (might be due to invalid IL or missing references)
//IL_03ea: Unknown result type (might be due to invalid IL or missing references) //IL_03ea: Unknown result type (might be due to invalid IL or missing references)
//IL_0405: Unknown result type (might be due to invalid IL or missing references) //IL_0405: Unknown result type (might be due to invalid IL or missing references)
//IL_040a: Unknown result type (might be due to invalid IL or missing references) //IL_040a: Unknown result type (might be due to invalid IL or missing references)
Animator component = sourceAvatar.GetComponent<Animator>(); Animator component = sourceAvatar.GetComponent<Animator>();
Animator component2 = targetAvatar.GetComponent<Animator>(); Animator component2 = targetAvatar.GetComponent<Animator>();
if ((Object)(object)component == (Object)null || (Object)(object)component2 == (Object)null) if ((Object)(object)component == (Object)null || (Object)(object)component2 == (Object)null)
{ {
Debug.LogError((object)"[AvatarBodyMatchUtil] sourceAvatar 또는 targetAvatar가 null입니다."); Debug.LogError((object)"[AvatarBodyMatchUtil] sourceAvatar 또는 targetAvatar가 null입니다.");
sourceToProxy = new Dictionary<Transform, Transform>(); sourceToProxy = new Dictionary<Transform, Transform>();
return null; return null;
} }
Dictionary<HumanBodyBones, HashSet<Transform>> humanBoneMap = meshClassifier.MeshHumanoidBoneMatcher(component, sourceBodyMeshes); Dictionary<HumanBodyBones, HashSet<Transform>> humanBoneMap = this.meshClassifier.MeshHumanoidBoneMatcher(component, sourceBodyMeshes);
Dictionary<HumanBodyBones, HashSet<Transform>> dictionary = meshClassifier.MeshHumanoidBoneMatcher(component2, targetBodyMeshes); Dictionary<HumanBodyBones, HashSet<Transform>> dictionary = this.meshClassifier.MeshHumanoidBoneMatcher(component2, targetBodyMeshes);
BodyPoseMatchSetupUtil bodyPoseMatchSetupUtil = new BodyPoseMatchSetupUtil(); BodyPoseMatchSetupUtil bodyPoseMatchSetupUtil = new BodyPoseMatchSetupUtil();
bodyPoseMatchSetupUtil.AdjustAvatarScaleByNeck(sourceAvatar.transform, humanBoneMap, neckTargetHeight); bodyPoseMatchSetupUtil.AdjustAvatarScaleByNeck(sourceAvatar.transform, humanBoneMap, neckTargetHeight);
bodyPoseMatchSetupUtil.AdjustAvatarScaleByNeck(targetAvatar.transform, dictionary, neckTargetHeight); bodyPoseMatchSetupUtil.AdjustAvatarScaleByNeck(targetAvatar.transform, dictionary, neckTargetHeight);
List<SkinnedMeshRenderer> proxyBodyMeshes; List<SkinnedMeshRenderer> proxyBodyMeshes;
GameObject val = bodyPoseMatchSetupUtil.CreateBodyProxy(component, sourceBodyMeshes, out proxyBodyMeshes, out sourceToProxy); GameObject val = bodyPoseMatchSetupUtil.CreateBodyProxy(component, sourceBodyMeshes, out proxyBodyMeshes, out sourceToProxy);
Animator component3 = val.GetComponent<Animator>(); Animator component3 = val.GetComponent<Animator>();
if (onlyScaling) if (onlyScaling)
{ {
val.transform.SetParent(targetAvatar.transform); val.transform.SetParent(targetAvatar.transform);
val.transform.localPosition = Vector3.zero; val.transform.localPosition = Vector3.zero;
return val; return val;
} }
Dictionary<HumanBodyBones, HashSet<Transform>> dictionary2 = meshClassifier.MeshHumanoidBoneMatcher(component3, proxyBodyMeshes); Dictionary<HumanBodyBones, HashSet<Transform>> dictionary2 = this.meshClassifier.MeshHumanoidBoneMatcher(component3, proxyBodyMeshes);
if (dictionary2 == null || dictionary2.Count == 0) if (dictionary2 == null || dictionary2.Count == 0)
{ {
throw new AutoMorpherException("Proxy Bone Map is Missing", "[BodyPoseMatch_Arm] AlignUpperArmByArmPcaCenters\n - proxyBoneMap is null"); throw new AutoMorpherException("Proxy Bone Map is Missing", "[BodyPoseMatch_Arm] AlignUpperArmByArmPcaCenters\n - proxyBoneMap is null");
} }
val.transform.SetParent(targetAvatar.transform); val.transform.SetParent(targetAvatar.transform);
val.transform.localPosition = Vector3.zero; val.transform.localPosition = Vector3.zero;
List<BakedBodyMesh> list = new List<BakedBodyMesh>(); List<BakedBodyMesh> list = new List<BakedBodyMesh>();
foreach (SkinnedMeshRenderer item in proxyBodyMeshes) foreach (SkinnedMeshRenderer item in proxyBodyMeshes)
{ {
list.Add(new BakedBodyMesh(item)); list.Add(new BakedBodyMesh(item));
} }
List<BakedBodyMesh> list2 = new List<BakedBodyMesh>(); List<BakedBodyMesh> list2 = new List<BakedBodyMesh>();
foreach (SkinnedMeshRenderer targetBodyMesh in targetBodyMeshes) foreach (SkinnedMeshRenderer targetBodyMesh in targetBodyMeshes)
{ {
list2.Add(new BakedBodyMesh(targetBodyMesh)); list2.Add(new BakedBodyMesh(targetBodyMesh));
} }
BodyPoseMatch_Torso bodyPoseMatch_Torso = new BodyPoseMatch_Torso(); BodyPoseMatch_Torso bodyPoseMatch_Torso = new BodyPoseMatch_Torso();
bodyPoseMatch_Torso.AlignTorsoByNeck(val, list, dictionary2, targetAvatar, list2, dictionary); bodyPoseMatch_Torso.AlignTorsoByNeck(val, list, dictionary2, targetAvatar, list2, dictionary);
if (doDebug) if (this.doDebug)
{ {
bodyPoseMatch_Torso.DrawTorsoPcaDebug(val, list, dictionary2, Color.yellow, Color.cyan, 1f, 20f); bodyPoseMatch_Torso.DrawTorsoPcaDebug(val, list, dictionary2, Color.yellow, Color.cyan, 1f, 20f);
bodyPoseMatch_Torso.DrawTorsoPcaDebug(targetAvatar, list2, dictionary, Color.red, Color.green, 1f, 20f); bodyPoseMatch_Torso.DrawTorsoPcaDebug(targetAvatar, list2, dictionary, Color.red, Color.green, 1f, 20f);
} }
foreach (BakedBodyMesh item2 in list) foreach (BakedBodyMesh item2 in list)
{ {
item2.ReBakeMesh(); item2.ReBakeMesh();
} }
BodyPoseMatch_Arm bodyPoseMatch_Arm = new BodyPoseMatch_Arm(); BodyPoseMatch_Arm bodyPoseMatch_Arm = new BodyPoseMatch_Arm();
bodyPoseMatch_Arm.AlignUpperArmByArmPcaCenters(list, dictionary2, list2, dictionary); bodyPoseMatch_Arm.AlignUpperArmByArmPcaCenters(list, dictionary2, list2, dictionary);
if (doDebug) if (this.doDebug)
{ {
bodyPoseMatch_Arm.DrawArmPcaDebug(val, list, dictionary2, isLeft: true, Color.yellow, Color.cyan, 1f, 20f); bodyPoseMatch_Arm.DrawArmPcaDebug(val, list, dictionary2, isLeft: true, Color.yellow, Color.cyan, 1f, 20f);
bodyPoseMatch_Arm.DrawArmPcaDebug(targetAvatar, list2, dictionary, isLeft: true, Color.red, Color.green, 1f, 20f); bodyPoseMatch_Arm.DrawArmPcaDebug(targetAvatar, list2, dictionary, isLeft: true, Color.red, Color.green, 1f, 20f);
} }
foreach (BakedBodyMesh item3 in list) foreach (BakedBodyMesh item3 in list)
{ {
item3.ReBakeMesh(); item3.ReBakeMesh();
} }
bodyPoseMatch_Arm.ScalingBothArmsLength(list, dictionary2, list2, dictionary); bodyPoseMatch_Arm.ScalingBothArmsLength(list, dictionary2, list2, dictionary);
foreach (BakedBodyMesh item4 in list) foreach (BakedBodyMesh item4 in list)
{ {
item4.ReBakeMesh(); item4.ReBakeMesh();
} }
BodyPoseMatch_Leg bodyPoseMatch_Leg = new BodyPoseMatch_Leg(); BodyPoseMatch_Leg bodyPoseMatch_Leg = new BodyPoseMatch_Leg();
bodyPoseMatch_Leg.AlignBothUpperLegs(val, list, dictionary2, targetAvatar, list2, dictionary); bodyPoseMatch_Leg.AlignBothUpperLegs(val, list, dictionary2, targetAvatar, list2, dictionary);
foreach (BakedBodyMesh item5 in list) foreach (BakedBodyMesh item5 in list)
{ {
item5.ReBakeMesh(); item5.ReBakeMesh();
} }
bodyPoseMatch_Leg.ScalingBothLegsAndFoots(val, list, dictionary2, targetAvatar, list2, dictionary); bodyPoseMatch_Leg.ScalingBothLegsAndFoots(val, list, dictionary2, targetAvatar, list2, dictionary);
if (doDebug) if (this.doDebug)
{ {
foreach (BakedBodyMesh item6 in list) foreach (BakedBodyMesh item6 in list)
{ {
item6.ReBakeMesh(); item6.ReBakeMesh();
} }
bodyPoseMatch_Leg.DrawLegPcaDebug(val, list, dictionary2, isLeft: true, Color.yellow, Color.cyan, 1f, 5f); bodyPoseMatch_Leg.DrawLegPcaDebug(val, list, dictionary2, isLeft: true, Color.yellow, Color.cyan, 1f, 5f);
bodyPoseMatch_Leg.DrawLegPcaDebug(val, list, dictionary2, isLeft: false, Color.yellow, Color.cyan, 1f, 5f); bodyPoseMatch_Leg.DrawLegPcaDebug(val, list, dictionary2, isLeft: false, Color.yellow, Color.cyan, 1f, 5f);
bodyPoseMatch_Leg.DrawLegPcaDebug(targetAvatar, list2, dictionary, isLeft: true, Color.magenta, Color.green, 1f, 5f); bodyPoseMatch_Leg.DrawLegPcaDebug(targetAvatar, list2, dictionary, isLeft: true, Color.magenta, Color.green, 1f, 5f);
bodyPoseMatch_Leg.DrawLegPcaDebug(targetAvatar, list2, dictionary, isLeft: false, Color.magenta, Color.green, 1f, 5f); bodyPoseMatch_Leg.DrawLegPcaDebug(targetAvatar, list2, dictionary, isLeft: false, Color.magenta, Color.green, 1f, 5f);
bodyPoseMatch_Arm.DrawForearmExtremeDebugPair(val.gameObject, proxyBodyMeshes, targetAvatar, targetBodyMeshes, isLeft: true, 1f, 5f); bodyPoseMatch_Arm.DrawForearmExtremeDebugPair(val.gameObject, proxyBodyMeshes, targetAvatar, targetBodyMeshes, isLeft: true, 1f, 5f);
} }
return val; return val;
} }
} }

File diff suppressed because it is too large Load Diff

View File

@@ -1,319 +1,315 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // 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. // 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 // EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.BodyPoseMatch_CommonUtil // Eden.AutoMorpher.BodyPoseMatch_CommonUtil
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Eden.AutoMorpher;
using Eden.AutoMorpher.profile;
using UnityEngine; using UnityEngine;
public class BodyPoseMatch_CommonUtil public class BodyPoseMatch_CommonUtil
{ {
public Transform GetBoneFromBoneMap(Dictionary<HumanBodyBones, HashSet<Transform>> boneMap, HumanBodyBones bone) public Transform GetBoneFromBoneMap(Dictionary<HumanBodyBones, HashSet<Transform>> boneMap, HumanBodyBones bone)
{ {
//IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references)
if (boneMap == null || !boneMap.TryGetValue(bone, out var value) || value == null) if (boneMap == null || !boneMap.TryGetValue(bone, out var value) || value == null)
{ {
return null; return null;
} }
return value.FirstOrDefault(); return value.FirstOrDefault();
} }
public Vector3 GetProfilePcaCenterWorld(Dictionary<HumanBodyBones, HashSet<Transform>> clothBoneMap, BoneSpatialData boneSpatialData, Vector3 comprehensiveScale, string errorContext = "") public Vector3 GetProfilePcaCenterWorld(Dictionary<HumanBodyBones, HashSet<Transform>> clothBoneMap, BoneSpatialData boneSpatialData, Vector3 comprehensiveScale, string errorContext = "")
{ {
//IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: 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_00ef: Unknown result type (might be due to invalid IL or missing references)
if (clothBoneMap == null) if (clothBoneMap == null)
{ {
throw new AutoMorpherException("Cloth Bone Map is Missing", "[BodyPoseMatch_CommonUtil] GetProfilePcaCenterWorld\n - clothBoneMap is null (context=" + errorContext + ")"); throw new AutoMorpherException("Cloth Bone Map is Missing", "[BodyPoseMatch_CommonUtil] GetProfilePcaCenterWorld\n - clothBoneMap is null (context=" + errorContext + ")");
} }
if (boneSpatialData == null || boneSpatialData.pcaData == null) if (boneSpatialData == null || boneSpatialData.pcaData == null)
{ {
throw new AutoMorpherException("Profile Bone Spatial Data is Missing", "[BodyPoseMatch_CommonUtil] GetProfilePcaCenterWorld\n - boneSpatialData or boneSpatialData.pcaData is null (context=" + errorContext + ")"); throw new AutoMorpherException("Profile Bone Spatial Data is Missing", "[BodyPoseMatch_CommonUtil] GetProfilePcaCenterWorld\n - boneSpatialData or boneSpatialData.pcaData is null (context=" + errorContext + ")");
} }
Transform boneFromBoneMap = GetBoneFromBoneMap(clothBoneMap, boneSpatialData.refBone); Transform boneFromBoneMap = this.GetBoneFromBoneMap(clothBoneMap, boneSpatialData.refBone);
if ((Object)(object)boneFromBoneMap == (Object)null) if ((Object)(object)boneFromBoneMap == (Object)null)
{ {
throw new AutoMorpherException("Profile Ref Bone Transform is Missing", "[BodyPoseMatch_CommonUtil] GetProfilePcaCenterWorld" + $"\n - refBone transform is null (refBone={boneSpatialData.refBone}, context={errorContext})"); throw new AutoMorpherException("Profile Ref Bone Transform is Missing", "[BodyPoseMatch_CommonUtil] GetProfilePcaCenterWorld" + $"\n - refBone transform is null (refBone={boneSpatialData.refBone}, context={errorContext})");
} }
if ((Object)(object)GetBoneFromBoneMap(clothBoneMap, (HumanBodyBones)0) == (Object)null) if ((Object)(object)this.GetBoneFromBoneMap(clothBoneMap, (HumanBodyBones)0) == (Object)null)
{ {
throw new AutoMorpherException("Hip Transform is Missing", "[BodyPoseMatch_CommonUtil] GetProfilePcaCenterWorld\n - hip transform is null (context=" + errorContext + ")"); throw new AutoMorpherException("Hip Transform is Missing", "[BodyPoseMatch_CommonUtil] GetProfilePcaCenterWorld\n - hip transform is null (context=" + errorContext + ")");
} }
Vector3 pcaCenter = boneSpatialData.pcaData.pcaCenter; Vector3 pcaCenter = boneSpatialData.pcaData.pcaCenter;
Vector3 val = default(Vector3); Vector3 val = new Vector3(pcaCenter.x / comprehensiveScale.x, pcaCenter.y / comprehensiveScale.y, pcaCenter.z / comprehensiveScale.z);
((Vector3)(ref val))._002Ector(pcaCenter.x / comprehensiveScale.x, pcaCenter.y / comprehensiveScale.y, pcaCenter.z / comprehensiveScale.z); return boneFromBoneMap.TransformPoint(val);
return boneFromBoneMap.TransformPoint(val); }
}
public Vector3 GetProfileVolumeMinWorld(Dictionary<HumanBodyBones, HashSet<Transform>> clothBoneMap, BoneSpatialData spatialData, int axis, Vector3 comprehensiveScale) public Vector3 GetProfileVolumeMinWorld(Dictionary<HumanBodyBones, HashSet<Transform>> clothBoneMap, BoneSpatialData spatialData, int axis, Vector3 comprehensiveScale)
{ {
//IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references)
return GetProfileVolumeWorld(clothBoneMap, spatialData, axis, comprehensiveScale, isMin: true); return this.GetProfileVolumeWorld(clothBoneMap, spatialData, axis, comprehensiveScale, isMin: true);
} }
public Vector3 GetProfileVolumeMaxWorld(Dictionary<HumanBodyBones, HashSet<Transform>> clothBoneMap, BoneSpatialData spatialData, int axis, Vector3 comprehensiveScale) public Vector3 GetProfileVolumeMaxWorld(Dictionary<HumanBodyBones, HashSet<Transform>> clothBoneMap, BoneSpatialData spatialData, int axis, Vector3 comprehensiveScale)
{ {
//IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references)
return GetProfileVolumeWorld(clothBoneMap, spatialData, axis, comprehensiveScale, isMin: false); return this.GetProfileVolumeWorld(clothBoneMap, spatialData, axis, comprehensiveScale, isMin: false);
} }
public Vector3 GetProfileVolumeWorld(Dictionary<HumanBodyBones, HashSet<Transform>> clothBoneMap, BoneSpatialData spatialData, int axisIndex, Vector3 comprehensiveScale, bool isMin) public Vector3 GetProfileVolumeWorld(Dictionary<HumanBodyBones, HashSet<Transform>> clothBoneMap, BoneSpatialData spatialData, int axisIndex, Vector3 comprehensiveScale, bool isMin)
{ {
//IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_008d: 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_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: 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_0107: 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_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references)
//IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_011b: 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_0123: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0129: 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_0137: Unknown result type (might be due to invalid IL or missing references)
//IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references)
if (clothBoneMap == null) if (clothBoneMap == null)
{ {
throw new AutoMorpherException("Cloth Bone Map is Missing", "[BodyPoseMatch_CommonUtil] GetProfileVolumeWorld\n - clothBoneMap is null"); throw new AutoMorpherException("Cloth Bone Map is Missing", "[BodyPoseMatch_CommonUtil] GetProfileVolumeWorld\n - clothBoneMap is null");
} }
if (spatialData == null || spatialData.volumeData == null) if (spatialData == null || spatialData.volumeData == null)
{ {
throw new AutoMorpherException("Profile Volume Data is Missing", "[BodyPoseMatch_CommonUtil] GetProfileVolumeWorld\n - spatialData or spatialData.volumeData is null"); throw new AutoMorpherException("Profile Volume Data is Missing", "[BodyPoseMatch_CommonUtil] GetProfileVolumeWorld\n - spatialData or spatialData.volumeData is null");
} }
Transform boneFromBoneMap = GetBoneFromBoneMap(clothBoneMap, spatialData.refBone); Transform boneFromBoneMap = this.GetBoneFromBoneMap(clothBoneMap, spatialData.refBone);
if ((Object)(object)boneFromBoneMap == (Object)null) if ((Object)(object)boneFromBoneMap == (Object)null)
{ {
throw new AutoMorpherException("Profile Ref Bone Transform is Missing", "[BodyPoseMatch_CommonUtil] GetProfileVolumeWorld" + $"\n - refBone transform is null (refBone={spatialData.refBone})"); throw new AutoMorpherException("Profile Ref Bone Transform is Missing", "[BodyPoseMatch_CommonUtil] GetProfileVolumeWorld" + $"\n - refBone transform is null (refBone={spatialData.refBone})");
} }
Vector3 val; Vector3 val;
switch (axisIndex) switch (axisIndex)
{ {
case 0: case 0:
val = (isMin ? spatialData.volumeData.fMinLocalPos : spatialData.volumeData.fMaxLocalPos); val = (isMin ? spatialData.volumeData.fMinLocalPos : spatialData.volumeData.fMaxLocalPos);
break; break;
case 1: case 1:
val = (isMin ? spatialData.volumeData.rMinLocalPos : spatialData.volumeData.rMaxLocalPos); val = (isMin ? spatialData.volumeData.rMinLocalPos : spatialData.volumeData.rMaxLocalPos);
break; break;
case 2: case 2:
val = (isMin ? spatialData.volumeData.uMinLocalPos : spatialData.volumeData.uMaxLocalPos); val = (isMin ? spatialData.volumeData.uMinLocalPos : spatialData.volumeData.uMaxLocalPos);
break; break;
default: default:
throw new AutoMorpherException("Unsupported Volume Axis Index", "[BodyPoseMatch_CommonUtil] GetProfileVolumeWorld" + $"\n - axisIndex must be 0(Forward), 1(Right), 2(Up) (axisIndex={axisIndex})"); throw new AutoMorpherException("Unsupported Volume Axis Index", "[BodyPoseMatch_CommonUtil] GetProfileVolumeWorld" + $"\n - axisIndex must be 0(Forward), 1(Right), 2(Up) (axisIndex={axisIndex})");
} }
Vector3 val2 = default(Vector3); Vector3 val2 = new Vector3(val.x / comprehensiveScale.x, val.y / comprehensiveScale.y, val.z / comprehensiveScale.z);
((Vector3)(ref val2))._002Ector(val.x / comprehensiveScale.x, val.y / comprehensiveScale.y, val.z / comprehensiveScale.z); return boneFromBoneMap.TransformPoint(val2);
return boneFromBoneMap.TransformPoint(val2); }
}
public List<Vector3> CollectWeightedVerticesWorld(IReadOnlyList<BakedBodyMesh> bakedBodyMeshes, HashSet<Transform> targetBoneSet, float weightThreshold = 0.15f, int sampleStep = 1) public List<Vector3> CollectWeightedVerticesWorld(IReadOnlyList<BakedBodyMesh> bakedBodyMeshes, HashSet<Transform> targetBoneSet, float weightThreshold = 0.15f, int sampleStep = 1)
{ {
//IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references)
//IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references)
List<Vector3> list = new List<Vector3>(); List<Vector3> list = new List<Vector3>();
if (bakedBodyMeshes == null || targetBoneSet == null || targetBoneSet.Count == 0) if (bakedBodyMeshes == null || targetBoneSet == null || targetBoneSet.Count == 0)
{ {
return list; return list;
} }
foreach (BakedBodyMesh bakedBodyMesh in bakedBodyMeshes) foreach (BakedBodyMesh bakedBodyMesh in bakedBodyMeshes)
{ {
if (bakedBodyMesh == null || (Object)(object)bakedBodyMesh.smr == (Object)null) if (bakedBodyMesh == null || (Object)(object)bakedBodyMesh.smr == (Object)null)
{ {
continue; continue;
} }
Mesh sharedMesh = bakedBodyMesh.smr.sharedMesh; Mesh sharedMesh = bakedBodyMesh.smr.sharedMesh;
if ((Object)(object)sharedMesh == (Object)null) if ((Object)(object)sharedMesh == (Object)null)
{ {
continue; continue;
} }
BoneWeight[] boneWeights = sharedMesh.boneWeights; BoneWeight[] boneWeights = sharedMesh.boneWeights;
Transform[] bones = bakedBodyMesh.smr.bones; Transform[] bones = bakedBodyMesh.smr.bones;
if (boneWeights == null || boneWeights.Length == 0 || bones == null || bones.Length == 0) if (boneWeights == null || boneWeights.Length == 0 || bones == null || bones.Length == 0)
{ {
continue; continue;
} }
Vector3[] worldVerticesWithBakedMesh = new WorldVertexUtil().GetWorldVerticesWithBakedMesh(bakedBodyMesh.smr, bakedBodyMesh.bakedMesh); Vector3[] worldVerticesWithBakedMesh = new WorldVertexUtil().GetWorldVerticesWithBakedMesh(bakedBodyMesh.smr, bakedBodyMesh.bakedMesh);
if (worldVerticesWithBakedMesh == null) if (worldVerticesWithBakedMesh == null)
{ {
continue; continue;
} }
int num = Mathf.Min(worldVerticesWithBakedMesh.Length, boneWeights.Length); int num = Mathf.Min(worldVerticesWithBakedMesh.Length, boneWeights.Length);
for (int i = 0; i < num; i += sampleStep) for (int i = 0; i < num; i += sampleStep)
{ {
BoneWeight val = boneWeights[i]; BoneWeight val = boneWeights[i];
float wSum = 0f; float wSum = 0f;
Acc(((BoneWeight)(ref val)).boneIndex0, ((BoneWeight)(ref val)).weight0); Acc(val.boneIndex0, val.weight0);
Acc(((BoneWeight)(ref val)).boneIndex1, ((BoneWeight)(ref val)).weight1); Acc(val.boneIndex1, val.weight1);
Acc(((BoneWeight)(ref val)).boneIndex2, ((BoneWeight)(ref val)).weight2); Acc(val.boneIndex2, val.weight2);
Acc(((BoneWeight)(ref val)).boneIndex3, ((BoneWeight)(ref val)).weight3); Acc(val.boneIndex3, val.weight3);
if (!(wSum < weightThreshold)) if (!(wSum < weightThreshold))
{ {
list.Add(worldVerticesWithBakedMesh[i]); list.Add(worldVerticesWithBakedMesh[i]);
} }
void Acc(int index, float w) void Acc(int index, float w)
{ {
if (index >= 0 && index < bones.Length && !(w <= 0f)) if (index >= 0 && index < bones.Length && !(w <= 0f))
{ {
Transform val2 = bones[index]; Transform val2 = bones[index];
if ((Object)(object)val2 != (Object)null && targetBoneSet.Contains(val2)) if ((Object)(object)val2 != (Object)null && targetBoneSet.Contains(val2))
{ {
wSum += w; wSum += w;
} }
} }
} }
} }
} }
return list; return list;
} }
public List<Vector3> CollectHumanoidVerticesWorld(IReadOnlyList<HumanBodyBones> targetHumanBones, IReadOnlyList<BakedBodyMesh> bakedBodyMeshes, Dictionary<HumanBodyBones, HashSet<Transform>> boneMap, float weightThreshold = 0.15f, int sampleStep = 1) public List<Vector3> CollectHumanoidVerticesWorld(IReadOnlyList<HumanBodyBones> targetHumanBones, IReadOnlyList<BakedBodyMesh> bakedBodyMeshes, Dictionary<HumanBodyBones, HashSet<Transform>> boneMap, float weightThreshold = 0.15f, int sampleStep = 1)
{ {
//IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references)
List<Vector3> result = new List<Vector3>(); List<Vector3> result = new List<Vector3>();
if (bakedBodyMeshes == null || boneMap == null || boneMap.Count == 0 || targetHumanBones == null) if (bakedBodyMeshes == null || boneMap == null || boneMap.Count == 0 || targetHumanBones == null)
{ {
throw new AutoMorpherException("Invalid Arguments for CollectHumanoidVerticesWorld", "[BodyPoseMatchCommonUtil] CollectHumanoidVerticesWorld\n - bakedBodyMeshes is null OR boneMap is null/empty OR targetHumanBones is null"); throw new AutoMorpherException("Invalid Arguments for CollectHumanoidVerticesWorld", "[BodyPoseMatchCommonUtil] CollectHumanoidVerticesWorld\n - bakedBodyMeshes is null OR boneMap is null/empty OR targetHumanBones is null");
} }
HashSet<Transform> hashSet = new HashSet<Transform>(); HashSet<Transform> hashSet = new HashSet<Transform>();
foreach (HumanBodyBones targetHumanBone in targetHumanBones) foreach (HumanBodyBones targetHumanBone in targetHumanBones)
{ {
if (!boneMap.TryGetValue(targetHumanBone, out var value) || value == null) if (!boneMap.TryGetValue(targetHumanBone, out var value) || value == null)
{ {
continue; continue;
} }
foreach (Transform item in value) foreach (Transform item in value)
{ {
if ((Object)(object)item != (Object)null) if ((Object)(object)item != (Object)null)
{ {
hashSet.Add(item); hashSet.Add(item);
} }
} }
} }
if (hashSet.Count == 0) if (hashSet.Count == 0)
{ {
Debug.Log((object)"[AvatarBodyMatchUtil] CollectBodyPartVerticesWorld: targetBoneSet is empty."); Debug.Log((object)"[AvatarBodyMatchUtil] CollectBodyPartVerticesWorld: targetBoneSet is empty.");
return result; return result;
} }
return CollectWeightedVerticesWorld(bakedBodyMeshes, hashSet, weightThreshold, sampleStep); return this.CollectWeightedVerticesWorld(bakedBodyMeshes, hashSet, weightThreshold, sampleStep);
} }
public void BoneLengthAdjust(Transform proxyParent, Transform proxyChild, Transform targetParent, Transform targetChild, HashSet<Transform> proxyParentSet, bool autoDetectAxis = true, int forceAxisIndex = 1) public void BoneLengthAdjust(Transform proxyParent, Transform proxyChild, Transform targetParent, Transform targetChild, HashSet<Transform> proxyParentSet, bool autoDetectAxis = true, int forceAxisIndex = 1)
{ {
//IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references)
//IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)proxyParent == (Object)null || (Object)(object)proxyChild == (Object)null || (Object)(object)targetParent == (Object)null || (Object)(object)targetChild == (Object)null) if ((Object)(object)proxyParent == (Object)null || (Object)(object)proxyChild == (Object)null || (Object)(object)targetParent == (Object)null || (Object)(object)targetChild == (Object)null)
{ {
Debug.LogWarning((object)"[AvatarBodyMatchUtil] MatchBoneSegmentLength: bone null"); Debug.LogWarning((object)"[AvatarBodyMatchUtil] MatchBoneSegmentLength: bone null");
return; return;
} }
float num = Vector3.Distance(proxyParent.position, proxyChild.position); float num = Vector3.Distance(proxyParent.position, proxyChild.position);
float num2 = Vector3.Distance(targetParent.position, targetChild.position); float num2 = Vector3.Distance(targetParent.position, targetChild.position);
if (num < 1E-06f || num2 < 1E-06f) if (num < 1E-06f || num2 < 1E-06f)
{ {
Debug.LogWarning((object)$"[AvatarBodyMatchUtil] MatchBoneSegmentLength: too small length. proxy={num}, target={num2}"); Debug.LogWarning((object)$"[AvatarBodyMatchUtil] MatchBoneSegmentLength: too small length. proxy={num}, target={num2}");
return; return;
} }
float num3 = num2 / num; float num3 = num2 / num;
int num7; int num7;
if (autoDetectAxis) if (autoDetectAxis)
{ {
Vector3 val = proxyChild.position - proxyParent.position; Vector3 val = proxyChild.position - proxyParent.position;
Vector3 val2 = proxyParent.InverseTransformDirection(val); Vector3 val2 = proxyParent.InverseTransformDirection(val);
float num4 = Mathf.Abs(val2.x); float num4 = Mathf.Abs(val2.x);
float num5 = Mathf.Abs(val2.y); float num5 = Mathf.Abs(val2.y);
float num6 = Mathf.Abs(val2.z); float num6 = Mathf.Abs(val2.z);
num7 = ((num5 >= num4 && num5 >= num6) ? 1 : ((!(num4 >= num6)) ? 2 : 0)); num7 = ((num5 >= num4 && num5 >= num6) ? 1 : ((!(num4 >= num6)) ? 2 : 0));
} }
else else
{ {
num7 = Mathf.Clamp(forceAxisIndex, 0, 2); num7 = Mathf.Clamp(forceAxisIndex, 0, 2);
} }
Vector3 localScale = proxyParent.localScale; Vector3 localScale = proxyParent.localScale;
switch (num7) switch (num7)
{ {
case 0: case 0:
localScale.x *= num3; localScale.x *= num3;
break; break;
case 1: case 1:
localScale.y *= num3; localScale.y *= num3;
break; break;
case 2: case 2:
localScale.z *= num3; localScale.z *= num3;
break; break;
} }
foreach (Transform item in proxyParentSet) foreach (Transform item in proxyParentSet)
{ {
item.localScale = localScale; item.localScale = localScale;
} }
} }
public Transform CreateTempMarker(string markerObjectName, Transform parentTransform, IReadOnlyList<Transform> childTransforms, Vector3 markerWorldPosition, Quaternion markerWorldRotation, Vector3 markerLocalScale, out TempBoneMarker tempBoneMarker) public Transform CreateTempMarker(string markerObjectName, Transform parentTransform, IReadOnlyList<Transform> childTransforms, Vector3 markerWorldPosition, Quaternion markerWorldRotation, Vector3 markerLocalScale, out TempBoneMarker tempBoneMarker)
{ {
//IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)parentTransform == (Object)null) if ((Object)(object)parentTransform == (Object)null)
{ {
throw new AutoMorpherException("Marker Parent Transform is Missing", "[BodyPoseMatch_CommonUtil] CreateTempMarker\n - parentTransform is null"); throw new AutoMorpherException("Marker Parent Transform is Missing", "[BodyPoseMatch_CommonUtil] CreateTempMarker\n - parentTransform is null");
} }
if (childTransforms == null || childTransforms.Count == 0) if (childTransforms == null || childTransforms.Count == 0)
{ {
throw new AutoMorpherException("Child Transforms are Missing", "[BodyPoseMatch_CommonUtil] CreateTempMarker\n - childTransforms is null or empty"); throw new AutoMorpherException("Child Transforms are Missing", "[BodyPoseMatch_CommonUtil] CreateTempMarker\n - childTransforms is null or empty");
} }
Transform transform = new GameObject(string.IsNullOrEmpty(markerObjectName) ? "scaleSupportBone" : markerObjectName).transform; Transform transform = new GameObject(string.IsNullOrEmpty(markerObjectName) ? "scaleSupportBone" : markerObjectName).transform;
transform.SetParent(parentTransform, true); transform.SetParent(parentTransform, true);
transform.position = markerWorldPosition; transform.position = markerWorldPosition;
transform.rotation = markerWorldRotation; transform.rotation = markerWorldRotation;
transform.localScale = markerLocalScale; transform.localScale = markerLocalScale;
tempBoneMarker = ((Component)transform).gameObject.AddComponent<TempBoneMarker>(); tempBoneMarker = ((Component)transform).gameObject.AddComponent<TempBoneMarker>();
tempBoneMarker.originalParent = parentTransform; tempBoneMarker.originalParent = parentTransform;
tempBoneMarker.additionalInfo = ""; tempBoneMarker.additionalInfo = "";
tempBoneMarker.wrappedChildNames = new List<string>(); tempBoneMarker.wrappedChildNames = new List<string>();
for (int i = 0; i < childTransforms.Count; i++) for (int i = 0; i < childTransforms.Count; i++)
{ {
Transform val = childTransforms[i]; Transform val = childTransforms[i];
if (!((Object)(object)val == (Object)null)) if (!((Object)(object)val == (Object)null))
{ {
tempBoneMarker.wrappedChildNames.Add(((Object)val).name); tempBoneMarker.wrappedChildNames.Add(((Object)val).name);
val.SetParent(transform, true); val.SetParent(transform, true);
} }
} }
return transform; return transform;
} }
} }

File diff suppressed because it is too large Load Diff

View File

@@ -1,213 +1,211 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // 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. // 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 // EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.BodyPoseMatch_Torso // Eden.AutoMorpher.BodyPoseMatch_Torso
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Eden.AutoMorpher;
using Eden.AutoMorpher.profile;
using UnityEngine; using UnityEngine;
public class BodyPoseMatch_Torso public class BodyPoseMatch_Torso
{ {
private readonly BodyPoseMatch_CommonUtil poseMatchCommonUtil; private readonly BodyPoseMatch_CommonUtil poseMatchCommonUtil;
public BodyPoseMatch_Torso() public BodyPoseMatch_Torso()
{ {
poseMatchCommonUtil = new BodyPoseMatch_CommonUtil(); this.poseMatchCommonUtil = new BodyPoseMatch_CommonUtil();
} }
public void AlignTorsoByNeck(IReadOnlyCollection<Transform> sourceHipSet, Vector3 sourceNeckCenterWorld, Vector3 targetNeckCenterWorld) public void AlignTorsoByNeck(IReadOnlyCollection<Transform> sourceHipSet, Vector3 sourceNeckCenterWorld, Vector3 targetNeckCenterWorld)
{ {
//IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005a: 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_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0062: 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_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_006f: 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_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0076: 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_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references)
if (sourceHipSet == null || sourceHipSet.Count == 0) if (sourceHipSet == null || sourceHipSet.Count == 0)
{ {
throw new AutoMorpherException("Source Hip Set is Missing", "[BodyPoseMatch_Torso] AlignTorsoByNeck\n - sourceHipSet is null or empty"); throw new AutoMorpherException("Source Hip Set is Missing", "[BodyPoseMatch_Torso] AlignTorsoByNeck\n - sourceHipSet is null or empty");
} }
Transform val = sourceHipSet.FirstOrDefault((Transform t) => (Object)(object)t != (Object)null); Transform val = sourceHipSet.FirstOrDefault((Transform t) => (Object)(object)t != (Object)null);
if ((Object)(object)val == (Object)null) if ((Object)(object)val == (Object)null)
{ {
throw new AutoMorpherException("Source Hip Transform is Missing", "[BodyPoseMatch_Torso] AlignTorsoByNeck\n - sourceHipSet has no valid Transform"); throw new AutoMorpherException("Source Hip Transform is Missing", "[BodyPoseMatch_Torso] AlignTorsoByNeck\n - sourceHipSet has no valid Transform");
} }
Vector3 val2 = targetNeckCenterWorld - sourceNeckCenterWorld; Vector3 val2 = targetNeckCenterWorld - sourceNeckCenterWorld;
Vector3 forward = val.forward; Vector3 forward = val.forward;
float num = Vector3.Dot(val2, forward); float num = Vector3.Dot(val2, forward);
Vector3 val3 = forward * num; Vector3 val3 = forward * num;
foreach (Transform item in sourceHipSet) foreach (Transform item in sourceHipSet)
{ {
if (!((Object)(object)item == (Object)null)) if (!((Object)(object)item == (Object)null))
{ {
item.position += val3; item.position += val3;
} }
} }
} }
public void AlignTorsoByNeck(GameObject proxyObject, IReadOnlyList<BakedBodyMesh> proxyBakedBodyMeshes, Dictionary<HumanBodyBones, HashSet<Transform>> proxyBoneMap, GameObject targetObject, IReadOnlyList<BakedBodyMesh> targetBakedBodyMeshes, Dictionary<HumanBodyBones, HashSet<Transform>> targetBoneMap) public void AlignTorsoByNeck(GameObject proxyObject, IReadOnlyList<BakedBodyMesh> proxyBakedBodyMeshes, Dictionary<HumanBodyBones, HashSet<Transform>> proxyBoneMap, GameObject targetObject, IReadOnlyList<BakedBodyMesh> targetBakedBodyMeshes, Dictionary<HumanBodyBones, HashSet<Transform>> targetBoneMap)
{ {
//IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)proxyObject == (Object)null || (Object)(object)targetObject == (Object)null) if ((Object)(object)proxyObject == (Object)null || (Object)(object)targetObject == (Object)null)
{ {
throw new AutoMorpherException("Proxy/Target Object is Missing", "[BodyPoseMatch_Torso] AlignTorsoByNeck\n - proxyObject or targetObject is null"); throw new AutoMorpherException("Proxy/Target Object is Missing", "[BodyPoseMatch_Torso] AlignTorsoByNeck\n - proxyObject or targetObject is null");
} }
RegionStats regionStats = ComputeNeckRegionStats(proxyObject.transform, proxyBakedBodyMeshes, proxyBoneMap); RegionStats regionStats = this.ComputeNeckRegionStats(proxyObject.transform, proxyBakedBodyMeshes, proxyBoneMap);
RegionStats regionStats2 = ComputeNeckRegionStats(targetObject.transform, targetBakedBodyMeshes, targetBoneMap); RegionStats regionStats2 = this.ComputeNeckRegionStats(targetObject.transform, targetBakedBodyMeshes, targetBoneMap);
if (regionStats.length < 0.0001f || regionStats2.length < 0.0001f) if (regionStats.length < 0.0001f || regionStats2.length < 0.0001f)
{ {
Debug.LogWarning((object)"[BodyPoseMatch_Torso] AlignTorsoByNeck: Neck PCA 통계가 비정상입니다."); Debug.LogWarning((object)"[BodyPoseMatch_Torso] AlignTorsoByNeck: Neck PCA 통계가 비정상입니다.");
return; return;
} }
if (proxyBoneMap == null || !proxyBoneMap.TryGetValue((HumanBodyBones)0, out var value) || value == null || value.Count == 0) if (proxyBoneMap == null || !proxyBoneMap.TryGetValue((HumanBodyBones)0, out var value) || value == null || value.Count == 0)
{ {
throw new AutoMorpherException("Proxy Hip Set is Missing", "[BodyPoseMatch_Torso] AlignTorsoByNeck\n - proxyBoneMap has no Hips bone set"); throw new AutoMorpherException("Proxy Hip Set is Missing", "[BodyPoseMatch_Torso] AlignTorsoByNeck\n - proxyBoneMap has no Hips bone set");
} }
AlignTorsoByNeck(value, regionStats.center, regionStats2.center); this.AlignTorsoByNeck(value, regionStats.center, regionStats2.center);
} }
public void AlignTorsoByNeck(Transform targetTransform, IReadOnlyList<BakedBodyMesh> targetBakedBodyMeshes, Dictionary<HumanBodyBones, HashSet<Transform>> targetBoneMap, Dictionary<HumanBodyBones, HashSet<Transform>> clothBoneMap, Transform clothesTransform, ProfileData profileData, Vector3 comprehensiveScale) public void AlignTorsoByNeck(Transform targetTransform, IReadOnlyList<BakedBodyMesh> targetBakedBodyMeshes, Dictionary<HumanBodyBones, HashSet<Transform>> targetBoneMap, Dictionary<HumanBodyBones, HashSet<Transform>> clothBoneMap, Transform clothesTransform, ProfileData profileData, Vector3 comprehensiveScale)
{ {
//IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)targetTransform == (Object)null) if ((Object)(object)targetTransform == (Object)null)
{ {
throw new AutoMorpherException("Target Transform is Missing", "[BodyPoseMatch_Torso] AlignTorsoByNeck\n - targetTransform is null"); throw new AutoMorpherException("Target Transform is Missing", "[BodyPoseMatch_Torso] AlignTorsoByNeck\n - targetTransform is null");
} }
if (profileData == null || profileData.NeckSpatialData == null) if (profileData == null || profileData.NeckSpatialData == null)
{ {
throw new AutoMorpherException("Profile Neck Data is Missing", "[BodyPoseMatch_Torso] AlignTorsoByNeck\n - profileData or profileData.NeckSpatialData is null"); throw new AutoMorpherException("Profile Neck Data is Missing", "[BodyPoseMatch_Torso] AlignTorsoByNeck\n - profileData or profileData.NeckSpatialData is null");
} }
RegionStats regionStats = ComputeNeckRegionStats(targetTransform, targetBakedBodyMeshes, targetBoneMap); RegionStats regionStats = this.ComputeNeckRegionStats(targetTransform, targetBakedBodyMeshes, targetBoneMap);
if (regionStats.length < 0.0001f) if (regionStats.length < 0.0001f)
{ {
Debug.LogWarning((object)"[BodyPoseMatch_Torso] AlignTorsoByNeck: Neck PCA 통계가 비정상입니다."); Debug.LogWarning((object)"[BodyPoseMatch_Torso] AlignTorsoByNeck: Neck PCA 통계가 비정상입니다.");
return; return;
} }
if (clothBoneMap == null || !clothBoneMap.TryGetValue((HumanBodyBones)0, out var value) || value == null || value.Count == 0) if (clothBoneMap == null || !clothBoneMap.TryGetValue((HumanBodyBones)0, out var value) || value == null || value.Count == 0)
{ {
throw new AutoMorpherException("Cloth Hip Set is Missing", "[BodyPoseMatch_Torso] AlignTorsoByNeck\n - clothBoneMap has no Hips bone set"); throw new AutoMorpherException("Cloth Hip Set is Missing", "[BodyPoseMatch_Torso] AlignTorsoByNeck\n - clothBoneMap has no Hips bone set");
} }
Vector3 profilePcaCenterWorld = poseMatchCommonUtil.GetProfilePcaCenterWorld(clothBoneMap, profileData.NeckSpatialData, comprehensiveScale); Vector3 profilePcaCenterWorld = this.poseMatchCommonUtil.GetProfilePcaCenterWorld(clothBoneMap, profileData.NeckSpatialData, comprehensiveScale);
AlignTorsoByNeck(value, profilePcaCenterWorld, regionStats.center); this.AlignTorsoByNeck(value, profilePcaCenterWorld, regionStats.center);
} }
public RegionStats ComputeNeckRegionStats(Transform avatarTransform, IReadOnlyList<BakedBodyMesh> avatarBakedBodyMeshes, Dictionary<HumanBodyBones, HashSet<Transform>> avatarBoneMap) public RegionStats ComputeNeckRegionStats(Transform avatarTransform, IReadOnlyList<BakedBodyMesh> avatarBakedBodyMeshes, Dictionary<HumanBodyBones, HashSet<Transform>> avatarBoneMap)
{ {
//IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_011c: 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_0123: Unknown result type (might be due to invalid IL or missing references)
//IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references)
//IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references)
//IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references)
//IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references)
//IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references)
//IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0135: 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_013a: Unknown result type (might be due to invalid IL or missing references)
HumanBodyBones[] targetHumanBones = (HumanBodyBones[])(object)new HumanBodyBones[1] { (HumanBodyBones)9 }; HumanBodyBones[] targetHumanBones = (HumanBodyBones[])(object)new HumanBodyBones[1] { (HumanBodyBones)9 };
List<Vector3> list = poseMatchCommonUtil.CollectHumanoidVerticesWorld(targetHumanBones, avatarBakedBodyMeshes, avatarBoneMap); List<Vector3> list = this.poseMatchCommonUtil.CollectHumanoidVerticesWorld(targetHumanBones, avatarBakedBodyMeshes, avatarBoneMap);
if (list == null || list.Count == 0) if (list == null || list.Count == 0)
{ {
Debug.LogWarning((object)("[AvatarBodyMatchUtil] ComputeNeckRegionStats: neck vertices 0개. avatar=" + ((avatarTransform != null) ? ((Object)avatarTransform).name : null))); Debug.LogWarning((object)("[AvatarBodyMatchUtil] ComputeNeckRegionStats: neck vertices 0개. avatar=" + ((avatarTransform != null) ? ((Object)avatarTransform).name : null)));
return default(RegionStats); return default(RegionStats);
} }
RegionStats result = new PcaUtil().ComputeRegionStats(list); RegionStats result = new PcaUtil().ComputeRegionStats(list);
Vector3 val = avatarTransform.up; Vector3 val = avatarTransform.up;
Transform boneFromBoneMap = poseMatchCommonUtil.GetBoneFromBoneMap(avatarBoneMap, (HumanBodyBones)10); Transform boneFromBoneMap = this.poseMatchCommonUtil.GetBoneFromBoneMap(avatarBoneMap, (HumanBodyBones)10);
Transform boneFromBoneMap2 = poseMatchCommonUtil.GetBoneFromBoneMap(avatarBoneMap, (HumanBodyBones)54); Transform boneFromBoneMap2 = this.poseMatchCommonUtil.GetBoneFromBoneMap(avatarBoneMap, (HumanBodyBones)54);
Transform boneFromBoneMap3 = poseMatchCommonUtil.GetBoneFromBoneMap(avatarBoneMap, (HumanBodyBones)8); Transform boneFromBoneMap3 = this.poseMatchCommonUtil.GetBoneFromBoneMap(avatarBoneMap, (HumanBodyBones)8);
Transform boneFromBoneMap4 = poseMatchCommonUtil.GetBoneFromBoneMap(avatarBoneMap, (HumanBodyBones)0); Transform boneFromBoneMap4 = this.poseMatchCommonUtil.GetBoneFromBoneMap(avatarBoneMap, (HumanBodyBones)0);
Transform val2 = (((Object)(object)boneFromBoneMap2 != (Object)null) ? boneFromBoneMap2 : boneFromBoneMap3); Transform val2 = (((Object)(object)boneFromBoneMap2 != (Object)null) ? boneFromBoneMap2 : boneFromBoneMap3);
if ((Object)(object)boneFromBoneMap != (Object)null && (Object)(object)val2 != (Object)null) if ((Object)(object)boneFromBoneMap != (Object)null && (Object)(object)val2 != (Object)null)
{ {
val = boneFromBoneMap.position - val2.position; val = boneFromBoneMap.position - val2.position;
} }
else if ((Object)(object)boneFromBoneMap != (Object)null && (Object)(object)boneFromBoneMap4 != (Object)null) else if ((Object)(object)boneFromBoneMap != (Object)null && (Object)(object)boneFromBoneMap4 != (Object)null)
{ {
val = boneFromBoneMap.position - boneFromBoneMap4.position; val = boneFromBoneMap.position - boneFromBoneMap4.position;
} }
if (((Vector3)(ref val)).sqrMagnitude > 1E-08f) if (val.sqrMagnitude > 1E-08f)
{ {
((Vector3)(ref val)).Normalize(); val.Normalize();
} }
if (Vector3.Dot(val, ((Component)avatarTransform).transform.up) < 0f) if (Vector3.Dot(val, ((Component)avatarTransform).transform.up) < 0f)
{ {
val = -val; val = -val;
} }
result.principalAxis = val; result.principalAxis = val;
return result; return result;
} }
public void DrawTorsoPcaDebug(GameObject avatarObject, IReadOnlyList<BakedBodyMesh> avatarBakedBodyMeshes, Dictionary<HumanBodyBones, HashSet<Transform>> avatarBoneMap, Color centerColor, Color axisColor, float axisScale = 1f, float duration = 0.1f) public void DrawTorsoPcaDebug(GameObject avatarObject, IReadOnlyList<BakedBodyMesh> avatarBakedBodyMeshes, Dictionary<HumanBodyBones, HashSet<Transform>> avatarBoneMap, Color centerColor, Color axisColor, float axisScale = 1f, float duration = 0.1f)
{ {
//IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0070: 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_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)avatarObject == (Object)null)) if (!((Object)(object)avatarObject == (Object)null))
{ {
RegionStats regionStats = ComputeNeckRegionStats(avatarObject.transform, avatarBakedBodyMeshes, avatarBoneMap); RegionStats regionStats = this.ComputeNeckRegionStats(avatarObject.transform, avatarBakedBodyMeshes, avatarBoneMap);
if (regionStats.length < 0.0001f) if (regionStats.length < 0.0001f)
{ {
Debug.LogWarning((object)$"[AvatarBodyMatchUtil] DrawNeckPcaDebug: neck.length가 너무 작음. avatar={((Object)avatarObject).name}, length={regionStats.length}"); Debug.LogWarning((object)$"[AvatarBodyMatchUtil] DrawNeckPcaDebug: neck.length가 너무 작음. avatar={((Object)avatarObject).name}, length={regionStats.length}");
return; return;
} }
Vector3 center = regionStats.center; Vector3 center = regionStats.center;
Vector3 normalized = ((Vector3)(ref regionStats.principalAxis)).normalized; Vector3 normalized = regionStats.principalAxis.normalized;
float num = 0.02f * axisScale; float num = 0.02f * axisScale;
Debug.DrawLine(center + Vector3.up * num, center - Vector3.up * num, centerColor, duration); Debug.DrawLine(center + Vector3.up * num, center - Vector3.up * num, centerColor, duration);
Debug.DrawLine(center + Vector3.right * num, center - Vector3.right * num, centerColor, duration); Debug.DrawLine(center + Vector3.right * num, center - Vector3.right * num, centerColor, duration);
float num2 = regionStats.length * 0.5f * axisScale; float num2 = regionStats.length * 0.5f * axisScale;
Vector3 val = center + normalized * num2; Vector3 val = center + normalized * num2;
Debug.DrawLine(center, val, axisColor, duration); Debug.DrawLine(center, val, axisColor, duration);
Debug.Log((object)$"[AvatarBodyMatchUtil] DrawNeckPcaDebug: avatar={((Object)avatarObject).name}, center={center}, axis={normalized}, halfLen={num2}"); Debug.Log((object)$"[AvatarBodyMatchUtil] DrawNeckPcaDebug: avatar={((Object)avatarObject).name}, center={center}, axis={normalized}, halfLen={num2}");
} }
} }
} }

View File

@@ -1,265 +1,264 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // 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. // 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 // EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.BodyPoseToClothApplier // Eden.AutoMorpher.BodyPoseToClothApplier
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Eden.AutoMorpher;
using UnityEngine; using UnityEngine;
public class BodyPoseToClothApplier public class BodyPoseToClothApplier
{ {
private class BoneMapping private class BoneMapping
{ {
public Transform proxyBone; public Transform proxyBone;
public Transform clothBone; public Transform clothBone;
public int depth; public int depth;
public HumanBodyBones? humanBone; public HumanBodyBones? humanBone;
} }
public void ApplyBodyPoseToClothes(Transform bodyProxyRoot, Transform clothesRoot, Dictionary<Transform, BoneMatchUtil.BoneRootLocalData> clothToBodyMatched, Dictionary<Transform, Transform> sourceToProxy, bool copyPosition = true, bool copyRotation = false, bool copyScale = true) public void ApplyBodyPoseToClothes(Transform bodyProxyRoot, Transform clothesRoot, Dictionary<Transform, BoneMatchUtil.BoneRootLocalData> clothToBodyMatched, Dictionary<Transform, Transform> sourceToProxy, bool copyPosition = true, bool copyRotation = false, bool copyScale = true)
{ {
//IL_0063: 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_011e: Unknown result type (might be due to invalid IL or missing references) //IL_011e: 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_0123: Unknown result type (might be due to invalid IL or missing references)
//IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references)
//IL_016d: Invalid comparison between Unknown and I4 //IL_016d: Invalid comparison between Unknown and I4
//IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references)
//IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references)
//IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references)
//IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)bodyProxyRoot == (Object)null) if ((Object)(object)bodyProxyRoot == (Object)null)
{ {
throw new AutoMorpherException("Body Proxy Root is Missing", "[BodyToClothPoseApplier] ApplyDeformedProxyPoseToCloth\n - bodyProxyRoot is null"); throw new AutoMorpherException("Body Proxy Root is Missing", "[BodyToClothPoseApplier] ApplyDeformedProxyPoseToCloth\n - bodyProxyRoot is null");
} }
if ((Object)(object)clothesRoot == (Object)null) if ((Object)(object)clothesRoot == (Object)null)
{ {
throw new AutoMorpherException("Clothes Root is Missing", "[BodyToClothPoseApplier] ApplyDeformedProxyPoseToCloth\n - clothesRoot is null"); throw new AutoMorpherException("Clothes Root is Missing", "[BodyToClothPoseApplier] ApplyDeformedProxyPoseToCloth\n - clothesRoot is null");
} }
if (clothToBodyMatched == null || clothToBodyMatched.Count == 0) if (clothToBodyMatched == null || clothToBodyMatched.Count == 0)
{ {
throw new AutoMorpherException("Cloth To Body Matched Map is Missing", "[BodyToClothPoseApplier] ApplyDeformedProxyPoseToCloth\n - clothToBodyMatched is null or empty"); throw new AutoMorpherException("Cloth To Body Matched Map is Missing", "[BodyToClothPoseApplier] ApplyDeformedProxyPoseToCloth\n - clothToBodyMatched is null or empty");
} }
if (sourceToProxy == null) if (sourceToProxy == null)
{ {
throw new AutoMorpherException("Source To Proxy Map is Missing", "[BodyToClothPoseApplier] ApplyDeformedProxyPoseToCloth\n - sourceToProxy is null"); throw new AutoMorpherException("Source To Proxy Map is Missing", "[BodyToClothPoseApplier] ApplyDeformedProxyPoseToCloth\n - sourceToProxy is null");
} }
clothesRoot.localScale = bodyProxyRoot.localScale; clothesRoot.localScale = bodyProxyRoot.localScale;
Animator component = ((Component)bodyProxyRoot).GetComponent<Animator>(); Animator component = ((Component)bodyProxyRoot).GetComponent<Animator>();
if ((Object)(object)component == (Object)null) if ((Object)(object)component == (Object)null)
{ {
throw new AutoMorpherException("Body Proxy Animator is Missing", "[BodyToClothPoseApplier] ApplyDeformedProxyPoseToCloth\n - bodyProxyRoot has no Animator"); throw new AutoMorpherException("Body Proxy Animator is Missing", "[BodyToClothPoseApplier] ApplyDeformedProxyPoseToCloth\n - bodyProxyRoot has no Animator");
} }
Transform transform = ((Component)component).transform; Transform transform = ((Component)component).transform;
Dictionary<Transform, int> dictionary = BuildDepthMap(transform); Dictionary<Transform, int> dictionary = this.BuildDepthMap(transform);
Dictionary<Transform, Transform> dictionary2 = new Dictionary<Transform, Transform>(); Dictionary<Transform, Transform> dictionary2 = new Dictionary<Transform, Transform>();
List<BoneMapping> list = new List<BoneMapping>(); List<BoneMapping> list = new List<BoneMapping>();
HashSet<Transform> hashSet = new HashSet<Transform>(); HashSet<Transform> hashSet = new HashSet<Transform>();
foreach (KeyValuePair<Transform, BoneMatchUtil.BoneRootLocalData> item in clothToBodyMatched) foreach (KeyValuePair<Transform, BoneMatchUtil.BoneRootLocalData> item in clothToBodyMatched)
{ {
Transform key = item.Key; Transform key = item.Key;
BoneMatchUtil.BoneRootLocalData value = item.Value; BoneMatchUtil.BoneRootLocalData value = item.Value;
if ((Object)(object)key == (Object)null || value == null) if ((Object)(object)key == (Object)null || value == null)
{ {
continue; continue;
} }
Transform t = value.t; Transform t = value.t;
if ((Object)(object)t == (Object)null || !sourceToProxy.TryGetValue(t, out var value2) || (Object)(object)value2 == (Object)null) if ((Object)(object)t == (Object)null || !sourceToProxy.TryGetValue(t, out var value2) || (Object)(object)value2 == (Object)null)
{ {
continue; continue;
} }
HumanBodyBones hBone = value.hBone; HumanBodyBones hBone = value.hBone;
if (hashSet.Add(key)) if (hashSet.Add(key))
{ {
int depth = 999; int depth = 999;
if (dictionary != null && dictionary.TryGetValue(value2, out var value3)) if (dictionary != null && dictionary.TryGetValue(value2, out var value3))
{ {
depth = value3; depth = value3;
} }
list.Add(new BoneMapping list.Add(new BoneMapping
{ {
proxyBone = value2, proxyBone = value2,
clothBone = key, clothBone = key,
depth = depth, depth = depth,
humanBone = (((int)hBone != 55) ? new HumanBodyBones?(hBone) : ((HumanBodyBones?)null)) humanBone = (((int)hBone != 55) ? new HumanBodyBones?(hBone) : ((HumanBodyBones?)null))
}); });
} }
if (!dictionary2.ContainsKey(value2)) if (!dictionary2.ContainsKey(value2))
{ {
dictionary2.Add(value2, key); dictionary2.Add(value2, key);
} }
} }
MirrorBoneMarkers(transform, dictionary2, dictionary, list); this.MirrorBoneMarkers(transform, dictionary2, dictionary, list);
foreach (BoneMapping item2 in (from m in list foreach (BoneMapping item2 in (from m in list
where m != null && (Object)(object)m.proxyBone != (Object)null && (Object)(object)m.clothBone != (Object)null where m != null && (Object)(object)m.proxyBone != (Object)null && (Object)(object)m.clothBone != (Object)null
orderby m.depth orderby m.depth
select m).ToList()) select m).ToList())
{ {
if (!((Object)(object)item2.proxyBone == (Object)null) && !((Object)(object)item2.clothBone == (Object)null)) if (!((Object)(object)item2.proxyBone == (Object)null) && !((Object)(object)item2.clothBone == (Object)null))
{ {
if (copyPosition) if (copyPosition)
{ {
item2.clothBone.position = item2.proxyBone.position; item2.clothBone.position = item2.proxyBone.position;
} }
if (copyRotation) if (copyRotation)
{ {
item2.clothBone.rotation = item2.proxyBone.rotation; item2.clothBone.rotation = item2.proxyBone.rotation;
} }
if (copyScale) if (copyScale)
{ {
item2.clothBone.localScale = item2.proxyBone.localScale; item2.clothBone.localScale = item2.proxyBone.localScale;
} }
} }
} }
} }
private Dictionary<Transform, int> BuildDepthMap(Transform root) private Dictionary<Transform, int> BuildDepthMap(Transform root)
{ {
Dictionary<Transform, int> dictionary = new Dictionary<Transform, int>(); Dictionary<Transform, int> dictionary = new Dictionary<Transform, int>();
if ((Object)(object)root == (Object)null) if ((Object)(object)root == (Object)null)
{ {
return dictionary; return dictionary;
} }
Transform[] componentsInChildren = ((Component)root).GetComponentsInChildren<Transform>(true); Transform[] componentsInChildren = ((Component)root).GetComponentsInChildren<Transform>(true);
foreach (Transform val in componentsInChildren) foreach (Transform val in componentsInChildren)
{ {
if (!((Object)(object)val == (Object)null)) if (!((Object)(object)val == (Object)null))
{ {
dictionary[val] = GetDepthFromRoot(val, root); dictionary[val] = this.GetDepthFromRoot(val, root);
} }
} }
return dictionary; return dictionary;
} }
private int GetDepthFromRoot(Transform t, Transform root) private int GetDepthFromRoot(Transform t, Transform root)
{ {
int num = 0; int num = 0;
Transform val = t; Transform val = t;
while ((Object)(object)val != (Object)null && (Object)(object)val != (Object)(object)root) while ((Object)(object)val != (Object)null && (Object)(object)val != (Object)(object)root)
{ {
num++; num++;
val = val.parent; val = val.parent;
} }
return num; return num;
} }
private void MirrorBoneMarkers(Transform proxyArmature, Dictionary<Transform, Transform> proxyToCloth, Dictionary<Transform, int> proxyDepthMap, List<BoneMapping> mappings) private void MirrorBoneMarkers(Transform proxyArmature, Dictionary<Transform, Transform> proxyToCloth, Dictionary<Transform, int> proxyDepthMap, List<BoneMapping> mappings)
{ {
//IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references)
//IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references)
//IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references)
//IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)proxyArmature == (Object)null || proxyToCloth == null || mappings == null) if ((Object)(object)proxyArmature == (Object)null || proxyToCloth == null || mappings == null)
{ {
return; return;
} }
TempBoneMarker[] componentsInChildren = ((Component)proxyArmature).GetComponentsInChildren<TempBoneMarker>(true); TempBoneMarker[] componentsInChildren = ((Component)proxyArmature).GetComponentsInChildren<TempBoneMarker>(true);
if (componentsInChildren == null || componentsInChildren.Length == 0) if (componentsInChildren == null || componentsInChildren.Length == 0)
{ {
return; return;
} }
HashSet<Transform> hashSet = new HashSet<Transform>(); HashSet<Transform> hashSet = new HashSet<Transform>();
for (int i = 0; i < mappings.Count; i++) for (int i = 0; i < mappings.Count; i++)
{ {
BoneMapping boneMapping = mappings[i]; BoneMapping boneMapping = mappings[i];
if (boneMapping != null && (Object)(object)boneMapping.proxyBone != (Object)null) if (boneMapping != null && (Object)(object)boneMapping.proxyBone != (Object)null)
{ {
hashSet.Add(boneMapping.proxyBone); hashSet.Add(boneMapping.proxyBone);
} }
} }
int value3; int value3;
foreach (TempBoneMarker item in (from bm in componentsInChildren foreach (TempBoneMarker item in (from bm in componentsInChildren
where (Object)(object)bm != (Object)null && (Object)(object)((Component)bm).transform != (Object)null where (Object)(object)bm != (Object)null && (Object)(object)((Component)bm).transform != (Object)null
orderby (proxyDepthMap != null && proxyDepthMap.TryGetValue(((Component)bm).transform, out value3)) ? value3 : int.MaxValue orderby (proxyDepthMap != null && proxyDepthMap.TryGetValue(((Component)bm).transform, out value3)) ? value3 : int.MaxValue
select bm).ToList()) select bm).ToList())
{ {
Transform transform = ((Component)item).transform; Transform transform = ((Component)item).transform;
if ((Object)(object)transform == (Object)null) if ((Object)(object)transform == (Object)null)
{ {
continue; continue;
} }
Transform originalParent = item.originalParent; Transform originalParent = item.originalParent;
if ((Object)(object)originalParent == (Object)null || !proxyToCloth.TryGetValue(originalParent, out var value) || (Object)(object)value == (Object)null) if ((Object)(object)originalParent == (Object)null || !proxyToCloth.TryGetValue(originalParent, out var value) || (Object)(object)value == (Object)null)
{ {
continue; continue;
} }
List<Transform> list = CollectDirectChilds(value); List<Transform> list = this.CollectDirectChilds(value);
Transform val = FindMarkerInChild(value); Transform val = this.FindMarkerInChild(value);
TempBoneMarker tempBoneMarker = null; TempBoneMarker tempBoneMarker = null;
if ((Object)(object)val == (Object)null) if ((Object)(object)val == (Object)null)
{ {
val = new GameObject(((Object)transform).name).transform; val = new GameObject(((Object)transform).name).transform;
val.SetParent(value, true); val.SetParent(value, true);
tempBoneMarker = ((Component)val).gameObject.AddComponent<TempBoneMarker>(); tempBoneMarker = ((Component)val).gameObject.AddComponent<TempBoneMarker>();
} }
else else
{ {
tempBoneMarker = ((Component)val).GetComponent<TempBoneMarker>(); tempBoneMarker = ((Component)val).GetComponent<TempBoneMarker>();
} }
val.position = transform.position; val.position = transform.position;
val.rotation = transform.rotation; val.rotation = transform.rotation;
val.localScale = transform.localScale; val.localScale = transform.localScale;
tempBoneMarker.originalParent = value; tempBoneMarker.originalParent = value;
tempBoneMarker.additionalInfo = item.additionalInfo; tempBoneMarker.additionalInfo = item.additionalInfo;
tempBoneMarker.wrappedChildNames = item.wrappedChildNames; tempBoneMarker.wrappedChildNames = item.wrappedChildNames;
for (int num = 0; num < list.Count; num++) for (int num = 0; num < list.Count; num++)
{ {
Transform val2 = list[num]; Transform val2 = list[num];
if (!((Object)(object)val2 == (Object)null) && !((Object)(object)val2 == (Object)(object)val)) if (!((Object)(object)val2 == (Object)null) && !((Object)(object)val2 == (Object)(object)val))
{ {
val2.SetParent(val, true); val2.SetParent(val, true);
} }
} }
if (!proxyToCloth.ContainsKey(transform)) if (!proxyToCloth.ContainsKey(transform))
{ {
proxyToCloth.Add(transform, val); proxyToCloth.Add(transform, val);
} }
if (hashSet.Add(transform)) if (hashSet.Add(transform))
{ {
int depth = 999; int depth = 999;
if (proxyDepthMap != null && proxyDepthMap.TryGetValue(transform, out var value2)) if (proxyDepthMap != null && proxyDepthMap.TryGetValue(transform, out var value2))
{ {
depth = value2; depth = value2;
} }
mappings.Add(new BoneMapping mappings.Add(new BoneMapping
{ {
proxyBone = transform, proxyBone = transform,
clothBone = val, clothBone = val,
depth = depth, depth = depth,
humanBone = null humanBone = null
}); });
} }
} }
} }
private Transform FindMarkerInChild(Transform parent) private Transform FindMarkerInChild(Transform parent)
{ {
if ((Object)(object)parent == (Object)null) if ((Object)(object)parent == (Object)null)
{ {
return null; return null;
} }
for (int i = 0; i < parent.childCount; i++) for (int i = 0; i < parent.childCount; i++)
{ {
Transform child = parent.GetChild(i); Transform child = parent.GetChild(i);
if (!((Object)(object)child == (Object)null) && (Object)(object)((Component)child).GetComponent<TempBoneMarker>() != (Object)null) if (!((Object)(object)child == (Object)null) && (Object)(object)((Component)child).GetComponent<TempBoneMarker>() != (Object)null)
{ {
return child; return child;
} }
} }
return null; return null;
} }
private List<Transform> CollectDirectChilds(Transform parentTransform) private List<Transform> CollectDirectChilds(Transform parentTransform)
{ {
int childCount = parentTransform.childCount; int childCount = parentTransform.childCount;
List<Transform> list = new List<Transform>(childCount); List<Transform> list = new List<Transform>(childCount);
for (int i = 0; i < childCount; i++) for (int i = 0; i < childCount; i++)
{ {
list.Add(parentTransform.GetChild(i)); list.Add(parentTransform.GetChild(i));
} }
return list; return list;
} }
} }

View File

@@ -1,180 +1,179 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // 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. // 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 // EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.BoneAlignmentUtil // Eden.AutoMorpher.BoneAlignmentUtil
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Eden.AutoMorpher;
using UnityEngine; using UnityEngine;
public class BoneAlignmentUtil public class BoneAlignmentUtil
{ {
public void AlignClothBonesToAvatar(ClothInstance cloth, Animator targetAvatarAnimator) public void AlignClothBonesToAvatar(ClothInstance cloth, Animator targetAvatarAnimator)
{ {
//IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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_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_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references)
if (cloth == null || (Object)(object)targetAvatarAnimator == (Object)null) if (cloth == null || (Object)(object)targetAvatarAnimator == (Object)null)
{ {
Debug.LogWarning((object)"[BoneAlignmentUtil] cloth 또는 targetAvatarAnimator 가 null."); Debug.LogWarning((object)"[BoneAlignmentUtil] cloth 또는 targetAvatarAnimator 가 null.");
return; return;
} }
foreach (KeyValuePair<HumanBodyBones, HashSet<Transform>> humanoidMatchedBone in cloth.humanoidMatchedBones) foreach (KeyValuePair<HumanBodyBones, HashSet<Transform>> humanoidMatchedBone in cloth.humanoidMatchedBones)
{ {
HumanBodyBones key = humanoidMatchedBone.Key; HumanBodyBones key = humanoidMatchedBone.Key;
foreach (Transform item in humanoidMatchedBone.Value) foreach (Transform item in humanoidMatchedBone.Value)
{ {
if (!((Object)(object)item == (Object)null)) if (!((Object)(object)item == (Object)null))
{ {
Transform boneTransform = targetAvatarAnimator.GetBoneTransform(key); Transform boneTransform = targetAvatarAnimator.GetBoneTransform(key);
if (!((Object)(object)boneTransform == (Object)null)) if (!((Object)(object)boneTransform == (Object)null))
{ {
item.position = boneTransform.position; item.position = boneTransform.position;
item.localScale = Vector3.one; item.localScale = Vector3.one;
((Object)item).name = ((Object)boneTransform).name; ((Object)item).name = ((Object)boneTransform).name;
} }
} }
} }
} }
} }
public void ReparentAccessoryBonesToAvatar(EdenAutoMorpherConfig config) public void ReparentAccessoryBonesToAvatar(EdenAutoMorpherConfig config)
{ {
//IL_005e: Unknown result type (might be due to invalid IL or missing references) //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_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references)
//IL_0201: Expected O, but got Unknown //IL_0201: Expected O, but got Unknown
if (config.clothBoneTypeMap == null || (Object)(object)config.targetAvatarObject == (Object)null) if (config.clothBoneTypeMap == null || (Object)(object)config.targetAvatarObject == (Object)null)
{ {
return; return;
} }
Animator component = config.targetAvatarObject.GetComponent<Animator>(); Animator component = config.targetAvatarObject.GetComponent<Animator>();
if ((Object)(object)component == (Object)null || !component.isHuman) if ((Object)(object)component == (Object)null || !component.isHuman)
{ {
return; return;
} }
Dictionary<Transform, Transform> dictionary = new Dictionary<Transform, Transform>(); Dictionary<Transform, Transform> dictionary = new Dictionary<Transform, Transform>();
if (config.clothesHumanoidMatchedBones != null) if (config.clothesHumanoidMatchedBones != null)
{ {
foreach (KeyValuePair<HumanBodyBones, HashSet<Transform>> clothesHumanoidMatchedBone in config.clothesHumanoidMatchedBones) foreach (KeyValuePair<HumanBodyBones, HashSet<Transform>> clothesHumanoidMatchedBone in config.clothesHumanoidMatchedBones)
{ {
HumanBodyBones key = clothesHumanoidMatchedBone.Key; HumanBodyBones key = clothesHumanoidMatchedBone.Key;
foreach (Transform item2 in clothesHumanoidMatchedBone.Value) foreach (Transform item2 in clothesHumanoidMatchedBone.Value)
{ {
Transform boneTransform = component.GetBoneTransform(key); Transform boneTransform = component.GetBoneTransform(key);
if ((Object)(object)item2 != (Object)null && (Object)(object)boneTransform != (Object)null) if ((Object)(object)item2 != (Object)null && (Object)(object)boneTransform != (Object)null)
{ {
dictionary[item2] = boneTransform; dictionary[item2] = boneTransform;
} }
} }
} }
} }
foreach (KeyValuePair<Transform, ClothBoneType> item3 in config.clothBoneTypeMap) foreach (KeyValuePair<Transform, ClothBoneType> item3 in config.clothBoneTypeMap)
{ {
if (item3.Value != ClothBoneType.Accessory) if (item3.Value != ClothBoneType.Accessory)
{ {
continue; continue;
} }
Transform key2 = item3.Key; Transform key2 = item3.Key;
if ((Object)(object)key2 == (Object)null || !key2.IsChildOf(config.targetClothesObject.transform)) if ((Object)(object)key2 == (Object)null || !key2.IsChildOf(config.targetClothesObject.transform))
{ {
continue; continue;
} }
Transform parent = key2.parent; Transform parent = key2.parent;
Transform val = null; Transform val = null;
while ((Object)(object)parent != (Object)null) while ((Object)(object)parent != (Object)null)
{ {
if (config.clothBoneTypeMap.TryGetValue(parent, out var value) && value == ClothBoneType.Body) if (config.clothBoneTypeMap.TryGetValue(parent, out var value) && value == ClothBoneType.Body)
{ {
val = parent; val = parent;
break; break;
} }
parent = parent.parent; parent = parent.parent;
} }
if (!((Object)(object)val == (Object)null) && dictionary.TryGetValue(val, out var value2)) if (!((Object)(object)val == (Object)null) && dictionary.TryGetValue(val, out var value2))
{ {
key2.SetParent(value2, true); key2.SetParent(value2, true);
} }
} }
foreach (KeyValuePair<Transform, Transform> item4 in dictionary) foreach (KeyValuePair<Transform, Transform> item4 in dictionary)
{ {
Transform key3 = item4.Key; Transform key3 = item4.Key;
Transform value3 = item4.Value; Transform value3 = item4.Value;
if ((Object)(object)key3 == (Object)null || (Object)(object)value3 == (Object)null) if ((Object)(object)key3 == (Object)null || (Object)(object)value3 == (Object)null)
{ {
continue; continue;
} }
List<Transform> list = new List<Transform>(); List<Transform> list = new List<Transform>();
foreach (Transform item5 in key3) foreach (Transform item5 in key3)
{ {
Transform item = item5; Transform item = item5;
list.Add(item); list.Add(item);
} }
foreach (Transform item6 in list) foreach (Transform item6 in list)
{ {
if (!((Object)(object)item6 == (Object)null) && !config.clothBoneTypeMap.ContainsKey(item6)) if (!((Object)(object)item6 == (Object)null) && !config.clothBoneTypeMap.ContainsKey(item6))
{ {
item6.SetParent(value3, true); item6.SetParent(value3, true);
} }
} }
} }
} }
public void CleanupTempBones(Transform root) public void CleanupTempBones(Transform root)
{ {
if ((Object)(object)root == (Object)null) if ((Object)(object)root == (Object)null)
{ {
return; return;
} }
TempBoneMarker[] componentsInChildren = ((Component)root).GetComponentsInChildren<TempBoneMarker>(true); TempBoneMarker[] componentsInChildren = ((Component)root).GetComponentsInChildren<TempBoneMarker>(true);
if (componentsInChildren == null || componentsInChildren.Length == 0) if (componentsInChildren == null || componentsInChildren.Length == 0)
{ {
return; return;
} }
TempBoneMarker[] array = (from m in componentsInChildren TempBoneMarker[] array = (from m in componentsInChildren
where (Object)(object)m != (Object)null where (Object)(object)m != (Object)null
orderby GetDepth(((Component)m).transform) descending orderby GetDepth(((Component)m).transform) descending
select m).ToArray(); select m).ToArray();
foreach (TempBoneMarker tempBoneMarker in array) foreach (TempBoneMarker tempBoneMarker in array)
{ {
if ((Object)(object)tempBoneMarker == (Object)null) if ((Object)(object)tempBoneMarker == (Object)null)
{ {
continue; continue;
} }
Transform transform = ((Component)tempBoneMarker).transform; Transform transform = ((Component)tempBoneMarker).transform;
Transform val = tempBoneMarker.originalParent; Transform val = tempBoneMarker.originalParent;
if ((Object)(object)val == (Object)null) if ((Object)(object)val == (Object)null)
{ {
val = transform.parent; val = transform.parent;
} }
if ((Object)(object)val != (Object)null) if ((Object)(object)val != (Object)null)
{ {
while (transform.childCount > 0) while (transform.childCount > 0)
{ {
transform.GetChild(0).SetParent(val, true); transform.GetChild(0).SetParent(val, true);
} }
} }
if (!Application.isPlaying) if (!Application.isPlaying)
{ {
Object.DestroyImmediate((Object)(object)((Component)transform).gameObject); Object.DestroyImmediate((Object)(object)((Component)transform).gameObject);
} }
else else
{ {
Object.Destroy((Object)(object)((Component)transform).gameObject); Object.Destroy((Object)(object)((Component)transform).gameObject);
} }
} }
int GetDepth(Transform t) int GetDepth(Transform t)
{ {
int num2 = 0; int num2 = 0;
while ((Object)(object)t != (Object)null) while ((Object)(object)t != (Object)null)
{ {
num2++; num2++;
t = t.parent; t = t.parent;
} }
return num2; return num2;
} }
} }
} }

View File

@@ -1,4 +1,4 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // 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. // 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 // EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.BoneCorrespondenceUtil // Eden.AutoMorpher.BoneCorrespondenceUtil
@@ -9,187 +9,187 @@ using UnityEngine;
public class BoneCorrespondenceUtil public class BoneCorrespondenceUtil
{ {
private char[] nameDelims = new char[8] { ' ', '-', '_', ':', '.', '|', '\\', '/' }; private char[] nameDelims = new char[8] { ' ', '-', '_', ':', '.', '|', '\\', '/' };
public float ComputeDistanceScore(float d, float near, float mid, float far) public float ComputeDistanceScore(float d, float near, float mid, float far)
{ {
if (d < near) if (d < near)
{ {
return 120f; return 120f;
} }
if (d < mid) if (d < mid)
{ {
return 90f; return 90f;
} }
if (d < far) if (d < far)
{ {
return 50f; return 50f;
} }
return 0f; return 0f;
} }
public float ComputeRotationScore(float ang, float RotTolDeg) public float ComputeRotationScore(float ang, float RotTolDeg)
{ {
return Mathf.Clamp01(1f - ang / RotTolDeg); return Mathf.Clamp01(1f - ang / RotTolDeg);
} }
public float ComputeNameScore(string bodyName, string bodyPath, string clothesName, string clothesPath) public float ComputeNameScore(string bodyName, string bodyPath, string clothesName, string clothesPath)
{ {
string text = StripDigits(NormalizeName(bodyName)); string text = this.StripDigits(this.NormalizeName(bodyName));
string text2 = StripDigits(NormalizeName(clothesName)); string text2 = this.StripDigits(this.NormalizeName(clothesName));
string text3 = StripDigits(NormalizePath(bodyPath)); string text3 = this.StripDigits(this.NormalizePath(bodyPath));
string text4 = StripDigits(NormalizePath(clothesPath)); string text4 = this.StripDigits(this.NormalizePath(clothesPath));
if (!string.IsNullOrEmpty(text3) && text3 == text4) if (!string.IsNullOrEmpty(text3) && text3 == text4)
{ {
return 80f; return 80f;
} }
if (!string.IsNullOrEmpty(text) && text == text2) if (!string.IsNullOrEmpty(text) && text == text2)
{ {
return 70f; return 70f;
} }
if (!string.IsNullOrEmpty(text) && !string.IsNullOrEmpty(text2) && (text.Contains(text2) || text2.Contains(text))) if (!string.IsNullOrEmpty(text) && !string.IsNullOrEmpty(text2) && (text.Contains(text2) || text2.Contains(text)))
{ {
return 40f; return 40f;
} }
return SubsequenceCoverage(bodyName, clothesName) * 10f; return this.SubsequenceCoverage(bodyName, clothesName) * 10f;
} }
private float SubsequenceCoverage(string bodyRaw, string clothesRaw) private float SubsequenceCoverage(string bodyRaw, string clothesRaw)
{ {
string text = StripDigits(NormalizeName(bodyRaw)); string text = this.StripDigits(this.NormalizeName(bodyRaw));
string text2 = StripDigits(NormalizeName(clothesRaw)); string text2 = this.StripDigits(this.NormalizeName(clothesRaw));
if (string.IsNullOrEmpty(text) || string.IsNullOrEmpty(text2)) if (string.IsNullOrEmpty(text) || string.IsNullOrEmpty(text2))
{ {
return 0f; return 0f;
} }
return (float)SubNameMatchBest(text, text2) / (float)text.Length; return (float)this.SubNameMatchBest(text, text2) / (float)text.Length;
} }
private int SubNameMatchBest(string a, string b, int minMatchCount = 3) private int SubNameMatchBest(string a, string b, int minMatchCount = 3)
{ {
if (string.IsNullOrEmpty(a) || string.IsNullOrEmpty(b)) if (string.IsNullOrEmpty(a) || string.IsNullOrEmpty(b))
{ {
return 0; return 0;
} }
if (a.Length < minMatchCount || b.Length < minMatchCount) if (a.Length < minMatchCount || b.Length < minMatchCount)
{ {
return 0; return 0;
} }
int num = 0; int num = 0;
for (int i = 0; i <= a.Length - minMatchCount; i++) for (int i = 0; i <= a.Length - minMatchCount; i++)
{ {
int num2 = SubNameMatch(a, i, b, minMatchCount); int num2 = this.SubNameMatch(a, i, b, minMatchCount);
if (num2 > num) if (num2 > num)
{ {
num = num2; num = num2;
} }
} }
return num; return num;
} }
private int SubNameMatch(string a, int startA, string b, int minMatchCount = 3) private int SubNameMatch(string a, int startA, string b, int minMatchCount = 3)
{ {
int length = a.Length; int length = a.Length;
int length2 = b.Length; int length2 = b.Length;
int num = 0; int num = 0;
int num2 = 0; int num2 = 0;
int num3 = 0; int num3 = 0;
int num4 = 0; int num4 = 0;
for (int i = startA; i < length; i++) for (int i = startA; i < length; i++)
{ {
for (int j = num3; j < length2; j++) for (int j = num3; j < length2; j++)
{ {
num3 = j + 1; num3 = j + 1;
if (a[i] == b[j]) if (a[i] == b[j])
{ {
num4 = i + 1; num4 = i + 1;
num2++; num2++;
if (num2 > num) if (num2 > num)
{ {
num = num2; num = num2;
} }
break; break;
} }
if (num2 > num) if (num2 > num)
{ {
num = num2; num = num2;
} }
num2 = 0; num2 = 0;
} }
if (num3 >= length2) if (num3 >= length2)
{ {
break; break;
} }
} }
if (num2 > num) if (num2 > num)
{ {
num = num2; num = num2;
} }
if (num < minMatchCount) if (num < minMatchCount)
{ {
return 0; return 0;
} }
return num4 - startA; return num4 - startA;
} }
public string GetHierarchyPath(Transform root, Transform t) public string GetHierarchyPath(Transform root, Transform t)
{ {
if ((Object)(object)t == (Object)null) if ((Object)(object)t == (Object)null)
{ {
return ""; return "";
} }
Stack<string> stack = new Stack<string>(); Stack<string> stack = new Stack<string>();
Transform val = t; Transform val = t;
while ((Object)(object)val != (Object)null && (Object)(object)val != (Object)(object)root) while ((Object)(object)val != (Object)null && (Object)(object)val != (Object)(object)root)
{ {
stack.Push(((Object)val).name); stack.Push(((Object)val).name);
val = val.parent; val = val.parent;
} }
return string.Join("/", stack); return string.Join("/", stack);
} }
public string NormalizeName(string s) public string NormalizeName(string s)
{ {
if (string.IsNullOrEmpty(s)) if (string.IsNullOrEmpty(s))
{ {
return ""; return "";
} }
s = s.ToLowerInvariant(); s = s.ToLowerInvariant();
s = s.Replace("left", "l").Replace("right", "r"); s = s.Replace("left", "l").Replace("right", "r");
char[] array = nameDelims; char[] array = this.nameDelims;
foreach (char c in array) foreach (char c in array)
{ {
s = s.Replace(c.ToString(), ""); s = s.Replace(c.ToString(), "");
} }
s = StripDigits(s); s = this.StripDigits(s);
return s; return s;
} }
public string NormalizePath(string p) public string NormalizePath(string p)
{ {
if (string.IsNullOrEmpty(p)) if (string.IsNullOrEmpty(p))
{ {
return ""; return "";
} }
return string.Join("/", (from x in p.Split('/') return string.Join("/", (from x in p.Split('/')
where !string.IsNullOrEmpty(x) where !string.IsNullOrEmpty(x)
select x).Select(NormalizeName)); select x).Select(this.NormalizeName));
} }
public string StripDigits(string s) public string StripDigits(string s)
{ {
if (string.IsNullOrEmpty(s)) if (string.IsNullOrEmpty(s))
{ {
return ""; return "";
} }
StringBuilder stringBuilder = new StringBuilder(s.Length); StringBuilder stringBuilder = new StringBuilder(s.Length);
foreach (char c in s) foreach (char c in s)
{ {
if (!char.IsDigit(c)) if (!char.IsDigit(c))
{ {
stringBuilder.Append(c); stringBuilder.Append(c);
} }
} }
return stringBuilder.ToString(); return stringBuilder.ToString();
} }
} }

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,4 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // 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. // 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 // EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.BvhNode // Eden.AutoMorpher.BvhNode
@@ -6,15 +6,15 @@ using UnityEngine;
public struct BvhNode public struct BvhNode
{ {
public Bounds bounds; public Bounds bounds;
public int leftChild; public int leftChild;
public int rightChild; public int rightChild;
public int start; public int start;
public int count; public int count;
public bool isLeaf; public bool isLeaf;
} }

View File

@@ -1,4 +1,4 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // 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. // 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 // EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.BvhTriangle // Eden.AutoMorpher.BvhTriangle
@@ -6,13 +6,13 @@ using UnityEngine;
public struct BvhTriangle public struct BvhTriangle
{ {
public Vector3 a; public Vector3 a;
public Vector3 b; public Vector3 b;
public Vector3 c; public Vector3 c;
public Vector3 normal; public Vector3 normal;
public HumanBodyBones mainHumanBone; public HumanBodyBones mainHumanBone;
} }

File diff suppressed because it is too large Load Diff

View File

@@ -1,9 +1,9 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // 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. // 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 // EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.ClothBoneType // Eden.AutoMorpher.ClothBoneType
public enum ClothBoneType public enum ClothBoneType
{ {
Body, Body,
Accessory Accessory
} }

View File

@@ -1,306 +1,305 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // 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. // 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 // EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.ClothHumanoidMaskUtil // Eden.AutoMorpher.ClothHumanoidMaskUtil
using System.Collections.Generic; using System.Collections.Generic;
using Eden.AutoMorpher;
using UnityEngine; using UnityEngine;
public class ClothHumanoidMaskUtil public class ClothHumanoidMaskUtil
{ {
public void BuildExcludedVertexMaskForHandsAndHead(ClothInstance clothInstance, bool excludeHandRoot = false, bool excludeThumbRoot = false) public void BuildExcludedVertexMaskForHandsAndHead(ClothInstance clothInstance, bool excludeHandRoot = false, bool excludeThumbRoot = false)
{ {
//IL_02ea: Unknown result type (might be due to invalid IL or missing references) //IL_02ea: Unknown result type (might be due to invalid IL or missing references)
//IL_02ef: Unknown result type (might be due to invalid IL or missing references) //IL_02ef: Unknown result type (might be due to invalid IL or missing references)
if (clothInstance == null || (Object)(object)clothInstance.smr == (Object)null) if (clothInstance == null || (Object)(object)clothInstance.smr == (Object)null)
{ {
Debug.LogWarning((object)"[ClothHumanoidMaskUtil] clothInstance / smr 가 null"); Debug.LogWarning((object)"[ClothHumanoidMaskUtil] clothInstance / smr 가 null");
return; return;
} }
SkinnedMeshRenderer smr = clothInstance.smr; SkinnedMeshRenderer smr = clothInstance.smr;
Mesh val = clothInstance.editableMesh ?? smr.sharedMesh; Mesh val = clothInstance.editableMesh ?? smr.sharedMesh;
if ((Object)(object)val == (Object)null) if ((Object)(object)val == (Object)null)
{ {
Debug.LogWarning((object)"[ClothHumanoidMaskUtil] mesh 가 null"); Debug.LogWarning((object)"[ClothHumanoidMaskUtil] mesh 가 null");
return; return;
} }
BoneWeight[] boneWeights = val.boneWeights; BoneWeight[] boneWeights = val.boneWeights;
Transform[] bones = smr.bones; Transform[] bones = smr.bones;
if (boneWeights == null || boneWeights.Length == 0 || bones == null || bones.Length == 0) if (boneWeights == null || boneWeights.Length == 0 || bones == null || bones.Length == 0)
{ {
Debug.LogWarning((object)"[ClothHumanoidMaskUtil] boneWeights 또는 bones 비어있음"); Debug.LogWarning((object)"[ClothHumanoidMaskUtil] boneWeights 또는 bones 비어있음");
return; return;
} }
if (clothInstance.humanoidMatchedBones == null || clothInstance.humanoidMatchedBones.Count == 0) if (clothInstance.humanoidMatchedBones == null || clothInstance.humanoidMatchedBones.Count == 0)
{ {
Debug.LogWarning((object)"[ClothHumanoidMaskUtil] humanoidMatchedBones 가 비어있음 (BodyToClothPoseApplier에서 매칭 안 되었을 가능성)"); Debug.LogWarning((object)"[ClothHumanoidMaskUtil] humanoidMatchedBones 가 비어있음 (BodyToClothPoseApplier에서 매칭 안 되었을 가능성)");
return; return;
} }
int num = val.vertexCount; int num = val.vertexCount;
if (boneWeights.Length != num) if (boneWeights.Length != num)
{ {
num = Mathf.Min(num, boneWeights.Length); num = Mathf.Min(num, boneWeights.Length);
} }
HashSet<Transform> excludedBones = new HashSet<Transform>(); HashSet<Transform> excludedBones = new HashSet<Transform>();
Dictionary<HumanBodyBones, HashSet<Transform>> humanoidMatchedBones = clothInstance.humanoidMatchedBones; Dictionary<HumanBodyBones, HashSet<Transform>> humanoidMatchedBones = clothInstance.humanoidMatchedBones;
if (humanoidMatchedBones.TryGetValue((HumanBodyBones)10, out var value) && value != null) if (humanoidMatchedBones.TryGetValue((HumanBodyBones)10, out var value) && value != null)
{ {
foreach (Transform item in value) foreach (Transform item in value)
{ {
if (!((Object)(object)item == (Object)null)) if (!((Object)(object)item == (Object)null))
{ {
AddHierarchy(item, includeRoot: true); AddHierarchy(item, includeRoot: true);
} }
} }
} }
if (humanoidMatchedBones.TryGetValue((HumanBodyBones)17, out var value2) && value2 != null) if (humanoidMatchedBones.TryGetValue((HumanBodyBones)17, out var value2) && value2 != null)
{ {
foreach (Transform item2 in value2) foreach (Transform item2 in value2)
{ {
if (!((Object)(object)item2 == (Object)null)) if (!((Object)(object)item2 == (Object)null))
{ {
AddHierarchy(item2, excludeHandRoot); AddHierarchy(item2, excludeHandRoot);
} }
} }
} }
if (humanoidMatchedBones.TryGetValue((HumanBodyBones)18, out var value3) && value3 != null) if (humanoidMatchedBones.TryGetValue((HumanBodyBones)18, out var value3) && value3 != null)
{ {
foreach (Transform item3 in value3) foreach (Transform item3 in value3)
{ {
if (!((Object)(object)item3 == (Object)null)) if (!((Object)(object)item3 == (Object)null))
{ {
AddHierarchy(item3, excludeHandRoot); AddHierarchy(item3, excludeHandRoot);
} }
} }
} }
if (humanoidMatchedBones.TryGetValue((HumanBodyBones)24, out var value4) && value4 != null) if (humanoidMatchedBones.TryGetValue((HumanBodyBones)24, out var value4) && value4 != null)
{ {
foreach (Transform item4 in value4) foreach (Transform item4 in value4)
{ {
if (!((Object)(object)item4 == (Object)null)) if (!((Object)(object)item4 == (Object)null))
{ {
if (excludeThumbRoot) if (excludeThumbRoot)
{ {
excludedBones.Add(item4); excludedBones.Add(item4);
} }
else else
{ {
excludedBones.Remove(item4); excludedBones.Remove(item4);
} }
} }
} }
} }
if (humanoidMatchedBones.TryGetValue((HumanBodyBones)39, out var value5) && value5 != null) if (humanoidMatchedBones.TryGetValue((HumanBodyBones)39, out var value5) && value5 != null)
{ {
foreach (Transform item5 in value5) foreach (Transform item5 in value5)
{ {
if (!((Object)(object)item5 == (Object)null)) if (!((Object)(object)item5 == (Object)null))
{ {
if (excludeThumbRoot) if (excludeThumbRoot)
{ {
excludedBones.Add(item5); excludedBones.Add(item5);
} }
else else
{ {
excludedBones.Remove(item5); excludedBones.Remove(item5);
} }
} }
} }
} }
bool[] boneIndexExcluded = new bool[bones.Length]; bool[] boneIndexExcluded = new bool[bones.Length];
for (int i = 0; i < bones.Length; i++) for (int i = 0; i < bones.Length; i++)
{ {
Transform val2 = bones[i]; Transform val2 = bones[i];
if ((Object)(object)val2 != (Object)null && excludedBones.Contains(val2)) if ((Object)(object)val2 != (Object)null && excludedBones.Contains(val2))
{ {
boneIndexExcluded[i] = true; boneIndexExcluded[i] = true;
} }
} }
bool[] array = new bool[num]; bool[] array = new bool[num];
for (int j = 0; j < num; j++) for (int j = 0; j < num; j++)
{ {
BoneWeight val3 = boneWeights[j]; BoneWeight val3 = boneWeights[j];
float excludedWeightSum = 0f; float excludedWeightSum = 0f;
AddExcludedWeight(((BoneWeight)(ref val3)).weight0, ((BoneWeight)(ref val3)).boneIndex0); AddExcludedWeight(val3.weight0, val3.boneIndex0);
AddExcludedWeight(((BoneWeight)(ref val3)).weight1, ((BoneWeight)(ref val3)).boneIndex1); AddExcludedWeight(val3.weight1, val3.boneIndex1);
AddExcludedWeight(((BoneWeight)(ref val3)).weight2, ((BoneWeight)(ref val3)).boneIndex2); AddExcludedWeight(val3.weight2, val3.boneIndex2);
AddExcludedWeight(((BoneWeight)(ref val3)).weight3, ((BoneWeight)(ref val3)).boneIndex3); AddExcludedWeight(val3.weight3, val3.boneIndex3);
array[j] = excludedWeightSum >= 0.8f; array[j] = excludedWeightSum >= 0.8f;
void AddExcludedWeight(float w, int bi) void AddExcludedWeight(float w, int bi)
{ {
if (!(w <= 0f) && bi >= 0 && bi < boneIndexExcluded.Length && boneIndexExcluded[bi]) if (!(w <= 0f) && bi >= 0 && bi < boneIndexExcluded.Length && boneIndexExcluded[bi])
{ {
excludedWeightSum += w; excludedWeightSum += w;
} }
} }
} }
clothInstance.excludedVertices = array; clothInstance.excludedVertices = array;
BuildLegVertexMasks(clothInstance); this.BuildLegVertexMasks(clothInstance);
void AddHierarchy(Transform root, bool includeRoot) void AddHierarchy(Transform root, bool includeRoot)
{ {
if (!((Object)(object)root == (Object)null)) if (!((Object)(object)root == (Object)null))
{ {
Stack<Transform> stack = new Stack<Transform>(); Stack<Transform> stack = new Stack<Transform>();
if (includeRoot) if (includeRoot)
{ {
stack.Push(root); stack.Push(root);
} }
else else
{ {
for (int k = 0; k < root.childCount; k++) for (int k = 0; k < root.childCount; k++)
{ {
stack.Push(root.GetChild(k)); stack.Push(root.GetChild(k));
} }
} }
while (stack.Count > 0) while (stack.Count > 0)
{ {
Transform val4 = stack.Pop(); Transform val4 = stack.Pop();
if (!((Object)(object)val4 == (Object)null) && excludedBones.Add(val4)) if (!((Object)(object)val4 == (Object)null) && excludedBones.Add(val4))
{ {
for (int l = 0; l < val4.childCount; l++) for (int l = 0; l < val4.childCount; l++)
{ {
stack.Push(val4.GetChild(l)); stack.Push(val4.GetChild(l));
} }
} }
} }
} }
} }
} }
public void BuildLegVertexMasks(ClothInstance clothInstance) public void BuildLegVertexMasks(ClothInstance clothInstance)
{ {
//IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references)
//IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references)
if (clothInstance == null || (Object)(object)clothInstance.smr == (Object)null) if (clothInstance == null || (Object)(object)clothInstance.smr == (Object)null)
{ {
Debug.LogWarning((object)"[ClothHumanoidMaskUtil] clothInstance / smr 가 null"); Debug.LogWarning((object)"[ClothHumanoidMaskUtil] clothInstance / smr 가 null");
return; return;
} }
SkinnedMeshRenderer smr = clothInstance.smr; SkinnedMeshRenderer smr = clothInstance.smr;
Mesh val = clothInstance.editableMesh ?? smr.sharedMesh; Mesh val = clothInstance.editableMesh ?? smr.sharedMesh;
if ((Object)(object)val == (Object)null) if ((Object)(object)val == (Object)null)
{ {
Debug.LogWarning((object)"[ClothHumanoidMaskUtil] mesh 가 null"); Debug.LogWarning((object)"[ClothHumanoidMaskUtil] mesh 가 null");
return; return;
} }
BoneWeight[] boneWeights = val.boneWeights; BoneWeight[] boneWeights = val.boneWeights;
Transform[] bones = smr.bones; Transform[] bones = smr.bones;
if (boneWeights == null || boneWeights.Length == 0 || bones == null || bones.Length == 0) if (boneWeights == null || boneWeights.Length == 0 || bones == null || bones.Length == 0)
{ {
Debug.LogWarning((object)"[ClothHumanoidMaskUtil] boneWeights 또는 bones 비어있음"); Debug.LogWarning((object)"[ClothHumanoidMaskUtil] boneWeights 또는 bones 비어있음");
return; return;
} }
if (clothInstance.humanoidMatchedBones == null || clothInstance.humanoidMatchedBones.Count == 0) if (clothInstance.humanoidMatchedBones == null || clothInstance.humanoidMatchedBones.Count == 0)
{ {
Debug.LogWarning((object)"[ClothHumanoidMaskUtil] humanoidMatchedBones 가 비어있음 (BodyToClothPoseApplier에서 매칭 필요)"); Debug.LogWarning((object)"[ClothHumanoidMaskUtil] humanoidMatchedBones 가 비어있음 (BodyToClothPoseApplier에서 매칭 필요)");
return; return;
} }
int num = val.vertexCount; int num = val.vertexCount;
if (boneWeights.Length != num) if (boneWeights.Length != num)
{ {
num = Mathf.Min(num, boneWeights.Length); num = Mathf.Min(num, boneWeights.Length);
} }
Dictionary<HumanBodyBones, HashSet<Transform>> humanoidMatchedBones = clothInstance.humanoidMatchedBones; Dictionary<HumanBodyBones, HashSet<Transform>> humanoidMatchedBones = clothInstance.humanoidMatchedBones;
HashSet<Transform> hashSet = new HashSet<Transform>(); HashSet<Transform> hashSet = new HashSet<Transform>();
HashSet<Transform> hashSet2 = new HashSet<Transform>(); HashSet<Transform> hashSet2 = new HashSet<Transform>();
if (humanoidMatchedBones.TryGetValue((HumanBodyBones)1, out var value) && value != null) if (humanoidMatchedBones.TryGetValue((HumanBodyBones)1, out var value) && value != null)
{ {
foreach (Transform item in value) foreach (Transform item in value)
{ {
if (!((Object)(object)item == (Object)null)) if (!((Object)(object)item == (Object)null))
{ {
CollectHierarchy(item, hashSet); CollectHierarchy(item, hashSet);
} }
} }
} }
if (humanoidMatchedBones.TryGetValue((HumanBodyBones)2, out var value2) && value2 != null) if (humanoidMatchedBones.TryGetValue((HumanBodyBones)2, out var value2) && value2 != null)
{ {
foreach (Transform item2 in value2) foreach (Transform item2 in value2)
{ {
if (!((Object)(object)item2 == (Object)null)) if (!((Object)(object)item2 == (Object)null))
{ {
CollectHierarchy(item2, hashSet2); CollectHierarchy(item2, hashSet2);
} }
} }
} }
bool[] boneIsLeftLeg = new bool[bones.Length]; bool[] boneIsLeftLeg = new bool[bones.Length];
bool[] boneIsRightLeg = new bool[bones.Length]; bool[] boneIsRightLeg = new bool[bones.Length];
for (int i = 0; i < bones.Length; i++) for (int i = 0; i < bones.Length; i++)
{ {
Transform val2 = bones[i]; Transform val2 = bones[i];
if (!((Object)(object)val2 == (Object)null)) if (!((Object)(object)val2 == (Object)null))
{ {
if (hashSet.Contains(val2)) if (hashSet.Contains(val2))
{ {
boneIsLeftLeg[i] = true; boneIsLeftLeg[i] = true;
} }
if (hashSet2.Contains(val2)) if (hashSet2.Contains(val2))
{ {
boneIsRightLeg[i] = true; boneIsRightLeg[i] = true;
} }
} }
} }
bool[] array = new bool[num]; bool[] array = new bool[num];
bool[] array2 = new bool[num]; bool[] array2 = new bool[num];
for (int j = 0; j < num; j++) for (int j = 0; j < num; j++)
{ {
BoneWeight val3 = boneWeights[j]; BoneWeight val3 = boneWeights[j];
float leftWeight = 0f; float leftWeight = 0f;
float rightWeight = 0f; float rightWeight = 0f;
Check(((BoneWeight)(ref val3)).boneIndex0, ((BoneWeight)(ref val3)).weight0); Check(val3.boneIndex0, val3.weight0);
Check(((BoneWeight)(ref val3)).boneIndex1, ((BoneWeight)(ref val3)).weight1); Check(val3.boneIndex1, val3.weight1);
Check(((BoneWeight)(ref val3)).boneIndex2, ((BoneWeight)(ref val3)).weight2); Check(val3.boneIndex2, val3.weight2);
Check(((BoneWeight)(ref val3)).boneIndex3, ((BoneWeight)(ref val3)).weight3); Check(val3.boneIndex3, val3.weight3);
if (leftWeight > 0.8f) if (leftWeight > 0.8f)
{ {
array[j] = true; array[j] = true;
array2[j] = false; array2[j] = false;
} }
else if (rightWeight > 0.8f) else if (rightWeight > 0.8f)
{ {
array[j] = false; array[j] = false;
array2[j] = true; array2[j] = true;
} }
else else
{ {
array[j] = false; array[j] = false;
array2[j] = false; array2[j] = false;
} }
void Check(int bi, float w) void Check(int bi, float w)
{ {
if (bi >= 0 && bi < bones.Length && !(w <= 0f)) if (bi >= 0 && bi < bones.Length && !(w <= 0f))
{ {
if (boneIsLeftLeg[bi]) if (boneIsLeftLeg[bi])
{ {
leftWeight += w; leftWeight += w;
} }
if (boneIsRightLeg[bi]) if (boneIsRightLeg[bi])
{ {
rightWeight += w; rightWeight += w;
} }
} }
} }
} }
clothInstance.isLeftLegVertex = array; clothInstance.isLeftLegVertex = array;
clothInstance.isRightLegVertex = array2; clothInstance.isRightLegVertex = array2;
void CollectHierarchy(Transform root, HashSet<Transform> set) void CollectHierarchy(Transform root, HashSet<Transform> set)
{ {
if (!((Object)(object)root == (Object)null)) if (!((Object)(object)root == (Object)null))
{ {
Stack<Transform> stack = new Stack<Transform>(); Stack<Transform> stack = new Stack<Transform>();
stack.Push(root); stack.Push(root);
while (stack.Count > 0) while (stack.Count > 0)
{ {
Transform val4 = stack.Pop(); Transform val4 = stack.Pop();
if (!((Object)(object)val4 == (Object)null) && set.Add(val4)) if (!((Object)(object)val4 == (Object)null) && set.Add(val4))
{ {
for (int k = 0; k < val4.childCount; k++) for (int k = 0; k < val4.childCount; k++)
{ {
stack.Push(val4.GetChild(k)); stack.Push(val4.GetChild(k));
} }
} }
} }
} }
} }
} }
} }

File diff suppressed because it is too large Load Diff

View File

@@ -1,342 +1,341 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // 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. // 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 // EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.ClothInstanceTotal // Eden.AutoMorpher.ClothInstanceTotal
using System.Collections.Generic; using System.Collections.Generic;
using Eden.AutoMorpher;
using UnityEngine; using UnityEngine;
public class ClothInstanceTotal public class ClothInstanceTotal
{ {
private readonly List<ClothInstance> clothInstances; private readonly List<ClothInstance> clothInstances;
public int TotalVertexCount { get; private set; } public int TotalVertexCount { get; private set; }
public Vector3[] GlobalPositions { get; private set; } public Vector3[] GlobalPositions { get; private set; }
public Vector3[] GlobalDeltas { get; private set; } public Vector3[] GlobalDeltas { get; private set; }
public List<int>[] GlobalAdjacencyTopology { get; private set; } public List<int>[] GlobalAdjacencyTopology { get; private set; }
public List<int>[] GlobalAdjacencyDistance { get; private set; } public List<int>[] GlobalAdjacencyDistance { get; private set; }
public List<int>[] GlobalAdjacencyMerged { get; private set; } public List<int>[] GlobalAdjacencyMerged { get; private set; }
public int[] VertexOffsets { get; private set; } public int[] VertexOffsets { get; private set; }
public ClothInstanceTotal(List<ClothInstance> clothInstances, float distanceBuildRadius, int maxNeighborsPerVertex = 0) public ClothInstanceTotal(List<ClothInstance> clothInstances, float distanceBuildRadius, int maxNeighborsPerVertex = 0)
{ {
if (clothInstances == null || clothInstances.Count == 0) if (clothInstances == null || clothInstances.Count == 0)
{ {
throw new AutoMorpherException("Cloth Instances are Missing", "[ClothInstanceTotal] ClothInstanceTotal\n - clothInstances is null or empty"); throw new AutoMorpherException("Cloth Instances are Missing", "[ClothInstanceTotal] ClothInstanceTotal\n - clothInstances is null or empty");
} }
if (distanceBuildRadius <= 0f) if (distanceBuildRadius <= 0f)
{ {
throw new AutoMorpherException("Distance Build Radius is Invalid", "[ClothInstanceTotal] ClothInstanceTotal\n - distanceBuildRadius must be > 0"); throw new AutoMorpherException("Distance Build Radius is Invalid", "[ClothInstanceTotal] ClothInstanceTotal\n - distanceBuildRadius must be > 0");
} }
this.clothInstances = clothInstances; this.clothInstances = clothInstances;
BuildTopologyCache(); this.BuildTopologyCache();
BuildDistanceAdjacencyCandidates(distanceBuildRadius, maxNeighborsPerVertex); this.BuildDistanceAdjacencyCandidates(distanceBuildRadius, maxNeighborsPerVertex);
BuildMergedAdjacency(); this.BuildMergedAdjacency();
} }
public void SetGlobalDeltas(Vector3[] globalDeltas) public void SetGlobalDeltas(Vector3[] globalDeltas)
{ {
if (globalDeltas == null || globalDeltas.Length != TotalVertexCount) if (globalDeltas == null || globalDeltas.Length != this.TotalVertexCount)
{ {
throw new AutoMorpherException("Global Deltas are Invalid", "[ClothInstanceTotal] SetGlobalDeltas\n - globalDeltas is null or length mismatch"); throw new AutoMorpherException("Global Deltas are Invalid", "[ClothInstanceTotal] SetGlobalDeltas\n - globalDeltas is null or length mismatch");
} }
GlobalDeltas = globalDeltas; this.GlobalDeltas = globalDeltas;
} }
public void UpdateGlobalBuffersFromClothInstances() public void UpdateGlobalBuffersFromClothInstances()
{ {
//IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: 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_00aa: Unknown result type (might be due to invalid IL or missing references)
ValidateGlobalBufferReady("[ClothInstanceTotal] UpdateGlobalBuffersFromClothInstances"); this.ValidateGlobalBufferReady("[ClothInstanceTotal] UpdateGlobalBuffersFromClothInstances");
for (int i = 0; i < clothInstances.Count; i++) for (int i = 0; i < this.clothInstances.Count; i++)
{ {
ClothInstance clothInstance = clothInstances[i]; ClothInstance clothInstance = this.clothInstances[i];
if (clothInstance != null) if (clothInstance != null)
{ {
if (clothInstance.worldVertices == null || clothInstance.deltasLocal == null) if (clothInstance.worldVertices == null || clothInstance.deltasLocal == null)
{ {
throw new AutoMorpherException("Cloth Instance Data is Missing", "[ClothInstanceTotal] UpdateGlobalBuffersFromClothInstances\n - worldVertices or deltasLocal is null"); throw new AutoMorpherException("Cloth Instance Data is Missing", "[ClothInstanceTotal] UpdateGlobalBuffersFromClothInstances\n - worldVertices or deltasLocal is null");
} }
int num = VertexOffsets[i]; int num = this.VertexOffsets[i];
int num2 = clothInstance.worldVertices.Length; int num2 = clothInstance.worldVertices.Length;
if (num2 != clothInstance.deltasLocal.Length) if (num2 != clothInstance.deltasLocal.Length)
{ {
throw new AutoMorpherException("Cloth Instance Array Length Mismatch", "[ClothInstanceTotal] UpdateGlobalBuffersFromClothInstances\n - worldVertices.Length != deltasLocal.Length"); throw new AutoMorpherException("Cloth Instance Array Length Mismatch", "[ClothInstanceTotal] UpdateGlobalBuffersFromClothInstances\n - worldVertices.Length != deltasLocal.Length");
} }
for (int j = 0; j < num2; j++) for (int j = 0; j < num2; j++)
{ {
GlobalPositions[num + j] = clothInstance.worldVertices[j]; this.GlobalPositions[num + j] = clothInstance.worldVertices[j];
GlobalDeltas[num + j] = clothInstance.deltasLocal[j]; this.GlobalDeltas[num + j] = clothInstance.deltasLocal[j];
} }
} }
} }
} }
public void ApplyGlobalDeltasToClothInstances() public void ApplyGlobalDeltasToClothInstances()
{ {
//IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references)
ValidateGlobalBufferReady("[ClothInstanceTotal] ApplyGlobalDeltasToClothInstances"); this.ValidateGlobalBufferReady("[ClothInstanceTotal] ApplyGlobalDeltasToClothInstances");
for (int i = 0; i < clothInstances.Count; i++) for (int i = 0; i < this.clothInstances.Count; i++)
{ {
ClothInstance clothInstance = clothInstances[i]; ClothInstance clothInstance = this.clothInstances[i];
if (clothInstance != null) if (clothInstance != null)
{ {
if (clothInstance.deltasLocal == null) if (clothInstance.deltasLocal == null)
{ {
throw new AutoMorpherException("Cloth Deltas are Missing", "[ClothInstanceTotal] ApplyGlobalDeltasToClothInstances\n - deltasLocal is null"); throw new AutoMorpherException("Cloth Deltas are Missing", "[ClothInstanceTotal] ApplyGlobalDeltasToClothInstances\n - deltasLocal is null");
} }
int num = VertexOffsets[i]; int num = this.VertexOffsets[i];
int num2 = clothInstance.deltasLocal.Length; int num2 = clothInstance.deltasLocal.Length;
for (int j = 0; j < num2; j++) for (int j = 0; j < num2; j++)
{ {
clothInstance.deltasLocal[j] = GlobalDeltas[num + j]; clothInstance.deltasLocal[j] = this.GlobalDeltas[num + j];
} }
} }
} }
} }
private void ValidateGlobalBufferReady(string functionContext) private void ValidateGlobalBufferReady(string functionContext)
{ {
if (clothInstances == null || clothInstances.Count == 0) if (this.clothInstances == null || this.clothInstances.Count == 0)
{ {
throw new AutoMorpherException("Cloth Instances are Missing", functionContext + "\n - clothInstances is null or empty"); throw new AutoMorpherException("Cloth Instances are Missing", functionContext + "\n - clothInstances is null or empty");
} }
if (TotalVertexCount <= 0 || GlobalPositions == null || GlobalDeltas == null || VertexOffsets == null || GlobalAdjacencyMerged == null) if (this.TotalVertexCount <= 0 || this.GlobalPositions == null || this.GlobalDeltas == null || this.VertexOffsets == null || this.GlobalAdjacencyMerged == null)
{ {
throw new AutoMorpherException("Cloth Instance Total Cache is Not Ready", functionContext + "\n - total/global buffers/merged adjacency are not initialized"); throw new AutoMorpherException("Cloth Instance Total Cache is Not Ready", functionContext + "\n - total/global buffers/merged adjacency are not initialized");
} }
} }
private void BuildTopologyCache() private void BuildTopologyCache()
{ {
//IL_0107: 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_010c: 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_0123: Unknown result type (might be due to invalid IL or missing references)
//IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references)
TotalVertexCount = CalculateTotalVertexCount(clothInstances); this.TotalVertexCount = this.CalculateTotalVertexCount(this.clothInstances);
if (TotalVertexCount <= 0) if (this.TotalVertexCount <= 0)
{ {
throw new AutoMorpherException("Total Vertex Count is Zero", "[ClothInstanceTotal] BuildTopologyCache\n - TotalVertexCount <= 0"); throw new AutoMorpherException("Total Vertex Count is Zero", "[ClothInstanceTotal] BuildTopologyCache\n - TotalVertexCount <= 0");
} }
GlobalPositions = (Vector3[])(object)new Vector3[TotalVertexCount]; this.GlobalPositions = (Vector3[])(object)new Vector3[this.TotalVertexCount];
GlobalDeltas = (Vector3[])(object)new Vector3[TotalVertexCount]; this.GlobalDeltas = (Vector3[])(object)new Vector3[this.TotalVertexCount];
GlobalAdjacencyTopology = new List<int>[TotalVertexCount]; this.GlobalAdjacencyTopology = new List<int>[this.TotalVertexCount];
VertexOffsets = new int[clothInstances.Count]; this.VertexOffsets = new int[this.clothInstances.Count];
int num = 0; int num = 0;
for (int i = 0; i < clothInstances.Count; i++) for (int i = 0; i < this.clothInstances.Count; i++)
{ {
ClothInstance clothInstance = clothInstances[i]; ClothInstance clothInstance = this.clothInstances[i];
VertexOffsets[i] = num; this.VertexOffsets[i] = num;
if (clothInstance == null) if (clothInstance == null)
{ {
continue; continue;
} }
if (clothInstance.worldVertices == null || clothInstance.deltasLocal == null || clothInstance.vertexAdjacency == null) if (clothInstance.worldVertices == null || clothInstance.deltasLocal == null || clothInstance.vertexAdjacency == null)
{ {
throw new AutoMorpherException("Cloth Instance Data is Missing", "[ClothInstanceTotal] BuildTopologyCache\n - worldVertices/deltasLocal/vertexAdjacency is null"); throw new AutoMorpherException("Cloth Instance Data is Missing", "[ClothInstanceTotal] BuildTopologyCache\n - worldVertices/deltasLocal/vertexAdjacency is null");
} }
int num2 = clothInstance.worldVertices.Length; int num2 = clothInstance.worldVertices.Length;
if (num2 != clothInstance.deltasLocal.Length || num2 != clothInstance.vertexAdjacency.Length) if (num2 != clothInstance.deltasLocal.Length || num2 != clothInstance.vertexAdjacency.Length)
{ {
throw new AutoMorpherException("Cloth Instance Array Length Mismatch", "[ClothInstanceTotal] BuildTopologyCache\n - worldVertices/deltasLocal/vertexAdjacency lengths differ"); throw new AutoMorpherException("Cloth Instance Array Length Mismatch", "[ClothInstanceTotal] BuildTopologyCache\n - worldVertices/deltasLocal/vertexAdjacency lengths differ");
} }
for (int j = 0; j < num2; j++) for (int j = 0; j < num2; j++)
{ {
GlobalPositions[num + j] = clothInstance.worldVertices[j]; this.GlobalPositions[num + j] = clothInstance.worldVertices[j];
GlobalDeltas[num + j] = clothInstance.deltasLocal[j]; this.GlobalDeltas[num + j] = clothInstance.deltasLocal[j];
int capacity = clothInstance.vertexAdjacency[j]?.Count ?? 0; int capacity = clothInstance.vertexAdjacency[j]?.Count ?? 0;
GlobalAdjacencyTopology[num + j] = new List<int>(capacity); this.GlobalAdjacencyTopology[num + j] = new List<int>(capacity);
} }
for (int k = 0; k < num2; k++) for (int k = 0; k < num2; k++)
{ {
List<int> list = clothInstance.vertexAdjacency[k]; List<int> list = clothInstance.vertexAdjacency[k];
if (list == null) if (list == null)
{ {
continue; continue;
} }
int num3 = num + k; int num3 = num + k;
List<int> list2 = GlobalAdjacencyTopology[num3]; List<int> list2 = this.GlobalAdjacencyTopology[num3];
for (int l = 0; l < list.Count; l++) for (int l = 0; l < list.Count; l++)
{ {
int num4 = list[l]; int num4 = list[l];
if ((uint)num4 >= (uint)num2) if ((uint)num4 >= (uint)num2)
{ {
throw new AutoMorpherException("Vertex Adjacency Index is Out of Range", "[ClothInstanceTotal] BuildTopologyCache\n - vertexAdjacency contains invalid neighbor index"); throw new AutoMorpherException("Vertex Adjacency Index is Out of Range", "[ClothInstanceTotal] BuildTopologyCache\n - vertexAdjacency contains invalid neighbor index");
} }
list2.Add(num + num4); list2.Add(num + num4);
} }
} }
num += num2; num += num2;
} }
} }
private void BuildDistanceAdjacencyCandidates(float radius, int maxNeighborsPerVertex) private void BuildDistanceAdjacencyCandidates(float radius, int maxNeighborsPerVertex)
{ {
if (GlobalPositions == null || GlobalPositions.Length == 0) if (this.GlobalPositions == null || this.GlobalPositions.Length == 0)
{ {
throw new AutoMorpherException("Reference Positions are Missing", "[ClothInstanceTotal] BuildDistanceAdjacencyCandidates\n - GlobalPositions is null or empty"); throw new AutoMorpherException("Reference Positions are Missing", "[ClothInstanceTotal] BuildDistanceAdjacencyCandidates\n - GlobalPositions is null or empty");
} }
GlobalAdjacencyDistance = BuildDistanceAdjacencyCandidatesInternal(GlobalPositions, radius, maxNeighborsPerVertex); this.GlobalAdjacencyDistance = this.BuildDistanceAdjacencyCandidatesInternal(this.GlobalPositions, radius, maxNeighborsPerVertex);
} }
private void BuildMergedAdjacency() private void BuildMergedAdjacency()
{ {
if (GlobalAdjacencyTopology == null || GlobalAdjacencyDistance == null) if (this.GlobalAdjacencyTopology == null || this.GlobalAdjacencyDistance == null)
{ {
throw new AutoMorpherException("Adjacency Inputs are Missing", "[ClothInstanceTotal] BuildMergedAdjacency\n - GlobalAdjacencyTopology or GlobalAdjacencyDistance is null"); throw new AutoMorpherException("Adjacency Inputs are Missing", "[ClothInstanceTotal] BuildMergedAdjacency\n - GlobalAdjacencyTopology or GlobalAdjacencyDistance is null");
} }
if (GlobalAdjacencyTopology.Length != GlobalAdjacencyDistance.Length) if (this.GlobalAdjacencyTopology.Length != this.GlobalAdjacencyDistance.Length)
{ {
throw new AutoMorpherException("Adjacency Length Mismatch", "[ClothInstanceTotal] BuildMergedAdjacency\n - topology and distance adjacency length differ"); throw new AutoMorpherException("Adjacency Length Mismatch", "[ClothInstanceTotal] BuildMergedAdjacency\n - topology and distance adjacency length differ");
} }
int num = GlobalAdjacencyTopology.Length; int num = this.GlobalAdjacencyTopology.Length;
GlobalAdjacencyMerged = new List<int>[num]; this.GlobalAdjacencyMerged = new List<int>[num];
for (int i = 0; i < num; i++) for (int i = 0; i < num; i++)
{ {
List<int> list = new List<int>((GlobalAdjacencyTopology[i]?.Count ?? 0) + (GlobalAdjacencyDistance[i]?.Count ?? 0)); List<int> list = new List<int>((this.GlobalAdjacencyTopology[i]?.Count ?? 0) + (this.GlobalAdjacencyDistance[i]?.Count ?? 0));
HashSet<int> hashSet = new HashSet<int>(); HashSet<int> hashSet = new HashSet<int>();
List<int> list2 = GlobalAdjacencyTopology[i]; List<int> list2 = this.GlobalAdjacencyTopology[i];
if (list2 != null) if (list2 != null)
{ {
for (int j = 0; j < list2.Count; j++) for (int j = 0; j < list2.Count; j++)
{ {
int num2 = list2[j]; int num2 = list2[j];
if (num2 != i && hashSet.Add(num2)) if (num2 != i && hashSet.Add(num2))
{ {
list.Add(num2); list.Add(num2);
} }
} }
} }
List<int> list3 = GlobalAdjacencyDistance[i]; List<int> list3 = this.GlobalAdjacencyDistance[i];
if (list3 != null) if (list3 != null)
{ {
for (int k = 0; k < list3.Count; k++) for (int k = 0; k < list3.Count; k++)
{ {
int num3 = list3[k]; int num3 = list3[k];
if (num3 != i && hashSet.Add(num3)) if (num3 != i && hashSet.Add(num3))
{ {
list.Add(num3); list.Add(num3);
} }
} }
} }
GlobalAdjacencyMerged[i] = list; this.GlobalAdjacencyMerged[i] = list;
} }
} }
private int CalculateTotalVertexCount(List<ClothInstance> clothInstances) private int CalculateTotalVertexCount(List<ClothInstance> clothInstances)
{ {
int num = 0; int num = 0;
for (int i = 0; i < clothInstances.Count; i++) for (int i = 0; i < clothInstances.Count; i++)
{ {
ClothInstance clothInstance = clothInstances[i]; ClothInstance clothInstance = clothInstances[i];
if (clothInstance != null && clothInstance.worldVertices != null) if (clothInstance != null && clothInstance.worldVertices != null)
{ {
num += clothInstance.worldVertices.Length; num += clothInstance.worldVertices.Length;
} }
} }
return num; return num;
} }
private List<int>[] BuildDistanceAdjacencyCandidatesInternal(Vector3[] referencePositions, float radius, int maxNeighborsPerVertex) private List<int>[] BuildDistanceAdjacencyCandidatesInternal(Vector3[] referencePositions, float radius, int maxNeighborsPerVertex)
{ {
//IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references)
//IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: 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_00fe: 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_010c: Unknown result type (might be due to invalid IL or missing references)
//IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011a: 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_0172: Unknown result type (might be due to invalid IL or missing references)
//IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references)
//IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references)
//IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references)
//IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references)
if (referencePositions == null || referencePositions.Length == 0) if (referencePositions == null || referencePositions.Length == 0)
{ {
throw new AutoMorpherException("Reference Positions are Missing", "[ClothInstanceTotal] BuildDistanceAdjacencyCandidatesInternal\n - referencePositions is null or empty"); throw new AutoMorpherException("Reference Positions are Missing", "[ClothInstanceTotal] BuildDistanceAdjacencyCandidatesInternal\n - referencePositions is null or empty");
} }
if (radius <= 0f) if (radius <= 0f)
{ {
throw new AutoMorpherException("Radius is Invalid", "[ClothInstanceTotal] BuildDistanceAdjacencyCandidatesInternal\n - radius must be > 0"); throw new AutoMorpherException("Radius is Invalid", "[ClothInstanceTotal] BuildDistanceAdjacencyCandidatesInternal\n - radius must be > 0");
} }
int num = referencePositions.Length; int num = referencePositions.Length;
List<int>[] array = new List<int>[num]; List<int>[] array = new List<int>[num];
for (int i = 0; i < num; i++) for (int i = 0; i < num; i++)
{ {
array[i] = new List<int>(8); array[i] = new List<int>(8);
} }
float num2 = 1f / Mathf.Max(radius, 1E-12f); float num2 = 1f / Mathf.Max(radius, 1E-12f);
float num3 = radius * radius; float num3 = radius * radius;
Dictionary<Vector3Int, List<int>> dictionary = new Dictionary<Vector3Int, List<int>>(num); Dictionary<Vector3Int, List<int>> dictionary = new Dictionary<Vector3Int, List<int>>(num);
Vector3Int key = default(Vector3Int); Vector3Int key = default(Vector3Int);
for (int j = 0; j < num; j++) for (int j = 0; j < num; j++)
{ {
Vector3 val = referencePositions[j]; Vector3 val = referencePositions[j];
((Vector3Int)(ref key))._002Ector(Mathf.FloorToInt(val.x * num2), Mathf.FloorToInt(val.y * num2), Mathf.FloorToInt(val.z * num2)); key = new Vector3Int(Mathf.FloorToInt(val.x * num2), Mathf.FloorToInt(val.y * num2), Mathf.FloorToInt(val.z * num2));
if (!dictionary.TryGetValue(key, out var value)) if (!dictionary.TryGetValue(key, out var value))
{ {
value = new List<int>(16); value = new List<int>(16);
dictionary.Add(key, value); dictionary.Add(key, value);
} }
value.Add(j); value.Add(j);
} }
Vector3Int val3 = default(Vector3Int); Vector3Int val3 = default(Vector3Int);
Vector3Int key2 = default(Vector3Int); Vector3Int key2 = default(Vector3Int);
for (int k = 0; k < num; k++) for (int k = 0; k < num; k++)
{ {
Vector3 val2 = referencePositions[k]; Vector3 val2 = referencePositions[k];
((Vector3Int)(ref val3))._002Ector(Mathf.FloorToInt(val2.x * num2), Mathf.FloorToInt(val2.y * num2), Mathf.FloorToInt(val2.z * num2)); val3 = new Vector3Int(Mathf.FloorToInt(val2.x * num2), Mathf.FloorToInt(val2.y * num2), Mathf.FloorToInt(val2.z * num2));
List<int> list = array[k]; List<int> list = array[k];
for (int l = -1; l <= 1; l++) for (int l = -1; l <= 1; l++)
{ {
for (int m = -1; m <= 1; m++) for (int m = -1; m <= 1; m++)
{ {
for (int n = -1; n <= 1; n++) for (int n = -1; n <= 1; n++)
{ {
((Vector3Int)(ref key2))._002Ector(((Vector3Int)(ref val3)).x + l, ((Vector3Int)(ref val3)).y + m, ((Vector3Int)(ref val3)).z + n); key2 = new Vector3Int(val3.x + l, val3.y + m, val3.z + n);
if (!dictionary.TryGetValue(key2, out var value2)) if (!dictionary.TryGetValue(key2, out var value2))
{ {
continue; continue;
} }
for (int num4 = 0; num4 < value2.Count; num4++) for (int num4 = 0; num4 < value2.Count; num4++)
{ {
int num5 = value2[num4]; int num5 = value2[num4];
if (num5 == k) if (num5 == k)
{ {
continue; continue;
} }
Vector3 val4 = referencePositions[num5] - val2; Vector3 val4 = referencePositions[num5] - val2;
if (!(((Vector3)(ref val4)).sqrMagnitude > num3)) if (!(val4.sqrMagnitude > num3))
{ {
list.Add(num5); list.Add(num5);
if (maxNeighborsPerVertex > 0 && list.Count >= maxNeighborsPerVertex) if (maxNeighborsPerVertex > 0 && list.Count >= maxNeighborsPerVertex)
{ {
break; break;
} }
} }
} }
if (maxNeighborsPerVertex > 0 && list.Count >= maxNeighborsPerVertex) if (maxNeighborsPerVertex > 0 && list.Count >= maxNeighborsPerVertex)
{ {
break; break;
} }
} }
} }
} }
} }
return array; return array;
} }
} }

File diff suppressed because it is too large Load Diff

View File

@@ -1,56 +1,55 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // 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. // 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 // EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.EdenAutoMorpherConfig // Eden.AutoMorpher.EdenAutoMorpherConfig
using System.Collections.Generic; using System.Collections.Generic;
using Eden.AutoMorpher;
using UnityEngine; using UnityEngine;
public struct EdenAutoMorpherConfig public struct EdenAutoMorpherConfig
{ {
public GameObject sourceAvatarObject; public GameObject sourceAvatarObject;
public GameObject sourceClothesObject; public GameObject sourceClothesObject;
public IReadOnlyList<SkinnedMeshRenderer> sourceBodyMeshes; public IReadOnlyList<SkinnedMeshRenderer> sourceBodyMeshes;
public GameObject targetAvatarObject; public GameObject targetAvatarObject;
public GameObject targetClothesObject; public GameObject targetClothesObject;
public IReadOnlyList<SkinnedMeshRenderer> targetBodyMeshes; public IReadOnlyList<SkinnedMeshRenderer> targetBodyMeshes;
public string profileName; public string profileName;
public float minMargin; public float minMargin;
public float worldRadius; public float worldRadius;
public float sigma; public float sigma;
public int smoothingIteration; public int smoothingIteration;
public int fittingExpandIteration; public int fittingExpandIteration;
public int fittingShrinkIteration; public int fittingShrinkIteration;
public bool isBodyAutoSetup; public bool isBodyAutoSetup;
public bool isReparentAccessoryBonesToTargetAvatar; public bool isReparentAccessoryBonesToTargetAvatar;
public bool skipFootFitting; public bool skipFootFitting;
public bool isRemoveAutoMorphedClothes; public bool isRemoveAutoMorphedClothes;
public bool transferWeightToAvatar; public bool transferWeightToAvatar;
public bool addAnchorBone; public bool addAnchorBone;
public bool armatureBoneScaleCopy; public bool armatureBoneScaleCopy;
public Dictionary<HumanBodyBones, HashSet<Transform>> clothesHumanoidMatchedBones; public Dictionary<HumanBodyBones, HashSet<Transform>> clothesHumanoidMatchedBones;
public Dictionary<Transform, ClothBoneType> clothBoneTypeMap; public Dictionary<Transform, ClothBoneType> clothBoneTypeMap;
public string tagEdenMorpehrCloth; public string tagEdenMorpehrCloth;
} }

View File

@@ -1,399 +1,398 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // 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. // 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 // EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.EdenAutoMorpherManager // Eden.AutoMorpher.EdenAutoMorpherManager
using Eden.AutoMorpher;
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using Eden.AutoMorpher;
using Eden.AutoMorpher.profile;
using UnityEditor; using UnityEditor;
using UnityEngine; using UnityEngine;
public class EdenAutoMorpherManager : IDisposable public class EdenAutoMorpherManager : IDisposable
{ {
private string displayTitle; private string displayTitle;
private string displayText; private string displayText;
private float displayProgress; private float displayProgress;
private List<ClothInstance> clothInstances; private List<ClothInstance> clothInstances;
public (string, string, float) GetProgressInfo() public (string, string, float) GetProgressInfo()
{ {
return (displayTitle, displayText, displayProgress); return (this.displayTitle, this.displayText, this.displayProgress);
} }
private void SetupProgress(string title, string text, float progress) private void SetupProgress(string title, string text, float progress)
{ {
displayTitle = title; this.displayTitle = title;
displayText = text; this.displayText = text;
displayProgress = progress; this.displayProgress = progress;
} }
private IEnumerator SetupClothInstances(GameObject targetClothesObject, Dictionary<HumanBodyBones, HashSet<Transform>> clothesHumanoidMatchedBones, bool duplicateMesh = true) private IEnumerator SetupClothInstances(GameObject targetClothesObject, Dictionary<HumanBodyBones, HashSet<Transform>> clothesHumanoidMatchedBones, bool duplicateMesh = true)
{ {
clothInstances = new List<ClothInstance>(); this.clothInstances = new List<ClothInstance>();
SkinnedMeshRenderer[] targetClothesSMRs = targetClothesObject.GetComponentsInChildren<SkinnedMeshRenderer>(false); SkinnedMeshRenderer[] targetClothesSMRs = targetClothesObject.GetComponentsInChildren<SkinnedMeshRenderer>(false);
if (targetClothesSMRs.Length == 0) if (targetClothesSMRs.Length == 0)
{ {
throw new AutoMorpherException("There is NO Skinned Mesh Renderer in Clothes", "[EdenAutoMorpherManager] SetupClothInstance\n - There is NO Skinned Mesh Renderer in Clothes"); throw new AutoMorpherException("There is NO Skinned Mesh Renderer in Clothes", "[EdenAutoMorpherManager] SetupClothInstance\n - There is NO Skinned Mesh Renderer in Clothes");
} }
EdenAutoMorpher_SetUpUtil setupUtil = new EdenAutoMorpher_SetUpUtil(); EdenAutoMorpher_SetUpUtil setupUtil = new EdenAutoMorpher_SetUpUtil();
for (int rendereri = 0; rendereri < targetClothesSMRs.Length; rendereri++) for (int rendereri = 0; rendereri < targetClothesSMRs.Length; rendereri++)
{ {
SetupProgress("Set Up", $"Setup Clothes Info [{rendereri}/{targetClothesSMRs.Length}] - ({((Object)targetClothesSMRs[rendereri]).name})", Mathf.Lerp(0.05f, 0.1f, (float)(rendereri / targetClothesSMRs.Length))); this.SetupProgress("Set Up", $"Setup Clothes Info [{rendereri}/{targetClothesSMRs.Length}] - ({targetClothesSMRs[rendereri].name})", Mathf.Lerp(0.05f, 0.1f, (float)(rendereri / targetClothesSMRs.Length)));
yield return null; yield return null;
ClothInstance clothInstance = setupUtil.SetupClothInstance(targetClothesSMRs[rendereri], clothesHumanoidMatchedBones, duplicateMesh); ClothInstance clothInstance = setupUtil.SetupClothInstance(targetClothesSMRs[rendereri], clothesHumanoidMatchedBones, duplicateMesh);
if (clothInstance != null) if (clothInstance != null)
{ {
clothInstances.Add(clothInstance); this.clothInstances.Add(clothInstance);
} }
} }
if (clothInstances.Count == 0) if (this.clothInstances.Count == 0)
{ {
throw new AutoMorpherException(LanguageManager.Get("UI.Exception.title.ClothInstanceAllocateFail"), LanguageManager.Get("UI.Exception.message.ClothInstanceAllocateFail")); throw new AutoMorpherException(LanguageManager.Get("UI.Exception.title.ClothInstanceAllocateFail"), LanguageManager.Get("UI.Exception.message.ClothInstanceAllocateFail"));
} }
} }
private IEnumerator SetupClothInstances(GameObject targetClothesObject, Dictionary<HumanBodyBones, HashSet<Transform>> clothesHumanoidMatchedBones, GameObject sourceClothesObject, MeshMatcher meshMatcher) private IEnumerator SetupClothInstances(GameObject targetClothesObject, Dictionary<HumanBodyBones, HashSet<Transform>> clothesHumanoidMatchedBones, GameObject sourceClothesObject, MeshMatcher meshMatcher)
{ {
clothInstances = new List<ClothInstance>(); this.clothInstances = new List<ClothInstance>();
SkinnedMeshRenderer[] targetClothesSMRs = targetClothesObject.GetComponentsInChildren<SkinnedMeshRenderer>(false); SkinnedMeshRenderer[] targetClothesSMRs = targetClothesObject.GetComponentsInChildren<SkinnedMeshRenderer>(false);
if (targetClothesSMRs.Length == 0) if (targetClothesSMRs.Length == 0)
{ {
throw new AutoMorpherException("There is NO Skinned Mesh Renderer in Clothes", "[EdenAutoMorpherManager] SetupClothInstance\n - There is NO Skinned Mesh Renderer in Clothes"); throw new AutoMorpherException("There is NO Skinned Mesh Renderer in Clothes", "[EdenAutoMorpherManager] SetupClothInstance\n - There is NO Skinned Mesh Renderer in Clothes");
} }
SkinnedMeshRenderer[] sourceClothesSMRs = sourceClothesObject.GetComponentsInChildren<SkinnedMeshRenderer>(false); SkinnedMeshRenderer[] sourceClothesSMRs = sourceClothesObject.GetComponentsInChildren<SkinnedMeshRenderer>(false);
if (sourceClothesSMRs.Length == 0 || targetClothesSMRs.Length != sourceClothesSMRs.Length) if (sourceClothesSMRs.Length == 0 || targetClothesSMRs.Length != sourceClothesSMRs.Length)
{ {
throw new AutoMorpherException("Clothes Skinned Mesh Renderer is Not Matched", "[EdenAutoMorpherManager] SetupClothInstance\n - Skinned Mesh Renderer of Source Clothes and Target Clothes is Not Matched"); throw new AutoMorpherException("Clothes Skinned Mesh Renderer is Not Matched", "[EdenAutoMorpherManager] SetupClothInstance\n - Skinned Mesh Renderer of Source Clothes and Target Clothes is Not Matched");
} }
EdenAutoMorpher_SetUpUtil setupUtil = new EdenAutoMorpher_SetUpUtil(); EdenAutoMorpher_SetUpUtil setupUtil = new EdenAutoMorpher_SetUpUtil();
for (int rendereri = 0; rendereri < targetClothesSMRs.Length; rendereri++) for (int rendereri = 0; rendereri < targetClothesSMRs.Length; rendereri++)
{ {
SetupProgress("Set Up", $"Setup Clothes Info [{rendereri}/{targetClothesSMRs.Length}] - ({((Object)targetClothesSMRs[rendereri]).name})", Mathf.Lerp(0.07f, 0.1f, (float)(rendereri / targetClothesSMRs.Length))); this.SetupProgress("Set Up", $"Setup Clothes Info [{rendereri}/{targetClothesSMRs.Length}] - ({targetClothesSMRs[rendereri].name})", Mathf.Lerp(0.07f, 0.1f, (float)(rendereri / targetClothesSMRs.Length)));
yield return null; yield return null;
ClothInstance clothInstance = setupUtil.SetupClothInstance(targetClothesSMRs[rendereri], sourceClothesSMRs[rendereri], meshMatcher, clothesHumanoidMatchedBones, duplicateMesh: true); ClothInstance clothInstance = setupUtil.SetupClothInstance(targetClothesSMRs[rendereri], sourceClothesSMRs[rendereri], meshMatcher, clothesHumanoidMatchedBones, duplicateMesh: true);
if (clothInstance != null) if (clothInstance != null)
{ {
clothInstances.Add(clothInstance); this.clothInstances.Add(clothInstance);
} }
} }
if (clothInstances.Count == 0) if (this.clothInstances.Count == 0)
{ {
throw new AutoMorpherException(LanguageManager.Get("UI.Exception.title.ClothInstanceAllocateFail"), LanguageManager.Get("UI.Exception.message.ClothInstanceAllocateFail")); throw new AutoMorpherException(LanguageManager.Get("UI.Exception.title.ClothInstanceAllocateFail"), LanguageManager.Get("UI.Exception.message.ClothInstanceAllocateFail"));
} }
} }
public IEnumerator FittingIteration(EdenAutoMorpherConfig config, MorpherMode morpherMode) public IEnumerator FittingIteration(EdenAutoMorpherConfig config, MorpherMode morpherMode)
{ {
SetupProgress("Set Up", "Setup Target Avatar Info", 0.03f); this.SetupProgress("Set Up", "Setup Target Avatar Info", 0.03f);
yield return null; yield return null;
MeshMatcher meshMatcher = new MeshMatcher(); MeshMatcher meshMatcher = new MeshMatcher();
BvhTriangleMesh targetBodyBVH = meshMatcher.BuildBvhMulti(config.targetBodyMeshes, config.targetAvatarObject.GetComponent<Animator>()); BvhTriangleMesh targetBodyBVH = meshMatcher.BuildBvhMulti(config.targetBodyMeshes, config.targetAvatarObject.GetComponent<Animator>());
if (targetBodyBVH == null) if (targetBodyBVH == null)
{ {
throw new AutoMorpherException("targetBodyBVH is Null", "[EdenAutoMorpherManater] FittingIteration\n - targetBodyBVH is null"); throw new AutoMorpherException("targetBodyBVH is Null", "[EdenAutoMorpherManater] FittingIteration\n - targetBodyBVH is null");
} }
yield return null; yield return null;
SetupProgress("Set Up", "Setup Source Avatar Info", 0.05f); this.SetupProgress("Set Up", "Setup Source Avatar Info", 0.05f);
yield return null; yield return null;
BvhTriangleMesh sourceBodyBVH = null; BvhTriangleMesh sourceBodyBVH = null;
switch (morpherMode) switch (morpherMode)
{ {
case MorpherMode.AutoMorpher: case MorpherMode.AutoMorpher:
case MorpherMode.ManualMorpher: case MorpherMode.ManualMorpher:
sourceBodyBVH = meshMatcher.BuildBvhMulti(config.sourceBodyMeshes, config.sourceAvatarObject.GetComponent<Animator>()); sourceBodyBVH = meshMatcher.BuildBvhMulti(config.sourceBodyMeshes, config.sourceAvatarObject.GetComponent<Animator>());
break; break;
case MorpherMode.ProfileMorpher: case MorpherMode.ProfileMorpher:
{ {
ProfileLoader profileLoader = new ProfileLoader(); ProfileLoader profileLoader = new ProfileLoader();
sourceBodyBVH = profileLoader.LoadBvhWithRootTransform(config.sourceClothesObject.transform, config.profileName); sourceBodyBVH = profileLoader.LoadBvhWithRootTransform(config.sourceClothesObject.transform, config.profileName);
break; break;
} }
default: default:
Debug.LogError((object)"Unknown MorpherMode"); Debug.LogError((object)"Unknown MorpherMode");
break; break;
} }
yield return null; yield return null;
if (sourceBodyBVH == null) if (sourceBodyBVH == null)
{ {
throw new AutoMorpherException("sourceBodyBVH is Null", "[EdenAutoMorpherManater] FittingIteration\n - sourceBodyBVH is null"); throw new AutoMorpherException("sourceBodyBVH is Null", "[EdenAutoMorpherManater] FittingIteration\n - sourceBodyBVH is null");
} }
meshMatcher.bodyBVH = sourceBodyBVH; meshMatcher.bodyBVH = sourceBodyBVH;
SetupProgress("Set Up", "Setup Clothes Info", 0.07f); this.SetupProgress("Set Up", "Setup Clothes Info", 0.07f);
yield return null; yield return null;
IEnumerator setupClothEnum = SetupClothInstances(config.targetClothesObject, config.clothesHumanoidMatchedBones, config.sourceClothesObject, meshMatcher); IEnumerator setupClothEnum = this.SetupClothInstances(config.targetClothesObject, config.clothesHumanoidMatchedBones, config.sourceClothesObject, meshMatcher);
while (setupClothEnum.MoveNext()) while (setupClothEnum.MoveNext())
{ {
yield return setupClothEnum.Current; yield return setupClothEnum.Current;
} }
yield return null; yield return null;
float fittingRadius = config.worldRadius; float fittingRadius = config.worldRadius;
meshMatcher.bodyBVH = targetBodyBVH; meshMatcher.bodyBVH = targetBodyBVH;
VertexFittingUtil vertexFittingUtil = new VertexFittingUtil(); VertexFittingUtil vertexFittingUtil = new VertexFittingUtil();
int fittingI; int fittingI;
for (fittingI = 0; fittingI < config.fittingExpandIteration; fittingI++) for (fittingI = 0; fittingI < config.fittingExpandIteration; fittingI++)
{ {
foreach (ClothInstance clothInstance in clothInstances) foreach (ClothInstance clothInstance in this.clothInstances)
{ {
SetupProgress("Fitting", $"Phase 1 Expanding [{fittingI + 1}/{config.fittingExpandIteration}] - {((Object)((Component)clothInstance.smr).transform).name}", Mathf.Lerp(0.1f, 0.4f, (float)fittingI / (float)config.fittingExpandIteration)); this.SetupProgress("Fitting", $"Phase 1 Expanding [{fittingI + 1}/{config.fittingExpandIteration}] - {clothInstance.smr.transform.name}", Mathf.Lerp(0.1f, 0.4f, (float)fittingI / (float)config.fittingExpandIteration));
yield return null; yield return null;
vertexFittingUtil.ExpandClothes_World(clothInstance, clothInstances, meshMatcher, config, fittingRadius); vertexFittingUtil.ExpandClothes_World(clothInstance, this.clothInstances, meshMatcher, config, fittingRadius);
yield return null; yield return null;
} }
if (fittingI % 2 == 0) if (fittingI % 2 == 0)
{ {
fittingRadius *= 0.97f; fittingRadius *= 0.97f;
} }
} }
fittingRadius = config.worldRadius; fittingRadius = config.worldRadius;
for (fittingI = 0; fittingI < config.fittingShrinkIteration; fittingI++) for (fittingI = 0; fittingI < config.fittingShrinkIteration; fittingI++)
{ {
foreach (ClothInstance clothInstance in clothInstances) foreach (ClothInstance clothInstance in this.clothInstances)
{ {
SetupProgress("Fitting", $"Phase 2 Fitting [{fittingI + 1}/{config.fittingShrinkIteration}] - {((Object)((Component)clothInstance.smr).transform).name}", Mathf.Lerp(0.4f, 0.8f, (float)fittingI / (float)config.fittingShrinkIteration)); this.SetupProgress("Fitting", $"Phase 2 Fitting [{fittingI + 1}/{config.fittingShrinkIteration}] - {clothInstance.smr.transform.name}", Mathf.Lerp(0.4f, 0.8f, (float)fittingI / (float)config.fittingShrinkIteration));
yield return null; yield return null;
vertexFittingUtil.ShrinkClothes_World(clothInstance, clothInstances, meshMatcher, config, fittingRadius); vertexFittingUtil.ShrinkClothes_World(clothInstance, this.clothInstances, meshMatcher, config, fittingRadius);
yield return null; yield return null;
vertexFittingUtil.ExpandClothes_World(clothInstance, clothInstances, meshMatcher, config, fittingRadius); vertexFittingUtil.ExpandClothes_World(clothInstance, this.clothInstances, meshMatcher, config, fittingRadius);
yield return null; yield return null;
} }
if (fittingI % 2 == 0) if (fittingI % 2 == 0)
{ {
fittingRadius *= 0.97f; fittingRadius *= 0.97f;
} }
} }
fittingRadius = config.worldRadius / 2f; fittingRadius = config.worldRadius / 2f;
for (fittingI = 0; fittingI < config.fittingExpandIteration; fittingI++) for (fittingI = 0; fittingI < config.fittingExpandIteration; fittingI++)
{ {
foreach (ClothInstance clothInstance in clothInstances) foreach (ClothInstance clothInstance in this.clothInstances)
{ {
SetupProgress("Fitting", $"Phase 3 Fine-tuning [{fittingI + 1}/{config.fittingExpandIteration}] - {((Object)((Component)clothInstance.smr).transform).name}", Mathf.Lerp(0.8f, 0.9f, (float)fittingI / (float)config.fittingExpandIteration)); this.SetupProgress("Fitting", $"Phase 3 Fine-tuning [{fittingI + 1}/{config.fittingExpandIteration}] - {clothInstance.smr.transform.name}", Mathf.Lerp(0.8f, 0.9f, (float)fittingI / (float)config.fittingExpandIteration));
yield return null; yield return null;
vertexFittingUtil.ExpandClothes_World(clothInstance, clothInstances, meshMatcher, config, fittingRadius); vertexFittingUtil.ExpandClothes_World(clothInstance, this.clothInstances, meshMatcher, config, fittingRadius);
yield return null; yield return null;
} }
if (fittingI % 2 == 0) if (fittingI % 2 == 0)
{ {
fittingRadius *= 0.97f; fittingRadius *= 0.97f;
} }
} }
yield return null; yield return null;
SetupProgress("Fitting", "Apply Transform Bone", 0.93f); this.SetupProgress("Fitting", "Apply Transform Bone", 0.93f);
yield return null; yield return null;
BoneAlignmentUtil boneAlignmentUtil = new BoneAlignmentUtil(); BoneAlignmentUtil boneAlignmentUtil = new BoneAlignmentUtil();
boneAlignmentUtil.CleanupTempBones(config.targetClothesObject.transform); boneAlignmentUtil.CleanupTempBones(config.targetClothesObject.transform);
MorpherMode morpherMode2 = morpherMode; MorpherMode morpherMode2 = morpherMode;
if (morpherMode2 == MorpherMode.AutoMorpher || morpherMode2 == MorpherMode.ProfileMorpher) if (morpherMode2 == MorpherMode.AutoMorpher || morpherMode2 == MorpherMode.ProfileMorpher)
{ {
config.targetClothesObject.transform.localScale = Vector3.one; config.targetClothesObject.transform.localScale = Vector3.one;
boneAlignmentUtil.AlignClothBonesToAvatar(clothInstances[0], config.targetAvatarObject.GetComponent<Animator>()); boneAlignmentUtil.AlignClothBonesToAvatar(this.clothInstances[0], config.targetAvatarObject.GetComponent<Animator>());
} }
yield return null; yield return null;
SetupProgress("Fitting", "Apply Transform Mesh", 0.99f); this.SetupProgress("Fitting", "Apply Transform Mesh", 0.99f);
yield return null; yield return null;
fittingI = 0; fittingI = 0;
while (fittingI < clothInstances.Count) while (fittingI < this.clothInstances.Count)
{ {
ClothInstance clothInstance = clothInstances[fittingI]; ClothInstance clothInstance = this.clothInstances[fittingI];
SetupProgress("Fitting", $"Apply to Mesh [{fittingI + 1}/{clothInstances.Count}] - {((Object)((Component)clothInstance.smr).transform).name}", Mathf.Lerp(0.93f, 0.98f, (float)fittingI / (float)clothInstances.Count)); this.SetupProgress("Fitting", $"Apply to Mesh [{fittingI + 1}/{this.clothInstances.Count}] - {clothInstance.smr.transform.name}", Mathf.Lerp(0.93f, 0.98f, (float)fittingI / (float)this.clothInstances.Count));
yield return null; yield return null;
clothInstance.ApplyWorldVerticesToMesh(); clothInstance.ApplyWorldVerticesToMesh();
((Renderer)clothInstance.smr).localBounds = new Bounds(Vector3.zero, Vector3.one * 2f); clothInstance.smr.localBounds = new Bounds(Vector3.zero, Vector3.one * 2f);
EditorUtility.SetDirty((Object)(object)clothInstance.smr.sharedMesh); EditorUtility.SetDirty(clothInstance.smr.sharedMesh);
EditorUtility.SetDirty((Object)(object)clothInstance.smr); EditorUtility.SetDirty(clothInstance.smr);
yield return null; yield return null;
int num = fittingI + 1; int num = fittingI + 1;
fittingI = num; fittingI = num;
} }
yield return null; yield return null;
SetupProgress("Saving", "Saving Mesh Data", 0.99f); this.SetupProgress("Saving", "Saving Mesh Data", 0.99f);
yield return null; yield return null;
SaveEditedMeshesToAssets(clothInstances, config); this.SaveEditedMeshesToAssets(this.clothInstances, config);
yield return null; yield return null;
SetupProgress("Finishing", "Finishing", 1f); this.SetupProgress("Finishing", "Finishing", 1f);
foreach (ClothInstance clothInstance2 in clothInstances) foreach (ClothInstance clothInstance2 in this.clothInstances)
{ {
clothInstance2.Dispose(); clothInstance2.Dispose();
} }
clothInstances = null; this.clothInstances = null;
yield return null; yield return null;
} }
public IEnumerator WeightingEnumerator(EdenAutoMorpherConfig config) public IEnumerator WeightingEnumerator(EdenAutoMorpherConfig config)
{ {
SetupProgress("Set Up", "Setup Target Avatar Info", 0f); this.SetupProgress("Set Up", "Setup Target Avatar Info", 0f);
yield return null; yield return null;
if (new MeshMatcher().BuildBvhMulti(config.targetBodyMeshes, config.targetAvatarObject.GetComponent<Animator>()) == null) if (new MeshMatcher().BuildBvhMulti(config.targetBodyMeshes, config.targetAvatarObject.GetComponent<Animator>()) == null)
{ {
throw new AutoMorpherException("targetBodyBVH is Null", "[EdenAutoMorpherManater] FittingIteration\n - targetBodyBVH is null"); throw new AutoMorpherException("targetBodyBVH is Null", "[EdenAutoMorpherManater] FittingIteration\n - targetBodyBVH is null");
} }
yield return null; yield return null;
List<Mesh> bakedTargetBodyMeshes = new List<Mesh>(); List<Mesh> bakedTargetBodyMeshes = new List<Mesh>();
foreach (SkinnedMeshRenderer bodyMesh in config.targetBodyMeshes) foreach (SkinnedMeshRenderer bodyMesh in config.targetBodyMeshes)
{ {
SetupProgress("Set Up", "Setup Target Avatar BodyMesh Info", Mathf.Lerp(0.02f, 0.05f, (float)(bakedTargetBodyMeshes.Count / config.targetBodyMeshes.Count))); this.SetupProgress("Set Up", "Setup Target Avatar BodyMesh Info", Mathf.Lerp(0.02f, 0.05f, (float)(bakedTargetBodyMeshes.Count / config.targetBodyMeshes.Count)));
yield return null; yield return null;
Mesh val = new Mesh(); Mesh val = new Mesh();
bodyMesh.BakeMesh(val); bodyMesh.BakeMesh(val);
val.triangles = bodyMesh.sharedMesh.triangles; val.triangles = bodyMesh.sharedMesh.triangles;
val.boneWeights = bodyMesh.sharedMesh.boneWeights; val.boneWeights = bodyMesh.sharedMesh.boneWeights;
bakedTargetBodyMeshes.Add(val); bakedTargetBodyMeshes.Add(val);
} }
yield return null; yield return null;
IEnumerator setupClothEnum = SetupClothInstances(config.targetClothesObject, config.clothesHumanoidMatchedBones, duplicateMesh: false); IEnumerator setupClothEnum = this.SetupClothInstances(config.targetClothesObject, config.clothesHumanoidMatchedBones, duplicateMesh: false);
while (setupClothEnum.MoveNext()) while (setupClothEnum.MoveNext())
{ {
yield return setupClothEnum.Current; yield return setupClothEnum.Current;
} }
yield return null; yield return null;
Dictionary<Transform, Transform> clonedBoneMap = null; Dictionary<Transform, Transform> clonedBoneMap = null;
if (!config.transferWeightToAvatar) if (!config.transferWeightToAvatar)
{ {
new EdenAutoMorpher_SetUpUtil().CreateClothesArmature(config, out clonedBoneMap); new EdenAutoMorpher_SetUpUtil().CreateClothesArmature(config, out clonedBoneMap);
} }
yield return null; yield return null;
WeightTransferUtil weightTransferUtil = new WeightTransferUtil(); WeightTransferUtil weightTransferUtil = new WeightTransferUtil();
WeightTransferUtil.Settings wtSettings = new WeightTransferUtil.Settings WeightTransferUtil.Settings wtSettings = new WeightTransferUtil.Settings
{ {
maxDistance = 0.07f, maxDistance = 0.07f,
maxNormalAngleDeg = 35f, maxNormalAngleDeg = 35f,
allowFlippedNormal = true, allowFlippedNormal = true,
enableSmoothing = true, enableSmoothing = true,
smoothingIterations = 4, smoothingIterations = 4,
smoothingAlpha = 0.25f, smoothingAlpha = 0.25f,
enforceFourBoneLimit = true, enforceFourBoneLimit = true,
weightInClothes = !config.transferWeightToAvatar weightInClothes = !config.transferWeightToAvatar
}; };
yield return null; yield return null;
int weightingI = 0; int weightingI = 0;
while (weightingI < clothInstances.Count) while (weightingI < this.clothInstances.Count)
{ {
ClothInstance clothInstance = clothInstances[weightingI]; ClothInstance clothInstance = this.clothInstances[weightingI];
float num = 0.1f; float num = 0.1f;
float num2 = (0.95f - num) / (float)Mathf.Max(1, clothInstances.Count); float num2 = (0.95f - num) / (float)Mathf.Max(1, this.clothInstances.Count);
float num3 = num + num2 * (float)weightingI; float num3 = num + num2 * (float)weightingI;
float num4 = 0.8f; float num4 = 0.8f;
float weightingStart = num3; float weightingStart = num3;
float weightingEnd = num3 + num2 * num4; float weightingEnd = num3 + num2 * num4;
float applyStart = num3 + num2 * num4; float applyStart = num3 + num2 * num4;
int step = 1; int step = 1;
SetupProgress("Weighting", $"Weighting | Step {step} [{weightingI + 1}/{clothInstances.Count}] - {((Object)((Component)clothInstance.smr).transform).name}", weightingStart); this.SetupProgress("Weighting", $"Weighting | Step {step} [{weightingI + 1}/{this.clothInstances.Count}] - {clothInstance.smr.transform.name}", weightingStart);
yield return null; yield return null;
IEnumerator weightingEnum = weightTransferUtil.RetargetAndTransfer(clothInstance, config.targetAvatarObject.GetComponent<Animator>(), config.targetBodyMeshes, bakedTargetBodyMeshes, 0, wtSettings, config.clothBoneTypeMap, clonedBoneMap); IEnumerator weightingEnum = weightTransferUtil.RetargetAndTransfer(clothInstance, config.targetAvatarObject.GetComponent<Animator>(), config.targetBodyMeshes, bakedTargetBodyMeshes, 0, wtSettings, config.clothBoneTypeMap, clonedBoneMap);
while (weightingEnum.MoveNext()) while (weightingEnum.MoveNext())
{ {
yield return null; yield return null;
step++; step++;
float num5 = 1f - 1f / ((float)step + 1f); float num5 = 1f - 1f / ((float)step + 1f);
float progress = Mathf.Lerp(weightingStart, weightingEnd, num5); float progress = Mathf.Lerp(weightingStart, weightingEnd, num5);
SetupProgress("Weighting", $"Weighting | Step {step} [{weightingI + 1}/{clothInstances.Count}] - {((Object)((Component)clothInstance.smr).transform).name}", progress); this.SetupProgress("Weighting", $"Weighting | Step {step} [{weightingI + 1}/{this.clothInstances.Count}] - {clothInstance.smr.transform.name}", progress);
yield return weightingEnum.Current; yield return weightingEnum.Current;
} }
yield return null; yield return null;
step++; step++;
SetupProgress("Weighting", $"Weighting | Step {step} - Apply to Mesh [{weightingI + 1}/{clothInstances.Count}] - {((Object)((Component)clothInstance.smr).transform).name}", applyStart); this.SetupProgress("Weighting", $"Weighting | Step {step} - Apply to Mesh [{weightingI + 1}/{this.clothInstances.Count}] - {clothInstance.smr.transform.name}", applyStart);
yield return null; yield return null;
clothInstance.ApplyWorldVerticesToMesh(); clothInstance.ApplyWorldVerticesToMesh();
((Renderer)clothInstance.smr).localBounds = new Bounds(Vector3.zero, Vector3.one * 2f); ((Renderer)clothInstance.smr).localBounds = new Bounds(Vector3.zero, Vector3.one * 2f);
EditorUtility.SetDirty((Object)(object)clothInstance.smr.sharedMesh); EditorUtility.SetDirty(clothInstance.smr.sharedMesh);
EditorUtility.SetDirty((Object)(object)clothInstance.smr); EditorUtility.SetDirty(clothInstance.smr);
yield return null; yield return null;
int num6 = weightingI + 1; int num6 = weightingI + 1;
weightingI = num6; weightingI = num6;
} }
SetupProgress("Weighting", "Allocate Bones", 0.95f); this.SetupProgress("Weighting", "Allocate Bones", 0.95f);
yield return null; yield return null;
if (config.transferWeightToAvatar && config.isReparentAccessoryBonesToTargetAvatar) if (config.transferWeightToAvatar && config.isReparentAccessoryBonesToTargetAvatar)
{ {
new BoneAlignmentUtil().ReparentAccessoryBonesToAvatar(config); new BoneAlignmentUtil().ReparentAccessoryBonesToAvatar(config);
} }
SetupProgress("Finishing", "Finishing", 1f); this.SetupProgress("Finishing", "Finishing", 1f);
yield return null; yield return null;
foreach (ClothInstance clothInstance2 in clothInstances) foreach (ClothInstance clothInstance2 in this.clothInstances)
{ {
clothInstance2.Dispose(); clothInstance2.Dispose();
} }
clothInstances = null; this.clothInstances = null;
yield return null; yield return null;
} }
private void SaveEditedMeshesToAssets(List<ClothInstance> clothInstances, EdenAutoMorpherConfig config) private void SaveEditedMeshesToAssets(List<ClothInstance> clothInstances, EdenAutoMorpherConfig config)
{ {
//IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references)
//IL_010b: Expected O, but got Unknown //IL_010b: Expected O, but got Unknown
if (clothInstances == null || clothInstances.Count == 0) if (clothInstances == null || clothInstances.Count == 0)
{ {
Debug.LogWarning((object)"[EdenAutoMorpher] 저장할 ClothInstance가 없습니다."); Debug.LogWarning((object)"[EdenAutoMorpher] 저장할 ClothInstance가 없습니다.");
throw new AutoMorpherException("Can't Save Mesh", "Therer is no ClothInstance to save mesh"); throw new AutoMorpherException("Can't Save Mesh", "Therer is no ClothInstance to save mesh");
} }
if ((Object)(object)config.targetClothesObject == (Object)null || (Object)(object)config.targetAvatarObject == (Object)null) if (config.targetClothesObject == null || config.targetAvatarObject == null)
{ {
Debug.LogWarning((object)"[EdenAutoMorpher] targetClothesObject 또는 targetAvatarObject 가 null 입니다. 메쉬 저장 경로를 만들 수 없습니다."); Debug.LogWarning((object)"[EdenAutoMorpher] targetClothesObject 또는 targetAvatarObject 가 null 입니다. 메쉬 저장 경로를 만들 수 없습니다.");
throw new AutoMorpherException("Can't Save Mesh", "Target Clothes Object or Target Avatar Object is null.\nCan't Create Mesh Folder"); throw new AutoMorpherException("Can't Save Mesh", "Target Clothes Object or Target Avatar Object is null.\nCan't Create Mesh Folder");
} }
string text = "Assets/@Eden_Mesh"; string text = "Assets/@Eden_Mesh";
if (!AssetDatabase.IsValidFolder(text)) if (!AssetDatabase.IsValidFolder(text))
{ {
AssetDatabase.CreateFolder("Assets", "@Eden_Mesh"); AssetDatabase.CreateFolder("Assets", "@Eden_Mesh");
} }
string text2 = SanitizeForAssetName(((Object)config.targetAvatarObject).name); string text2 = SanitizeForAssetName(config.targetAvatarObject.name);
string text3 = text + "/" + text2; string text3 = text + "/" + text2;
if (!AssetDatabase.IsValidFolder(text3)) if (!AssetDatabase.IsValidFolder(text3))
{ {
AssetDatabase.CreateFolder(text, text2); AssetDatabase.CreateFolder(text, text2);
} }
string text4 = SanitizeForAssetName(((Object)config.targetClothesObject).name); string text4 = SanitizeForAssetName(config.targetClothesObject.name);
string text5 = text3 + "/" + text4; string text5 = text3 + "/" + text4;
if (!AssetDatabase.IsValidFolder(text5)) if (!AssetDatabase.IsValidFolder(text5))
{ {
AssetDatabase.CreateFolder(text3, text4); AssetDatabase.CreateFolder(text3, text4);
} }
string text6 = AssetDatabase.GenerateUniqueAssetPath(text5 + "/" + text4 + "_Meshes.asset"); string text6 = AssetDatabase.GenerateUniqueAssetPath(text5 + "/" + text4 + "_Meshes.asset");
int num = 0; int num = 0;
AssetDatabase.CreateAsset((Object)new Mesh AssetDatabase.CreateAsset(new Mesh
{ {
name = text4 + "_RootMesh" name = text4 + "_RootMesh"
}, text6); }, text6);
foreach (ClothInstance clothInstance in clothInstances) foreach (ClothInstance clothInstance in clothInstances)
{ {
if (clothInstance != null && !((Object)(object)clothInstance.smr == (Object)null)) if (clothInstance != null && !(clothInstance.smr == null))
{ {
Mesh sharedMesh = clothInstance.smr.sharedMesh; Mesh sharedMesh = clothInstance.smr.sharedMesh;
if (!((Object)(object)sharedMesh == (Object)null)) if (!(sharedMesh == null))
{ {
Mesh val = Object.Instantiate<Mesh>(sharedMesh); Mesh val = UnityEngine.Object.Instantiate<Mesh>(sharedMesh);
((Object)val).name = SanitizeForAssetName(((Object)((Component)clothInstance.smr).gameObject).name + "_EditedMesh"); val.name = SanitizeForAssetName(clothInstance.smr.gameObject.name + "_EditedMesh");
AssetDatabase.AddObjectToAsset((Object)(object)val, text6); AssetDatabase.AddObjectToAsset(val, text6);
clothInstance.smr.sharedMesh = val; clothInstance.smr.sharedMesh = val;
clothInstance.editableMesh = clothInstance.smr.sharedMesh; clothInstance.editableMesh = clothInstance.smr.sharedMesh;
EditorUtility.SetDirty((Object)(object)clothInstance.smr); EditorUtility.SetDirty(clothInstance.smr);
EditorUtility.SetDirty((Object)(object)clothInstance.smr.sharedMesh); EditorUtility.SetDirty(clothInstance.smr.sharedMesh);
EditorUtility.SetDirty((Object)(object)((Component)clothInstance.smr).gameObject); EditorUtility.SetDirty(clothInstance.smr.gameObject);
num++; num++;
} }
} }
} }
AssetDatabase.SaveAssets(); AssetDatabase.SaveAssets();
AssetDatabase.Refresh(); AssetDatabase.Refresh();
Debug.Log((object)($"[EdenAutoMorpher] 편집된 메쉬 {num}개를 " + "'" + text6 + "' 에 서브 에셋으로 저장했습니다. (원본 프리팹은 변경하지 않음)")); Debug.Log((object)($"[EdenAutoMorpher] 편집된 메쉬 {num}개를 " + "'" + text6 + "' 에 서브 에셋으로 저장했습니다. (원본 프리팹은 변경하지 않음)"));
string SanitizeForAssetName(string rawName) string SanitizeForAssetName(string rawName)
{ {
char[] invalidFileNameChars = Path.GetInvalidFileNameChars(); char[] invalidFileNameChars = Path.GetInvalidFileNameChars();
foreach (char oldChar in invalidFileNameChars) foreach (char oldChar in invalidFileNameChars)
{ {
rawName = rawName.Replace(oldChar, '_'); rawName = rawName.Replace(oldChar, '_');
} }
return rawName.Trim(); return rawName.Trim();
} }
} }
public void Dispose() public void Dispose()
{ {
} }
} }

View File

@@ -1,277 +1,306 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // 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. // 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 // EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.MeshClassifier // Eden.AutoMorpher.MeshClassifier
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Runtime.CompilerServices;
using Eden.AutoMorpher;
using UnityEngine; using UnityEngine;
public class MeshClassifier public class MeshClassifier
{ {
private HumanBodyBones[] bodyBones; private HumanBodyBones[] bodyBones;
private HumanBodyBones[] headBones; private HumanBodyBones[] headBones;
public SkinnedMeshRenderer GetBodyMesh(Transform root, Animator animator) public SkinnedMeshRenderer GetBodyMesh(Transform root, Animator animator)
{ {
List<Transform> list = HumanBodyBonesTrsnforms(bodyBones, animator); List<Transform> list = this.HumanBodyBonesTrsnforms(this.bodyBones, animator);
if (list.Count != bodyBones.Length) if (list.Count != this.bodyBones.Length)
{ {
if (AutoMorpherDev.isDeveloperMode) if (AutoMorpherDev.isDeveloperMode)
{ {
Debug.LogWarning((object)"[Body Mesh] Animator Bone is not enough"); Debug.LogWarning("[Body Mesh] Animator Bone is not enough");
} }
return null; return null;
} }
return GetBoneMatchedMesh(root, list); return this.GetBoneMatchedMesh(root, list);
} }
public SkinnedMeshRenderer GetHeadMesh(Transform root, Animator animator) public SkinnedMeshRenderer GetHeadMesh(Transform root, Animator animator)
{ {
List<Transform> list = HumanBodyBonesTrsnforms(headBones, animator); List<Transform> list = this.HumanBodyBonesTrsnforms(this.headBones, animator);
if (list.Count != headBones.Length) if (list.Count != this.headBones.Length)
{ {
return null; return null;
} }
return GetBoneMatchedMesh(root, list); return this.GetBoneMatchedMesh(root, list);
} }
private List<Transform> HumanBodyBonesTrsnforms(HumanBodyBones[] humanBonesList, Animator animator) private List<Transform> HumanBodyBonesTrsnforms(HumanBodyBones[] humanBonesList, Animator animator)
{ {
//IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references)
List<Transform> list = new List<Transform>(); List<Transform> list = new List<Transform>();
List<HumanBodyBones> list2 = new List<HumanBodyBones>(); List<HumanBodyBones> list2 = new List<HumanBodyBones>();
foreach (HumanBodyBones val in humanBonesList) foreach (HumanBodyBones val in humanBonesList)
{ {
Transform boneTransform = animator.GetBoneTransform(val); Transform boneTransform = animator.GetBoneTransform(val);
if ((Object)(object)boneTransform == (Object)null) if (boneTransform == null)
{ {
list2.Add(val); list2.Add(val);
} }
else else
{ {
list.Add(boneTransform); list.Add(boneTransform);
} }
} }
if (list2.Count > 0) if (list2.Count > 0)
{ {
string text = string.Join(", ", list2); string text = string.Join(", ", list2);
throw new AutoMorpherException("[Body Mesh Finding] Required Humanoid Bones are Missing", "[BodyMeshUtil] HumanBodyBonesTrsnforms\n - Missing Humanoid Bones: [" + text + "]\n - Animator Humanoid mapping may be broken\n - Please check whether the missing humanoid bones are correctly assigned in [Animator → Avatar → Configure]."); throw new AutoMorpherException("[Body Mesh Finding] Required Humanoid Bones are Missing", "[BodyMeshUtil] HumanBodyBonesTrsnforms\n - Missing Humanoid Bones: [" + text + "]\n - Animator Humanoid mapping may be broken\n - Please check whether the missing humanoid bones are correctly assigned in [Animator → Avatar → Configure].");
} }
return list; return list;
} }
private SkinnedMeshRenderer GetBoneMatchedMesh(Transform root, List<Transform> humanBoneTransforms) private SkinnedMeshRenderer GetBoneMatchedMesh(Transform root, List<Transform> humanBoneTransforms)
{ {
SkinnedMeshRenderer[] componentsInChildren = ((Component)root).GetComponentsInChildren<SkinnedMeshRenderer>(false); SkinnedMeshRenderer[] componentsInChildren = ((Component)root).GetComponentsInChildren<SkinnedMeshRenderer>(false);
foreach (SkinnedMeshRenderer val in componentsInChildren) foreach (SkinnedMeshRenderer val in componentsInChildren)
{ {
bool flag = true; bool flag = true;
HashSet<Transform> activeBones = GetActiveBones(val); HashSet<Transform> activeBones = this.GetActiveBones(val);
if (AutoMorpherDev.isDeveloperMode) if (AutoMorpherDev.isDeveloperMode)
{ {
Debug.Log((object)$"[Body Mesh] {((Object)((Component)val).gameObject).name} have bone Set {activeBones.Count}"); Debug.Log($"[Body Mesh] {val.gameObject.name} have bone Set {activeBones.Count}");
} }
foreach (Transform humanBoneTransform in humanBoneTransforms) foreach (Transform humanBoneTransform in humanBoneTransforms)
{ {
if (!activeBones.Contains(humanBoneTransform) && !BoneExistsByPosition(humanBoneTransform, activeBones)) if (!activeBones.Contains(humanBoneTransform) && !this.BoneExistsByPosition(humanBoneTransform, activeBones))
{ {
flag = false; flag = false;
if (AutoMorpherDev.isDeveloperMode) if (AutoMorpherDev.isDeveloperMode)
{ {
Debug.Log((object)("[Body Mesh] " + ((Object)((Component)val).gameObject).name + " Doesn't hav bone " + ((Object)humanBoneTransform).name)); Debug.Log(("[Body Mesh] " + val.gameObject.name + " Doesn't hav bone " + humanBoneTransform.name));
} }
break; break;
} }
} }
if (flag) if (flag)
{ {
return val; return val;
} }
} }
return null; return null;
} }
private bool BoneExistsByPosition(Transform boneToCheck, HashSet<Transform> smrBoneSet, float posTolerance = 0.0001f) private bool BoneExistsByPosition(Transform boneToCheck, HashSet<Transform> smrBoneSet, float posTolerance = 0.0001f)
{ {
//IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references)
foreach (Transform item in smrBoneSet) foreach (Transform item in smrBoneSet)
{ {
Vector3 val = item.position - boneToCheck.position; Vector3 val = item.position - boneToCheck.position;
if (((Vector3)(ref val)).sqrMagnitude <= posTolerance * posTolerance) if (val.sqrMagnitude <= posTolerance * posTolerance)
{ {
return true; return true;
} }
} }
return false; return false;
} }
public HashSet<Transform> GetActiveBones(SkinnedMeshRenderer smr, float weightThreshold = 0.0001f) public HashSet<Transform> GetActiveBones(SkinnedMeshRenderer smr, float weightThreshold = 0.0001f)
{ {
//IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references)
Mesh sharedMesh = smr.sharedMesh; Mesh sharedMesh = smr.sharedMesh;
if ((Object)(object)sharedMesh == (Object)null) if (sharedMesh == null)
{ {
Debug.LogWarning((object)"SkinnedMeshRenderer에 연결된 Mesh가 없습니다."); Debug.LogWarning("SkinnedMeshRenderer에 연결된 Mesh가 없습니다.");
return new HashSet<Transform>(); return new HashSet<Transform>();
} }
Transform[] bones = smr.bones; Transform[] bones = smr.bones;
BoneWeight[] boneWeights = sharedMesh.boneWeights; BoneWeight[] boneWeights = sharedMesh.boneWeights;
HashSet<int> hashSet = new HashSet<int>(); HashSet<int> hashSet = new HashSet<int>();
BoneWeight[] array = boneWeights; BoneWeight[] array = boneWeights;
for (int i = 0; i < array.Length; i++) for (int i = 0; i < array.Length; i++)
{ {
BoneWeight val = array[i]; BoneWeight val = array[i];
if (((BoneWeight)(ref val)).weight0 > weightThreshold) if (val.weight0 > weightThreshold)
{ {
hashSet.Add(((BoneWeight)(ref val)).boneIndex0); hashSet.Add(val.boneIndex0);
} }
if (((BoneWeight)(ref val)).weight1 > weightThreshold) if (val.weight1 > weightThreshold)
{ {
hashSet.Add(((BoneWeight)(ref val)).boneIndex1); hashSet.Add(val.boneIndex1);
} }
if (((BoneWeight)(ref val)).weight2 > weightThreshold) if (val.weight2 > weightThreshold)
{ {
hashSet.Add(((BoneWeight)(ref val)).boneIndex2); hashSet.Add(val.boneIndex2);
} }
if (((BoneWeight)(ref val)).weight3 > weightThreshold) if (val.weight3 > weightThreshold)
{ {
hashSet.Add(((BoneWeight)(ref val)).boneIndex3); hashSet.Add(val.boneIndex3);
} }
} }
HashSet<Transform> hashSet2 = new HashSet<Transform>(); HashSet<Transform> hashSet2 = new HashSet<Transform>();
foreach (int item in hashSet) foreach (int item in hashSet)
{ {
if (item >= 0 && item < bones.Length) if (item >= 0 && item < bones.Length)
{ {
hashSet2.Add(bones[item]); hashSet2.Add(bones[item]);
} }
} }
return hashSet2; return hashSet2;
} }
public Dictionary<HumanBodyBones, HashSet<Transform>> MeshHumanoidBoneMatcher(Animator animator, IReadOnlyList<SkinnedMeshRenderer> bodyMeshes, float posTolerance = 0.0001f, float weightThreshold = 0.0001f) public Dictionary<HumanBodyBones, HashSet<Transform>> MeshHumanoidBoneMatcher(Animator animator, IReadOnlyList<SkinnedMeshRenderer> bodyMeshes, float posTolerance = 0.0001f, float weightThreshold = 0.0001f)
{ {
//IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references)
Dictionary<HumanBodyBones, HashSet<Transform>> dictionary = new Dictionary<HumanBodyBones, HashSet<Transform>>(); Dictionary<HumanBodyBones, HashSet<Transform>> dictionary = new Dictionary<HumanBodyBones, HashSet<Transform>>();
if ((Object)(object)animator == (Object)null) if (animator == null)
{ {
throw new AutoMorpherException("Animator is Missing", "[MeshHumanoidBoneMatcher] MeshHumanoidBoneMatcher\n - animator is null"); throw new AutoMorpherException("Animator is Missing", "[MeshHumanoidBoneMatcher] MeshHumanoidBoneMatcher\n - animator is null");
} }
HashSet<Transform> hashSet = new HashSet<Transform>(); HashSet<Transform> hashSet = new HashSet<Transform>();
if (bodyMeshes != null) if (bodyMeshes != null)
{ {
foreach (SkinnedMeshRenderer bodyMesh in bodyMeshes) foreach (SkinnedMeshRenderer bodyMesh in bodyMeshes)
{ {
if ((Object)(object)bodyMesh == (Object)null) if (bodyMesh == null)
{ {
continue; continue;
} }
foreach (Transform activeBone in GetActiveBones(bodyMesh, weightThreshold)) foreach (Transform activeBone in this.GetActiveBones(bodyMesh, weightThreshold))
{ {
if ((Object)(object)activeBone != (Object)null) if (activeBone != null)
{ {
hashSet.Add(activeBone); hashSet.Add(activeBone);
} }
} }
} }
} }
for (int i = 0; i < 55; i++) for (int i = 0; i < 55; i++)
{ {
HumanBodyBones val = (HumanBodyBones)i; HumanBodyBones val = (HumanBodyBones)i;
Transform boneTransform = animator.GetBoneTransform(val); Transform boneTransform = animator.GetBoneTransform(val);
if ((Object)(object)boneTransform == (Object)null) if (boneTransform == null)
{ {
continue; continue;
} }
HashSet<Transform> hashSet2 = new HashSet<Transform>(); HashSet<Transform> hashSet2 = new HashSet<Transform>();
hashSet2.Add(boneTransform); hashSet2.Add(boneTransform);
foreach (Transform item in FindBonesByPosition(boneTransform, hashSet, posTolerance)) foreach (Transform item in this.FindBonesByPosition(boneTransform, hashSet, posTolerance))
{ {
hashSet2.Add(item); hashSet2.Add(item);
} }
dictionary[val] = hashSet2; dictionary[val] = hashSet2;
} }
return dictionary; return dictionary;
} }
private List<Transform> FindBonesByPosition(Transform boneToCheck, HashSet<Transform> smrBoneSet, float posTolerance = 0.0001f) private List<Transform> FindBonesByPosition(Transform boneToCheck, HashSet<Transform> smrBoneSet, float posTolerance = 0.0001f)
{ {
//IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001b: 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_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references)
List<Transform> list = new List<Transform>(); List<Transform> list = new List<Transform>();
if ((Object)(object)boneToCheck == (Object)null) if (boneToCheck == null)
{ {
return list; return list;
} }
float num = posTolerance * posTolerance; float num = posTolerance * posTolerance;
Vector3 position = boneToCheck.position; Vector3 position = boneToCheck.position;
foreach (Transform item in smrBoneSet) foreach (Transform item in smrBoneSet)
{ {
if (!((Object)(object)item == (Object)null) && !((Object)(object)item == (Object)(object)boneToCheck) && NameMatches(((Object)((Component)item).gameObject).name, ((Object)((Component)boneToCheck).gameObject).name)) if (!(item == null) && !(item == boneToCheck) && this.NameMatches((((Component)item).gameObject).name, (((Component)boneToCheck).gameObject).name))
{ {
Vector3 val = item.position - position; Vector3 val = item.position - position;
if (((Vector3)(ref val)).sqrMagnitude <= num) if (val.sqrMagnitude <= num)
{ {
list.Add(item); list.Add(item);
} }
} }
} }
return list; return list;
} }
private string[] TokenizeBoneName(string name) private string[] TokenizeBoneName(string name)
{ {
if (string.IsNullOrWhiteSpace(name)) if (string.IsNullOrWhiteSpace(name))
{ {
return Array.Empty<string>(); return Array.Empty<string>();
} }
char[] separator = new char[5] { '-', '_', ':', '.', '|' }; char[] separator = new char[5] { '-', '_', ':', '.', '|' };
name = name.Trim(); name = name.Trim();
return name.Split(separator, StringSplitOptions.RemoveEmptyEntries); return name.Split(separator, StringSplitOptions.RemoveEmptyEntries);
} }
private bool NameMatches(string boneToCheckName, string candidateName) private bool NameMatches(string boneToCheckName, string candidateName)
{ {
string[] array = TokenizeBoneName(boneToCheckName); string[] array = this.TokenizeBoneName(boneToCheckName);
string[] array2 = TokenizeBoneName(candidateName); string[] array2 = this.TokenizeBoneName(candidateName);
if (array.Length == 0 || array2.Length == 0) if (array.Length == 0 || array2.Length == 0)
{ {
return false; return false;
} }
if (!array[0].Equals(array2[0], StringComparison.OrdinalIgnoreCase)) if (!array[0].Equals(array2[0], StringComparison.OrdinalIgnoreCase))
{ {
return false; return false;
} }
if (array.Length > 1 && array2.Length > 1 && !array[1].Equals(array2[1], StringComparison.OrdinalIgnoreCase)) if (array.Length > 1 && array2.Length > 1 && !array[1].Equals(array2[1], StringComparison.OrdinalIgnoreCase))
{ {
return false; return false;
} }
return true; return true;
} }
public MeshClassifier() public MeshClassifier()
{ {
HumanBodyBones[] array = new HumanBodyBones[28]; this.bodyBones = new HumanBodyBones[28]
RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); {
bodyBones = (HumanBodyBones[])(object)array; HumanBodyBones.Hips,
HumanBodyBones[] array2 = new HumanBodyBones[3]; HumanBodyBones.Spine,
RuntimeHelpers.InitializeArray(array2, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); HumanBodyBones.Chest,
headBones = (HumanBodyBones[])(object)array2; HumanBodyBones.Neck,
base._002Ector(); HumanBodyBones.LeftShoulder,
} HumanBodyBones.LeftUpperArm,
HumanBodyBones.LeftLowerArm,
HumanBodyBones.LeftHand,
HumanBodyBones.LeftThumbProximal,
HumanBodyBones.LeftIndexProximal,
HumanBodyBones.LeftMiddleProximal,
HumanBodyBones.LeftRingProximal,
HumanBodyBones.LeftLittleProximal,
HumanBodyBones.RightShoulder,
HumanBodyBones.RightUpperArm,
HumanBodyBones.RightLowerArm,
HumanBodyBones.RightHand,
HumanBodyBones.RightThumbProximal,
HumanBodyBones.RightIndexProximal,
HumanBodyBones.RightMiddleProximal,
HumanBodyBones.RightRingProximal,
HumanBodyBones.RightLittleProximal,
HumanBodyBones.LeftUpperLeg,
HumanBodyBones.LeftLowerLeg,
HumanBodyBones.LeftFoot,
HumanBodyBones.RightUpperLeg,
HumanBodyBones.RightLowerLeg,
HumanBodyBones.RightFoot
};
this.headBones = new HumanBodyBones[3]
{
HumanBodyBones.Head,
HumanBodyBones.LeftEye,
HumanBodyBones.RightEye
};
}
} }

View File

@@ -1,351 +1,351 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // 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. // 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 // EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.MeshMatcher // Eden.AutoMorpher.MeshMatcher
using System.Collections.Generic;
using Eden.AutoMorpher; using Eden.AutoMorpher;
using System.Collections.Generic;
using UnityEngine; using UnityEngine;
public class MeshMatcher public class MeshMatcher
{ {
public struct ClosestHit public struct ClosestHit
{ {
public Vector3 closestP; public Vector3 closestP;
public Vector3 direction; public Vector3 direction;
public Vector3 moveVector; public Vector3 moveVector;
public float distance; public float distance;
} }
public BvhTriangleMesh bodyBVH; public BvhTriangleMesh bodyBVH;
private readonly HashSet<HumanBodyBones> LeftLegBones = new HashSet<HumanBodyBones> private readonly HashSet<HumanBodyBones> LeftLegBones = new HashSet<HumanBodyBones>
{ {
(HumanBodyBones)1, (HumanBodyBones)1,
(HumanBodyBones)3, (HumanBodyBones)3,
(HumanBodyBones)5, (HumanBodyBones)5,
(HumanBodyBones)19 (HumanBodyBones)19
}; };
private readonly HashSet<HumanBodyBones> RightLegBones = new HashSet<HumanBodyBones> private readonly HashSet<HumanBodyBones> RightLegBones = new HashSet<HumanBodyBones>
{ {
(HumanBodyBones)2, (HumanBodyBones)2,
(HumanBodyBones)4, (HumanBodyBones)4,
(HumanBodyBones)6, (HumanBodyBones)6,
(HumanBodyBones)20 (HumanBodyBones)20
}; };
public BvhTriangleMesh BuildBvhMulti(IReadOnlyList<SkinnedMeshRenderer> bodies, Animator bodyAnimator) public BvhTriangleMesh BuildBvhMulti(IReadOnlyList<SkinnedMeshRenderer> bodies, Animator bodyAnimator)
{ {
if (bodies == null || bodies.Count == 0) if (bodies == null || bodies.Count == 0)
{ {
throw new AutoMorpherException("Body Meshes are Missing", "[BuildBvhMulti] BuildBvhMulti\n - bodies is null or empty"); throw new AutoMorpherException("Body Meshes are Missing", "[BuildBvhMulti] BuildBvhMulti\n - bodies is null or empty");
} }
BvhTriangleMesh bvhTriangleMesh = new BvhTriangleMesh().BuildFromSkinnedMeshes(bodies, bodyAnimator); BvhTriangleMesh bvhTriangleMesh = new BvhTriangleMesh().BuildFromSkinnedMeshes(bodies, bodyAnimator);
if (bvhTriangleMesh == null || bvhTriangleMesh.triangles == null) if (bvhTriangleMesh == null || bvhTriangleMesh.triangles == null)
{ {
Debug.LogError((object)"Failed to build multi-body BVH (no triangles)."); Debug.LogError((object)"Failed to build multi-body BVH (no triangles).");
throw new AutoMorpherException(LanguageManager.Get("UI.Exception.title.BodyBVHFail"), LanguageManager.GetFormat("UI.Exception.message.BodyBVHFail", new object[3] throw new AutoMorpherException(LanguageManager.Get("UI.Exception.title.BodyBVHFail"), LanguageManager.GetFormat("UI.Exception.message.BodyBVHFail", new object[3]
{ {
((Object)((Component)bodyAnimator).gameObject).name, ((Object)((Component)bodyAnimator).gameObject).name,
bvhTriangleMesh == null, bvhTriangleMesh == null,
bvhTriangleMesh.triangles == null bvhTriangleMesh.triangles == null
})); }));
} }
return bvhTriangleMesh; return bvhTriangleMesh;
} }
public Vector3[] ExpandVertexMatch(ClothInstance clothInstance, float defaultMinDist = 0.005f, bool skipFootFitting = false, float maxMatchDistance = 0.1f) public Vector3[] ExpandVertexMatch(ClothInstance clothInstance, float defaultMinDist = 0.005f, bool skipFootFitting = false, float maxMatchDistance = 0.1f)
{ {
//IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0092: 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_00aa: 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_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references)
//IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: Invalid comparison between Unknown and I4 //IL_0131: Invalid comparison between Unknown and I4
//IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references)
//IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references)
//IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references)
//IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references)
//IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references)
//IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references)
//IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references)
//IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: 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_0172: Unknown result type (might be due to invalid IL or missing references)
//IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references)
//IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references)
//IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references)
//IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references)
//IL_013b: Invalid comparison between Unknown and I4 //IL_013b: Invalid comparison between Unknown and I4
//IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references)
//IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references)
//IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references)
//IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references)
//IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references)
//IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references)
//IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: 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_013f: Unknown result type (might be due to invalid IL or missing references)
//IL_0146: Invalid comparison between Unknown and I4 //IL_0146: Invalid comparison between Unknown and I4
//IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references)
//IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references)
//IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references)
//IL_0151: Invalid comparison between Unknown and I4 //IL_0151: Invalid comparison between Unknown and I4
//IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references)
//IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_020b: 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_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_0214: Unknown result type (might be due to invalid IL or missing references)
//IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references)
//IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references)
//IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references)
Vector3[] worldVertices = clothInstance.worldVertices; Vector3[] worldVertices = clothInstance.worldVertices;
float[] minDistance = clothInstance.minDistance; float[] minDistance = clothInstance.minDistance;
if (bodyBVH == null) if (this.bodyBVH == null)
{ {
throw new AutoMorpherException("Body BVH is Missing", "[ExpandVertexMatch] ExpandVertexMatch\n - bodyBVH is null"); throw new AutoMorpherException("Body BVH is Missing", "[ExpandVertexMatch] ExpandVertexMatch\n - bodyBVH is null");
} }
if (worldVertices == null) if (worldVertices == null)
{ {
throw new AutoMorpherException("Cloth World Vertices are Missing", "[ExpandVertexMatch] ExpandVertexMatch\n - clothInstance.worldVertices is null"); throw new AutoMorpherException("Cloth World Vertices are Missing", "[ExpandVertexMatch] ExpandVertexMatch\n - clothInstance.worldVertices is null");
} }
if (worldVertices.Length == 0) if (worldVertices.Length == 0)
{ {
Debug.LogWarning((object)"clothes mesh has no vertices"); Debug.LogWarning((object)"clothes mesh has no vertices");
return null; return null;
} }
if (minDistance == null) if (minDistance == null)
{ {
Debug.LogWarning((object)"minDists is null"); Debug.LogWarning((object)"minDists is null");
} }
if (minDistance.Length != worldVertices.Length) if (minDistance.Length != worldVertices.Length)
{ {
Debug.LogWarning((object)"minDists.Length != worldVertexs.Length"); Debug.LogWarning((object)"minDists.Length != worldVertexs.Length");
} }
Vector3[] array = (Vector3[])(object)new Vector3[worldVertices.Length]; Vector3[] array = (Vector3[])(object)new Vector3[worldVertices.Length];
float num = maxMatchDistance * maxMatchDistance; float num = maxMatchDistance * maxMatchDistance;
for (int i = 0; i < worldVertices.Length; i++) for (int i = 0; i < worldVertices.Length; i++)
{ {
if (clothInstance.excludedVertices[i]) if (clothInstance.excludedVertices[i])
{ {
array[i] = Vector3.zero; array[i] = Vector3.zero;
continue; continue;
} }
if (clothInstance.isInsideVertex[i]) if (clothInstance.isInsideVertex[i])
{ {
array[i] = Vector3.zero; array[i] = Vector3.zero;
continue; continue;
} }
float num2 = minDistance[i] + defaultMinDist; float num2 = minDistance[i] + defaultMinDist;
BvhTriangleMesh.ClosestHit closestHit = (clothInstance.isLeftLegVertex[i] ? bodyBVH.QueryClosest(worldVertices[i], LeftLegBones) : ((!clothInstance.isRightLegVertex[i]) ? bodyBVH.QueryClosest(worldVertices[i]) : bodyBVH.QueryClosest(worldVertices[i], RightLegBones))); BvhTriangleMesh.ClosestHit closestHit = (clothInstance.isLeftLegVertex[i] ? this.bodyBVH.QueryClosest(worldVertices[i], this.LeftLegBones) : ((!clothInstance.isRightLegVertex[i]) ? this.bodyBVH.QueryClosest(worldVertices[i]) : this.bodyBVH.QueryClosest(worldVertices[i], this.RightLegBones)));
if (skipFootFitting && ((int)closestHit.mainHumanBone == 5 || (int)closestHit.mainHumanBone == 6 || (int)closestHit.mainHumanBone == 20 || (int)closestHit.mainHumanBone == 19)) if (skipFootFitting && ((int)closestHit.mainHumanBone == 5 || (int)closestHit.mainHumanBone == 6 || (int)closestHit.mainHumanBone == 20 || (int)closestHit.mainHumanBone == 19))
{ {
array[i] = Vector3.zero; array[i] = Vector3.zero;
continue; continue;
} }
if (closestHit.sqrDistance > num) if (closestHit.sqrDistance > num)
{ {
array[i] = Vector3.zero; array[i] = Vector3.zero;
continue; continue;
} }
Vector3 val = closestHit.closestPoint - worldVertices[i]; Vector3 val = closestHit.closestPoint - worldVertices[i];
Vector3 normalized = ((Vector3)(ref val)).normalized; Vector3 normalized = val.normalized;
float num3 = Vector3.Dot(normalized, ((Vector3)(ref closestHit.normal)).normalized); float num3 = Vector3.Dot(normalized, closestHit.normal.normalized);
if (num3 > 0.7f) if (num3 > 0.7f)
{ {
array[i] = closestHit.closestPoint + normalized * num2 - worldVertices[i]; array[i] = closestHit.closestPoint + normalized * num2 - worldVertices[i];
} }
else if (num3 < -0.7f) else if (num3 < -0.7f)
{ {
if (closestHit.sqrDistance < num2 * num2) if (closestHit.sqrDistance < num2 * num2)
{ {
array[i] = closestHit.closestPoint - normalized * num2 - worldVertices[i]; array[i] = closestHit.closestPoint - normalized * num2 - worldVertices[i];
} }
} }
else else
{ {
array[i] = Vector3.zero; array[i] = Vector3.zero;
} }
} }
return array; return array;
} }
public Vector3[] ShrinkVertexMatch(ClothInstance clothInstance, float defaultMinDist = 0.005f, float maxMatchDistance = 0.1f) public Vector3[] ShrinkVertexMatch(ClothInstance clothInstance, float defaultMinDist = 0.005f, float maxMatchDistance = 0.1f)
{ {
//IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references)
//IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references)
//IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references)
//IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references)
//IL_0156: Invalid comparison between Unknown and I4 //IL_0156: Invalid comparison between Unknown and I4
//IL_013f: 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_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references)
//IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references)
//IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references)
//IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references)
//IL_0160: Invalid comparison between Unknown and I4 //IL_0160: Invalid comparison between Unknown and I4
//IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references)
//IL_016b: Invalid comparison between Unknown and I4 //IL_016b: Invalid comparison between Unknown and I4
//IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references)
//IL_0176: Invalid comparison between Unknown and I4 //IL_0176: Invalid comparison between Unknown and I4
//IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references)
//IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references)
//IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references)
//IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references)
//IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references)
//IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references)
//IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references)
//IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references)
//IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references)
//IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references)
//IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: 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_01da: Unknown result type (might be due to invalid IL or missing references)
//IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references)
//IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references)
//IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references)
//IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references)
//IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_023e: 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_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_0214: Unknown result type (might be due to invalid IL or missing references)
//IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references)
//IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references)
//IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references)
//IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references)
//IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references)
Vector3[] worldVertices = clothInstance.worldVertices; Vector3[] worldVertices = clothInstance.worldVertices;
float[] minDistance = clothInstance.minDistance; float[] minDistance = clothInstance.minDistance;
if (bodyBVH == null) if (this.bodyBVH == null)
{ {
throw new AutoMorpherException("Body BVH is Missing", "[ShrinkVertexMatch] ShrinkVertexMatch\n - bodyBVH is null"); throw new AutoMorpherException("Body BVH is Missing", "[ShrinkVertexMatch] ShrinkVertexMatch\n - bodyBVH is null");
} }
if (worldVertices == null) if (worldVertices == null)
{ {
throw new AutoMorpherException("Cloth World Vertices are Missing", "[ShrinkVertexMatch] ShrinkVertexMatch\n - clothInstance.worldVertices is null"); throw new AutoMorpherException("Cloth World Vertices are Missing", "[ShrinkVertexMatch] ShrinkVertexMatch\n - clothInstance.worldVertices is null");
} }
if (worldVertices.Length == 0) if (worldVertices.Length == 0)
{ {
Debug.LogWarning((object)"clothes mesh has no vertices"); Debug.LogWarning((object)"clothes mesh has no vertices");
return null; return null;
} }
if (minDistance == null) if (minDistance == null)
{ {
Debug.LogWarning((object)"minDists is null"); Debug.LogWarning((object)"minDists is null");
} }
if (minDistance.Length != worldVertices.Length) if (minDistance.Length != worldVertices.Length)
{ {
Debug.LogWarning((object)"minDists.Length != worldVertexs.Length"); Debug.LogWarning((object)"minDists.Length != worldVertexs.Length");
} }
Vector3[] array = (Vector3[])(object)new Vector3[worldVertices.Length]; Vector3[] array = (Vector3[])(object)new Vector3[worldVertices.Length];
float num = maxMatchDistance * maxMatchDistance; float num = maxMatchDistance * maxMatchDistance;
_ = clothInstance.isLeftLegVertex; _ = clothInstance.isLeftLegVertex;
_ = clothInstance.isRightLegVertex; _ = clothInstance.isRightLegVertex;
for (int i = 0; i < worldVertices.Length; i++) for (int i = 0; i < worldVertices.Length; i++)
{ {
if (clothInstance.excludedVertices[i]) if (clothInstance.excludedVertices[i])
{ {
array[i] = Vector3.zero; array[i] = Vector3.zero;
continue; continue;
} }
if (clothInstance.isInsideVertex[i]) if (clothInstance.isInsideVertex[i])
{ {
array[i] = Vector3.zero; array[i] = Vector3.zero;
continue; continue;
} }
float num2 = minDistance[i] + defaultMinDist; float num2 = minDistance[i] + defaultMinDist;
BvhTriangleMesh.ClosestHit closestHit = (clothInstance.isLeftLegVertex[i] ? bodyBVH.QueryClosest(worldVertices[i], LeftLegBones) : ((!clothInstance.isRightLegVertex[i]) ? bodyBVH.QueryClosest(worldVertices[i]) : bodyBVH.QueryClosest(worldVertices[i], RightLegBones))); BvhTriangleMesh.ClosestHit closestHit = (clothInstance.isLeftLegVertex[i] ? this.bodyBVH.QueryClosest(worldVertices[i], this.LeftLegBones) : ((!clothInstance.isRightLegVertex[i]) ? this.bodyBVH.QueryClosest(worldVertices[i]) : this.bodyBVH.QueryClosest(worldVertices[i], this.RightLegBones)));
if (closestHit.sqrDistance > num) if (closestHit.sqrDistance > num)
{ {
array[i] = Vector3.zero; array[i] = Vector3.zero;
continue; continue;
} }
if ((int)closestHit.mainHumanBone == 5 || (int)closestHit.mainHumanBone == 6 || (int)closestHit.mainHumanBone == 20 || (int)closestHit.mainHumanBone == 19) if ((int)closestHit.mainHumanBone == 5 || (int)closestHit.mainHumanBone == 6 || (int)closestHit.mainHumanBone == 20 || (int)closestHit.mainHumanBone == 19)
{ {
array[i] = Vector3.zero; array[i] = Vector3.zero;
continue; continue;
} }
Vector3 val = closestHit.closestPoint - worldVertices[i]; Vector3 val = closestHit.closestPoint - worldVertices[i];
Vector3 normalized = ((Vector3)(ref val)).normalized; Vector3 normalized = val.normalized;
float num3 = Vector3.Dot(normalized, ((Vector3)(ref closestHit.normal)).normalized); float num3 = Vector3.Dot(normalized, closestHit.normal.normalized);
if (num3 < -0.7f) if (num3 < -0.7f)
{ {
array[i] = closestHit.closestPoint - normalized * num2 - worldVertices[i]; array[i] = closestHit.closestPoint - normalized * num2 - worldVertices[i];
} }
else if (num3 < -0.7f) else if (num3 < -0.7f)
{ {
if (closestHit.sqrDistance < num2 * num2) if (closestHit.sqrDistance < num2 * num2)
{ {
array[i] = closestHit.closestPoint + normalized * num2 - worldVertices[i]; array[i] = closestHit.closestPoint + normalized * num2 - worldVertices[i];
} }
} }
else else
{ {
array[i] = Vector3.zero; array[i] = Vector3.zero;
} }
} }
return array; return array;
} }
public Vector3[] GetMinDistanceToBody(Vector3[] clothesVertices) public Vector3[] GetMinDistanceToBody(Vector3[] clothesVertices)
{ {
//IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0056: 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_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references)
if (bodyBVH == null) if (this.bodyBVH == null)
{ {
throw new AutoMorpherException("sourceBodyBVH is null", "[MeshMatcher] GetMinDistanceToBodysourceBodyBVH is null"); throw new AutoMorpherException("sourceBodyBVH is null", "[MeshMatcher] GetMinDistanceToBodysourceBodyBVH is null");
} }
if (clothesVertices == null || clothesVertices.Length == 0) if (clothesVertices == null || clothesVertices.Length == 0)
{ {
throw new AutoMorpherException("Source Vertices is null", "[MeshMatcher] GetMinDistanceToBodySource Vertices is null or no vertices"); throw new AutoMorpherException("Source Vertices is null", "[MeshMatcher] GetMinDistanceToBodySource Vertices is null or no vertices");
} }
Vector3[] array = (Vector3[])(object)new Vector3[clothesVertices.Length]; Vector3[] array = (Vector3[])(object)new Vector3[clothesVertices.Length];
for (int i = 0; i < clothesVertices.Length; i++) for (int i = 0; i < clothesVertices.Length; i++)
{ {
Vector3 val = clothesVertices[i]; Vector3 val = clothesVertices[i];
Vector3 val2 = bodyBVH.QueryClosest(val).closestPoint - val; Vector3 val2 = this.bodyBVH.QueryClosest(val).closestPoint - val;
array[i] = val2; array[i] = val2;
} }
return array; return array;
} }
public bool[] GetBodyInsideFlags(Vector3[] worldVertices) public bool[] GetBodyInsideFlags(Vector3[] worldVertices)
{ {
//IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references)
if (bodyBVH == null) if (this.bodyBVH == null)
{ {
throw new AutoMorpherException("sourceBodyBVH is null", "[MeshMatcher] GetBodyInsideFlagssourceBodyBVH is null"); throw new AutoMorpherException("sourceBodyBVH is null", "[MeshMatcher] GetBodyInsideFlagssourceBodyBVH is null");
} }
if (worldVertices == null || worldVertices.Length == 0) if (worldVertices == null || worldVertices.Length == 0)
{ {
Debug.LogError((object)"clothes is null"); Debug.LogError((object)"clothes is null");
throw new AutoMorpherException("Source Vertices is null", "[MeshMatcher] GetMinDistanceToBodySource Vertices is null or no vertices"); throw new AutoMorpherException("Source Vertices is null", "[MeshMatcher] GetMinDistanceToBodySource Vertices is null or no vertices");
} }
bool[] array = new bool[worldVertices.Length]; bool[] array = new bool[worldVertices.Length];
for (int i = 0; i < worldVertices.Length; i++) for (int i = 0; i < worldVertices.Length; i++)
{ {
BvhTriangleMesh.ClosestHit closestHit = bodyBVH.QueryClosest(worldVertices[i]); BvhTriangleMesh.ClosestHit closestHit = this.bodyBVH.QueryClosest(worldVertices[i]);
Vector3 val = closestHit.closestPoint - worldVertices[i]; Vector3 val = closestHit.closestPoint - worldVertices[i];
float num = Vector3.Dot(((Vector3)(ref val)).normalized, ((Vector3)(ref closestHit.normal)).normalized); float num = Vector3.Dot(val.normalized, closestHit.normal.normalized);
array[i] = num > 0f; array[i] = num > 0f;
} }
return array; return array;
} }
} }

View File

@@ -1,11 +1,11 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // 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. // 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 // EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.MorpherMode // Eden.AutoMorpher.MorpherMode
public enum MorpherMode public enum MorpherMode
{ {
AutoMorpher = 0, AutoMorpher = 0,
ManualMorpher = 1, ManualMorpher = 1,
ProfileMorpher = 2, ProfileMorpher = 2,
ETC = 99 ETC = 99
} }

View File

@@ -1,12 +1,12 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // 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. // 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 // EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.MorpherState // Eden.AutoMorpher.MorpherState
public enum MorpherState public enum MorpherState
{ {
Idle, Idle,
Fitting_Doing, Fitting_Doing,
Fitting_End, Fitting_End,
Weighting_Doing, Weighting_Doing,
Weighting_End Weighting_End
} }

View File

@@ -1,213 +1,212 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // 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. // 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 // EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.PcaUtil // Eden.AutoMorpher.PcaUtil
using System.Collections.Generic; using System.Collections.Generic;
using Eden.AutoMorpher;
using UnityEngine; using UnityEngine;
public class PcaUtil public class PcaUtil
{ {
public RegionStats ComputeRegionStats(IList<Vector3> points) public RegionStats ComputeRegionStats(IList<Vector3> points)
{ {
//IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_007e: 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_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: 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_00ef: 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_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references)
//IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references)
//IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references)
//IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references)
//IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references)
//IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references)
//IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references)
//IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references)
//IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references)
//IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references)
//IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references)
//IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references)
//IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references)
//IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references)
//IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references)
//IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references)
//IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references)
//IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references)
//IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references)
RegionStats result = default(RegionStats); RegionStats result = default(RegionStats);
if (points == null || points.Count == 0) if (points == null || points.Count == 0)
{ {
return result; return result;
} }
int count = points.Count; int count = points.Count;
Vector3 val = Vector3.zero; Vector3 val = Vector3.zero;
for (int i = 0; i < count; i++) for (int i = 0; i < count; i++)
{ {
val += points[i]; val += points[i];
} }
val /= (float)count; val /= (float)count;
float num = 0f; float num = 0f;
float num2 = 0f; float num2 = 0f;
float num3 = 0f; float num3 = 0f;
float num4 = 0f; float num4 = 0f;
float num5 = 0f; float num5 = 0f;
float num6 = 0f; float num6 = 0f;
for (int j = 0; j < count; j++) for (int j = 0; j < count; j++)
{ {
Vector3 val2 = points[j] - val; Vector3 val2 = points[j] - val;
num += val2.x * val2.x; num += val2.x * val2.x;
num2 += val2.x * val2.y; num2 += val2.x * val2.y;
num3 += val2.x * val2.z; num3 += val2.x * val2.z;
num4 += val2.y * val2.y; num4 += val2.y * val2.y;
num5 += val2.y * val2.z; num5 += val2.y * val2.z;
num6 += val2.z * val2.z; num6 += val2.z * val2.z;
} }
float num7 = 1f / (float)count; float num7 = 1f / (float)count;
num *= num7; num *= num7;
num2 *= num7; num2 *= num7;
num3 *= num7; num3 *= num7;
num4 *= num7; num4 *= num7;
num5 *= num7; num5 *= num7;
num6 *= num7; num6 *= num7;
JacobiEigenDecomposition3x3(num, num2, num3, num4, num5, num6, out var eigenValues, out var eigenVectors); this.JacobiEigenDecomposition3x3(num, num2, num3, num4, num5, num6, out var eigenValues, out var eigenVectors);
int num8 = 0; int num8 = 0;
if (eigenValues[1] > eigenValues[num8]) if (eigenValues[1] > eigenValues[num8])
{ {
num8 = 1; num8 = 1;
} }
if (eigenValues[2] > eigenValues[num8]) if (eigenValues[2] > eigenValues[num8])
{ {
num8 = 2; num8 = 2;
} }
Vector3 normalized = ((Vector3)(ref eigenVectors[num8])).normalized; Vector3 normalized = eigenVectors[num8].normalized;
float num9 = float.PositiveInfinity; float num9 = float.PositiveInfinity;
float num10 = float.NegativeInfinity; float num10 = float.NegativeInfinity;
float num11 = 0f; float num11 = 0f;
for (int k = 0; k < count; k++) for (int k = 0; k < count; k++)
{ {
float num12 = Vector3.Dot(points[k] - val, normalized); float num12 = Vector3.Dot(points[k] - val, normalized);
if (num12 < num9) if (num12 < num9)
{ {
num9 = num12; num9 = num12;
} }
if (num12 > num10) if (num12 > num10)
{ {
num10 = num12; num10 = num12;
} }
Vector3 val3 = val + normalized * num12; Vector3 val3 = val + normalized * num12;
Vector3 val4 = points[k] - val3; Vector3 val4 = points[k] - val3;
float magnitude = ((Vector3)(ref val4)).magnitude; float magnitude = val4.magnitude;
num11 += magnitude; num11 += magnitude;
} }
result.center = val; result.center = val;
result.principalAxis = normalized; result.principalAxis = normalized;
result.length = num10 - num9; result.length = num10 - num9;
result.avgRadius = num11 / (float)count; result.avgRadius = num11 / (float)count;
return result; return result;
} }
private void JacobiEigenDecomposition3x3(float c00, float c01, float c02, float c11, float c12, float c22, out float[] eigenValues, out Vector3[] eigenVectors) private void JacobiEigenDecomposition3x3(float c00, float c01, float c02, float c11, float c12, float c22, out float[] eigenValues, out Vector3[] eigenVectors)
{ {
//IL_032d: Unknown result type (might be due to invalid IL or missing references) //IL_032d: Unknown result type (might be due to invalid IL or missing references)
//IL_0332: Unknown result type (might be due to invalid IL or missing references) //IL_0332: Unknown result type (might be due to invalid IL or missing references)
//IL_0353: Unknown result type (might be due to invalid IL or missing references) //IL_0353: Unknown result type (might be due to invalid IL or missing references)
//IL_0358: Unknown result type (might be due to invalid IL or missing references) //IL_0358: Unknown result type (might be due to invalid IL or missing references)
//IL_0379: Unknown result type (might be due to invalid IL or missing references) //IL_0379: 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_037e: Unknown result type (might be due to invalid IL or missing references)
float[,] array = new float[3, 3] float[,] array = new float[3, 3]
{ {
{ c00, c01, c02 }, { c00, c01, c02 },
{ c01, c11, c12 }, { c01, c11, c12 },
{ c02, c12, c22 } { c02, c12, c22 }
}; };
float[,] array2 = new float[3, 3] float[,] array2 = new float[3, 3]
{ {
{ 1f, 0f, 0f }, { 1f, 0f, 0f },
{ 0f, 1f, 0f }, { 0f, 1f, 0f },
{ 0f, 0f, 1f } { 0f, 0f, 1f }
}; };
for (int i = 0; i < 32; i++) for (int i = 0; i < 32; i++)
{ {
int num = 0; int num = 0;
int num2 = 1; int num2 = 1;
float num3 = Mathf.Abs(array[0, 1]); float num3 = Mathf.Abs(array[0, 1]);
float num4 = Mathf.Abs(array[0, 2]); float num4 = Mathf.Abs(array[0, 2]);
if (num4 > num3) if (num4 > num3)
{ {
num3 = num4; num3 = num4;
num = 0; num = 0;
num2 = 2; num2 = 2;
} }
float num5 = Mathf.Abs(array[1, 2]); float num5 = Mathf.Abs(array[1, 2]);
if (num5 > num3) if (num5 > num3)
{ {
num3 = num5; num3 = num5;
num = 1; num = 1;
num2 = 2; num2 = 2;
} }
if (num3 < 1E-10f) if (num3 < 1E-10f)
{ {
break; break;
} }
float num6 = array[num, num]; float num6 = array[num, num];
float num7 = array[num2, num2]; float num7 = array[num2, num2];
float num8 = array[num, num2]; float num8 = array[num, num2];
float num9 = 0.5f * Mathf.Atan2(2f * num8, num7 - num6); float num9 = 0.5f * Mathf.Atan2(2f * num8, num7 - num6);
float num10 = Mathf.Cos(num9); float num10 = Mathf.Cos(num9);
float num11 = Mathf.Sin(num9); float num11 = Mathf.Sin(num9);
for (int j = 0; j < 3; j++) for (int j = 0; j < 3; j++)
{ {
if (j != num && j != num2) if (j != num && j != num2)
{ {
float num12 = array[j, num]; float num12 = array[j, num];
float num13 = array[j, num2]; float num13 = array[j, num2];
array[j, num] = num10 * num12 - num11 * num13; array[j, num] = num10 * num12 - num11 * num13;
array[num, j] = array[j, num]; array[num, j] = array[j, num];
array[j, num2] = num11 * num12 + num10 * num13; array[j, num2] = num11 * num12 + num10 * num13;
array[num2, j] = array[j, num2]; array[num2, j] = array[j, num2];
} }
} }
float num14 = num10 * num10 * num6 - 2f * num11 * num10 * num8 + num11 * num11 * num7; float num14 = num10 * num10 * num6 - 2f * num11 * num10 * num8 + num11 * num11 * num7;
float num15 = num11 * num11 * num6 + 2f * num11 * num10 * num8 + num10 * num10 * num7; float num15 = num11 * num11 * num6 + 2f * num11 * num10 * num8 + num10 * num10 * num7;
array[num, num] = num14; array[num, num] = num14;
array[num2, num2] = num15; array[num2, num2] = num15;
array[num, num2] = 0f; array[num, num2] = 0f;
array[num2, num] = 0f; array[num2, num] = 0f;
for (int k = 0; k < 3; k++) for (int k = 0; k < 3; k++)
{ {
float num16 = array2[k, num]; float num16 = array2[k, num];
float num17 = array2[k, num2]; float num17 = array2[k, num2];
array2[k, num] = num10 * num16 - num11 * num17; array2[k, num] = num10 * num16 - num11 * num17;
array2[k, num2] = num11 * num16 + num10 * num17; array2[k, num2] = num11 * num16 + num10 * num17;
} }
} }
eigenValues = new float[3]; eigenValues = new float[3];
eigenVectors = (Vector3[])(object)new Vector3[3]; eigenVectors = (Vector3[])(object)new Vector3[3];
eigenValues[0] = array[0, 0]; eigenValues[0] = array[0, 0];
eigenValues[1] = array[1, 1]; eigenValues[1] = array[1, 1];
eigenValues[2] = array[2, 2]; eigenValues[2] = array[2, 2];
eigenVectors[0] = new Vector3(array2[0, 0], array2[1, 0], array2[2, 0]); eigenVectors[0] = new Vector3(array2[0, 0], array2[1, 0], array2[2, 0]);
eigenVectors[1] = new Vector3(array2[0, 1], array2[1, 1], array2[2, 1]); eigenVectors[1] = new Vector3(array2[0, 1], array2[1, 1], array2[2, 1]);
eigenVectors[2] = new Vector3(array2[0, 2], array2[1, 2], array2[2, 2]); eigenVectors[2] = new Vector3(array2[0, 2], array2[1, 2], array2[2, 2]);
} }
} }

View File

@@ -1,12 +1,12 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // 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. // 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 // EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.ProcessInfo // Eden.AutoMorpher.ProcessInfo
public struct ProcessInfo public struct ProcessInfo
{ {
public string title; public string title;
public string text; public string text;
public float progress; public float progress;
} }

View File

@@ -1,4 +1,4 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // 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. // 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 // EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.RegionStats // Eden.AutoMorpher.RegionStats
@@ -6,11 +6,11 @@ using UnityEngine;
public struct RegionStats public struct RegionStats
{ {
public Vector3 center; public Vector3 center;
public Vector3 principalAxis; public Vector3 principalAxis;
public float length; public float length;
public float avgRadius; public float avgRadius;
} }

View File

@@ -1,4 +1,4 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // 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. // 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 // EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.SkinningUtil // Eden.AutoMorpher.SkinningUtil
@@ -6,459 +6,458 @@ using UnityEngine;
public class SkinningUtil public class SkinningUtil
{ {
public Vector3 WorldPosToBindPos(SkinnedMeshRenderer smr, Mesh bindMesh, int vertexIndex, Vector3 targetWorld) public Vector3 WorldPosToBindPos(SkinnedMeshRenderer smr, Mesh bindMesh, int vertexIndex, Vector3 targetWorld)
{ {
//IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references)
//IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references)
//IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references)
//IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references)
//IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references)
//IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references)
//IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references)
//IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references)
//IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references)
//IL_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Unknown result type (might be due to invalid IL or missing references)
//IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references)
//IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Unknown result type (might be due to invalid IL or missing references)
//IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Unknown result type (might be due to invalid IL or missing references)
//IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references)
//IL_02ef: Unknown result type (might be due to invalid IL or missing references) //IL_02ef: Unknown result type (might be due to invalid IL or missing references)
//IL_02f6: Unknown result type (might be due to invalid IL or missing references) //IL_02f6: Unknown result type (might be due to invalid IL or missing references)
//IL_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Unknown result type (might be due to invalid IL or missing references)
//IL_030c: Unknown result type (might be due to invalid IL or missing references) //IL_030c: Unknown result type (might be due to invalid IL or missing references)
//IL_0317: Unknown result type (might be due to invalid IL or missing references) //IL_0317: 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_031e: Unknown result type (might be due to invalid IL or missing references)
//IL_0325: Unknown result type (might be due to invalid IL or missing references) //IL_0325: Unknown result type (might be due to invalid IL or missing references)
//IL_032d: Unknown result type (might be due to invalid IL or missing references) //IL_032d: Unknown result type (might be due to invalid IL or missing references)
//IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_0334: Unknown result type (might be due to invalid IL or missing references)
//IL_035a: Unknown result type (might be due to invalid IL or missing references) //IL_035a: Unknown result type (might be due to invalid IL or missing references)
//IL_035c: Unknown result type (might be due to invalid IL or missing references) //IL_035c: Unknown result type (might be due to invalid IL or missing references)
//IL_0361: Unknown result type (might be due to invalid IL or missing references) //IL_0361: Unknown result type (might be due to invalid IL or missing references)
//IL_0365: Unknown result type (might be due to invalid IL or missing references) //IL_0365: 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_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_036c: Unknown result type (might be due to invalid IL or missing references)
//IL_0379: Unknown result type (might be due to invalid IL or missing references) //IL_0379: Unknown result type (might be due to invalid IL or missing references)
//IL_037b: Unknown result type (might be due to invalid IL or missing references) //IL_037b: 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_0380: Unknown result type (might be due to invalid IL or missing references)
//IL_0382: Unknown result type (might be due to invalid IL or missing references) //IL_0382: 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_0396: Unknown result type (might be due to invalid IL or missing references)
//IL_034b: Unknown result type (might be due to invalid IL or missing references) //IL_034b: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)smr == (Object)null || (Object)(object)bindMesh == (Object)null) if (smr == null || bindMesh == null)
{ {
return Vector3.zero; return Vector3.zero;
} }
BoneWeight[] boneWeights = bindMesh.boneWeights; BoneWeight[] boneWeights = bindMesh.boneWeights;
Matrix4x4[] bindposes = bindMesh.bindposes; Matrix4x4[] bindposes = bindMesh.bindposes;
Transform[] bones = smr.bones; Transform[] bones = smr.bones;
if (boneWeights == null || bindposes == null || bones == null) if (boneWeights == null || bindposes == null || bones == null)
{ {
return ((Component)smr).transform.InverseTransformPoint(targetWorld); return ((Component)smr).transform.InverseTransformPoint(targetWorld);
} }
if (vertexIndex < 0 || vertexIndex >= boneWeights.Length) if (vertexIndex < 0 || vertexIndex >= boneWeights.Length)
{ {
return ((Component)smr).transform.InverseTransformPoint(targetWorld); return ((Component)smr).transform.InverseTransformPoint(targetWorld);
} }
if (bindposes.Length != bones.Length) if (bindposes.Length != bones.Length)
{ {
return ((Component)smr).transform.InverseTransformPoint(targetWorld); return ((Component)smr).transform.InverseTransformPoint(targetWorld);
} }
BoneWeight val = boneWeights[vertexIndex]; BoneWeight val = boneWeights[vertexIndex];
bool flag = ((BoneWeight)(ref val)).boneIndex0 >= 0 && ((BoneWeight)(ref val)).boneIndex0 < bones.Length && (Object)(object)bones[((BoneWeight)(ref val)).boneIndex0] != (Object)null && ((BoneWeight)(ref val)).weight0 > 0f; bool flag = val.boneIndex0 >= 0 && val.boneIndex0 < bones.Length && bones[val.boneIndex0] != null && val.weight0 > 0f;
bool flag2 = ((BoneWeight)(ref val)).boneIndex1 >= 0 && ((BoneWeight)(ref val)).boneIndex1 < bones.Length && (Object)(object)bones[((BoneWeight)(ref val)).boneIndex1] != (Object)null && ((BoneWeight)(ref val)).weight1 > 0f; bool flag2 = val.boneIndex1 >= 0 && val.boneIndex1 < bones.Length && bones[val.boneIndex1] != null && val.weight1 > 0f;
bool flag3 = ((BoneWeight)(ref val)).boneIndex2 >= 0 && ((BoneWeight)(ref val)).boneIndex2 < bones.Length && (Object)(object)bones[((BoneWeight)(ref val)).boneIndex2] != (Object)null && ((BoneWeight)(ref val)).weight2 > 0f; bool flag3 = val.boneIndex2 >= 0 && val.boneIndex2 < bones.Length && bones[val.boneIndex2] != null && val.weight2 > 0f;
bool num = ((BoneWeight)(ref val)).boneIndex3 >= 0 && ((BoneWeight)(ref val)).boneIndex3 < bones.Length && (Object)(object)bones[((BoneWeight)(ref val)).boneIndex3] != (Object)null && ((BoneWeight)(ref val)).weight3 > 0f; bool num = val.boneIndex3 >= 0 && val.boneIndex3 < bones.Length && bones[val.boneIndex3] != null && val.weight3 > 0f;
float num2 = (flag ? ((BoneWeight)(ref val)).weight0 : 0f); float num2 = (flag ? val.weight0 : 0f);
float num3 = (flag2 ? ((BoneWeight)(ref val)).weight1 : 0f); float num3 = (flag2 ? val.weight1 : 0f);
float num4 = (flag3 ? ((BoneWeight)(ref val)).weight2 : 0f); float num4 = (flag3 ? val.weight2 : 0f);
float num5 = (num ? ((BoneWeight)(ref val)).weight3 : 0f); float num5 = (num ? val.weight3 : 0f);
float num6 = num2 + num3 + num4 + num5; float num6 = num2 + num3 + num4 + num5;
if (num6 <= 1E-08f) if (num6 <= 1E-08f)
{ {
return ((Component)smr).transform.InverseTransformPoint(targetWorld); return ((Component)smr).transform.InverseTransformPoint(targetWorld);
} }
num2 /= num6; num2 /= num6;
num3 /= num6; num3 /= num6;
num4 /= num6; num4 /= num6;
num5 /= num6; num5 /= num6;
Vector3 val2 = ((Component)smr).transform.InverseTransformPoint(targetWorld); Vector3 val2 = ((Component)smr).transform.InverseTransformPoint(targetWorld);
Matrix4x4 objWorldInv = ((Component)smr).transform.worldToLocalMatrix; Matrix4x4 objWorldInv = ((Component)smr).transform.worldToLocalMatrix;
Matrix4x4 acc = Matrix4x4.zero; Matrix4x4 acc = Matrix4x4.zero;
if (num2 > 0f) if (num2 > 0f)
{ {
Acc(ref acc, ((BoneWeight)(ref val)).boneIndex0, num2); Acc(ref acc, val.boneIndex0, num2);
} }
if (num3 > 0f) if (num3 > 0f)
{ {
Acc(ref acc, ((BoneWeight)(ref val)).boneIndex1, num3); Acc(ref acc, val.boneIndex1, num3);
} }
if (num4 > 0f) if (num4 > 0f)
{ {
Acc(ref acc, ((BoneWeight)(ref val)).boneIndex2, num4); Acc(ref acc, val.boneIndex2, num4);
} }
if (num5 > 0f) if (num5 > 0f)
{ {
Acc(ref acc, ((BoneWeight)(ref val)).boneIndex3, num5); Acc(ref acc, val.boneIndex3, num5);
} }
if (Mathf.Abs(acc.m00 * (acc.m11 * acc.m22 - acc.m12 * acc.m21) - acc.m01 * (acc.m10 * acc.m22 - acc.m12 * acc.m20) + acc.m02 * (acc.m10 * acc.m21 - acc.m11 * acc.m20)) < 1E-12f) if (Mathf.Abs(acc.m00 * (acc.m11 * acc.m22 - acc.m12 * acc.m21) - acc.m01 * (acc.m10 * acc.m22 - acc.m12 * acc.m20) + acc.m02 * (acc.m10 * acc.m21 - acc.m11 * acc.m20)) < 1E-12f)
{ {
return val2; return val2;
} }
acc.m33 = 1f; acc.m33 = 1f;
Matrix4x4 val3 = Matrix4x4.Inverse(acc); Matrix4x4 val3 = Matrix4x4.Inverse(acc);
Vector3 val4 = ((Matrix4x4)(ref val3)).MultiplyPoint3x4(val2); Vector3 val4 = val3.MultiplyPoint3x4(val2);
Debug.Log((object)$"Diff{((Component)smr).transform.TransformPoint(val4) - targetWorld}"); Debug.Log($"Diff{((Component)smr).transform.TransformPoint(val4) - targetWorld}");
return val4; return val4;
void Acc(ref Matrix4x4 reference, int boneIndex, float w) void Acc(ref Matrix4x4 reference, int boneIndex, float w)
{ {
//IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_005f: 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_0071: 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_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: 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_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references)
if (!(w <= 0f)) if (!(w <= 0f))
{ {
Matrix4x4 val5 = objWorldInv * bones[boneIndex].localToWorldMatrix * bindposes[boneIndex]; Matrix4x4 val5 = objWorldInv * bones[boneIndex].localToWorldMatrix * bindposes[boneIndex];
reference.m00 += val5.m00 * w; reference.m00 += val5.m00 * w;
reference.m01 += val5.m01 * w; reference.m01 += val5.m01 * w;
reference.m02 += val5.m02 * w; reference.m02 += val5.m02 * w;
reference.m10 += val5.m10 * w; reference.m10 += val5.m10 * w;
reference.m11 += val5.m11 * w; reference.m11 += val5.m11 * w;
reference.m12 += val5.m12 * w; reference.m12 += val5.m12 * w;
reference.m20 += val5.m20 * w; reference.m20 += val5.m20 * w;
reference.m21 += val5.m21 * w; reference.m21 += val5.m21 * w;
reference.m22 += val5.m22 * w; reference.m22 += val5.m22 * w;
} }
} }
} }
public Vector3 WorldPosToBindPos_Full(SkinnedMeshRenderer smr, Mesh bindMesh, int vertexIndex, Vector3 targetWorld) public Vector3 WorldPosToBindPos_Full(SkinnedMeshRenderer smr, Mesh bindMesh, int vertexIndex, Vector3 targetWorld)
{ {
//IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_008c: 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_0157: Unknown result type (might be due to invalid IL or missing references)
//IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references)
//IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0183: 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_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_018a: Unknown result type (might be due to invalid IL or missing references)
//IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references)
//IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references)
//IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references)
//IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references)
//IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references)
//IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references)
//IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references)
//IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references)
//IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references)
//IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references)
//IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references)
//IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_0227: 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_0231: 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_0238: 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_023f: Unknown result type (might be due to invalid IL or missing references)
//IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references)
//IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_024e: 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_0259: Unknown result type (might be due to invalid IL or missing references)
//IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references)
//IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references)
//IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references)
//IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_0276: 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_0290: Unknown result type (might be due to invalid IL or missing references)
//IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references)
//IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Unknown result type (might be due to invalid IL or missing references)
//IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references)
//IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references)
//IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references)
//IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)smr == (Object)null || (Object)(object)bindMesh == (Object)null) if (smr == null || bindMesh == null)
{ {
return Vector3.zero; return Vector3.zero;
} }
BoneWeight[] boneWeights = bindMesh.boneWeights; BoneWeight[] boneWeights = bindMesh.boneWeights;
Matrix4x4[] bindposes = bindMesh.bindposes; Matrix4x4[] bindposes = bindMesh.bindposes;
Transform[] bones = smr.bones; Transform[] bones = smr.bones;
if (boneWeights == null || bindposes == null || bones == null) if (boneWeights == null || bindposes == null || bones == null)
{ {
return ((Component)smr).transform.InverseTransformPoint(targetWorld); return ((Component)smr).transform.InverseTransformPoint(targetWorld);
} }
if (vertexIndex < 0 || vertexIndex >= boneWeights.Length) if (vertexIndex < 0 || vertexIndex >= boneWeights.Length)
{ {
return ((Component)smr).transform.InverseTransformPoint(targetWorld); return ((Component)smr).transform.InverseTransformPoint(targetWorld);
} }
if (bindposes.Length != bones.Length) if (bindposes.Length != bones.Length)
{ {
return ((Component)smr).transform.InverseTransformPoint(targetWorld); return ((Component)smr).transform.InverseTransformPoint(targetWorld);
} }
BoneWeight val = boneWeights[vertexIndex]; BoneWeight val = boneWeights[vertexIndex];
float[] array = new float[4]; float[] array = new float[4];
int[] array2 = new int[4]; int[] array2 = new int[4];
array[0] = ((BoneWeight)(ref val)).weight0; array[0] = val.weight0;
array2[0] = ((BoneWeight)(ref val)).boneIndex0; array2[0] = val.boneIndex0;
array[1] = ((BoneWeight)(ref val)).weight1; array[1] = val.weight1;
array2[1] = ((BoneWeight)(ref val)).boneIndex1; array2[1] = val.boneIndex1;
array[2] = ((BoneWeight)(ref val)).weight2; array[2] = val.weight2;
array2[2] = ((BoneWeight)(ref val)).boneIndex2; array2[2] = val.boneIndex2;
array[3] = ((BoneWeight)(ref val)).weight3; array[3] = val.weight3;
array2[3] = ((BoneWeight)(ref val)).boneIndex3; array2[3] = val.boneIndex3;
float num = 0f; float num = 0f;
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
{ {
if (array2[i] >= 0 && array2[i] < bones.Length && (Object)(object)bones[array2[i]] != (Object)null) if (array2[i] >= 0 && array2[i] < bones.Length && bones[array2[i]] != null)
{ {
num += array[i]; num += array[i];
} }
} }
if (num < 1E-08f) if (num < 1E-08f)
{ {
return ((Component)smr).transform.InverseTransformPoint(targetWorld); return ((Component)smr).transform.InverseTransformPoint(targetWorld);
} }
for (int j = 0; j < 4; j++) for (int j = 0; j < 4; j++)
{ {
array[j] /= num; array[j] /= num;
} }
Vector3 val2 = ((Component)smr).transform.InverseTransformPoint(targetWorld); Vector3 val2 = smr.transform.InverseTransformPoint(targetWorld);
Vector4 val3 = default(Vector4); Vector4 val3 = new Vector4(val2.x, val2.y, val2.z, 1f);
((Vector4)(ref val3))._002Ector(val2.x, val2.y, val2.z, 1f); Matrix4x4 objWorldInv = ((Component)smr).transform.worldToLocalMatrix;
Matrix4x4 objWorldInv = ((Component)smr).transform.worldToLocalMatrix; Matrix4x4 acc = Matrix4x4.zero;
Matrix4x4 acc = Matrix4x4.zero; for (int k = 0; k < 4; k++)
for (int k = 0; k < 4; k++) {
{ if (array[k] > 0f && array2[k] >= 0 && array2[k] < bones.Length)
if (array[k] > 0f && array2[k] >= 0 && array2[k] < bones.Length) {
{ Accumulate(ref acc, array2[k], array[k]);
Accumulate(ref acc, array2[k], array[k]); }
} }
} if (Mathf.Abs(acc.m00 * (acc.m11 * acc.m22 - acc.m12 * acc.m21) - acc.m01 * (acc.m10 * acc.m22 - acc.m12 * acc.m20) + acc.m02 * (acc.m10 * acc.m21 - acc.m11 * acc.m20)) < 1E-12f)
if (Mathf.Abs(acc.m00 * (acc.m11 * acc.m22 - acc.m12 * acc.m21) - acc.m01 * (acc.m10 * acc.m22 - acc.m12 * acc.m20) + acc.m02 * (acc.m10 * acc.m21 - acc.m11 * acc.m20)) < 1E-12f) {
{ return val2;
return val2; }
} Matrix4x4 val4 = Matrix4x4.Inverse(acc);
Matrix4x4 val4 = Matrix4x4.Inverse(acc); return val4.MultiplyPoint3x4((Vector4)val3);
return ((Matrix4x4)(ref val4)).MultiplyPoint3x4(Vector4.op_Implicit(val3)); void Accumulate(ref Matrix4x4 reference, int bi, float w)
void Accumulate(ref Matrix4x4 reference, int bi, float w) {
{ //IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: 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_0071: 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_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: 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_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: 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_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references)
//IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references)
//IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references)
//IL_0125: 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_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references)
//IL_0149: Unknown result type (might be due to invalid IL or missing references) if (!(w <= 0f))
if (!(w <= 0f)) {
{ Matrix4x4 val5 = objWorldInv * bones[bi].localToWorldMatrix * bindposes[bi];
Matrix4x4 val5 = objWorldInv * bones[bi].localToWorldMatrix * bindposes[bi]; reference.m00 += val5.m00 * w;
reference.m00 += val5.m00 * w; reference.m01 += val5.m01 * w;
reference.m01 += val5.m01 * w; reference.m02 += val5.m02 * w;
reference.m02 += val5.m02 * w; reference.m03 += val5.m03 * w;
reference.m03 += val5.m03 * w; reference.m10 += val5.m10 * w;
reference.m10 += val5.m10 * w; reference.m11 += val5.m11 * w;
reference.m11 += val5.m11 * w; reference.m12 += val5.m12 * w;
reference.m12 += val5.m12 * w; reference.m13 += val5.m13 * w;
reference.m13 += val5.m13 * w; reference.m20 += val5.m20 * w;
reference.m20 += val5.m20 * w; reference.m21 += val5.m21 * w;
reference.m21 += val5.m21 * w; reference.m22 += val5.m22 * w;
reference.m22 += val5.m22 * w; reference.m23 += val5.m23 * w;
reference.m23 += val5.m23 * w; reference.m30 += val5.m30 * w;
reference.m30 += val5.m30 * w; reference.m31 += val5.m31 * w;
reference.m31 += val5.m31 * w; reference.m32 += val5.m32 * w;
reference.m32 += val5.m32 * w; reference.m33 += val5.m33 * w;
reference.m33 += val5.m33 * w; }
} }
} }
}
public Vector3 WorldDirToBindDir_Full(SkinnedMeshRenderer smr, Mesh bindMesh, int vertexIndex, Vector3 targetWorldDir) public Vector3 WorldDirToBindDir_Full(SkinnedMeshRenderer smr, Mesh bindMesh, int vertexIndex, Vector3 targetWorldDir)
{ {
//IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0073: 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_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_007e: 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_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_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: 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_0172: Unknown result type (might be due to invalid IL or missing references)
//IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references)
//IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references)
//IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references)
//IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references)
//IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references)
//IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references)
//IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references)
//IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references)
//IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references)
//IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references)
//IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references)
//IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references)
//IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_0228: 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_022c: Unknown result type (might be due to invalid IL or missing references)
//IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_022e: 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_0233: Unknown result type (might be due to invalid IL or missing references)
//IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references)
//IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)smr == (Object)null || (Object)(object)bindMesh == (Object)null) if (smr == null || bindMesh == null)
{ {
return Vector3.zero; return Vector3.zero;
} }
BoneWeight[] boneWeights = bindMesh.boneWeights; BoneWeight[] boneWeights = bindMesh.boneWeights;
Matrix4x4[] bindposes = bindMesh.bindposes; Matrix4x4[] bindposes = bindMesh.bindposes;
Transform[] bones = smr.bones; Transform[] bones = smr.bones;
Vector3 val; Vector3 val;
if (boneWeights == null || bindposes == null || bones == null) if (boneWeights == null || bindposes == null || bones == null)
{ {
val = ((Component)smr).transform.InverseTransformDirection(targetWorldDir); val = ((Component)smr).transform.InverseTransformDirection(targetWorldDir);
return ((Vector3)(ref val)).normalized; return val.normalized;
} }
if (vertexIndex < 0 || vertexIndex >= boneWeights.Length) if (vertexIndex < 0 || vertexIndex >= boneWeights.Length)
{ {
val = ((Component)smr).transform.InverseTransformDirection(targetWorldDir); val = ((Component)smr).transform.InverseTransformDirection(targetWorldDir);
return ((Vector3)(ref val)).normalized; return val.normalized;
} }
if (bindposes.Length != bones.Length) if (bindposes.Length != bones.Length)
{ {
val = ((Component)smr).transform.InverseTransformDirection(targetWorldDir); val = ((Component)smr).transform.InverseTransformDirection(targetWorldDir);
return ((Vector3)(ref val)).normalized; return val.normalized;
} }
BoneWeight val2 = boneWeights[vertexIndex]; BoneWeight val2 = boneWeights[vertexIndex];
float[] array = new float[4]; float[] array = new float[4];
int[] array2 = new int[4]; int[] array2 = new int[4];
array[0] = ((BoneWeight)(ref val2)).weight0; array[0] = val2.weight0;
array2[0] = ((BoneWeight)(ref val2)).boneIndex0; array2[0] = val2.boneIndex0;
array[1] = ((BoneWeight)(ref val2)).weight1; array[1] = val2.weight1;
array2[1] = ((BoneWeight)(ref val2)).boneIndex1; array2[1] = val2.boneIndex1;
array[2] = ((BoneWeight)(ref val2)).weight2; array[2] = val2.weight2;
array2[2] = ((BoneWeight)(ref val2)).boneIndex2; array2[2] = val2.boneIndex2;
array[3] = ((BoneWeight)(ref val2)).weight3; array[3] = val2.weight3;
array2[3] = ((BoneWeight)(ref val2)).boneIndex3; array2[3] = val2.boneIndex3;
float num = 0f; float num = 0f;
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
{ {
if (array2[i] >= 0 && array2[i] < bones.Length && (Object)(object)bones[array2[i]] != (Object)null) if (array2[i] >= 0 && array2[i] < bones.Length && bones[array2[i]] != null)
{ {
num += array[i]; num += array[i];
} }
} }
if (num < 1E-08f) if (num < 1E-08f)
{ {
val = ((Component)smr).transform.InverseTransformDirection(targetWorldDir); val = ((Component)smr).transform.InverseTransformDirection(targetWorldDir);
return ((Vector3)(ref val)).normalized; return val.normalized;
} }
for (int j = 0; j < 4; j++) for (int j = 0; j < 4; j++)
{ {
array[j] /= num; array[j] /= num;
} }
Vector3 val3 = ((Component)smr).transform.InverseTransformDirection(targetWorldDir); Vector3 val3 = ((Component)smr).transform.InverseTransformDirection(targetWorldDir);
if (((Vector3)(ref val3)).sqrMagnitude < 1E-12f) if (val3.sqrMagnitude < 1E-12f)
{ {
return Vector3.up; return Vector3.up;
} }
Matrix4x4 objWorldInv = ((Component)smr).transform.worldToLocalMatrix; Matrix4x4 objWorldInv = ((Component)smr).transform.worldToLocalMatrix;
Matrix4x4 acc = Matrix4x4.zero; Matrix4x4 acc = Matrix4x4.zero;
for (int k = 0; k < 4; k++) for (int k = 0; k < 4; k++)
{ {
if (array[k] > 0f && array2[k] >= 0 && array2[k] < bones.Length) if (array[k] > 0f && array2[k] >= 0 && array2[k] < bones.Length)
{ {
Accumulate(ref acc, array2[k], array[k]); Accumulate(ref acc, array2[k], array[k]);
} }
} }
Matrix4x4 transpose = ((Matrix4x4)(ref acc)).transpose; Matrix4x4 transpose = acc.transpose;
Vector3 val4 = ((Matrix4x4)(ref transpose)).MultiplyVector(val3); Vector3 val4 = transpose.MultiplyVector(val3);
if (((Vector3)(ref val4)).sqrMagnitude < 1E-12f) if (val4.sqrMagnitude < 1E-12f)
{ {
return ((Vector3)(ref val3)).normalized; return val3.normalized;
} }
return ((Vector3)(ref val4)).normalized; return val4.normalized;
void Accumulate(ref Matrix4x4 reference, int bi, float w) void Accumulate(ref Matrix4x4 reference, int bi, float w)
{ {
//IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_005f: 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_0071: 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_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: 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_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: 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_00ef: Unknown result type (might be due to invalid IL or missing references)
//IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references)
//IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references)
//IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0125: 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_0137: Unknown result type (might be due to invalid IL or missing references)
//IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references)
if (!(w <= 0f)) if (!(w <= 0f))
{ {
Matrix4x4 val5 = objWorldInv * bones[bi].localToWorldMatrix * bindposes[bi]; Matrix4x4 val5 = objWorldInv * bones[bi].localToWorldMatrix * bindposes[bi];
reference.m00 += val5.m00 * w; reference.m00 += val5.m00 * w;
reference.m01 += val5.m01 * w; reference.m01 += val5.m01 * w;
reference.m02 += val5.m02 * w; reference.m02 += val5.m02 * w;
reference.m03 += val5.m03 * w; reference.m03 += val5.m03 * w;
reference.m10 += val5.m10 * w; reference.m10 += val5.m10 * w;
reference.m11 += val5.m11 * w; reference.m11 += val5.m11 * w;
reference.m12 += val5.m12 * w; reference.m12 += val5.m12 * w;
reference.m13 += val5.m13 * w; reference.m13 += val5.m13 * w;
reference.m20 += val5.m20 * w; reference.m20 += val5.m20 * w;
reference.m21 += val5.m21 * w; reference.m21 += val5.m21 * w;
reference.m22 += val5.m22 * w; reference.m22 += val5.m22 * w;
reference.m23 += val5.m23 * w; reference.m23 += val5.m23 * w;
reference.m30 += val5.m30 * w; reference.m30 += val5.m30 * w;
reference.m31 += val5.m31 * w; reference.m31 += val5.m31 * w;
reference.m32 += val5.m32 * w; reference.m32 += val5.m32 * w;
reference.m33 += val5.m33 * w; reference.m33 += val5.m33 * w;
} }
} }
} }
} }

View File

@@ -1,4 +1,4 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // 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. // 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 // EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// TempBoneMarker // TempBoneMarker
@@ -7,9 +7,9 @@ using UnityEngine;
public class TempBoneMarker : MonoBehaviour public class TempBoneMarker : MonoBehaviour
{ {
public Transform originalParent; public Transform originalParent;
public string additionalInfo = ""; public string additionalInfo = "";
public List<string> wrappedChildNames = new List<string>(); public List<string> wrappedChildNames = new List<string>();
} }

View File

@@ -1,4 +1,4 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // 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. // 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 // EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.TransformInfo // Eden.AutoMorpher.TransformInfo
@@ -6,83 +6,83 @@ using UnityEngine;
public class TransformInfo public class TransformInfo
{ {
public Transform parentTransform; public Transform parentTransform;
public Vector3 position; public Vector3 position;
public Vector3 localPosition; public Vector3 localPosition;
public Quaternion rotation; public Quaternion rotation;
public Quaternion localRotation; public Quaternion localRotation;
public Vector3 localScale; public Vector3 localScale;
public string name; public string name;
public TransformInfo(Transform t) public TransformInfo(Transform t)
{ {
//IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references)
parentTransform = t.parent; this.parentTransform = t.parent;
position = t.position; this.position = t.position;
localPosition = t.localPosition; this.localPosition = t.localPosition;
rotation = t.rotation; this.rotation = t.rotation;
localRotation = t.localRotation; this.localRotation = t.localRotation;
localScale = t.localScale; this.localScale = t.localScale;
name = ((Object)t).name; this.name = ((Object)t).name;
} }
public void ApplyToTransform(Transform t, bool applyParent, bool applyPosition, bool applyRotation, bool applyScale, bool applyName = false) public void ApplyToTransform(Transform t, bool applyParent, bool applyPosition, bool applyRotation, bool applyScale, bool applyName = false)
{ {
//IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references)
if (applyParent) if (applyParent)
{ {
t.SetParent(parentTransform, true); t.SetParent(this.parentTransform, true);
if (applyPosition) if (applyPosition)
{ {
t.localPosition = localPosition; t.localPosition = this.localPosition;
} }
if (applyRotation) if (applyRotation)
{ {
t.localRotation = localRotation; t.localRotation = this.localRotation;
} }
if (applyScale) if (applyScale)
{ {
t.localScale = localScale; t.localScale = this.localScale;
} }
} }
else else
{ {
if (applyPosition) if (applyPosition)
{ {
t.position = position; t.position = this.position;
} }
if (applyRotation) if (applyRotation)
{ {
t.rotation = rotation; t.rotation = this.rotation;
} }
if (applyScale) if (applyScale)
{ {
t.localScale = localScale; t.localScale = this.localScale;
} }
} }
if (applyName) if (applyName)
{ {
((Object)t).name = name; ((Object)t).name = this.name;
} }
} }
} }

View File

@@ -1,4 +1,4 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // 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. // 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 // EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.TriangleUtil // Eden.AutoMorpher.TriangleUtil
@@ -6,108 +6,108 @@ using UnityEngine;
public class TriangleUtil public class TriangleUtil
{ {
public Vector3 ClosestPointOnTriangle(Vector3 p, Vector3 a, Vector3 b, Vector3 c) public Vector3 ClosestPointOnTriangle(Vector3 p, Vector3 a, Vector3 b, Vector3 c)
{ {
//IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: 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_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references)
//IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references)
//IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references)
//IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references)
//IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references)
//IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references)
//IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references)
//IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0109: 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_010c: 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_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_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0159: 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_015c: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references)
//IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references)
//IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references)
//IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = b - a; Vector3 val = b - a;
Vector3 val2 = c - a; Vector3 val2 = c - a;
Vector3 val3 = p - a; Vector3 val3 = p - a;
float num = Vector3.Dot(val, val3); float num = Vector3.Dot(val, val3);
float num2 = Vector3.Dot(val2, val3); float num2 = Vector3.Dot(val2, val3);
if (num <= 0f && num2 <= 0f) if (num <= 0f && num2 <= 0f)
{ {
return a; return a;
} }
Vector3 val4 = p - b; Vector3 val4 = p - b;
float num3 = Vector3.Dot(val, val4); float num3 = Vector3.Dot(val, val4);
float num4 = Vector3.Dot(val2, val4); float num4 = Vector3.Dot(val2, val4);
if (num3 >= 0f && num4 <= num3) if (num3 >= 0f && num4 <= num3)
{ {
return b; return b;
} }
float num5 = num * num4 - num3 * num2; float num5 = num * num4 - num3 * num2;
if (num5 <= 0f && num >= 0f && num3 <= 0f) if (num5 <= 0f && num >= 0f && num3 <= 0f)
{ {
float num6 = num / (num - num3); float num6 = num / (num - num3);
return a + num6 * val; return a + num6 * val;
} }
Vector3 val5 = p - c; Vector3 val5 = p - c;
float num7 = Vector3.Dot(val, val5); float num7 = Vector3.Dot(val, val5);
float num8 = Vector3.Dot(val2, val5); float num8 = Vector3.Dot(val2, val5);
if (num8 >= 0f && num7 <= num8) if (num8 >= 0f && num7 <= num8)
{ {
return c; return c;
} }
float num9 = num7 * num2 - num * num8; float num9 = num7 * num2 - num * num8;
if (num9 <= 0f && num2 >= 0f && num8 <= 0f) if (num9 <= 0f && num2 >= 0f && num8 <= 0f)
{ {
float num10 = num2 / (num2 - num8); float num10 = num2 / (num2 - num8);
return a + num10 * val2; return a + num10 * val2;
} }
float num11 = num3 * num8 - num7 * num4; float num11 = num3 * num8 - num7 * num4;
if (num11 <= 0f && num4 - num3 >= 0f && num7 - num8 >= 0f) if (num11 <= 0f && num4 - num3 >= 0f && num7 - num8 >= 0f)
{ {
float num12 = (num4 - num3) / (num4 - num3 + (num7 - num8)); float num12 = (num4 - num3) / (num4 - num3 + (num7 - num8));
return b + num12 * (c - b); return b + num12 * (c - b);
} }
float num13 = 1f / (num11 + num9 + num5); float num13 = 1f / (num11 + num9 + num5);
float num14 = num9 * num13; float num14 = num9 * num13;
float num15 = num5 * num13; float num15 = num5 * num13;
return a + val * num14 + val2 * num15; return a + val * num14 + val2 * num15;
} }
} }

File diff suppressed because it is too large Load Diff

View File

@@ -1,195 +1,194 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // 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. // 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 // EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.VertexMoverUtil // Eden.AutoMorpher.VertexMoverUtil
using Eden.AutoMorpher;
using UnityEngine; using UnityEngine;
public class VertexMoverUtil public class VertexMoverUtil
{ {
public Vector3[] MoveVertices(ClothInstance cloth, Vector3 targetPoint, bool centerIsLeftLeg, bool centerIsRightLeg, float maxRadius, float param, Vector3 vertexMovement) public Vector3[] MoveVertices(ClothInstance cloth, Vector3 targetPoint, bool centerIsLeftLeg, bool centerIsRightLeg, float maxRadius, float param, Vector3 vertexMovement)
{ {
//IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references)
if (cloth == null || cloth.worldVertices == null) if (cloth == null || cloth.worldVertices == null)
{ {
throw new AutoMorpherException("Cloth or World Vertices are Missing", "[MoveVertices] MoveVertices\n - cloth is null or cloth.worldVertices is null"); throw new AutoMorpherException("Cloth or World Vertices are Missing", "[MoveVertices] MoveVertices\n - cloth is null or cloth.worldVertices is null");
} }
Vector3[] worldVertices = cloth.worldVertices; Vector3[] worldVertices = cloth.worldVertices;
int num = worldVertices.Length; int num = worldVertices.Length;
bool[] isInboundVerts; bool[] isInboundVerts;
float[] array = ComputeEuclideanDistances(worldVertices, targetPoint, maxRadius, out isInboundVerts); float[] array = this.ComputeEuclideanDistances(worldVertices, targetPoint, maxRadius, out isInboundVerts);
if (array == null) if (array == null)
{ {
return null; return null;
} }
float[] array2 = ComputeKernelWeights(array, isInboundVerts, maxRadius, WeightKernel.Gaussian, param); float[] array2 = this.ComputeKernelWeights(array, isInboundVerts, maxRadius, WeightKernel.Gaussian, param);
Vector3[] array3 = (Vector3[])(object)new Vector3[num]; Vector3[] array3 = (Vector3[])(object)new Vector3[num];
bool[] isLeftLegVertex = cloth.isLeftLegVertex; bool[] isLeftLegVertex = cloth.isLeftLegVertex;
bool[] isRightLegVertex = cloth.isRightLegVertex; bool[] isRightLegVertex = cloth.isRightLegVertex;
for (int i = 0; i < num; i++) for (int i = 0; i < num; i++)
{ {
if (!isInboundVerts[i]) if (!isInboundVerts[i])
{ {
array3[i] = Vector3.zero; array3[i] = Vector3.zero;
continue; continue;
} }
if (centerIsLeftLeg && IsRightLegVertex(isRightLegVertex, i)) if (centerIsLeftLeg && this.IsRightLegVertex(isRightLegVertex, i))
{ {
array3[i] = Vector3.zero; array3[i] = Vector3.zero;
continue; continue;
} }
if (centerIsRightLeg && IsLeftLegVertex(isLeftLegVertex, i)) if (centerIsRightLeg && this.IsLeftLegVertex(isLeftLegVertex, i))
{ {
array3[i] = Vector3.zero; array3[i] = Vector3.zero;
continue; continue;
} }
float num2 = array2[i]; float num2 = array2[i];
array3[i] = vertexMovement * num2; array3[i] = vertexMovement * num2;
} }
return array3; return array3;
} }
public Vector3[] MoveVertices(ClothInstance cloth, int targetVertexIdx, bool centerIsLeftLeg, bool centerIsRightLeg, float maxRadius, float param, Vector3 vertexMovement) public Vector3[] MoveVertices(ClothInstance cloth, int targetVertexIdx, bool centerIsLeftLeg, bool centerIsRightLeg, float maxRadius, float param, Vector3 vertexMovement)
{ {
//IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references)
if (cloth == null || cloth.worldVertices == null) if (cloth == null || cloth.worldVertices == null)
{ {
throw new AutoMorpherException("Cloth or World Vertices are Missing", "[MoveVertices] MoveVertices\n - cloth is null or cloth.worldVertices is null"); throw new AutoMorpherException("Cloth or World Vertices are Missing", "[MoveVertices] MoveVertices\n - cloth is null or cloth.worldVertices is null");
} }
Vector3[] worldVertices = cloth.worldVertices; Vector3[] worldVertices = cloth.worldVertices;
int num = worldVertices.Length; int num = worldVertices.Length;
bool[] isInboundVerts; bool[] isInboundVerts;
float[] array = ComputeEuclideanDistances(worldVertices, targetVertexIdx, maxRadius, out isInboundVerts); float[] array = this.ComputeEuclideanDistances(worldVertices, targetVertexIdx, maxRadius, out isInboundVerts);
if (array == null) if (array == null)
{ {
return null; return null;
} }
float[] array2 = ComputeKernelWeights(array, isInboundVerts, maxRadius, WeightKernel.Gaussian, param); float[] array2 = this.ComputeKernelWeights(array, isInboundVerts, maxRadius, WeightKernel.Gaussian, param);
Vector3[] array3 = (Vector3[])(object)new Vector3[num]; Vector3[] array3 = (Vector3[])(object)new Vector3[num];
bool[] isLeftLegVertex = cloth.isLeftLegVertex; bool[] isLeftLegVertex = cloth.isLeftLegVertex;
bool[] isRightLegVertex = cloth.isRightLegVertex; bool[] isRightLegVertex = cloth.isRightLegVertex;
for (int i = 0; i < num; i++) for (int i = 0; i < num; i++)
{ {
if (!isInboundVerts[i]) if (!isInboundVerts[i])
{ {
array3[i] = Vector3.zero; array3[i] = Vector3.zero;
continue; continue;
} }
if (centerIsLeftLeg && IsRightLegVertex(isRightLegVertex, i)) if (centerIsLeftLeg && this.IsRightLegVertex(isRightLegVertex, i))
{ {
array3[i] = Vector3.zero; array3[i] = Vector3.zero;
continue; continue;
} }
if (centerIsRightLeg && IsLeftLegVertex(isLeftLegVertex, i)) if (centerIsRightLeg && this.IsLeftLegVertex(isLeftLegVertex, i))
{ {
array3[i] = Vector3.zero; array3[i] = Vector3.zero;
continue; continue;
} }
float num2 = array2[i]; float num2 = array2[i];
array3[i] = vertexMovement * num2; array3[i] = vertexMovement * num2;
} }
return array3; return array3;
} }
private float[] ComputeEuclideanDistances(Vector3[] verts, int targetVertIdx, float maxRadius, out bool[] isInboundVerts) private float[] ComputeEuclideanDistances(Vector3[] verts, int targetVertIdx, float maxRadius, out bool[] isInboundVerts)
{ {
//IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references)
return ComputeEuclideanDistances(verts, verts[targetVertIdx], maxRadius, out isInboundVerts); return this.ComputeEuclideanDistances(verts, verts[targetVertIdx], maxRadius, out isInboundVerts);
} }
private float[] ComputeEuclideanDistances(Vector3[] verts, Vector3 targetVert, float maxRadius, out bool[] isInboundVerts) private float[] ComputeEuclideanDistances(Vector3[] verts, Vector3 targetVert, float maxRadius, out bool[] isInboundVerts)
{ {
//IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references)
int num = verts.Length; int num = verts.Length;
float[] array = new float[num]; float[] array = new float[num];
isInboundVerts = new bool[num]; isInboundVerts = new bool[num];
bool flag = false; bool flag = false;
for (int i = 0; i < num; i++) for (int i = 0; i < num; i++)
{ {
array[i] = Vector3.Distance(verts[i], targetVert); array[i] = Vector3.Distance(verts[i], targetVert);
isInboundVerts[i] = array[i] <= maxRadius; isInboundVerts[i] = array[i] <= maxRadius;
flag |= isInboundVerts[i]; flag |= isInboundVerts[i];
} }
if (!flag) if (!flag)
{ {
return null; return null;
} }
return array; return array;
} }
private float ComputeGaussianWeight(float distance, float alpah) private float ComputeGaussianWeight(float distance, float alpah)
{ {
return Mathf.Exp((0f - distance * distance) / (2f * alpah * alpah)); return Mathf.Exp((0f - distance * distance) / (2f * alpah * alpah));
} }
private float ComputeLaplacianWeight(float distance, float beta) private float ComputeLaplacianWeight(float distance, float beta)
{ {
return Mathf.Exp(0f - distance / beta); return Mathf.Exp(0f - distance / beta);
} }
private float[] ComputeKernelWeights(float[] dist, bool[] isInboundVerts, float maxRadius, WeightKernel kernel, float param) private float[] ComputeKernelWeights(float[] dist, bool[] isInboundVerts, float maxRadius, WeightKernel kernel, float param)
{ {
int num = dist.Length; int num = dist.Length;
float[] array = new float[num]; float[] array = new float[num];
float num2 = Mathf.Max(1E-08f, param); float num2 = Mathf.Max(1E-08f, param);
for (int i = 0; i < num; i++) for (int i = 0; i < num; i++)
{ {
if (!isInboundVerts[i]) if (!isInboundVerts[i])
{ {
array[i] = 0f; array[i] = 0f;
continue; continue;
} }
switch (kernel) switch (kernel)
{ {
case WeightKernel.Gaussian: case WeightKernel.Gaussian:
array[i] = ComputeGaussianWeight(dist[i], num2); array[i] = this.ComputeGaussianWeight(dist[i], num2);
break; break;
case WeightKernel.Laplacian: case WeightKernel.Laplacian:
array[i] = ComputeLaplacianWeight(dist[i], num2); array[i] = this.ComputeLaplacianWeight(dist[i], num2);
break; break;
default: default:
array[i] = 0f; array[i] = 0f;
break; break;
} }
float num3 = 1f - dist[i] / maxRadius; float num3 = 1f - dist[i] / maxRadius;
array[i] *= num3 * num3; array[i] *= num3 * num3;
} }
return array; return array;
} }
private bool IsLeftLegVertex(bool[] leftMask, int index) private bool IsLeftLegVertex(bool[] leftMask, int index)
{ {
if (leftMask != null && index >= 0 && index < leftMask.Length) if (leftMask != null && index >= 0 && index < leftMask.Length)
{ {
return leftMask[index]; return leftMask[index];
} }
return false; return false;
} }
private bool IsRightLegVertex(bool[] rightMask, int index) private bool IsRightLegVertex(bool[] rightMask, int index)
{ {
if (rightMask != null && index >= 0 && index < rightMask.Length) if (rightMask != null && index >= 0 && index < rightMask.Length)
{ {
return rightMask[index]; return rightMask[index];
} }
return false; return false;
} }
} }

View File

@@ -1,9 +1,9 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // 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. // 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 // EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.WeightKernel // Eden.AutoMorpher.WeightKernel
public enum WeightKernel public enum WeightKernel
{ {
Gaussian, Gaussian,
Laplacian Laplacian
} }

View File

@@ -1,100 +1,97 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // 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. // 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 // EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.WorldVertexUtil // Eden.AutoMorpher.WorldVertexUtil
using Eden.AutoMorpher;
using UnityEngine; using UnityEngine;
public class WorldVertexUtil public class WorldVertexUtil
{ {
public Vector3[] GetWorldVertices(SkinnedMeshRenderer smr) public Vector3[] GetWorldVertices(SkinnedMeshRenderer smr)
{ {
//IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Expected O, but got Unknown //IL_0006: Expected O, but got Unknown
Mesh bakedMesh = new Mesh(); Mesh bakedMesh = new Mesh();
return GetWorldVertices(smr, ref bakedMesh); return this.GetWorldVertices(smr, ref bakedMesh);
} }
public Vector3[] GetWorldVertices(SkinnedMeshRenderer smr, ref Mesh bakedMesh) public Vector3[] GetWorldVertices(SkinnedMeshRenderer smr, ref Mesh bakedMesh)
{ {
//IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Expected O, but got Unknown //IL_002a: Expected O, but got Unknown
//IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)smr == (Object)null) if ((Object)(object)smr == (Object)null)
{ {
throw new AutoMorpherException("SkinnedMeshRenderer is Missing", "[SkinnedMeshWorldUtil] GetWorldVertices\n - smr is null"); throw new AutoMorpherException("SkinnedMeshRenderer is Missing", "[SkinnedMeshWorldUtil] GetWorldVertices\n - smr is null");
} }
if ((Object)(object)bakedMesh == (Object)null) if ((Object)(object)bakedMesh == (Object)null)
{ {
bakedMesh = new Mesh(); bakedMesh = new Mesh();
} }
else else
{ {
bakedMesh.Clear(); bakedMesh.Clear();
} }
smr.BakeMesh(bakedMesh); smr.BakeMesh(bakedMesh);
Transform transform = ((Component)smr).transform; Transform transform = ((Component)smr).transform;
Vector3 lossyScale = transform.lossyScale; Vector3 lossyScale = transform.lossyScale;
Vector3 val = default(Vector3); 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));
((Vector3)(ref val))._002Ector(1f / Mathf.Max(lossyScale.x, 1E-08f), 1f / Mathf.Max(lossyScale.y, 1E-08f), 1f / Mathf.Max(lossyScale.z, 1E-08f)); Matrix4x4 val2 = transform.localToWorldMatrix * Matrix4x4.Scale(val);
Matrix4x4 val2 = transform.localToWorldMatrix * Matrix4x4.Scale(val); Vector3[] vertices = bakedMesh.vertices;
Vector3[] vertices = bakedMesh.vertices; int num = vertices.Length;
int num = vertices.Length; Vector3[] array = (Vector3[])(object)new Vector3[num];
Vector3[] array = (Vector3[])(object)new Vector3[num]; for (int i = 0; i < num; i++)
for (int i = 0; i < num; i++) {
{ array[i] = val2.MultiplyPoint3x4(vertices[i]);
array[i] = ((Matrix4x4)(ref val2)).MultiplyPoint3x4(vertices[i]); }
} return array;
return array; }
}
public Vector3[] GetWorldVerticesWithBakedMesh(SkinnedMeshRenderer smr, Mesh bakedMesh) public Vector3[] GetWorldVerticesWithBakedMesh(SkinnedMeshRenderer smr, Mesh bakedMesh)
{ {
//IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008a: 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_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)smr == (Object)null) if ((Object)(object)smr == (Object)null)
{ {
throw new AutoMorpherException("SkinnedMeshRenderer is Missing", "[SkinnedMeshWorldUtil] GetWorldVerticesWithBakedMesh\n - smr is null"); throw new AutoMorpherException("SkinnedMeshRenderer is Missing", "[SkinnedMeshWorldUtil] GetWorldVerticesWithBakedMesh\n - smr is null");
} }
if ((Object)(object)bakedMesh == (Object)null) if ((Object)(object)bakedMesh == (Object)null)
{ {
return null; return null;
} }
Transform transform = ((Component)smr).transform; Transform transform = ((Component)smr).transform;
Vector3 lossyScale = transform.lossyScale; Vector3 lossyScale = transform.lossyScale;
Vector3 val = default(Vector3); 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));
((Vector3)(ref val))._002Ector(1f / Mathf.Max(lossyScale.x, 1E-08f), 1f / Mathf.Max(lossyScale.y, 1E-08f), 1f / Mathf.Max(lossyScale.z, 1E-08f)); Matrix4x4 val2 = transform.localToWorldMatrix * Matrix4x4.Scale(val);
Matrix4x4 val2 = transform.localToWorldMatrix * Matrix4x4.Scale(val); Vector3[] vertices = bakedMesh.vertices;
Vector3[] vertices = bakedMesh.vertices; int num = vertices.Length;
int num = vertices.Length; Vector3[] array = (Vector3[])(object)new Vector3[num];
Vector3[] array = (Vector3[])(object)new Vector3[num]; for (int i = 0; i < num; i++)
for (int i = 0; i < num; i++) {
{ array[i] = val2.MultiplyPoint3x4(vertices[i]);
array[i] = ((Matrix4x4)(ref val2)).MultiplyPoint3x4(vertices[i]); }
} return array;
return array; }
}
} }

View File

@@ -1,4 +1,4 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // 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. // 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 // EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.profile.ProfileLoader // Eden.AutoMorpher.profile.ProfileLoader
@@ -6,485 +6,483 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Text; using System.Text;
using Eden.AutoMorpher;
using Eden.AutoMorpher.profile;
using UnityEngine; using UnityEngine;
public class ProfileLoader public class ProfileLoader
{ {
private ProfileData loadedProfileData; private ProfileData loadedProfileData;
private const int HEX32_W = 8; private const int HEX32_W = 8;
public List<string> GetProfileList() public List<string> GetProfileList()
{ {
//IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Expected O, but got Unknown //IL_0006: Expected O, but got Unknown
ProfileUtils val = new ProfileUtils(); ProfileUtils val = new ProfileUtils();
string text = Path.Combine(Application.dataPath, val.GetProfileBasePath()); string text = Path.Combine(Application.dataPath, val.GetProfileBasePath());
List<string> list = new List<string>(); List<string> list = new List<string>();
if (!Directory.Exists(text)) if (!Directory.Exists(text))
{ {
Debug.LogWarning((object)("[ProfileUtils] Profile base path does not exist: " + text)); Debug.LogWarning((object)("[ProfileUtils] Profile base path does not exist: " + text));
return list; return list;
} }
string[] directories = Directory.GetDirectories(text); string[] directories = Directory.GetDirectories(text);
foreach (string text2 in directories) foreach (string text2 in directories)
{ {
string fileName = Path.GetFileName(text2); string fileName = Path.GetFileName(text2);
if (!string.IsNullOrEmpty(fileName)) if (!string.IsNullOrEmpty(fileName))
{ {
string path = Path.Combine(text2, fileName + ".json"); string path = Path.Combine(text2, fileName + ".json");
string path2 = Path.Combine(text2, fileName + ".eb"); string path2 = Path.Combine(text2, fileName + ".eb");
if (File.Exists(path) && File.Exists(path2)) if (File.Exists(path) && File.Exists(path2))
{ {
list.Add(fileName); list.Add(fileName);
} }
} }
} }
return list; return list;
} }
public ProfileData LoadProfileData(string profileName) public ProfileData LoadProfileData(string profileName)
{ {
//IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Expected O, but got Unknown //IL_0006: Expected O, but got Unknown
ProfileUtils val = new ProfileUtils(); ProfileUtils val = new ProfileUtils();
string path = Path.Combine(Application.dataPath, val.GetProfileBasePath()); string path = Path.Combine(Application.dataPath, val.GetProfileBasePath());
path = Path.Combine(path, profileName); path = Path.Combine(path, profileName);
path = Path.Combine(path, profileName + ".json"); path = Path.Combine(path, profileName + ".json");
if (string.IsNullOrWhiteSpace(path)) if (string.IsNullOrWhiteSpace(path))
{ {
throw new AutoMorpherException("Profile File Path is Invalid", "[ProfileLoader] LoadProfileData\n - Profile Path is null, empty, or whitespace"); throw new AutoMorpherException("Profile File Path is Invalid", "[ProfileLoader] LoadProfileData\n - Profile Path is null, empty, or whitespace");
} }
if (!File.Exists(path)) if (!File.Exists(path))
{ {
throw new AutoMorpherException("Profile File Does Not Exist", "[ProfileLoader] LoadProfileData\n - profile file does not exist\n - path : " + path); throw new AutoMorpherException("Profile File Does Not Exist", "[ProfileLoader] LoadProfileData\n - profile file does not exist\n - path : " + path);
} }
string text = File.ReadAllText(path); string text = File.ReadAllText(path);
loadedProfileData = JsonUtility.FromJson<ProfileData>(text); this.loadedProfileData = JsonUtility.FromJson<ProfileData>(text);
if (loadedProfileData == null) if (this.loadedProfileData == null)
{ {
throw new AutoMorpherException("Failed to Load Profile Data", "[ProfileLoader] LoadProfileData\n - Can't Load Profile Data\n - Please place a valid profile data file at " + path); throw new AutoMorpherException("Failed to Load Profile Data", "[ProfileLoader] LoadProfileData\n - Can't Load Profile Data\n - Please place a valid profile data file at " + path);
} }
return loadedProfileData; return this.loadedProfileData;
} }
public BvhTriangleMesh LoadBvhWithRootTransform(Transform rootTransform, string profileName) public BvhTriangleMesh LoadBvhWithRootTransform(Transform rootTransform, string profileName)
{ {
//IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Expected O, but got Unknown //IL_0006: Expected O, but got Unknown
//IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references)
//IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references)
//IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references)
//IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references)
//IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references)
//IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references)
//IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references)
//IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references)
//IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references)
//IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references)
//IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references)
//IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references)
//IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references)
//IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0159: 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_015c: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references)
//IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0160: 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_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_0167: Unknown result type (might be due to invalid IL or missing references)
//IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references)
//IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_017e: 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_0185: Unknown result type (might be due to invalid IL or missing references)
//IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references)
//IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references)
//IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references)
//IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references)
//IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references)
//IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references)
//IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_0244: 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_0248: Unknown result type (might be due to invalid IL or missing references)
//IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references)
//IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references)
ProfileUtils val = new ProfileUtils(); ProfileUtils val = new ProfileUtils();
string path = Path.Combine(Application.dataPath, val.GetProfileBasePath()); string path = Path.Combine(Application.dataPath, val.GetProfileBasePath());
path = Path.Combine(path, profileName); path = Path.Combine(path, profileName);
path = Path.Combine(path, profileName + ".eb"); path = Path.Combine(path, profileName + ".eb");
if ((Object)(object)rootTransform == (Object)null) if (rootTransform == null)
{ {
throw new AutoMorpherException("Root Transform is Null", "[ProfileLoader] LoadBvhWithRootTransform\n - rootTransform is null"); throw new AutoMorpherException("Root Transform is Null", "[ProfileLoader] LoadBvhWithRootTransform\n - rootTransform is null");
} }
if (string.IsNullOrEmpty(path)) if (string.IsNullOrEmpty(path))
{ {
throw new AutoMorpherException("Profile BVH Path is Invalid", "[ProfileLoader] LoadBvhWithRootTransform\n - profileBvhPath is null or empty"); throw new AutoMorpherException("Profile BVH Path is Invalid", "[ProfileLoader] LoadBvhWithRootTransform\n - profileBvhPath is null or empty");
} }
int version; int version;
ProfileBVH val2 = LoadProfileBVHData(path, out version); ProfileBVH val2 = this.LoadProfileBVHData(path, out version);
if (val2 == null || val2.vertices == null || val2.datas == null || val2.nodes == null || val2.dataIndices == null) if (val2 == null || val2.vertices == null || val2.datas == null || val2.nodes == null || val2.dataIndices == null)
{ {
throw new AutoMorpherException("Profile BVH Data is Invalid", "[ProfileLoader] LoadBvhWithRootTransform\n - profile or one of its internal data fields is null"); throw new AutoMorpherException("Profile BVH Data is Invalid", "[ProfileLoader] LoadBvhWithRootTransform\n - profile or one of its internal data fields is null");
} }
Matrix4x4 localToWorldMatrix = rootTransform.localToWorldMatrix; Matrix4x4 localToWorldMatrix = rootTransform.localToWorldMatrix;
int num = val2.datas.Length; int num = val2.datas.Length;
BvhTriangleMesh bvhTriangleMesh = new BvhTriangleMesh BvhTriangleMesh bvhTriangleMesh = new BvhTriangleMesh
{ {
triangles = new BvhTriangle[num], triangles = new BvhTriangle[num],
triIndices = new int[val2.dataIndices.Length], triIndices = new int[val2.dataIndices.Length],
nodes = new BvhNode[val2.nodes.Length] nodes = new BvhNode[val2.nodes.Length]
}; };
for (int i = 0; i < num; i++) for (int i = 0; i < num; i++)
{ {
profileBVHData val3 = val2.datas[i]; profileBVHData val3 = val2.datas[i];
Vector3 val4 = val2.vertices[val3.verA]; Vector3 val4 = val2.vertices[val3.verA];
Vector3 val5 = val2.vertices[val3.verB]; Vector3 val5 = val2.vertices[val3.verB];
Vector3 val6 = val2.vertices[val3.verC]; Vector3 val6 = val2.vertices[val3.verC];
Vector3 a = ((Matrix4x4)(ref localToWorldMatrix)).MultiplyPoint3x4(val4); Vector3 a = localToWorldMatrix.MultiplyPoint3x4(val4);
Vector3 b = ((Matrix4x4)(ref localToWorldMatrix)).MultiplyPoint3x4(val5); Vector3 b = localToWorldMatrix.MultiplyPoint3x4(val5);
Vector3 c = ((Matrix4x4)(ref localToWorldMatrix)).MultiplyPoint3x4(val6); Vector3 c = localToWorldMatrix.MultiplyPoint3x4(val6);
Vector3 normal = ComputeTriangleNormal(a, b, c); Vector3 normal = this.ComputeTriangleNormal(a, b, c);
bvhTriangleMesh.triangles[i] = new BvhTriangle bvhTriangleMesh.triangles[i] = new BvhTriangle
{ {
a = a, a = a,
b = b, b = b,
c = c, c = c,
normal = normal, normal = normal,
mainHumanBone = (HumanBodyBones)55 mainHumanBone = (HumanBodyBones)55
}; };
} }
Array.Copy(val2.dataIndices, bvhTriangleMesh.triIndices, val2.dataIndices.Length); Array.Copy(val2.dataIndices, bvhTriangleMesh.triIndices, val2.dataIndices.Length);
for (int j = 0; j < val2.nodes.Length; j++) for (int j = 0; j < val2.nodes.Length; j++)
{ {
profileBVHNode val7 = val2.nodes[j]; profileBVHNode val7 = val2.nodes[j];
bvhTriangleMesh.nodes[j] = new BvhNode bvhTriangleMesh.nodes[j] = new BvhNode
{ {
isLeaf = val7.isLeaf, isLeaf = val7.isLeaf,
leftChild = val7.leftChild, leftChild = val7.leftChild,
rightChild = val7.rightChild, rightChild = val7.rightChild,
start = val7.start, start = val7.start,
count = val7.count, count = val7.count,
bounds = TransformBoundsToWorldAABB(localToWorldMatrix, val7.bounds) bounds = this.TransformBoundsToWorldAABB(localToWorldMatrix, val7.bounds)
}; };
} }
return bvhTriangleMesh; return bvhTriangleMesh;
} }
private ProfileBVH LoadProfileBVHData(string path, out int version) private ProfileBVH LoadProfileBVHData(string path, out int version)
{ {
//IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Expected O, but got Unknown //IL_0037: Expected O, but got Unknown
//IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references)
//IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references)
//IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references)
//IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references)
//IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references)
//IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references)
//IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references)
//IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references)
//IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references)
//IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references)
//IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references)
//IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references)
//IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references)
//IL_01dd: Expected O, but got Unknown //IL_01dd: Expected O, but got Unknown
//IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: 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_01fe: Unknown result type (might be due to invalid IL or missing references)
//IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references)
//IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references)
//IL_022c: Expected O, but got Unknown //IL_022c: Expected O, but got Unknown
//IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references)
//IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_0249: 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_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_0254: Unknown result type (might be due to invalid IL or missing references)
//IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references)
//IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references)
//IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references)
//IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references)
//IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references)
//IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_0273: 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_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_027d: Unknown result type (might be due to invalid IL or missing references)
//IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references)
//IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_029b: 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_02aa: Unknown result type (might be due to invalid IL or missing references)
//IL_02b9: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: Unknown result type (might be due to invalid IL or missing references)
//IL_02db: Expected O, but got Unknown //IL_02db: Expected O, but got Unknown
version = 0; version = 0;
int num = 0; int num = 0;
if (!File.Exists(path)) if (!File.Exists(path))
{ {
throw new AutoMorpherException("Profile BVH File Not Found", "[ProfileLoader] LoadProfileBVHData\n - file not found\n - path : " + path); throw new AutoMorpherException("Profile BVH File Not Found", "[ProfileLoader] LoadProfileBVHData\n - file not found\n - path : " + path);
} }
string text = File.ReadAllText(path, Encoding.UTF8); string text = File.ReadAllText(path, Encoding.UTF8);
int num2 = 0; int num2 = 0;
ProfileUtils val = new ProfileUtils(); ProfileUtils val = new ProfileUtils();
string profileMagic = val.GetProfileMagic(); string profileMagic = val.GetProfileMagic();
if (text.Length < profileMagic.Length || text.Substring(0, profileMagic.Length) != profileMagic) if (text.Length < profileMagic.Length || text.Substring(0, profileMagic.Length) != profileMagic)
{ {
throw new AutoMorpherException("Profile BVH Magic Mismatch", "[ProfileLoader] LoadProfileBVHData\n - magic string mismatch\n - invalid or corrupted BVH file"); throw new AutoMorpherException("Profile BVH Magic Mismatch", "[ProfileLoader] LoadProfileBVHData\n - magic string mismatch\n - invalid or corrupted BVH file");
} }
num2 += profileMagic.Length; num2 += profileMagic.Length;
version = ReadHexIntSafe(text, ref num2); version = this.ReadHexIntSafe(text, ref num2);
num = ReadHexIntSafe(text, ref num2); num = this.ReadHexIntSafe(text, ref num2);
int num3 = ReadHexIntSafe(text, ref num2); int num3 = this.ReadHexIntSafe(text, ref num2);
int num4 = ReadHexIntSafe(text, ref num2); int num4 = this.ReadHexIntSafe(text, ref num2);
int num5 = ReadHexIntSafe(text, ref num2); int num5 = this.ReadHexIntSafe(text, ref num2);
int num6 = ReadHexIntSafe(text, ref num2); int num6 = this.ReadHexIntSafe(text, ref num2);
if (num3 < 0 || num4 < 0 || num5 < 0 || num6 < 0) if (num3 < 0 || num4 < 0 || num5 < 0 || num6 < 0)
{ {
throw new AutoMorpherException("Profile BVH Count Data is Invalid", "[ProfileLoader] LoadProfileBVHData\n - one or more count values are negative"); throw new AutoMorpherException("Profile BVH Count Data is Invalid", "[ProfileLoader] LoadProfileBVHData\n - one or more count values are negative");
} }
Vector3[] array = (Vector3[])(object)new Vector3[num3]; Vector3[] array = (Vector3[])(object)new Vector3[num3];
for (int i = 0; i < num3; i++) for (int i = 0; i < num3; i++)
{ {
array[i] = ReadHexVec3Safe(text, ref num2); array[i] = this.ReadHexVec3Safe(text, ref num2);
} }
int num7 = default(int); int num7 = default(int);
int num8 = default(int); int num8 = default(int);
BaseKey3[] array2 = new ProfileUtils_VertexUtil().LoadTable(val.GetBaseDataPath(), ref num7, ref num8); BaseKey3[] array2 = new ProfileUtils_VertexUtil().LoadTable(val.GetBaseDataPath(), out num7, out num8);
if (array2 == null || array2.Length == 0) if (array2 == null || array2.Length == 0)
{ {
throw new AutoMorpherException("Profile BVH Base Vertex Table is Invalid", "[ProfileLoader] LoadProfileBVHData\n - base vertex table is null or empty"); throw new AutoMorpherException("Profile BVH Base Vertex Table is Invalid", "[ProfileLoader] LoadProfileBVHData\n - base vertex table is null or empty");
} }
ProfileUtil_IndexUtil val2 = new ProfileUtil_IndexUtil(9783); ProfileUtil_IndexUtil val2 = new ProfileUtil_IndexUtil(9783);
val2.Build(num); val2.Build(num);
Vector3[] array3 = (Vector3[])(object)new Vector3[num3]; Vector3[] array3 = (Vector3[])(object)new Vector3[num3];
val2.DecodeInto(array, array3); val2.DecodeInto(array, array3);
Vector3[] array4 = (Vector3[])(object)new Vector3[num3]; Vector3[] array4 = (Vector3[])(object)new Vector3[num3];
for (int j = 0; j < num3; j++) for (int j = 0; j < num3; j++)
{ {
array4[j] = TransformVec3(array3[j], array2[j % array2.Length]); array4[j] = this.TransformVec3(array3[j], array2[j % array2.Length]);
} }
ProfileBVH val3 = new ProfileBVH ProfileBVH val3 = new ProfileBVH
{ {
vertices = new List<Vector3>(num3), vertices = new List<Vector3>(num3),
datas = (profileBVHData[])(object)new profileBVHData[num4], datas = (profileBVHData[])(object)new profileBVHData[num4],
nodes = (profileBVHNode[])(object)new profileBVHNode[num5], nodes = (profileBVHNode[])(object)new profileBVHNode[num5],
dataIndices = new int[num6] dataIndices = new int[num6]
}; };
val3.vertices.AddRange(array4); val3.vertices.AddRange(array4);
for (int k = 0; k < num4; k++) for (int k = 0; k < num4; k++)
{ {
val3.datas[k] = new profileBVHData val3.datas[k] = new profileBVHData
{ {
verA = ReadHexIntSafe(text, ref num2), verA = this.ReadHexIntSafe(text, ref num2),
verB = ReadHexIntSafe(text, ref num2), verB = this.ReadHexIntSafe(text, ref num2),
verC = ReadHexIntSafe(text, ref num2) verC = this.ReadHexIntSafe(text, ref num2)
}; };
} }
for (int l = 0; l < num5; l++) for (int l = 0; l < num5; l++)
{ {
Vector3 val4 = ReadHexVec3Safe(text, ref num2); Vector3 val4 = this.ReadHexVec3Safe(text, ref num2);
Vector3 val5 = ReadHexVec3Safe(text, ref num2); Vector3 val5 = this.ReadHexVec3Safe(text, ref num2);
val3.nodes[l] = new profileBVHNode val3.nodes[l] = new profileBVHNode
{ {
bounds = new Bounds(val4, val5 * 2f), bounds = new Bounds(val4, val5 * 2f),
leftChild = ReadHexIntSafe(text, ref num2), leftChild = this.ReadHexIntSafe(text, ref num2),
rightChild = ReadHexIntSafe(text, ref num2), rightChild = this.ReadHexIntSafe(text, ref num2),
start = ReadHexIntSafe(text, ref num2), start = this.ReadHexIntSafe(text, ref num2),
count = ReadHexIntSafe(text, ref num2), count = this.ReadHexIntSafe(text, ref num2),
isLeaf = (num2 < text.Length && text[num2++] == '1') isLeaf = (num2 < text.Length && text[num2++] == '1')
}; };
} }
for (int m = 0; m < num6; m++) for (int m = 0; m < num6; m++)
{ {
val3.dataIndices[m] = ReadHexIntSafe(text, ref num2); val3.dataIndices[m] = this.ReadHexIntSafe(text, ref num2);
} }
return val3; return val3;
} }
private int ReadHexIntSafe(string s, ref int p) private int ReadHexIntSafe(string s, ref int p)
{ {
if (p + 8 > s.Length) if (p + 8 > s.Length)
{ {
p = s.Length; p = s.Length;
throw new AutoMorpherException("Profile BVH ReadHexInt Out of Range", "[ProfileBVH] ReadHexIntSafe\n - read position exceeds string length"); throw new AutoMorpherException("Profile BVH ReadHexInt Out of Range", "[ProfileBVH] ReadHexIntSafe\n - read position exceeds string length");
} }
uint result = Convert.ToUInt32(s.Substring(p, 8), 16); uint result = Convert.ToUInt32(s.Substring(p, 8), 16);
p += 8; p += 8;
return (int)result; return (int)result;
} }
private Vector3 ReadHexVec3Safe(string s, ref int p) private Vector3 ReadHexVec3Safe(string s, ref int p)
{ {
//IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references)
return new Vector3(ReadHexFloatSafe(s, ref p), ReadHexFloatSafe(s, ref p), ReadHexFloatSafe(s, ref p)); return new Vector3(this.ReadHexFloatSafe(s, ref p), this.ReadHexFloatSafe(s, ref p), this.ReadHexFloatSafe(s, ref p));
} }
private float ReadHexFloatSafe(string s, ref int p) private float ReadHexFloatSafe(string s, ref int p)
{ {
if (p + 8 > s.Length) if (p + 8 > s.Length)
{ {
p = s.Length; p = s.Length;
throw new AutoMorpherException("Profile BVH ReadHexFloat Out of Range", "[ProfileBVH] ReadHexFloat\n - read position exceeds string length"); throw new AutoMorpherException("Profile BVH ReadHexFloat Out of Range", "[ProfileBVH] ReadHexFloat\n - read position exceeds string length");
} }
uint value = Convert.ToUInt32(s.Substring(p, 8), 16); uint value = Convert.ToUInt32(s.Substring(p, 8), 16);
p += 8; p += 8;
return BitConverter.Int32BitsToSingle((int)value); return BitConverter.Int32BitsToSingle((int)value);
} }
private Vector3 TransformVec3(Vector3 v, BaseKey3 k) private Vector3 TransformVec3(Vector3 v, BaseKey3 k)
{ {
//IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references)
return new Vector3(TransformFloatBits(v.x, k.x), TransformFloatBits(v.y, k.y), TransformFloatBits(v.z, k.z)); return new Vector3(this.TransformFloatBits(v.x, k.x), this.TransformFloatBits(v.y, k.y), this.TransformFloatBits(v.z, k.z));
} }
private float TransformFloatBits(float a, uint keyBits) private float TransformFloatBits(float a, uint keyBits)
{ {
return BitConverter.Int32BitsToSingle(BitConverter.SingleToInt32Bits(a) ^ (int)keyBits); return BitConverter.Int32BitsToSingle(BitConverter.SingleToInt32Bits(a) ^ (int)keyBits);
} }
private Vector3 ComputeTriangleNormal(Vector3 a, Vector3 b, Vector3 c) private Vector3 ComputeTriangleNormal(Vector3 a, Vector3 b, Vector3 c)
{ {
//IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = Vector3.Cross(b - a, c - a); Vector3 val = Vector3.Cross(b - a, c - a);
float magnitude = ((Vector3)(ref val)).magnitude; float magnitude = val.magnitude;
if (magnitude > 1E-08f) if (magnitude > 1E-08f)
{ {
return val / magnitude; return val / magnitude;
} }
return Vector3.up; return Vector3.up;
} }
private Bounds TransformBoundsToWorldAABB(Matrix4x4 l2w, Bounds localBounds) private Bounds TransformBoundsToWorldAABB(Matrix4x4 l2w, Bounds localBounds)
{ {
//IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references) //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_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_006e: 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_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0084: 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_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: 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_00aa: 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_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_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references)
//IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: 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_00ef: Unknown result type (might be due to invalid IL or missing references)
//IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references)
//IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references)
//IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: 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_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010a: 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_0111: Unknown result type (might be due to invalid IL or missing references)
//IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references)
//IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references)
//IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references)
//IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references)
//IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0131: 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_0137: Unknown result type (might be due to invalid IL or missing references)
//IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references)
//IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references)
//IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references)
//IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references)
//IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references)
//IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references)
//IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0152: 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_015d: Unknown result type (might be due to invalid IL or missing references)
//IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references)
//IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references)
//IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references)
//IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_018c: 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_0198: Unknown result type (might be due to invalid IL or missing references)
//IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references)
//IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references)
//IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references)
//IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references)
//IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references)
//IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references)
//IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references)
//IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references)
Vector3 center = ((Bounds)(ref localBounds)).center; Vector3 center = localBounds.center;
Vector3 extents = ((Bounds)(ref localBounds)).extents; Vector3 extents = localBounds.extents;
Vector3 val = ((Matrix4x4)(ref l2w)).MultiplyPoint3x4(center + new Vector3(0f - extents.x, 0f - extents.y, 0f - extents.z)); Vector3 val = l2w.MultiplyPoint3x4(center + new Vector3(0f - extents.x, 0f - extents.y, 0f - extents.z));
Vector3 p = ((Matrix4x4)(ref l2w)).MultiplyPoint3x4(center + new Vector3(0f - extents.x, 0f - extents.y, extents.z)); Vector3 p = l2w.MultiplyPoint3x4(center + new Vector3(0f - extents.x, 0f - extents.y, extents.z));
Vector3 p2 = ((Matrix4x4)(ref l2w)).MultiplyPoint3x4(center + new Vector3(0f - extents.x, extents.y, 0f - extents.z)); Vector3 p2 = l2w.MultiplyPoint3x4(center + new Vector3(0f - extents.x, extents.y, 0f - extents.z));
Vector3 p3 = ((Matrix4x4)(ref l2w)).MultiplyPoint3x4(center + new Vector3(0f - extents.x, extents.y, extents.z)); Vector3 p3 = l2w.MultiplyPoint3x4(center + new Vector3(0f - extents.x, extents.y, extents.z));
Vector3 p4 = ((Matrix4x4)(ref l2w)).MultiplyPoint3x4(center + new Vector3(extents.x, 0f - extents.y, 0f - extents.z)); Vector3 p4 = l2w.MultiplyPoint3x4(center + new Vector3(extents.x, 0f - extents.y, 0f - extents.z));
Vector3 p5 = ((Matrix4x4)(ref l2w)).MultiplyPoint3x4(center + new Vector3(extents.x, 0f - extents.y, extents.z)); Vector3 p5 = l2w.MultiplyPoint3x4(center + new Vector3(extents.x, 0f - extents.y, extents.z));
Vector3 p6 = ((Matrix4x4)(ref l2w)).MultiplyPoint3x4(center + new Vector3(extents.x, extents.y, 0f - extents.z)); Vector3 p6 = l2w.MultiplyPoint3x4(center + new Vector3(extents.x, extents.y, 0f - extents.z));
Vector3 p7 = ((Matrix4x4)(ref l2w)).MultiplyPoint3x4(center + new Vector3(extents.x, extents.y, extents.z)); Vector3 p7 = l2w.MultiplyPoint3x4(center + new Vector3(extents.x, extents.y, extents.z));
Vector3 min = val; Vector3 min = val;
Vector3 max = val; Vector3 max = val;
Encapsulate(ref min, ref max, p); this.Encapsulate(ref min, ref max, p);
Encapsulate(ref min, ref max, p2); this.Encapsulate(ref min, ref max, p2);
Encapsulate(ref min, ref max, p3); this.Encapsulate(ref min, ref max, p3);
Encapsulate(ref min, ref max, p4); this.Encapsulate(ref min, ref max, p4);
Encapsulate(ref min, ref max, p5); this.Encapsulate(ref min, ref max, p5);
Encapsulate(ref min, ref max, p6); this.Encapsulate(ref min, ref max, p6);
Encapsulate(ref min, ref max, p7); this.Encapsulate(ref min, ref max, p7);
return new Bounds((min + max) * 0.5f, max - min); return new Bounds((min + max) * 0.5f, max - min);
} }
private void Encapsulate(ref Vector3 min, ref Vector3 max, Vector3 p) private void Encapsulate(ref Vector3 min, ref Vector3 max, Vector3 p)
{ {
//IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references)
min = Vector3.Min(min, p); min = Vector3.Min(min, p);
max = Vector3.Max(max, p); max = Vector3.Max(max, p);
} }
} }

View File

@@ -1,89 +1,87 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // 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. // 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 // EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.profile.ProfilePoseMatchUtil // Eden.AutoMorpher.profile.ProfilePoseMatchUtil
using System.Collections.Generic; using System.Collections.Generic;
using Eden.AutoMorpher;
using Eden.AutoMorpher.profile;
using UnityEngine; using UnityEngine;
public class ProfilePoseMatchUtil public class ProfilePoseMatchUtil
{ {
private WorldVertexUtil _worldVertexUtil; private WorldVertexUtil _worldVertexUtil;
private MeshClassifier meshClassifier; private MeshClassifier meshClassifier;
public ProfilePoseMatchUtil() public ProfilePoseMatchUtil()
{ {
_worldVertexUtil = new WorldVertexUtil(); this._worldVertexUtil = new WorldVertexUtil();
meshClassifier = new MeshClassifier(); this.meshClassifier = new MeshClassifier();
} }
public void ProfilePoseMatcher(GameObject targetAvatar, IReadOnlyList<SkinnedMeshRenderer> targetBodyMeshes, GameObject targetCloth, ProfileData profileData, Dictionary<HumanBodyBones, HashSet<Transform>> clothHumanBonesMap, Dictionary<Transform, ClothBoneType> clothBoneTypeMap, float neckTargetHeight = 1.5f) public void ProfilePoseMatcher(GameObject targetAvatar, IReadOnlyList<SkinnedMeshRenderer> targetBodyMeshes, GameObject targetCloth, ProfileData profileData, Dictionary<HumanBodyBones, HashSet<Transform>> clothHumanBonesMap, Dictionary<Transform, ClothBoneType> clothBoneTypeMap, float neckTargetHeight = 1.5f)
{ {
//IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references)
//IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references)
//IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references)
//IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references)
//IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references)
//IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references)
//IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references)
//IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)targetAvatar == (Object)null) if ((Object)(object)targetAvatar == (Object)null)
{ {
throw new AutoMorpherException("Target Avatar is Null", "[ProfilePoseMatchUtil] ProfilePoseMatcher\n - targetAvatar is null"); throw new AutoMorpherException("Target Avatar is Null", "[ProfilePoseMatchUtil] ProfilePoseMatcher\n - targetAvatar is null");
} }
if ((Object)(object)targetAvatar.GetComponent<Animator>() == (Object)null) if ((Object)(object)targetAvatar.GetComponent<Animator>() == (Object)null)
{ {
throw new AutoMorpherException("Target Avatar Animator is Null", "[ProfilePoseMatchUtil] ProfilePoseMatcher\n - targetAvatar has no animator"); throw new AutoMorpherException("Target Avatar Animator is Null", "[ProfilePoseMatchUtil] ProfilePoseMatcher\n - targetAvatar has no animator");
} }
if (targetBodyMeshes == null || targetBodyMeshes.Count == 0) if (targetBodyMeshes == null || targetBodyMeshes.Count == 0)
{ {
throw new AutoMorpherException("Target Body Meshes are Missing", "[ProfilePoseMatchUtil] ProfilePoseMatcher\n - targetBodyMeshes is null or empty"); throw new AutoMorpherException("Target Body Meshes are Missing", "[ProfilePoseMatchUtil] ProfilePoseMatcher\n - targetBodyMeshes is null or empty");
} }
if ((Object)(object)targetCloth == (Object)null) if ((Object)(object)targetCloth == (Object)null)
{ {
throw new AutoMorpherException("Target Cloth is Null", "[ProfilePoseMatchUtil] ProfilePoseMatcher\n - targetCloth is null"); throw new AutoMorpherException("Target Cloth is Null", "[ProfilePoseMatchUtil] ProfilePoseMatcher\n - targetCloth is null");
} }
if (profileData == null) if (profileData == null)
{ {
throw new AutoMorpherException("Profile Data is Null", "[ProfilePoseMatchUtil] ProfilePoseMatcher\n - profileData is null"); throw new AutoMorpherException("Profile Data is Null", "[ProfilePoseMatchUtil] ProfilePoseMatcher\n - profileData is null");
} }
if (clothHumanBonesMap == null || clothHumanBonesMap.Count == 0 || clothBoneTypeMap == null || clothBoneTypeMap.Count == 0) if (clothHumanBonesMap == null || clothHumanBonesMap.Count == 0 || clothBoneTypeMap == null || clothBoneTypeMap.Count == 0)
{ {
throw new AutoMorpherException("Clothing Bone Match Data is Missing", "[ProfilePoseMatchUtil] ProfilePoseMatcher\n - profile Clothe Bone Match Data is null or empty"); throw new AutoMorpherException("Clothing Bone Match Data is Missing", "[ProfilePoseMatchUtil] ProfilePoseMatcher\n - profile Clothe Bone Match Data is null or empty");
} }
Transform transform = targetAvatar.transform; Transform transform = targetAvatar.transform;
Transform transform2 = targetCloth.transform; Transform transform2 = targetCloth.transform;
Transform parent = transform.parent; Transform parent = transform.parent;
transform.SetParent((Transform)null, true); transform.SetParent((Transform)null, true);
Transform parent2 = transform2.parent; Transform parent2 = transform2.parent;
transform2.SetParent((Transform)null, true); transform2.SetParent((Transform)null, true);
transform2.position = transform.position; transform2.position = transform.position;
Dictionary<HumanBodyBones, HashSet<Transform>> dictionary = meshClassifier.MeshHumanoidBoneMatcher(targetAvatar.GetComponent<Animator>(), targetBodyMeshes); Dictionary<HumanBodyBones, HashSet<Transform>> dictionary = this.meshClassifier.MeshHumanoidBoneMatcher(targetAvatar.GetComponent<Animator>(), targetBodyMeshes);
if (dictionary == null || dictionary.Count == 0) if (dictionary == null || dictionary.Count == 0)
{ {
throw new AutoMorpherException("Target Avatar Bone Match Data is Missing", "[ProfilePoseMatchUtil] ProfilePoseMatcher\n - target Avatar Bone Match Data is null or empty"); throw new AutoMorpherException("Target Avatar Bone Match Data is Missing", "[ProfilePoseMatchUtil] ProfilePoseMatcher\n - target Avatar Bone Match Data is null or empty");
} }
BodyPoseMatchSetupUtil bodyPoseMatchSetupUtil = new BodyPoseMatchSetupUtil(); BodyPoseMatchSetupUtil bodyPoseMatchSetupUtil = new BodyPoseMatchSetupUtil();
Vector3 comprehensiveScale = bodyPoseMatchSetupUtil.GetComprehensiveScale(transform2, clothHumanBonesMap, profileData); Vector3 comprehensiveScale = bodyPoseMatchSetupUtil.GetComprehensiveScale(transform2, clothHumanBonesMap, profileData);
Debug.Log((object)$"ComprehensiveScale: {comprehensiveScale}"); Debug.Log((object)$"ComprehensiveScale: {comprehensiveScale}");
bodyPoseMatchSetupUtil.AdjustAvatarScaleByNeck(transform, dictionary, neckTargetHeight); bodyPoseMatchSetupUtil.AdjustAvatarScaleByNeck(transform, dictionary, neckTargetHeight);
bodyPoseMatchSetupUtil.AdjustAvatarScaleByNeck(transform2, clothHumanBonesMap, neckTargetHeight); bodyPoseMatchSetupUtil.AdjustAvatarScaleByNeck(transform2, clothHumanBonesMap, neckTargetHeight);
List<BakedBodyMesh> list = new List<BakedBodyMesh>(); List<BakedBodyMesh> list = new List<BakedBodyMesh>();
foreach (SkinnedMeshRenderer targetBodyMesh in targetBodyMeshes) foreach (SkinnedMeshRenderer targetBodyMesh in targetBodyMeshes)
{ {
list.Add(new BakedBodyMesh(targetBodyMesh)); list.Add(new BakedBodyMesh(targetBodyMesh));
} }
new BodyPoseMatch_Torso().AlignTorsoByNeck(transform, list, dictionary, clothHumanBonesMap, transform2, profileData, comprehensiveScale); new BodyPoseMatch_Torso().AlignTorsoByNeck(transform, list, dictionary, clothHumanBonesMap, transform2, profileData, comprehensiveScale);
BodyPoseMatch_Arm bodyPoseMatch_Arm = new BodyPoseMatch_Arm(); BodyPoseMatch_Arm bodyPoseMatch_Arm = new BodyPoseMatch_Arm();
bodyPoseMatch_Arm.AlignUpperArmByArmPcaCenters(list, dictionary, clothHumanBonesMap, transform2, profileData, comprehensiveScale); bodyPoseMatch_Arm.AlignUpperArmByArmPcaCenters(list, dictionary, clothHumanBonesMap, transform2, profileData, comprehensiveScale);
bodyPoseMatch_Arm.ScalingBothArmsLength(list, dictionary, clothHumanBonesMap, profileData, comprehensiveScale); bodyPoseMatch_Arm.ScalingBothArmsLength(list, dictionary, clothHumanBonesMap, profileData, comprehensiveScale);
BodyPoseMatch_Leg bodyPoseMatch_Leg = new BodyPoseMatch_Leg(); BodyPoseMatch_Leg bodyPoseMatch_Leg = new BodyPoseMatch_Leg();
bodyPoseMatch_Leg.AlignBothUpperLegs(transform, list, dictionary, transform2, clothHumanBonesMap, profileData, comprehensiveScale); bodyPoseMatch_Leg.AlignBothUpperLegs(transform, list, dictionary, transform2, clothHumanBonesMap, profileData, comprehensiveScale);
bodyPoseMatch_Leg.ScalingBothLegsAndFoots(transform, list, dictionary, transform2, clothHumanBonesMap, profileData, comprehensiveScale); bodyPoseMatch_Leg.ScalingBothLegsAndFoots(transform, list, dictionary, transform2, clothHumanBonesMap, profileData, comprehensiveScale);
transform.SetParent(parent, true); transform.SetParent(parent, true);
transform2.SetParent(parent2, true); transform2.SetParent(parent2, true);
} }
} }