Compare commits

..

9 Commits

Author SHA1 Message Date
793e544eb0 포매팅 2026-02-01 19:42:47 +09:00
e4566118f7 EdenAutoMorpherEditor 디컴파일 소스 추가 2026-02-01 19:42:18 +09:00
7637ff2ac0 수동 정제 2026-02-01 19:40:04 +09:00
6c2bb74df3 포매팅 2026-02-01 19:30:24 +09:00
34507ca208 EdenAutoMorpherScript 디컴파일 소스 추가 2026-02-01 19:26:39 +09:00
15efd5b720 포매팅 2026-02-01 19:23:23 +09:00
ff3a3c522e EdenAutoMorpher_ProfileSaver_Editor 디컴파일 소스 추가 2026-02-01 19:23:02 +09:00
bf39155bf3 포매팅 2026-02-01 19:20:25 +09:00
5d4f773fe5 EdenAutoMorpher_ProfileSaver_Script 디컴파일 소스 추가 2026-02-01 19:19:37 +09:00
108 changed files with 5209 additions and 6270 deletions

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: dcd2dae79e135544e8f59bbfd335d224
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,139 @@
// 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.
// EdenAutoMorpherEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.AutoMorpherLogCollector
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using UnityEditor;
using UnityEngine;
public class AutoMorpherLogCollector
{
private struct LogEntry
{
public DateTime utcTime;
public LogType type;
public string condition;
public string stackTrace;
}
private bool _isCapturing;
private DateTime _captureStartUtc;
private readonly List<LogEntry> _entries = new List<LogEntry>(2048);
private int entriesCapacity = 5000;
private const string logSavePath = "Assets/@Eden_Tools/Eden_AutoMorpher/Logs";
public void BeginCapture()
{
if (!this._isCapturing)
{
this._isCapturing = true;
this._entries.Clear();
this._captureStartUtc = DateTime.UtcNow;
Application.logMessageReceived += this.OnLogMessageReceived;
}
}
public void EndCapture()
{
if (this._isCapturing)
{
this._isCapturing = false;
Application.logMessageReceived -= this.OnLogMessageReceived;
}
}
public string SaveToTextFile(string defaultFileName, bool includeWarningsAndInfo)
{
this.EnsureLogDirectoryExists();
string text = defaultFileName;
if (string.IsNullOrEmpty(text))
{
text = "EdenAutoMorpher_Report.txt";
}
if (!text.EndsWith(".txt", StringComparison.OrdinalIgnoreCase))
{
text += ".txt";
}
string text2 = Path.Combine("Assets/@Eden_Tools/Eden_AutoMorpher/Logs", text);
string contents = this.BuildReportText(includeWarningsAndInfo);
File.WriteAllText(text2, contents, Encoding.UTF8);
AssetDatabase.Refresh();
Debug.Log("[AutoMorpher] Log report saved: " + text2);
return text2;
}
private void EnsureLogDirectoryExists()
{
if (AssetDatabase.IsValidFolder("Assets/@Eden_Tools/Eden_AutoMorpher/Logs"))
{
return;
}
string[] array = "Assets/@Eden_Tools/Eden_AutoMorpher/Logs".Split('/', StringSplitOptions.None);
string text = array[0];
for (int i = 1; i < array.Length; i++)
{
string text2 = text + "/" + array[i];
if (!AssetDatabase.IsValidFolder(text2))
{
AssetDatabase.CreateFolder(text, array[i]);
}
text = text2;
}
}
public string BuildReportText(bool includeWarningsAndInfo)
{
StringBuilder stringBuilder = new StringBuilder(65536);
stringBuilder.AppendLine("==== EDEN AUTO MORPHER LOG REPORT ====");
stringBuilder.AppendLine($"Captured (UTC) : {this._captureStartUtc:yyyy-MM-dd HH:mm:ss} ~ {DateTime.UtcNow:yyyy-MM-dd HH:mm:ss}");
stringBuilder.AppendLine("Unity Version : " + Application.unityVersion);
stringBuilder.AppendLine($"Platform : {Application.platform}");
stringBuilder.AppendLine("Project : " + Application.productName);
stringBuilder.AppendLine();
stringBuilder.AppendLine("---- Logs ----");
for (int i = 0; i < this._entries.Count; i++)
{
LogEntry logEntry = this._entries[i];
if (includeWarningsAndInfo || logEntry.type == LogType.Error || logEntry.type == LogType.Assert || logEntry.type == LogType.Exception)
{
stringBuilder.AppendLine($"[{i:0000}] - [{logEntry.type}] | {logEntry.utcTime:HH:mm:ss.fff} UTC");
stringBuilder.AppendLine(logEntry.condition ?? string.Empty);
if (!string.IsNullOrEmpty(logEntry.stackTrace))
{
stringBuilder.AppendLine("Details:");
stringBuilder.AppendLine(logEntry.stackTrace);
}
stringBuilder.AppendLine();
}
}
return stringBuilder.ToString();
}
private void OnLogMessageReceived(string condition, string stackTrace, LogType type)
{
if (this._isCapturing)
{
this._entries.Add(new LogEntry
{
utcTime = DateTime.UtcNow,
type = type,
condition = condition,
stackTrace = stackTrace
});
if (this._entries.Count > this.entriesCapacity)
{
this._entries.RemoveRange(0, 1000);
}
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 48dbd59641bef954eb938512667a41d1

View File

@@ -0,0 +1,304 @@
// 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.
// EdenAutoMorpherEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.AutoMorpherValidator
using Eden.AutoMorpher;
using System.Text;
using UnityEngine;
public class AutoMorpherValidator
{
public bool ValidateAutoModeObjects(GameObject sourceAvatar, GameObject sourceClothes, GameObject targetAvatar, out string errorMessage)
{
return this.ValidateAutoModeObjects_Internal(sourceAvatar, sourceClothes, targetAvatar, out errorMessage);
}
public bool ValidateManualMode_AutoSetup_Objects(GameObject sourceAvatar, GameObject sourceClothes, GameObject targetAvatar, out string errorMessage)
{
return this.ValidateManualMode_AutoSetup_Objects_Internal(sourceAvatar, sourceClothes, targetAvatar, out errorMessage);
}
public bool ValidateManualModeObjects(GameObject sourceAvatar, GameObject sourceClothes, GameObject targetAvatar, GameObject targetClothes, out string errorMessage)
{
return this.ValidateManualModeObjects_Internal(sourceAvatar, sourceClothes, targetAvatar, targetClothes, out errorMessage);
}
public bool ValidateProfileModeObjects(GameObject sourceClothes, GameObject targetAvatar, out string errorMessage)
{
return this.ValidateProfileModeObjects_Internal(sourceClothes, targetAvatar, out errorMessage);
}
public bool ValidateAutoModeObjects_Internal(GameObject sourceAvatar, GameObject sourceClothes, GameObject targetAvatar, out string errorMessage)
{
StringBuilder stringBuilder = new StringBuilder();
this.ObjectNullCheck(stringBuilder, (sourceAvatar, "- Source Avatar Object"), (sourceClothes, "- Source Clothes Object"), (targetAvatar, "- Target Avatar Object"));
if (sourceClothes != null)
{
this.ClothesChildCheck(stringBuilder, sourceAvatar, sourceClothes, LanguageManager.Get("UI.Validator.SourceClothesChildCheck"));
this.HasSMRInClothes(stringBuilder, sourceClothes, "ClothesObject - There is No SkinnedMeshRenderer");
this.HasLocalArmature(stringBuilder, sourceClothes, "Source " + LanguageManager.Get("UI.Validator.ClothesArmatureCheck"));
}
if (sourceAvatar != null)
{
this.IsHumanoid(stringBuilder, sourceAvatar, LanguageManager.Get("UI.Validator.SourceAvatarAnimatorCheck"));
}
if (targetAvatar != null)
{
this.IsHumanoid(stringBuilder, targetAvatar, LanguageManager.Get("UI.Validator.TargetAvatarAnimatorCheck"));
}
if (stringBuilder.Length == 0)
{
errorMessage = null;
return true;
}
errorMessage = "Auto Mode: " + LanguageManager.Get("UI.Validator.Can'tFitting") + stringBuilder.ToString();
return false;
}
public bool ValidateProfileModeObjects_Internal(GameObject sourceClothes, GameObject targetAvatar, out string errorMessage)
{
StringBuilder stringBuilder = new StringBuilder();
this.ObjectNullCheck(stringBuilder, (sourceClothes, "- Source Clothes Object"), (targetAvatar, "- Target Avatar Object"));
if (sourceClothes != null)
{
this.HasSMRInClothes(stringBuilder, sourceClothes, "ClothesObject - There is No SkinnedMeshRenderer");
this.HasLocalArmature(stringBuilder, sourceClothes, "Source " + LanguageManager.Get("UI.Validator.ClothesArmatureCheck"));
}
if (targetAvatar != null)
{
this.IsHumanoid(stringBuilder, targetAvatar, LanguageManager.Get("UI.Validator.TargetAvatarAnimatorCheck"));
}
if (stringBuilder.Length == 0)
{
errorMessage = null;
return true;
}
errorMessage = "Profile Mode: " + LanguageManager.Get("UI.Validator.Can'tFitting") + stringBuilder.ToString();
return false;
}
public bool ValidateManualMode_AutoSetup_Objects_Internal(GameObject sourceAvatar, GameObject sourceClothes, GameObject targetAvatar, out string errorMessage)
{
StringBuilder stringBuilder = new StringBuilder();
this.ObjectNullCheck(stringBuilder, (sourceAvatar, "- Source Avatar Object"), (sourceClothes, "- Source Clothes Object"), (targetAvatar, "- Target Avatar Object"));
if (sourceClothes != null)
{
this.ClothesChildCheck(stringBuilder, sourceAvatar, sourceClothes, LanguageManager.Get("UI.Validator.SourceClothesChildCheck"));
this.HasSMRInClothes(stringBuilder, sourceClothes, "ClothesObject - There is No SkinnedMeshRenderer");
this.HasLocalArmature(stringBuilder, sourceClothes, "Source " + LanguageManager.Get("UI.Validator.ClothesArmatureCheck"));
}
if (sourceAvatar != null)
{
this.IsHumanoid(stringBuilder, sourceAvatar, LanguageManager.Get("UI.Validator.SourceAvatarAnimatorCheck"));
}
if (targetAvatar != null)
{
this.IsHumanoid(stringBuilder, targetAvatar, LanguageManager.Get("UI.Validator.TargetAvatarAnimatorCheck"));
}
if (stringBuilder.Length == 0)
{
errorMessage = null;
return true;
}
errorMessage = "Manual Mode - Auto Setup: " + LanguageManager.Get("UI.Validator.Can'tFitting") + stringBuilder.ToString();
return false;
}
private bool ValidateManualModeObjects_Internal(GameObject sourceAvatar, GameObject sourceClothes, GameObject targetAvatar, GameObject targetClothes, out string errorMessage)
{
StringBuilder stringBuilder = new StringBuilder();
this.ObjectNullCheck(stringBuilder, (sourceAvatar, "- Source Avatar Object"), (sourceClothes, "- Source Clothes Object"), (targetAvatar, "- Target Avatar Object"), (targetClothes, "- Target Clothes Object"));
if (sourceClothes != null)
{
this.ClothesChildCheck(stringBuilder, sourceAvatar, sourceClothes, LanguageManager.Get("UI.Validator.SourceClothesChildCheck"));
this.HasSMRInClothes(stringBuilder, sourceClothes, "ClothesObject - There is No SkinnedMeshRenderer");
this.HasLocalArmature(stringBuilder, sourceClothes, "Source " + LanguageManager.Get("UI.Validator.ClothesArmatureCheck"));
}
if (targetClothes != null)
{
this.ClothesChildCheck(stringBuilder, targetAvatar, targetClothes, LanguageManager.Get("UI.Validator.TargetClothesChildCheck"));
this.HasSMRInClothes(stringBuilder, targetClothes, "ClothesObject - There is No SkinnedMeshRenderer");
this.HasLocalArmature(stringBuilder, targetClothes, "Target " + LanguageManager.Get("UI.Validator.ClothesArmatureCheck"));
}
if (sourceAvatar != null)
{
this.IsHumanoid(stringBuilder, sourceAvatar, LanguageManager.Get("UI.Validator.SourceAvatarAnimatorCheck"));
}
if (targetAvatar != null)
{
this.IsHumanoid(stringBuilder, targetAvatar, LanguageManager.Get("UI.Validator.TargetAvatarAnimatorCheck"));
}
if (sourceClothes != null && targetClothes != null)
{
this.AppendSmrAndVertexCheck(stringBuilder, sourceClothes, targetClothes);
}
if (stringBuilder.Length == 0)
{
errorMessage = null;
return true;
}
errorMessage = "Manual Mode: " + LanguageManager.Get("UI.Validator.Can'tFitting") + stringBuilder.ToString();
return false;
}
private void ObjectNullCheck(StringBuilder sb, params (GameObject obj, string label)[] refs)
{
bool flag = false;
for (int i = 0; i < refs.Length; i++)
{
if (refs[i].obj == null)
{
flag = true;
break;
}
}
if (!flag)
{
return;
}
sb.AppendLine(LanguageManager.Get("UI.Validator.ReferenceCheck"));
for (int j = 0; j < refs.Length; j++)
{
if (refs[j].obj == null)
{
sb.AppendLine(refs[j].label);
}
}
}
private void ClothesChildCheck(StringBuilder sb, GameObject parentObject, GameObject childObject, string messageOnInvalid)
{
if (!(childObject == null) && (parentObject == null || !childObject.transform.IsChildOf(parentObject.transform)))
{
if (sb.Length > 0)
{
sb.AppendLine();
}
sb.AppendLine(messageOnInvalid);
}
}
private void HasSMRInClothes(StringBuilder sb, GameObject clothesRoot, string messageOnInvalid)
{
if (clothesRoot == null)
{
return;
}
SkinnedMeshRenderer[] componentsInChildren = clothesRoot.GetComponentsInChildren<SkinnedMeshRenderer>(includeInactive: true);
if (componentsInChildren == null || componentsInChildren.Length == 0)
{
if (sb.Length > 0)
{
sb.AppendLine();
}
sb.AppendLine(messageOnInvalid);
}
}
private void HasLocalArmature(StringBuilder sb, GameObject clothesRoot, string messageOnInvalid)
{
if (clothesRoot == null)
{
return;
}
SkinnedMeshRenderer[] componentsInChildren = clothesRoot.GetComponentsInChildren<SkinnedMeshRenderer>(includeInactive: true);
if (componentsInChildren == null || componentsInChildren.Length == 0)
{
return;
}
Transform transform = clothesRoot.transform;
bool flag = true;
SkinnedMeshRenderer[] array = componentsInChildren;
for (int i = 0; i < array.Length; i++)
{
Transform[] bones = array[i].bones;
if (bones == null || bones.Length == 0)
{
continue;
}
Transform[] array2 = bones;
foreach (Transform transform2 in array2)
{
if (!(transform2 == null) && !transform2.transform.IsChildOf(transform))
{
flag = false;
}
}
}
if (!flag)
{
if (sb.Length > 0)
{
sb.AppendLine();
}
sb.AppendLine(messageOnInvalid);
}
}
private bool IsHumanoid(StringBuilder sb, GameObject avatarObject, string messageOnInvalid)
{
if (avatarObject == null)
{
return false;
}
Animator component = avatarObject.GetComponent<Animator>();
if (component == null)
{
return false;
}
if (component.avatar == null)
{
return false;
}
if (!component.avatar.isHuman)
{
return false;
}
return true;
}
private void AppendSmrAndVertexCheck(StringBuilder sb, GameObject sourceClothes, GameObject targetClothes)
{
if (sourceClothes == null || targetClothes == null)
{
return;
}
SkinnedMeshRenderer[] componentsInChildren = sourceClothes.GetComponentsInChildren<SkinnedMeshRenderer>(includeInactive: true);
SkinnedMeshRenderer[] componentsInChildren2 = targetClothes.GetComponentsInChildren<SkinnedMeshRenderer>(includeInactive: true);
int num = ((componentsInChildren != null) ? componentsInChildren.Length : 0);
int num2 = ((componentsInChildren2 != null) ? componentsInChildren2.Length : 0);
if (num != num2)
{
if (sb.Length > 0)
{
sb.AppendLine();
}
sb.AppendLine(LanguageManager.Get("UI.Validator.CheckRendererCountCheck"));
sb.AppendLine($"- Source Clothes SMR : {num}");
sb.AppendLine($"- Target Clothes SMR : {num2}");
return;
}
for (int i = 0; i < num; i++)
{
SkinnedMeshRenderer skinnedMeshRenderer = componentsInChildren[i];
SkinnedMeshRenderer skinnedMeshRenderer2 = componentsInChildren2[i];
if (skinnedMeshRenderer == null || skinnedMeshRenderer2 == null)
{
continue;
}
Mesh sharedMesh = skinnedMeshRenderer.sharedMesh;
Mesh sharedMesh2 = skinnedMeshRenderer2.sharedMesh;
if (!(sharedMesh == null) && !(sharedMesh2 == null) && sharedMesh.vertexCount != sharedMesh2.vertexCount)
{
if (sb.Length > 0)
{
sb.AppendLine();
}
sb.AppendLine(LanguageManager.Get("UI.Validator.VertexCountCheck"));
sb.AppendLine($"- Source: {skinnedMeshRenderer.name} (vertices: {sharedMesh.vertexCount})");
sb.AppendLine($"- Target: {skinnedMeshRenderer2.name} (vertices: {sharedMesh2.vertexCount})");
break;
}
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 367e223b416de1d4d92bdcaee21b1df7

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 2a5cebf384008fb4fa1e1141a4845238

View File

@@ -0,0 +1,16 @@
// 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.
// EdenAutoMorpherEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.ResultInfo
public class ResultInfo
{
public bool isComplicated;
public string processTyep = "";
public string processEndState = "";
public string processTime = "";
public string errorMessage = "";
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 45a0e5ffc6837dc48b871f340e85e7a4

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f4b157cb0292d6a43b5b593c5d80b658
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,195 @@
// 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.
// EdenAutoMorpher_ProfileSaver_Editor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// EdenAutoMorpher_ProfileSaverEditor
using Eden.AutoMorpher;
using System;
using System.IO;
using UnityEditor;
using UnityEngine;
[CustomEditor(typeof(EdenAutoMorpher_ProfileSaver))]
public class EdenAutoMorpher_ProfileSaverEditor : Editor
{
private EdenAutoMorpher_ProfileSaver saver;
private ProfileUtils profileUtils;
private string errorMessage;
private bool hasError;
private void OnEnable()
{
this.saver = (EdenAutoMorpher_ProfileSaver)base.target;
this.profileUtils = new ProfileUtils();
}
public override void OnInspectorGUI()
{
base.serializedObject.Update();
this.DrawProfileVersion();
EditorGUILayout.Space(8f);
this.DrawGuideMessage();
EditorGUILayout.Space(10f);
this.DrawRequiredInputFields();
EditorGUILayout.Space(10f);
this.DrawSavePath();
EditorGUILayout.Space(8f);
this.ValidateInputs();
this.DrawErrorMessage();
EditorGUILayout.Space(12f);
this.DrawSaveButton();
base.serializedObject.ApplyModifiedProperties();
}
private void DrawProfileVersion()
{
//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_0036: 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_0038: 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_005c: 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)
int profileVersion = this.profileUtils.GetProfileVersion();
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField("EDEN Auto Morpher - Profile Saver", EditorStyles.boldLabel);
GUILayout.FlexibleSpace();
Language currentLanguage = LanguageManager.CurrentLanguage;
Language val = currentLanguage;
val = (Language)(object)EditorGUILayout.EnumPopup((Enum)(object)currentLanguage, GUILayout.Width(80f));
if (val != currentLanguage)
{
LanguageManager.SetLanguage(val);
GUI.FocusControl(null);
}
EditorGUILayout.EndHorizontal();
EditorGUILayout.LabelField($"Profile Version : {profileVersion}", EditorStyles.boldLabel);
EditorGUILayout.Space(6f);
}
private void DrawGuideMessage()
{
EditorGUILayout.HelpBox("\n" + LanguageManager.Get("UI.ProfileSaver.Guide") + "\n", MessageType.Info);
}
private void DrawRequiredInputFields()
{
EditorGUILayout.LabelField("Required Input Fields", EditorStyles.boldLabel);
using (new EditorGUILayout.VerticalScope(EditorStyles.helpBox))
{
EditorGUI.indentLevel++;
EditorGUILayout.Space(4f);
EditorGUILayout.PropertyField(base.serializedObject.FindProperty("profileName"), new GUIContent("Profile Name", LanguageManager.Get("UI.ProfileSaver.ProfileName.Tooltip")));
EditorGUILayout.Space(6f);
EditorGUILayout.PropertyField(base.serializedObject.FindProperty("sourceAvatar"), new GUIContent("Source Avatar", LanguageManager.Get("UI.ProfileSaver.SourceAvatar.Tooltip")));
EditorGUILayout.Space(6f);
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(base.serializedObject.FindProperty("sourceBodyMeshes"), new GUIContent("Source Body Meshes", LanguageManager.Get("UI.ProfileSaver.SourceBodyMeshes.Tooltip")), true);
EditorGUILayout.Space(4f);
EditorGUI.indentLevel--;
EditorGUI.indentLevel--;
}
}
private void DrawSavePath()
{
EditorGUILayout.LabelField("Save Path", EditorStyles.boldLabel);
string text = Path.Combine(this.profileUtils.GetProfileBasePath(), this.saver.profileName ?? string.Empty);
using (new EditorGUI.DisabledScope(disabled: true))
{
EditorGUILayout.TextField(text);
}
}
private void ValidateInputs()
{
this.errorMessage = "\n";
this.hasError = false;
if (string.IsNullOrEmpty(this.saver.profileName))
{
this.errorMessage = this.errorMessage + LanguageManager.Get("UI.ProfileSaver.Error.ProfileNameEmpty") + "\n";
this.hasError = true;
}
if (this.saver.sourceAvatar == null)
{
this.errorMessage = this.errorMessage + LanguageManager.Get("UI.ProfileSaver.Error.SourceAvatarNull") + "\n";
this.hasError = true;
}
else if (this.saver.sourceAvatar.GetComponent<Animator>() == null)
{
this.errorMessage = this.errorMessage + LanguageManager.Get("UI.ProfileSaver.Error.SourceAvatarAnimatorMissing") + "\n";
this.hasError = true;
}
if (this.saver.sourceBodyMeshes == null || this.saver.sourceBodyMeshes.Count == 0)
{
this.errorMessage = this.errorMessage + LanguageManager.Get("UI.ProfileSaver.Error.SourceBodyMeshesEmpty") + "\n";
this.hasError = true;
}
else
{
if (this.IsBodyMeshesContainNull())
{
this.errorMessage = this.errorMessage + LanguageManager.Get("UI.ProfileSaver.Error.SourceBodyMeshesContainNull") + "\n";
this.hasError = true;
}
if (this.saver.sourceAvatar != null && this.IsBodyMeshNotChildOfAvatar())
{
this.errorMessage = this.errorMessage + LanguageManager.Get("UI.ProfileSaver.Error.BodyMeshNotChildOfAvatar") + "\n";
this.hasError = true;
}
}
if (!this.saver.IsExistBaseData())
{
this.errorMessage = this.errorMessage + LanguageManager.Get("UI.ProfileSaver.Error.BaseDataMissing") + "\n";
this.hasError = true;
}
}
private bool IsBodyMeshesContainNull()
{
foreach (SkinnedMeshRenderer sourceBodyMesh in this.saver.sourceBodyMeshes)
{
if (sourceBodyMesh == null)
{
return true;
}
}
return false;
}
private bool IsBodyMeshNotChildOfAvatar()
{
foreach (SkinnedMeshRenderer sourceBodyMesh in this.saver.sourceBodyMeshes)
{
if (sourceBodyMesh != null && !sourceBodyMesh.transform.IsChildOf(this.saver.sourceAvatar.transform))
{
return true;
}
}
return false;
}
private void DrawErrorMessage()
{
if (this.hasError)
{
EditorGUILayout.HelpBox(this.errorMessage, MessageType.Error);
}
}
private void DrawSaveButton()
{
using (new EditorGUI.DisabledScope(this.hasError))
{
if (GUILayout.Button("Save Profile", GUILayout.Height(34f)))
{
this.saver.SaveProfile();
}
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 06e603c0e6910f74e8ae69f4b1025e99

View File

@@ -1,6 +1,4 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies.
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.profile.BaseKey3 // Eden.AutoMorpher.profile.BaseKey3
public struct BaseKey3 public struct BaseKey3
{ {

View File

@@ -1,6 +1,4 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies.
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.profile.BoneData // Eden.AutoMorpher.profile.BoneData
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;

View File

@@ -1,6 +1,4 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies.
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.profile.BoneSpatialData // Eden.AutoMorpher.profile.BoneSpatialData
using System; using System;
using UnityEngine; using UnityEngine;

View File

@@ -1,6 +1,4 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies.
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.profile.EdenAutoMorpher_ProfileSaver // Eden.AutoMorpher.profile.EdenAutoMorpher_ProfileSaver
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
@@ -21,33 +19,21 @@ public class EdenAutoMorpher_ProfileSaver : MonoBehaviour
[ContextMenu("SaveProfile")] [ContextMenu("SaveProfile")]
public void SaveProfile() public void SaveProfile()
{ {
//IL_0006: 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_0012: 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_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_0042: 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_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
//IL_0205: Unknown result type (might be due to invalid IL or missing references)
Vector3 position = this.sourceAvatar.position; Vector3 position = this.sourceAvatar.position;
Quaternion rotation = this.sourceAvatar.rotation; Quaternion rotation = this.sourceAvatar.rotation;
Vector3 localScale = this.sourceAvatar.localScale; Vector3 localScale = this.sourceAvatar.localScale;
Transform parent = this.sourceAvatar.parent; Transform parent = this.sourceAvatar.parent;
this.sourceAvatar.SetParent((Transform)null); this.sourceAvatar.SetParent(null);
this.sourceAvatar.position = Vector3.zero; this.sourceAvatar.position = Vector3.zero;
this.sourceAvatar.rotation = Quaternion.identity; this.sourceAvatar.rotation = Quaternion.identity;
this.sourceAvatar.localScale = Vector3.one; this.sourceAvatar.localScale = Vector3.one;
ProfileData newProfileData = new ProfileData(); ProfileData newProfileData = new ProfileData();
ProfileUtils profileUtils = new ProfileUtils(); ProfileUtils profileUtils = new ProfileUtils();
newProfileData.version = profileUtils.GetProfileVersion(); newProfileData.version = profileUtils.GetProfileVersion();
Animator component = ((Component)this.sourceAvatar).GetComponent<Animator>(); Animator component = this.sourceAvatar.GetComponent<Animator>();
if (component == null) if (component == null)
{ {
Debug.LogError((object)("[EdenAutoMorpher_ProfileSaver] Source Avatar Has No Animator\nSet Animator to Source Avatar " + this.sourceAvatar.name)); Debug.LogError("[EdenAutoMorpher_ProfileSaver] Source Avatar Has No Animator\nSet Animator to Source Avatar " + this.sourceAvatar.name);
} }
Dictionary<HumanBodyBones, HashSet<Transform>> humanoidMeshBoneMap = profileUtils.GetHumanoidMeshBoneMap(component, this.sourceBodyMeshes); Dictionary<HumanBodyBones, HashSet<Transform>> humanoidMeshBoneMap = profileUtils.GetHumanoidMeshBoneMap(component, this.sourceBodyMeshes);
List<ProfileBakedBodyMesh> list = new List<ProfileBakedBodyMesh>(); List<ProfileBakedBodyMesh> list = new List<ProfileBakedBodyMesh>();
@@ -78,172 +64,188 @@ public class EdenAutoMorpher_ProfileSaver : MonoBehaviour
ProfileUtils profileUtils = new ProfileUtils(); ProfileUtils profileUtils = new ProfileUtils();
HumanBodyBones[] influencedBones = new HumanBodyBones[1] { HumanBodyBones.Neck }; HumanBodyBones[] influencedBones = new HumanBodyBones[1] { HumanBodyBones.Neck };
newProfileData.NeckSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.Neck, influencedBones, sourceBoneMap, sourceBodyBakedMeshes); newProfileData.NeckSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.Neck, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
influencedBones = new HumanBodyBones[3]
influencedBones = new HumanBodyBones[3] { HumanBodyBones.LeftUpperArm, HumanBodyBones.LeftLowerArm, HumanBodyBones.LeftHand }; {
HumanBodyBones.LeftUpperArm,
HumanBodyBones.LeftLowerArm,
HumanBodyBones.LeftHand
};
newProfileData.LeftUpperArmSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.LeftUpperArm, influencedBones, sourceBoneMap, sourceBodyBakedMeshes); newProfileData.LeftUpperArmSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.LeftUpperArm, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
influencedBones = new HumanBodyBones[3]
influencedBones = new HumanBodyBones[3] { HumanBodyBones.RightUpperArm, HumanBodyBones.RightLowerArm, HumanBodyBones.RightHand }; {
HumanBodyBones.RightUpperArm,
HumanBodyBones.RightLowerArm,
HumanBodyBones.RightHand
};
newProfileData.RightUpperArmSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.RightUpperArm, influencedBones, sourceBoneMap, sourceBodyBakedMeshes); newProfileData.RightUpperArmSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.RightUpperArm, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
influencedBones = new HumanBodyBones[1] { HumanBodyBones.LeftLowerArm }; influencedBones = new HumanBodyBones[1] { HumanBodyBones.LeftLowerArm };
newProfileData.LeftLowerArmSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.LeftLowerArm, influencedBones, sourceBoneMap, sourceBodyBakedMeshes); newProfileData.LeftLowerArmSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.LeftLowerArm, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
influencedBones = new HumanBodyBones[1] { HumanBodyBones.RightLowerArm }; influencedBones = new HumanBodyBones[1] { HumanBodyBones.RightLowerArm };
newProfileData.RightLowerArmSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.RightLowerArm, influencedBones, sourceBoneMap, sourceBodyBakedMeshes); newProfileData.RightLowerArmSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.RightLowerArm, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
influencedBones = new HumanBodyBones[1] { HumanBodyBones.LeftHand }; influencedBones = new HumanBodyBones[1] { HumanBodyBones.LeftHand };
newProfileData.LeftLowerArm_HandSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.LeftLowerArm, influencedBones, sourceBoneMap, sourceBodyBakedMeshes); newProfileData.LeftLowerArm_HandSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.LeftLowerArm, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
influencedBones = new HumanBodyBones[1] { HumanBodyBones.RightHand }; influencedBones = new HumanBodyBones[1] { HumanBodyBones.RightHand };
newProfileData.RightLowerArm_HandSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.RightLowerArm, influencedBones, sourceBoneMap, sourceBodyBakedMeshes); newProfileData.RightLowerArm_HandSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.RightLowerArm, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
influencedBones = new HumanBodyBones[2]
influencedBones = new HumanBodyBones[2] { HumanBodyBones.LeftUpperLeg, HumanBodyBones.LeftLowerLeg }; {
HumanBodyBones.LeftUpperLeg,
HumanBodyBones.LeftLowerLeg
};
newProfileData.LeftUpperLegSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.LeftUpperLeg, influencedBones, sourceBoneMap, sourceBodyBakedMeshes); newProfileData.LeftUpperLegSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.LeftUpperLeg, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
influencedBones = new HumanBodyBones[2]
influencedBones = new HumanBodyBones[2] { HumanBodyBones.RightUpperLeg, HumanBodyBones.RightLowerLeg }; {
HumanBodyBones.RightUpperLeg,
HumanBodyBones.RightLowerLeg
};
newProfileData.RightUpperLegSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.RightUpperLeg, influencedBones, sourceBoneMap, sourceBodyBakedMeshes); newProfileData.RightUpperLegSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.RightUpperLeg, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
influencedBones = new HumanBodyBones[1] { HumanBodyBones.LeftFoot }; influencedBones = new HumanBodyBones[1] { HumanBodyBones.LeftFoot };
newProfileData.LeftFootSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.LeftFoot, influencedBones, sourceBoneMap, sourceBodyBakedMeshes, addChildBones: true); newProfileData.LeftFootSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.LeftFoot, influencedBones, sourceBoneMap, sourceBodyBakedMeshes, addChildBones: true);
influencedBones = new HumanBodyBones[1] { HumanBodyBones.RightFoot }; influencedBones = new HumanBodyBones[1] { HumanBodyBones.RightFoot };
newProfileData.RightFootSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.RightFoot, influencedBones, sourceBoneMap, sourceBodyBakedMeshes, addChildBones: true); newProfileData.RightFootSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.RightFoot, influencedBones, sourceBoneMap, sourceBodyBakedMeshes, addChildBones: true);
influencedBones = new HumanBodyBones[1] { HumanBodyBones.Chest }; influencedBones = new HumanBodyBones[1] { HumanBodyBones.Chest };
newProfileData.ChestSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.Chest, influencedBones, sourceBoneMap, sourceBodyBakedMeshes); newProfileData.ChestSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.Chest, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
influencedBones = new HumanBodyBones[1] { HumanBodyBones.UpperChest }; influencedBones = new HumanBodyBones[1] { HumanBodyBones.UpperChest };
newProfileData.UpperChestSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.UpperChest, influencedBones, sourceBoneMap, sourceBodyBakedMeshes); newProfileData.UpperChestSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.UpperChest, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
influencedBones = new HumanBodyBones[2]
influencedBones = new HumanBodyBones[2] { HumanBodyBones.Chest, HumanBodyBones.UpperChest }; {
HumanBodyBones.Chest,
HumanBodyBones.UpperChest
};
newProfileData.IntegratedChestSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.Chest, influencedBones, sourceBoneMap, sourceBodyBakedMeshes); newProfileData.IntegratedChestSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.Chest, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
influencedBones = new HumanBodyBones[1] { HumanBodyBones.Spine }; influencedBones = new HumanBodyBones[1] { HumanBodyBones.Spine };
newProfileData.SpineSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.Spine, influencedBones, sourceBoneMap, sourceBodyBakedMeshes); newProfileData.SpineSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.Spine, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
influencedBones = new HumanBodyBones[1] { HumanBodyBones.LeftHand }; influencedBones = new HumanBodyBones[1] { HumanBodyBones.LeftHand };
newProfileData.LeftHandSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.LeftHand, influencedBones, sourceBoneMap, sourceBodyBakedMeshes); newProfileData.LeftHandSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.LeftHand, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
influencedBones = new HumanBodyBones[3]
influencedBones = new HumanBodyBones[3] { HumanBodyBones.LeftThumbProximal, HumanBodyBones.LeftThumbIntermediate, HumanBodyBones.LeftThumbDistal }; {
HumanBodyBones.LeftThumbProximal,
HumanBodyBones.LeftThumbIntermediate,
HumanBodyBones.LeftThumbDistal
};
newProfileData.LeftHandThumbSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.LeftThumbProximal, influencedBones, sourceBoneMap, sourceBodyBakedMeshes, addChildBones: true); newProfileData.LeftHandThumbSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.LeftThumbProximal, influencedBones, sourceBoneMap, sourceBodyBakedMeshes, addChildBones: true);
influencedBones = new HumanBodyBones[1] { HumanBodyBones.LeftThumbProximal }; influencedBones = new HumanBodyBones[1] { HumanBodyBones.LeftThumbProximal };
newProfileData.LeftHandThumbProximalSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.LeftThumbProximal, influencedBones, sourceBoneMap, sourceBodyBakedMeshes); newProfileData.LeftHandThumbProximalSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.LeftThumbProximal, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
influencedBones = new HumanBodyBones[1] { HumanBodyBones.LeftThumbIntermediate }; influencedBones = new HumanBodyBones[1] { HumanBodyBones.LeftThumbIntermediate };
newProfileData.LeftHandThumbIntermediateSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.LeftThumbIntermediate, influencedBones, sourceBoneMap, sourceBodyBakedMeshes); newProfileData.LeftHandThumbIntermediateSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.LeftThumbIntermediate, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
influencedBones = new HumanBodyBones[1] { HumanBodyBones.LeftThumbDistal }; influencedBones = new HumanBodyBones[1] { HumanBodyBones.LeftThumbDistal };
newProfileData.LeftHandThumbDistalSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.LeftThumbDistal, influencedBones, sourceBoneMap, sourceBodyBakedMeshes); newProfileData.LeftHandThumbDistalSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.LeftThumbDistal, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
influencedBones = new HumanBodyBones[3]
influencedBones = new HumanBodyBones[3] { HumanBodyBones.LeftIndexProximal, HumanBodyBones.LeftIndexIntermediate, HumanBodyBones.LeftIndexDistal }; {
HumanBodyBones.LeftIndexProximal,
HumanBodyBones.LeftIndexIntermediate,
HumanBodyBones.LeftIndexDistal
};
newProfileData.LeftHandIndexSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.LeftIndexProximal, influencedBones, sourceBoneMap, sourceBodyBakedMeshes, addChildBones: true); newProfileData.LeftHandIndexSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.LeftIndexProximal, influencedBones, sourceBoneMap, sourceBodyBakedMeshes, addChildBones: true);
influencedBones = new HumanBodyBones[1] { HumanBodyBones.LeftIndexProximal }; influencedBones = new HumanBodyBones[1] { HumanBodyBones.LeftIndexProximal };
newProfileData.LeftHandIndexProximalSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.LeftIndexProximal, influencedBones, sourceBoneMap, sourceBodyBakedMeshes); newProfileData.LeftHandIndexProximalSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.LeftIndexProximal, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
influencedBones = new HumanBodyBones[1] { HumanBodyBones.LeftIndexIntermediate }; influencedBones = new HumanBodyBones[1] { HumanBodyBones.LeftIndexIntermediate };
newProfileData.LeftHandIndexIntermediateSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.LeftIndexIntermediate, influencedBones, sourceBoneMap, sourceBodyBakedMeshes); newProfileData.LeftHandIndexIntermediateSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.LeftIndexIntermediate, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
influencedBones = new HumanBodyBones[1] { HumanBodyBones.LeftIndexDistal }; influencedBones = new HumanBodyBones[1] { HumanBodyBones.LeftIndexDistal };
newProfileData.LeftHandIndexDistalSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.LeftIndexDistal, influencedBones, sourceBoneMap, sourceBodyBakedMeshes); newProfileData.LeftHandIndexDistalSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.LeftIndexDistal, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
influencedBones = new HumanBodyBones[3]
influencedBones = new HumanBodyBones[3] { HumanBodyBones.LeftMiddleProximal, HumanBodyBones.LeftMiddleIntermediate, HumanBodyBones.LeftMiddleDistal }; {
HumanBodyBones.LeftMiddleProximal,
HumanBodyBones.LeftMiddleIntermediate,
HumanBodyBones.LeftMiddleDistal
};
newProfileData.LeftHandMiddleSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.LeftMiddleProximal, influencedBones, sourceBoneMap, sourceBodyBakedMeshes, addChildBones: true); newProfileData.LeftHandMiddleSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.LeftMiddleProximal, influencedBones, sourceBoneMap, sourceBodyBakedMeshes, addChildBones: true);
influencedBones = new HumanBodyBones[1] { HumanBodyBones.LeftMiddleProximal }; influencedBones = new HumanBodyBones[1] { HumanBodyBones.LeftMiddleProximal };
newProfileData.LeftHandMiddleProximalSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.LeftMiddleProximal, influencedBones, sourceBoneMap, sourceBodyBakedMeshes); newProfileData.LeftHandMiddleProximalSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.LeftMiddleProximal, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
influencedBones = new HumanBodyBones[1] { HumanBodyBones.LeftMiddleIntermediate }; influencedBones = new HumanBodyBones[1] { HumanBodyBones.LeftMiddleIntermediate };
newProfileData.LeftHandMiddleIntermediateSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.LeftMiddleIntermediate, influencedBones, sourceBoneMap, sourceBodyBakedMeshes); newProfileData.LeftHandMiddleIntermediateSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.LeftMiddleIntermediate, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
influencedBones = new HumanBodyBones[1] { HumanBodyBones.LeftMiddleDistal }; influencedBones = new HumanBodyBones[1] { HumanBodyBones.LeftMiddleDistal };
newProfileData.LeftHandMiddleDistalSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.LeftMiddleDistal, influencedBones, sourceBoneMap, sourceBodyBakedMeshes); newProfileData.LeftHandMiddleDistalSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.LeftMiddleDistal, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
influencedBones = new HumanBodyBones[3]
influencedBones = new HumanBodyBones[3] { HumanBodyBones.LeftRingProximal, HumanBodyBones.LeftRingIntermediate, HumanBodyBones.LeftRingDistal }; {
HumanBodyBones.LeftRingProximal,
HumanBodyBones.LeftRingIntermediate,
HumanBodyBones.LeftRingDistal
};
newProfileData.LeftHandRingSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.LeftRingProximal, influencedBones, sourceBoneMap, sourceBodyBakedMeshes, addChildBones: true); newProfileData.LeftHandRingSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.LeftRingProximal, influencedBones, sourceBoneMap, sourceBodyBakedMeshes, addChildBones: true);
influencedBones = new HumanBodyBones[1] { HumanBodyBones.LeftRingProximal }; influencedBones = new HumanBodyBones[1] { HumanBodyBones.LeftRingProximal };
newProfileData.LeftHandRingProximalSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.LeftRingProximal, influencedBones, sourceBoneMap, sourceBodyBakedMeshes); newProfileData.LeftHandRingProximalSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.LeftRingProximal, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
influencedBones = new HumanBodyBones[1] { HumanBodyBones.LeftRingIntermediate }; influencedBones = new HumanBodyBones[1] { HumanBodyBones.LeftRingIntermediate };
newProfileData.LeftHandRingIntermediateSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.LeftRingIntermediate, influencedBones, sourceBoneMap, sourceBodyBakedMeshes); newProfileData.LeftHandRingIntermediateSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.LeftRingIntermediate, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
influencedBones = new HumanBodyBones[1] { HumanBodyBones.LeftRingDistal }; influencedBones = new HumanBodyBones[1] { HumanBodyBones.LeftRingDistal };
newProfileData.LeftHandRingDistalSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.LeftRingDistal, influencedBones, sourceBoneMap, sourceBodyBakedMeshes); newProfileData.LeftHandRingDistalSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.LeftRingDistal, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
influencedBones = new HumanBodyBones[3]
influencedBones = new HumanBodyBones[3] { HumanBodyBones.LeftLittleProximal, HumanBodyBones.LeftLittleIntermediate, HumanBodyBones.LeftLittleDistal }; {
HumanBodyBones.LeftLittleProximal,
HumanBodyBones.LeftLittleIntermediate,
HumanBodyBones.LeftLittleDistal
};
newProfileData.LeftHandLittleSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.LeftLittleProximal, influencedBones, sourceBoneMap, sourceBodyBakedMeshes, addChildBones: true); newProfileData.LeftHandLittleSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.LeftLittleProximal, influencedBones, sourceBoneMap, sourceBodyBakedMeshes, addChildBones: true);
influencedBones = new HumanBodyBones[1] { HumanBodyBones.LeftLittleProximal }; influencedBones = new HumanBodyBones[1] { HumanBodyBones.LeftLittleProximal };
newProfileData.LeftHandLittleProximalSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.LeftLittleProximal, influencedBones, sourceBoneMap, sourceBodyBakedMeshes); newProfileData.LeftHandLittleProximalSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.LeftLittleProximal, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
influencedBones = new HumanBodyBones[1] { HumanBodyBones.LeftLittleIntermediate }; influencedBones = new HumanBodyBones[1] { HumanBodyBones.LeftLittleIntermediate };
newProfileData.LeftHandLittleIntermediateSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.LeftLittleIntermediate, influencedBones, sourceBoneMap, sourceBodyBakedMeshes); newProfileData.LeftHandLittleIntermediateSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.LeftLittleIntermediate, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
influencedBones = new HumanBodyBones[1] { HumanBodyBones.LeftLittleDistal }; influencedBones = new HumanBodyBones[1] { HumanBodyBones.LeftLittleDistal };
newProfileData.LeftHandLittleDistalSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.LeftLittleDistal, influencedBones, sourceBoneMap, sourceBodyBakedMeshes); newProfileData.LeftHandLittleDistalSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.LeftLittleDistal, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
influencedBones = new HumanBodyBones[1] { HumanBodyBones.RightHand }; influencedBones = new HumanBodyBones[1] { HumanBodyBones.RightHand };
newProfileData.RightHandSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.RightHand, influencedBones, sourceBoneMap, sourceBodyBakedMeshes); newProfileData.RightHandSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.RightHand, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
influencedBones = new HumanBodyBones[3]
influencedBones = new HumanBodyBones[3] { HumanBodyBones.RightThumbProximal, HumanBodyBones.RightThumbIntermediate, HumanBodyBones.RightThumbDistal }; {
HumanBodyBones.RightThumbProximal,
HumanBodyBones.RightThumbIntermediate,
HumanBodyBones.RightThumbDistal
};
newProfileData.RightHandThumbSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.RightThumbProximal, influencedBones, sourceBoneMap, sourceBodyBakedMeshes, addChildBones: true); newProfileData.RightHandThumbSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.RightThumbProximal, influencedBones, sourceBoneMap, sourceBodyBakedMeshes, addChildBones: true);
influencedBones = new HumanBodyBones[1] { HumanBodyBones.RightThumbProximal }; influencedBones = new HumanBodyBones[1] { HumanBodyBones.RightThumbProximal };
newProfileData.RightHandThumbProximalSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.RightThumbProximal, influencedBones, sourceBoneMap, sourceBodyBakedMeshes); newProfileData.RightHandThumbProximalSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.RightThumbProximal, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
influencedBones = new HumanBodyBones[1] { HumanBodyBones.RightThumbIntermediate }; influencedBones = new HumanBodyBones[1] { HumanBodyBones.RightThumbIntermediate };
newProfileData.RightHandThumbIntermediateSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.RightThumbIntermediate, influencedBones, sourceBoneMap, sourceBodyBakedMeshes); newProfileData.RightHandThumbIntermediateSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.RightThumbIntermediate, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
influencedBones = new HumanBodyBones[1] { HumanBodyBones.RightThumbDistal }; influencedBones = new HumanBodyBones[1] { HumanBodyBones.RightThumbDistal };
newProfileData.RightHandThumbDistalSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.RightThumbDistal, influencedBones, sourceBoneMap, sourceBodyBakedMeshes); newProfileData.RightHandThumbDistalSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.RightThumbDistal, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
influencedBones = new HumanBodyBones[3]
influencedBones = new HumanBodyBones[3] { HumanBodyBones.RightIndexProximal, HumanBodyBones.RightIndexIntermediate, HumanBodyBones.RightIndexDistal }; {
HumanBodyBones.RightIndexProximal,
HumanBodyBones.RightIndexIntermediate,
HumanBodyBones.RightIndexDistal
};
newProfileData.RightHandIndexSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.RightIndexProximal, influencedBones, sourceBoneMap, sourceBodyBakedMeshes, addChildBones: true); newProfileData.RightHandIndexSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.RightIndexProximal, influencedBones, sourceBoneMap, sourceBodyBakedMeshes, addChildBones: true);
influencedBones = new HumanBodyBones[1] { HumanBodyBones.RightIndexProximal }; influencedBones = new HumanBodyBones[1] { HumanBodyBones.RightIndexProximal };
newProfileData.RightHandIndexProximalSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.RightIndexProximal, influencedBones, sourceBoneMap, sourceBodyBakedMeshes); newProfileData.RightHandIndexProximalSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.RightIndexProximal, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
influencedBones = new HumanBodyBones[1] { HumanBodyBones.RightIndexIntermediate }; influencedBones = new HumanBodyBones[1] { HumanBodyBones.RightIndexIntermediate };
newProfileData.RightHandIndexIntermediateSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.RightIndexIntermediate, influencedBones, sourceBoneMap, sourceBodyBakedMeshes); newProfileData.RightHandIndexIntermediateSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.RightIndexIntermediate, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
influencedBones = new HumanBodyBones[1] { HumanBodyBones.RightIndexDistal }; influencedBones = new HumanBodyBones[1] { HumanBodyBones.RightIndexDistal };
newProfileData.RightHandIndexDistalSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.RightIndexDistal, influencedBones, sourceBoneMap, sourceBodyBakedMeshes); newProfileData.RightHandIndexDistalSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.RightIndexDistal, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
influencedBones = new HumanBodyBones[3]
influencedBones = new HumanBodyBones[3] { HumanBodyBones.RightMiddleProximal, HumanBodyBones.RightMiddleIntermediate, HumanBodyBones.RightMiddleDistal }; {
HumanBodyBones.RightMiddleProximal,
HumanBodyBones.RightMiddleIntermediate,
HumanBodyBones.RightMiddleDistal
};
newProfileData.RightHandMiddleSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.RightMiddleProximal, influencedBones, sourceBoneMap, sourceBodyBakedMeshes, addChildBones: true); newProfileData.RightHandMiddleSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.RightMiddleProximal, influencedBones, sourceBoneMap, sourceBodyBakedMeshes, addChildBones: true);
influencedBones = new HumanBodyBones[1] { HumanBodyBones.RightMiddleProximal }; influencedBones = new HumanBodyBones[1] { HumanBodyBones.RightMiddleProximal };
newProfileData.RightHandMiddleProximalSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.RightMiddleProximal, influencedBones, sourceBoneMap, sourceBodyBakedMeshes); newProfileData.RightHandMiddleProximalSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.RightMiddleProximal, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
influencedBones = new HumanBodyBones[1] { HumanBodyBones.RightMiddleIntermediate }; influencedBones = new HumanBodyBones[1] { HumanBodyBones.RightMiddleIntermediate };
newProfileData.RightHandMiddleIntermediateSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.RightMiddleIntermediate, influencedBones, sourceBoneMap, sourceBodyBakedMeshes); newProfileData.RightHandMiddleIntermediateSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.RightMiddleIntermediate, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
influencedBones = new HumanBodyBones[1] { HumanBodyBones.RightMiddleDistal }; influencedBones = new HumanBodyBones[1] { HumanBodyBones.RightMiddleDistal };
newProfileData.RightHandMiddleDistalSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.RightMiddleDistal, influencedBones, sourceBoneMap, sourceBodyBakedMeshes); newProfileData.RightHandMiddleDistalSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.RightMiddleDistal, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
influencedBones = new HumanBodyBones[3]
influencedBones = new HumanBodyBones[3] { HumanBodyBones.RightRingProximal, HumanBodyBones.RightRingIntermediate, HumanBodyBones.RightRingDistal }; {
HumanBodyBones.RightRingProximal,
HumanBodyBones.RightRingIntermediate,
HumanBodyBones.RightRingDistal
};
newProfileData.RightHandRingSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.RightRingProximal, influencedBones, sourceBoneMap, sourceBodyBakedMeshes, addChildBones: true); newProfileData.RightHandRingSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.RightRingProximal, influencedBones, sourceBoneMap, sourceBodyBakedMeshes, addChildBones: true);
influencedBones = new HumanBodyBones[1] { HumanBodyBones.RightRingProximal }; influencedBones = new HumanBodyBones[1] { HumanBodyBones.RightRingProximal };
newProfileData.RightHandRingProximalSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.RightRingProximal, influencedBones, sourceBoneMap, sourceBodyBakedMeshes); newProfileData.RightHandRingProximalSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.RightRingProximal, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
influencedBones = new HumanBodyBones[1] { HumanBodyBones.RightRingIntermediate }; influencedBones = new HumanBodyBones[1] { HumanBodyBones.RightRingIntermediate };
newProfileData.RightHandRingIntermediateSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.RightRingIntermediate, influencedBones, sourceBoneMap, sourceBodyBakedMeshes); newProfileData.RightHandRingIntermediateSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.RightRingIntermediate, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
influencedBones = new HumanBodyBones[1] { HumanBodyBones.RightRingDistal }; influencedBones = new HumanBodyBones[1] { HumanBodyBones.RightRingDistal };
newProfileData.RightHandRingDistalSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.RightRingDistal, influencedBones, sourceBoneMap, sourceBodyBakedMeshes); newProfileData.RightHandRingDistalSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.RightRingDistal, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
influencedBones = new HumanBodyBones[3]
influencedBones = new HumanBodyBones[3] { HumanBodyBones.RightLittleProximal, HumanBodyBones.RightLittleIntermediate, HumanBodyBones.RightLittleDistal }; {
HumanBodyBones.RightLittleProximal,
HumanBodyBones.RightLittleIntermediate,
HumanBodyBones.RightLittleDistal
};
newProfileData.RightHandLittleSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.RightLittleProximal, influencedBones, sourceBoneMap, sourceBodyBakedMeshes, addChildBones: true); newProfileData.RightHandLittleSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.RightLittleProximal, influencedBones, sourceBoneMap, sourceBodyBakedMeshes, addChildBones: true);
influencedBones = new HumanBodyBones[1] { HumanBodyBones.RightLittleProximal }; influencedBones = new HumanBodyBones[1] { HumanBodyBones.RightLittleProximal };
newProfileData.RightHandLittleProximalSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.RightLittleProximal, influencedBones, sourceBoneMap, sourceBodyBakedMeshes); newProfileData.RightHandLittleProximalSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.RightLittleProximal, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
influencedBones = new HumanBodyBones[1] { HumanBodyBones.RightLittleIntermediate }; influencedBones = new HumanBodyBones[1] { HumanBodyBones.RightLittleIntermediate };
newProfileData.RightHandLittleIntermediateSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.RightLittleIntermediate, influencedBones, sourceBoneMap, sourceBodyBakedMeshes); newProfileData.RightHandLittleIntermediateSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.RightLittleIntermediate, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
influencedBones = new HumanBodyBones[1] { HumanBodyBones.RightLittleDistal }; influencedBones = new HumanBodyBones[1] { HumanBodyBones.RightLittleDistal };
newProfileData.RightHandLittleDistalSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.RightLittleDistal, influencedBones, sourceBoneMap, sourceBodyBakedMeshes); newProfileData.RightHandLittleDistalSpatialData = profileUtils.GetBoneSpatialData(HumanBodyBones.RightLittleDistal, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
} }
@@ -261,7 +263,7 @@ public class EdenAutoMorpher_ProfileSaver : MonoBehaviour
} }
if (hashSet.Count == 0) if (hashSet.Count == 0)
{ {
Debug.LogWarning((object)"[EdenAutoMorpher_ProfileSaver] SaveBoneData - avatarBones is empty."); Debug.LogWarning("[EdenAutoMorpher_ProfileSaver] SaveBoneData - avatarBones is empty.");
newProfileData.boneRootId = -1; newProfileData.boneRootId = -1;
newProfileData.bones = new List<BoneData>(); newProfileData.bones = new List<BoneData>();
} }
@@ -274,14 +276,6 @@ public class EdenAutoMorpher_ProfileSaver : MonoBehaviour
private void AdjustAvatarHigh(Transform sourceRoot, Dictionary<HumanBodyBones, HashSet<Transform>> sourceBoneMap, float targetHeight) private void AdjustAvatarHigh(Transform sourceRoot, Dictionary<HumanBodyBones, HashSet<Transform>> sourceBoneMap, float targetHeight)
{ {
//IL_0027: 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_006c: 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_0073: 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_007b: 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)
if (!sourceBoneMap.TryGetValue(HumanBodyBones.Neck, out var value) || value.Count == 0) if (!sourceBoneMap.TryGetValue(HumanBodyBones.Neck, out var value) || value.Count == 0)
{ {
Debug.LogError("[EdenAutoMorpher_ProfileSaver] Can't Find Neck Bones"); Debug.LogError("[EdenAutoMorpher_ProfileSaver] Can't Find Neck Bones");
@@ -311,14 +305,14 @@ public class EdenAutoMorpher_ProfileSaver : MonoBehaviour
Debug.LogError("[EdenAutoMorpher_ProfileSaver] profileName is empty."); Debug.LogError("[EdenAutoMorpher_ProfileSaver] profileName is empty.");
return; return;
} }
string path = profileName.EndsWith(".json") ? profileName : (profileName + ".json"); string path = (profileName.EndsWith(".json") ? profileName : (profileName + ".json"));
string text = Path.Combine(Application.dataPath, savePath ?? string.Empty); string text = Path.Combine(Application.dataPath, savePath ?? string.Empty);
if (!Directory.Exists(text)) if (!Directory.Exists(text))
{ {
Directory.CreateDirectory(text); Directory.CreateDirectory(text);
} }
string text2 = Path.Combine(text, path); string text2 = Path.Combine(text, path);
string contents = JsonUtility.ToJson(profileData, true); string contents = JsonUtility.ToJson(profileData, prettyPrint: true);
File.WriteAllText(text2, contents); File.WriteAllText(text2, contents);
Debug.Log("[EdenAutoMorpher_ProfileSaver] Profile saved successfully.\nPath: " + text2); Debug.Log("[EdenAutoMorpher_ProfileSaver] Profile saved successfully.\nPath: " + text2);
AssetDatabase.Refresh(); AssetDatabase.Refresh();

View File

@@ -1,6 +1,4 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies.
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.profile.PCAData // Eden.AutoMorpher.profile.PCAData
using System; using System;
using UnityEngine; using UnityEngine;

View File

@@ -1,6 +1,4 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies.
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.profile.ProfileBVH // Eden.AutoMorpher.profile.ProfileBVH
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;

View File

@@ -1,6 +1,4 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies.
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.profile.ProfileBakedBodyMesh // Eden.AutoMorpher.profile.ProfileBakedBodyMesh
using UnityEngine; using UnityEngine;
@@ -16,7 +14,7 @@ public class ProfileBakedBodyMesh
{ {
get get
{ {
if (!((Object)(object)this.smr != (Object)null)) if (!(this.smr != null))
{ {
return null; return null;
} }
@@ -28,7 +26,7 @@ public class ProfileBakedBodyMesh
{ {
get get
{ {
if (!((Object)(object)this.smr != (Object)null)) if (!(this.smr != null))
{ {
return null; return null;
} }
@@ -38,16 +36,14 @@ public class ProfileBakedBodyMesh
public ProfileBakedBodyMesh(SkinnedMeshRenderer _smr) public ProfileBakedBodyMesh(SkinnedMeshRenderer _smr)
{ {
//IL_0063: Unknown result type (might be due to invalid IL or missing references) if (_smr == null)
//IL_006d: Expected O, but got Unknown
if ((Object)(object)_smr == (Object)null)
{ {
Debug.LogError((object)("[ProfileUtil - ProfileBakedBodyMesh] BakeBodyMesh Init : SkinnedMeshRenderer " + ((Object)((Component)_smr).gameObject).name + " is null")); Debug.LogError("[ProfileUtil - ProfileBakedBodyMesh] BakeBodyMesh Init : SkinnedMeshRenderer " + _smr.gameObject.name + " is null");
} }
this.smr = _smr; this.smr = _smr;
if ((Object)(object)_smr.sharedMesh == (Object)null) if (_smr.sharedMesh == null)
{ {
Debug.LogError((object)("[ProfileUtil - ProfileBakedBodyMesh] BakeBodyMesh Init : SkinnedMeshRenderer " + ((Object)((Component)_smr).gameObject).name + " has null sharedMesh.")); Debug.LogError("[ProfileUtil - ProfileBakedBodyMesh] BakeBodyMesh Init : SkinnedMeshRenderer " + _smr.gameObject.name + " has null sharedMesh.");
} }
this.bakedMesh = new Mesh(); this.bakedMesh = new Mesh();
this.smr.BakeMesh(this.bakedMesh); this.smr.BakeMesh(this.bakedMesh);
@@ -68,38 +64,25 @@ public class ProfileBakedBodyMesh
private Vector3[] CalculateWorldVertices(SkinnedMeshRenderer smr, Mesh bakedMesh) private Vector3[] CalculateWorldVertices(SkinnedMeshRenderer smr, Mesh bakedMesh)
{ {
//IL_003c: Unknown result type (might be due to invalid IL or missing references) if (smr == null)
//IL_0041: 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_005f: 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_008b: 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_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_009b: 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_00c4: 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)
if ((Object)(object)smr == (Object)null)
{ {
Debug.LogError((object)("[ProfileUtil - ProfileBakedBodyMesh] CalculateWorldVertices: smr " + ((Object)((Component)smr).gameObject).name + " == null")); Debug.LogError("[ProfileUtil - ProfileBakedBodyMesh] CalculateWorldVertices: smr " + smr.gameObject.name + " == null");
return null; return null;
} }
if ((Object)(object)bakedMesh == (Object)null) if (bakedMesh == null)
{ {
return null; return null;
} }
Transform transform = ((Component)smr).transform; Transform transform = smr.transform;
Vector3 lossyScale = transform.lossyScale; Vector3 lossyScale = transform.lossyScale;
Vector3 val = new Vector3(1f / Mathf.Max(lossyScale.x, 1E-08f), 1f / Mathf.Max(lossyScale.y, 1E-08f), 1f / Mathf.Max(lossyScale.z, 1E-08f)); Vector3 vector = new Vector3(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 matrix4x = transform.localToWorldMatrix * Matrix4x4.Scale(vector);
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 = 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] = matrix4x.MultiplyPoint3x4(vertices[i]);
} }
return array; return array;
} }

View File

@@ -1,6 +1,4 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies.
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.profile.ProfileData // Eden.AutoMorpher.profile.ProfileData
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;

View File

@@ -1,6 +1,4 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies.
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.profile.ProfileUtil_IndexUtil // Eden.AutoMorpher.profile.ProfileUtil_IndexUtil
using UnityEngine; using UnityEngine;
@@ -62,7 +60,7 @@ public class ProfileUtil_IndexUtil
{ {
if (this._blockSize <= 1) if (this._blockSize <= 1)
{ {
Debug.LogError((object)"[ProfileUtil_IndexUtil] BlockPermutations.Build - invalid blockSize"); Debug.LogError("[ProfileUtil_IndexUtil] BlockPermutations.Build - invalid blockSize");
return; return;
} }
XorShift32 rng = new XorShift32((uint)(seed ^ -1556008596)); XorShift32 rng = new XorShift32((uint)(seed ^ -1556008596));
@@ -196,21 +194,14 @@ public class ProfileUtil_IndexUtil
public void EncodeInto(Vector3[] input, Vector3[] output) public void EncodeInto(Vector3[] input, Vector3[] output)
{ {
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: 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_0094: 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_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
if (input == null || output == null) if (input == null || output == null)
{ {
Debug.LogError((object)"[ProfileUtil_IndexUtil] EncodeInto - null args"); Debug.LogError("[ProfileUtil_IndexUtil] EncodeInto - null args");
return; return;
} }
if (output.Length < input.Length) if (output.Length < input.Length)
{ {
Debug.LogError((object)"[ProfileUtil_IndexUtil] EncodeInto - output too small"); Debug.LogError("[ProfileUtil_IndexUtil] EncodeInto - output too small");
return; return;
} }
int num = input.Length; int num = input.Length;
@@ -223,10 +214,10 @@ public class ProfileUtil_IndexUtil
this._perm.GetPermutationsForLen(num5, out var pxUse, out var pyUse, out var pzUse, out var pallUse); this._perm.GetPermutationsForLen(num5, out var pxUse, out var pyUse, out var pzUse, out var pallUse);
for (int j = 0; j < num5; j++) for (int j = 0; j < num5; j++)
{ {
Vector3 val = input[num4 + j]; Vector3 vector = input[num4 + j];
this._xTmp[pxUse[j]] = val.x; this._xTmp[pxUse[j]] = vector.x;
this._yTmp[pyUse[j]] = val.y; this._yTmp[pyUse[j]] = vector.y;
this._zTmp[pzUse[j]] = val.z; this._zTmp[pzUse[j]] = vector.z;
} }
for (int k = 0; k < num5; k++) for (int k = 0; k < num5; k++)
{ {
@@ -238,21 +229,14 @@ public class ProfileUtil_IndexUtil
public void DecodeInto(Vector3[] encoded, Vector3[] output) public void DecodeInto(Vector3[] encoded, Vector3[] output)
{ {
//IL_0076: 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_0085: 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_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
if (encoded == null || output == null) if (encoded == null || output == null)
{ {
Debug.LogError((object)"[ProfileUtil_IndexUtil] DecodeInto - null args"); Debug.LogError("[ProfileUtil_IndexUtil] DecodeInto - null args");
return; return;
} }
if (output.Length < encoded.Length) if (output.Length < encoded.Length)
{ {
Debug.LogError((object)"[ProfileUtil_IndexUtil] DecodeInto - output too small"); Debug.LogError("[ProfileUtil_IndexUtil] DecodeInto - output too small");
return; return;
} }
int num = encoded.Length; int num = encoded.Length;
@@ -266,10 +250,10 @@ public class ProfileUtil_IndexUtil
for (int j = 0; j < num5; j++) for (int j = 0; j < num5; j++)
{ {
int num6 = pallUse[j]; int num6 = pallUse[j];
Vector3 val = encoded[num4 + num6]; Vector3 vector = encoded[num4 + num6];
this._xTmp[j] = val.x; this._xTmp[j] = vector.x;
this._yTmp[j] = val.y; this._yTmp[j] = vector.y;
this._zTmp[j] = val.z; this._zTmp[j] = vector.z;
} }
for (int k = 0; k < num5; k++) for (int k = 0; k < num5; k++)
{ {

View File

@@ -1,6 +1,4 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies.
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.profile.ProfileUtils // Eden.AutoMorpher.profile.ProfileUtils
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
@@ -59,7 +57,6 @@ public class ProfileUtils
public BoneSpatialData GetBoneSpatialData(HumanBodyBones refBone, HumanBodyBones[] influencedBones, Dictionary<HumanBodyBones, HashSet<Transform>> boneMap, List<ProfileBakedBodyMesh> sourceBodyBakedMeshes, bool addChildBones = false) public BoneSpatialData GetBoneSpatialData(HumanBodyBones refBone, HumanBodyBones[] influencedBones, Dictionary<HumanBodyBones, HashSet<Transform>> boneMap, List<ProfileBakedBodyMesh> sourceBodyBakedMeshes, bool addChildBones = false)
{ {
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
return this.poseUtil.GetBoneSpatialData(refBone, influencedBones, boneMap, sourceBodyBakedMeshes, addChildBones); return this.poseUtil.GetBoneSpatialData(refBone, influencedBones, boneMap, sourceBodyBakedMeshes, addChildBones);
} }

View File

@@ -1,6 +1,4 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies.
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.profile.ProfileUtils_BVHUtil // Eden.AutoMorpher.profile.ProfileUtils_BVHUtil
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@@ -19,12 +17,6 @@ public class ProfileUtils_BVHUtil
public ProfileBVH BuildFromSkinnedMeshes(Transform rootTransform, List<ProfileBakedBodyMesh> bakedBodyMeshes) public ProfileBVH BuildFromSkinnedMeshes(Transform rootTransform, List<ProfileBakedBodyMesh> bakedBodyMeshes)
{ {
//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_0100: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: 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_0112: Unknown result type (might be due to invalid IL or missing references)
ProfileBVH profileBVH = new ProfileBVH ProfileBVH profileBVH = new ProfileBVH
{ {
vertices = new List<Vector3>(1024) vertices = new List<Vector3>(1024)
@@ -85,43 +77,6 @@ public class ProfileUtils_BVHUtil
private int BuildRecursive(ProfileBVH bvh, int[] triIndices, int start, int count, List<profileBVHNode> outNodes) private int BuildRecursive(ProfileBVH bvh, int[] triIndices, int start, int count, List<profileBVHNode> outNodes)
{ {
//IL_0010: 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_003f: 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_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_00bd: 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_0092: 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_00a4: 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_0070: 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_0085: 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_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: 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_0127: Unknown result type (might be due to invalid IL or missing references)
//IL_012e: 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_0119: 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_013e: 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_0182: 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_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_019d: 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_01a4: Unknown result type (might be due to invalid IL or missing references)
//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
//IL_01b0: 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)
int count2 = outNodes.Count; int count2 = outNodes.Count;
profileBVHNode profileBVHNode2 = new profileBVHNode(); profileBVHNode profileBVHNode2 = new profileBVHNode();
Bounds bounds = default(Bounds); Bounds bounds = default(Bounds);
@@ -129,21 +84,21 @@ public class ProfileUtils_BVHUtil
for (int i = start; i < start + count; i++) for (int i = start; i < start + count; i++)
{ {
profileBVHData profileBVHData2 = bvh.datas[triIndices[i]]; profileBVHData profileBVHData2 = bvh.datas[triIndices[i]];
Vector3 val = bvh.vertices[profileBVHData2.verA]; Vector3 vector = bvh.vertices[profileBVHData2.verA];
Vector3 val2 = bvh.vertices[profileBVHData2.verB]; Vector3 point = bvh.vertices[profileBVHData2.verB];
Vector3 val3 = bvh.vertices[profileBVHData2.verC]; Vector3 point2 = bvh.vertices[profileBVHData2.verC];
if (flag) if (flag)
{ {
bounds = new Bounds(val, Vector3.zero); bounds = new Bounds(vector, Vector3.zero);
bounds.Encapsulate(val2); bounds.Encapsulate(point);
bounds.Encapsulate(val3); bounds.Encapsulate(point2);
flag = false; flag = false;
} }
else else
{ {
bounds.Encapsulate(val); bounds.Encapsulate(vector);
bounds.Encapsulate(val2); bounds.Encapsulate(point);
bounds.Encapsulate(val3); bounds.Encapsulate(point2);
} }
} }
profileBVHNode2.bounds = bounds; profileBVHNode2.bounds = bounds;
@@ -171,11 +126,10 @@ public class ProfileUtils_BVHUtil
for (int j = start; j < start + count; j++) for (int j = start; j < start + count; j++)
{ {
profileBVHData profileBVHData3 = bvh.datas[triIndices[j]]; profileBVHData profileBVHData3 = bvh.datas[triIndices[j]];
Vector3 val4 = bvh.vertices[profileBVHData3.verA]; Vector3 vector2 = bvh.vertices[profileBVHData3.verA];
Vector3 val5 = bvh.vertices[profileBVHData3.verB]; Vector3 vector3 = bvh.vertices[profileBVHData3.verB];
Vector3 val6 = bvh.vertices[profileBVHData3.verC]; Vector3 vector4 = bvh.vertices[profileBVHData3.verC];
Vector3 val7 = (val4 + val5 + val6) / 3f; num2 += ((vector2 + vector3 + vector4) / 3f)[num];
num2 += val7[num];
} }
num2 /= (float)count; num2 /= (float)count;
int num3 = this.Partition(bvh, triIndices, start, count, num, num2); int num3 = this.Partition(bvh, triIndices, start, count, num, num2);
@@ -197,32 +151,20 @@ public class ProfileUtils_BVHUtil
private int Partition(ProfileBVH bvh, int[] triIndices, int start, int count, int axis, float splitPos) private int Partition(ProfileBVH bvh, int[] triIndices, int start, int count, int axis, float splitPos)
{ {
//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_0043: 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_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_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_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_008f: 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)
int num = start; int num = start;
int num2 = start + count - 1; int num2 = start + count - 1;
while (num <= num2) while (num <= num2)
{ {
profileBVHData profileBVHData2 = bvh.datas[triIndices[num]]; profileBVHData profileBVHData2 = bvh.datas[triIndices[num]];
profileBVHData profileBVHData3 = bvh.datas[triIndices[num2]]; profileBVHData profileBVHData3 = bvh.datas[triIndices[num2]];
Vector3 val = bvh.vertices[profileBVHData2.verA]; Vector3 vector = bvh.vertices[profileBVHData2.verA];
Vector3 val2 = bvh.vertices[profileBVHData2.verB]; Vector3 vector2 = bvh.vertices[profileBVHData2.verB];
Vector3 val3 = bvh.vertices[profileBVHData2.verC]; Vector3 vector3 = bvh.vertices[profileBVHData2.verC];
Vector3 val4 = bvh.vertices[profileBVHData3.verA]; Vector3 vector4 = bvh.vertices[profileBVHData3.verA];
Vector3 val5 = bvh.vertices[profileBVHData3.verB]; Vector3 vector5 = bvh.vertices[profileBVHData3.verB];
Vector3 val6 = bvh.vertices[profileBVHData3.verC]; Vector3 vector6 = bvh.vertices[profileBVHData3.verC];
float num3 = (val[axis] + val2[axis] + val3[axis]) / 3f; float num3 = (vector[axis] + vector2[axis] + vector3[axis]) / 3f;
_ = (val4[axis] + val5[axis] + val6[axis]) / 3f; _ = (vector4[axis] + vector5[axis] + vector6[axis]) / 3f;
if (num3 < splitPos) if (num3 < splitPos)
{ {
num++; num++;
@@ -241,15 +183,9 @@ public class ProfileUtils_BVHUtil
public void SaveProfileBVH(ProfileBVH bvh, string savePath, string profileName) public void SaveProfileBVH(ProfileBVH bvh, string savePath, string profileName)
{ {
//IL_009a: 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_0160: Unknown result type (might be due to invalid IL or missing references)
//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
if (bvh == null || bvh.vertices == null || bvh.datas == null || bvh.nodes == null || bvh.dataIndices == null) if (bvh == null || bvh.vertices == null || bvh.datas == null || bvh.nodes == null || bvh.dataIndices == null)
{ {
Debug.LogError((object)"[ProfileUtils_BVHUtil] SaveProfileBVH - bvh or fields are null"); Debug.LogError("[ProfileUtils_BVHUtil] SaveProfileBVH - bvh or fields are null");
return; return;
} }
ProfileUtils profileUtils = new ProfileUtils(); ProfileUtils profileUtils = new ProfileUtils();
@@ -260,7 +196,7 @@ public class ProfileUtils_BVHUtil
BaseKey3[] array = new ProfileUtils_VertexUtil().LoadTable(profileUtils.GetBaseDataPath(), out version, out countInFile); BaseKey3[] array = new ProfileUtils_VertexUtil().LoadTable(profileUtils.GetBaseDataPath(), out version, out countInFile);
if (array == null || array.Length == 0) if (array == null || array.Length == 0)
{ {
Debug.LogError((object)"[ProfileUtils_BVHUtil] SaveProfileBVH - failed to load base vertex table"); Debug.LogError("[ProfileUtils_BVHUtil] SaveProfileBVH - failed to load base vertex table");
return; return;
} }
Vector3[] array2 = bvh.vertices.ToArray(); Vector3[] array2 = bvh.vertices.ToArray();
@@ -270,7 +206,7 @@ public class ProfileUtils_BVHUtil
} }
ProfileUtil_IndexUtil profileUtil_IndexUtil = new ProfileUtil_IndexUtil(); ProfileUtil_IndexUtil profileUtil_IndexUtil = new ProfileUtil_IndexUtil();
profileUtil_IndexUtil.Build(num); profileUtil_IndexUtil.Build(num);
Vector3[] array3 = (Vector3[])(object)new Vector3[array2.Length]; Vector3[] array3 = new Vector3[array2.Length];
profileUtil_IndexUtil.EncodeInto(array2, array3); profileUtil_IndexUtil.EncodeInto(array2, array3);
StringBuilder stringBuilder = new StringBuilder(1024); StringBuilder stringBuilder = new StringBuilder(1024);
stringBuilder.Append(profileUtils.GetProfileMagic()); stringBuilder.Append(profileUtils.GetProfileMagic());
@@ -317,9 +253,6 @@ public class ProfileUtils_BVHUtil
private void AppendHexVec3(StringBuilder sb, Vector3 v) private void AppendHexVec3(StringBuilder sb, Vector3 v)
{ {
//IL_0002: 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_001c: Unknown result type (might be due to invalid IL or missing references)
this.AppendHexFloat(sb, v.x); this.AppendHexFloat(sb, v.x);
this.AppendHexFloat(sb, v.y); this.AppendHexFloat(sb, v.y);
this.AppendHexFloat(sb, v.z); this.AppendHexFloat(sb, v.z);
@@ -340,10 +273,6 @@ public class ProfileUtils_BVHUtil
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_0013: 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_0036: Unknown result type (might be due to invalid IL or missing references)
return new Vector3(this.TransformFloatBits(v.x, k.x), this.TransformFloatBits(v.y, k.y), this.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));
} }

View File

@@ -1,6 +1,4 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies.
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.profile.ProfileUtils_BoneUtil // Eden.AutoMorpher.profile.ProfileUtils_BoneUtil
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@@ -11,8 +9,6 @@ public class ProfileUtils_BoneUtil
{ {
public HashSet<Transform> GetBodyMeshBones(SkinnedMeshRenderer smr, float weightThreshold = 0.0001f) public HashSet<Transform> GetBodyMeshBones(SkinnedMeshRenderer smr, float weightThreshold = 0.0001f)
{ {
//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)
Mesh sharedMesh = smr.sharedMesh; Mesh sharedMesh = smr.sharedMesh;
if (sharedMesh == null) if (sharedMesh == null)
{ {
@@ -25,22 +21,22 @@ public class ProfileUtils_BoneUtil
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 boneWeight = array[i];
if (val.weight0 > weightThreshold) if (boneWeight.weight0 > weightThreshold)
{ {
hashSet.Add(val.boneIndex0); hashSet.Add(boneWeight.boneIndex0);
} }
if (val.weight1 > weightThreshold) if (boneWeight.weight1 > weightThreshold)
{ {
hashSet.Add(val.boneIndex1); hashSet.Add(boneWeight.boneIndex1);
} }
if (val.weight2 > weightThreshold) if (boneWeight.weight2 > weightThreshold)
{ {
hashSet.Add(val.boneIndex2); hashSet.Add(boneWeight.boneIndex2);
} }
if (val.weight3 > weightThreshold) if (boneWeight.weight3 > weightThreshold)
{ {
hashSet.Add(val.boneIndex3); hashSet.Add(boneWeight.boneIndex3);
} }
} }
HashSet<Transform> hashSet2 = new HashSet<Transform>(); HashSet<Transform> hashSet2 = new HashSet<Transform>();
@@ -56,9 +52,6 @@ public class ProfileUtils_BoneUtil
public Dictionary<HumanBodyBones, HashSet<Transform>> GetHumanoidMeshBoneMap(Animator animator, IReadOnlyList<SkinnedMeshRenderer> bodyMeshes, float posTolerance = 0.0001f, float weightThreshold = 0.0001f) public Dictionary<HumanBodyBones, HashSet<Transform>> GetHumanoidMeshBoneMap(Animator animator, IReadOnlyList<SkinnedMeshRenderer> bodyMeshes, float posTolerance = 0.0001f, float weightThreshold = 0.0001f)
{ {
//IL_009f: 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_0106: 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 (animator == null) if (animator == null)
{ {
@@ -85,8 +78,8 @@ public class ProfileUtils_BoneUtil
} }
for (int i = 0; i < 55; i++) for (int i = 0; i < 55; i++)
{ {
HumanBodyBones val = (HumanBodyBones)i; HumanBodyBones humanBodyBones = (HumanBodyBones)i;
Transform boneTransform = animator.GetBoneTransform(val); Transform boneTransform = animator.GetBoneTransform(humanBodyBones);
if (boneTransform == null) if (boneTransform == null)
{ {
continue; continue;
@@ -97,19 +90,17 @@ public class ProfileUtils_BoneUtil
{ {
hashSet2.Add(item); hashSet2.Add(item);
} }
dictionary[val] = hashSet2; dictionary[humanBodyBones] = hashSet2;
} }
return dictionary; return dictionary;
} }
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_0043: Unknown result type (might be due to invalid IL or missing references)
Mesh sharedMesh = smr.sharedMesh; Mesh sharedMesh = smr.sharedMesh;
if (sharedMesh == null) if (sharedMesh == null)
{ {
Debug.LogError((object)"SkinnedMeshRenderer에 연결된 Mesh가 없습니다."); Debug.LogError("SkinnedMeshRenderer에 연결된 Mesh가 없습니다.");
return new HashSet<Transform>(); return new HashSet<Transform>();
} }
Transform[] bones = smr.bones; Transform[] bones = smr.bones;
@@ -118,22 +109,22 @@ public class ProfileUtils_BoneUtil
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 boneWeight = array[i];
if (val.weight0 > weightThreshold) if (boneWeight.weight0 > weightThreshold)
{ {
hashSet.Add(val.boneIndex0); hashSet.Add(boneWeight.boneIndex0);
} }
if (val.weight1 > weightThreshold) if (boneWeight.weight1 > weightThreshold)
{ {
hashSet.Add(val.boneIndex1); hashSet.Add(boneWeight.boneIndex1);
} }
if (val.weight2 > weightThreshold) if (boneWeight.weight2 > weightThreshold)
{ {
hashSet.Add(val.boneIndex2); hashSet.Add(boneWeight.boneIndex2);
} }
if (val.weight3 > weightThreshold) if (boneWeight.weight3 > weightThreshold)
{ {
hashSet.Add(val.boneIndex3); hashSet.Add(boneWeight.boneIndex3);
} }
} }
HashSet<Transform> hashSet2 = new HashSet<Transform>(); HashSet<Transform> hashSet2 = new HashSet<Transform>();
@@ -149,12 +140,6 @@ public class ProfileUtils_BoneUtil
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_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_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_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 (boneToCheck == null) if (boneToCheck == null)
{ {
@@ -164,15 +149,11 @@ public class ProfileUtils_BoneUtil
Vector3 position = boneToCheck.position; Vector3 position = boneToCheck.position;
foreach (Transform item in smrBoneSet) foreach (Transform item in smrBoneSet)
{ {
if (!(item == null) && !(item == boneToCheck) && this.NameMatches(item.gameObject.name, boneToCheck.gameObject.name)) if (!(item == null) && !(item == boneToCheck) && this.NameMatches(item.gameObject.name, boneToCheck.gameObject.name) && (item.position - position).sqrMagnitude <= num)
{
Vector3 val = item.position - position;
if (val.sqrMagnitude <= num)
{ {
list.Add(item); list.Add(item);
} }
} }
}
return list; return list;
} }
@@ -208,46 +189,6 @@ public class ProfileUtils_BoneUtil
public List<BoneData> GetBoneDatas(Transform rootTransform, HashSet<Transform> avatarBones, Dictionary<HumanBodyBones, HashSet<Transform>> sourceBoneMap) public List<BoneData> GetBoneDatas(Transform rootTransform, HashSet<Transform> avatarBones, Dictionary<HumanBodyBones, HashSet<Transform>> sourceBoneMap)
{ {
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: 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_010c: Unknown result type (might be due to invalid IL or missing references)
//IL_0111: Unknown result type (might be due to invalid IL or missing references)
//IL_0117: 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_0122: 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_006e: 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_01d7: Unknown result type (might be due to invalid IL or missing references)
//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
//IL_0202: 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_022d: Unknown result type (might be due to invalid IL or missing references)
//IL_0232: 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_0237: Unknown result type (might be due to invalid IL or missing references)
//IL_023b: Unknown result type (might be due to invalid IL or missing references)
//IL_0240: 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_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_0267: Unknown result type (might be due to invalid IL or missing references)
//IL_0274: 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_0288: Unknown result type (might be due to invalid IL or missing references)
//IL_028f: Unknown result type (might be due to invalid IL or missing references)
//IL_02f3: Unknown result type (might be due to invalid IL or missing references)
//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
//IL_030d: Unknown result type (might be due to invalid IL or missing references)
//IL_030f: Unknown result type (might be due to invalid IL or missing references)
//IL_0315: 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_031d: Unknown result type (might be due to invalid IL or missing references)
//IL_031f: Unknown result type (might be due to invalid IL or missing references)
Dictionary<Transform, HumanBodyBones> dictionary = new Dictionary<Transform, HumanBodyBones>(); Dictionary<Transform, HumanBodyBones> dictionary = new Dictionary<Transform, HumanBodyBones>();
foreach (KeyValuePair<HumanBodyBones, HashSet<Transform>> item2 in sourceBoneMap) foreach (KeyValuePair<HumanBodyBones, HashSet<Transform>> item2 in sourceBoneMap)
{ {
@@ -269,10 +210,10 @@ public class ProfileUtils_BoneUtil
BoneData item = new BoneData BoneData item = new BoneData
{ {
id = 0, id = 0,
boneName = rootTransform != null ? rootTransform.name : "Root", boneName = ((rootTransform != null) ? rootTransform.name : "Root"),
parentName = null, parentName = null,
hierarchyPath = "", hierarchyPath = "",
hBone = (HumanBodyBones)55, hBone = HumanBodyBones.LastBone,
parentId = -1, parentId = -1,
childrenIds = new List<int>(), childrenIds = new List<int>(),
rootLocalPosition = Vector3.zero, rootLocalPosition = Vector3.zero,
@@ -291,27 +232,27 @@ public class ProfileUtils_BoneUtil
dictionary2[item4] = num++; dictionary2[item4] = num++;
string hierarchyPath = this.GetHierarchyPath(rootTransform, item4); string hierarchyPath = this.GetHierarchyPath(rootTransform, item4);
HumanBodyBones value2; HumanBodyBones value2;
HumanBodyBones hBone = (HumanBodyBones)((!dictionary.TryGetValue(item4, out value2)) ? 55 : ((int)value2)); HumanBodyBones hBone = (dictionary.TryGetValue(item4, out value2) ? value2 : HumanBodyBones.LastBone);
Vector3 rootLocalPosition = (rootTransform != null) ? rootTransform.InverseTransformPoint(item4.position) : item4.position; Vector3 rootLocalPosition = ((rootTransform != null) ? rootTransform.InverseTransformPoint(item4.position) : item4.position);
Quaternion rootLocalRotation = (rootTransform != null) ? (Quaternion.Inverse(rootTransform.rotation) * item4.rotation) : item4.rotation; Quaternion rootLocalRotation = ((rootTransform != null) ? (Quaternion.Inverse(rootTransform.rotation) * item4.rotation) : item4.rotation);
Vector3 lossyScale = item4.lossyScale; Vector3 rootLocalScale = item4.lossyScale;
if (rootTransform != null) if (rootTransform != null)
{ {
Vector3 lossyScale2 = rootTransform.lossyScale; Vector3 lossyScale = rootTransform.lossyScale;
lossyScale = new Vector3(this.SafeDiv(lossyScale.x, lossyScale2.x), this.SafeDiv(lossyScale.y, lossyScale2.y), this.SafeDiv(lossyScale.z, lossyScale2.z)); rootLocalScale = new Vector3(this.SafeDiv(rootLocalScale.x, lossyScale.x), this.SafeDiv(rootLocalScale.y, lossyScale.y), this.SafeDiv(rootLocalScale.z, lossyScale.z));
} }
list.Add(new BoneData list.Add(new BoneData
{ {
id = dictionary2[item4], id = dictionary2[item4],
boneName = item4.name, boneName = item4.name,
parentName = (item4.parent != null) ? (item4.parent).name : "", parentName = ((item4.parent != null) ? item4.parent.name : ""),
hierarchyPath = hierarchyPath, hierarchyPath = hierarchyPath,
hBone = hBone, hBone = hBone,
parentId = -1, parentId = -1,
childrenIds = new List<int>(), childrenIds = new List<int>(),
rootLocalPosition = rootLocalPosition, rootLocalPosition = rootLocalPosition,
rootLocalRotation = rootLocalRotation, rootLocalRotation = rootLocalRotation,
rootLocalScale = lossyScale rootLocalScale = rootLocalScale
}); });
} }
Dictionary<int, List<int>> dictionary3 = new Dictionary<int, List<int>>(); Dictionary<int, List<int>> dictionary3 = new Dictionary<int, List<int>>();
@@ -363,11 +304,11 @@ public class ProfileUtils_BoneUtil
private int GetDepthFromSkeletonRoot(Transform root, Transform t) private int GetDepthFromSkeletonRoot(Transform root, Transform t)
{ {
int num = 0; int num = 0;
Transform val = t; Transform transform = t;
while (val != null && val != root) while (transform != null && transform != root)
{ {
num++; num++;
val = val.parent; transform = transform.parent;
} }
return num; return num;
} }
@@ -384,7 +325,7 @@ public class ProfileUtils_BoneUtil
} }
if (!t.IsChildOf(root) && t != root) if (!t.IsChildOf(root) && t != root)
{ {
Debug.LogError((object)("[ProfileUtils_BoneUtil] GetHierarchyPath - bone " + t.name + " is not child of root " + root.name)); Debug.LogError("[ProfileUtils_BoneUtil] GetHierarchyPath - bone " + t.name + " is not child of root " + root.name);
return ""; return "";
} }
if (t == root) if (t == root)
@@ -392,11 +333,11 @@ public class ProfileUtils_BoneUtil
return ""; return "";
} }
Stack<string> stack = new Stack<string>(); Stack<string> stack = new Stack<string>();
Transform val = t; Transform transform = t;
while (val != null && val != root) while (transform != null && transform != root)
{ {
stack.Push(val.name); stack.Push(transform.name);
val = val.parent; transform = transform.parent;
} }
return string.Join("/", stack); return string.Join("/", stack);
} }

View File

@@ -1,6 +1,4 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies.
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.profile.ProfileUtils_PCAUtil // Eden.AutoMorpher.profile.ProfileUtils_PCAUtil
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
@@ -9,62 +7,18 @@ public class ProfileUtils_PCAUtil
{ {
public PCAData ComputeRegionStats(IList<Vector3> points) public PCAData ComputeRegionStats(IList<Vector3> points)
{ {
//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_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: 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_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_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_0082: 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_008a: 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_009d: 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_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: 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_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: 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_017c: Unknown result type (might be due to invalid IL or missing references)
//IL_0181: 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_01a5: Unknown result type (might be due to invalid IL or missing references)
//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
//IL_01ab: 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_0207: 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_020f: 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_01c9: 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_01d7: Unknown result type (might be due to invalid IL or missing references)
//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
//IL_01e1: 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_01e8: Unknown result type (might be due to invalid IL or missing references)
PCAData pCAData = new PCAData(); PCAData pCAData = new PCAData();
if (points == null || points.Count == 0) if (points == null || points.Count == 0)
{ {
return pCAData; return pCAData;
} }
int count = points.Count; int count = points.Count;
Vector3 val = Vector3.zero; Vector3 zero = Vector3.zero;
for (int i = 0; i < count; i++) for (int i = 0; i < count; i++)
{ {
val += points[i]; zero += points[i];
} }
val /= (float)count; zero /= (float)count;
float num = 0f; float num = 0f;
float num2 = 0f; float num2 = 0f;
float num3 = 0f; float num3 = 0f;
@@ -73,13 +27,13 @@ public class ProfileUtils_PCAUtil
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 vector = points[j] - zero;
num += val2.x * val2.x; num += vector.x * vector.x;
num2 += val2.x * val2.y; num2 += vector.x * vector.y;
num3 += val2.x * val2.z; num3 += vector.x * vector.z;
num4 += val2.y * val2.y; num4 += vector.y * vector.y;
num5 += val2.y * val2.z; num5 += vector.y * vector.z;
num6 += val2.z * val2.z; num6 += vector.z * vector.z;
} }
float num7 = 1f / (float)count; float num7 = 1f / (float)count;
num *= num7; num *= num7;
@@ -104,7 +58,7 @@ public class ProfileUtils_PCAUtil
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] - zero, normalized);
if (num12 < num9) if (num12 < num9)
{ {
num9 = num12; num9 = num12;
@@ -113,12 +67,11 @@ public class ProfileUtils_PCAUtil
{ {
num10 = num12; num10 = num12;
} }
Vector3 val3 = val + normalized * num12; Vector3 vector2 = zero + normalized * num12;
Vector3 val4 = points[k] - val3; float magnitude = (points[k] - vector2).magnitude;
float magnitude = val4.magnitude;
num11 += magnitude; num11 += magnitude;
} }
pCAData.pcaCenter = val; pCAData.pcaCenter = zero;
pCAData.pcaPrincipalAxis = normalized; pCAData.pcaPrincipalAxis = normalized;
pCAData.pcaLength = num10 - num9; pCAData.pcaLength = num10 - num9;
pCAData.pcaAvgRadius = num11 / (float)count; pCAData.pcaAvgRadius = num11 / (float)count;
@@ -127,12 +80,6 @@ public class ProfileUtils_PCAUtil
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_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_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_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 },
@@ -171,37 +118,37 @@ public class ProfileUtils_PCAUtil
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 f = 0.5f * Mathf.Atan2(2f * num8, num7 - num6);
float num10 = Mathf.Cos(num9); float num9 = Mathf.Cos(f);
float num11 = Mathf.Sin(num9); float num10 = Mathf.Sin(f);
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 num11 = array[j, num];
float num13 = array[j, num2]; float num12 = array[j, num2];
array[j, num] = num10 * num12 - num11 * num13; array[j, num] = num9 * num11 - num10 * num12;
array[num, j] = array[j, num]; array[num, j] = array[j, num];
array[j, num2] = num11 * num12 + num10 * num13; array[j, num2] = num10 * num11 + num9 * num12;
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 num13 = num9 * num9 * num6 - 2f * num10 * num9 * num8 + num10 * num10 * num7;
float num15 = num11 * num11 * num6 + 2f * num11 * num10 * num8 + num10 * num10 * num7; float num14 = num10 * num10 * num6 + 2f * num10 * num9 * num8 + num9 * num9 * num7;
array[num, num] = num14; array[num, num] = num13;
array[num2, num2] = num15; array[num2, num2] = num14;
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 num15 = array2[k, num];
float num17 = array2[k, num2]; float num16 = array2[k, num2];
array2[k, num] = num10 * num16 - num11 * num17; array2[k, num] = num9 * num15 - num10 * num16;
array2[k, num2] = num11 * num16 + num10 * num17; array2[k, num2] = num10 * num15 + num9 * num16;
} }
} }
eigenValues = new float[3]; eigenValues = new float[3];
eigenVectors = (Vector3[])(object)new Vector3[3]; eigenVectors = 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];

View File

@@ -1,6 +1,4 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies.
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.profile.ProfileUtils_PoseUtil // Eden.AutoMorpher.profile.ProfileUtils_PoseUtil
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@@ -10,30 +8,22 @@ public class ProfileUtils_PoseUtil
{ {
public BoneSpatialData GetBoneSpatialData(HumanBodyBones refBone, HumanBodyBones[] influencedBones, Dictionary<HumanBodyBones, HashSet<Transform>> boneMap, List<ProfileBakedBodyMesh> sourceBodyBakedMeshes, bool addChildBones = false) public BoneSpatialData GetBoneSpatialData(HumanBodyBones refBone, HumanBodyBones[] influencedBones, Dictionary<HumanBodyBones, HashSet<Transform>> boneMap, List<ProfileBakedBodyMesh> sourceBodyBakedMeshes, bool addChildBones = false)
{ {
//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_000f: Unknown result type (might be due to invalid IL or missing references)
BoneSpatialData boneSpatialData = new BoneSpatialData(); BoneSpatialData boneSpatialData = new BoneSpatialData();
boneSpatialData.refBone = refBone; boneSpatialData.refBone = refBone;
Transform baseBoneFromBoneMap = this.GetBaseBoneFromBoneMap(boneMap, refBone); Transform baseBoneFromBoneMap = this.GetBaseBoneFromBoneMap(boneMap, refBone);
if ((Object)(object)baseBoneFromBoneMap == (Object)null) if (baseBoneFromBoneMap == null)
{ {
return null; return null;
} }
List<Vector3> refVertices = this.GetRefVertices(influencedBones, boneMap, sourceBodyBakedMeshes, addChildBones); List<Vector3> refVertices = this.GetRefVertices(influencedBones, boneMap, sourceBodyBakedMeshes, addChildBones);
boneSpatialData.pcaData = this.GetPCAData(baseBoneFromBoneMap, refVertices); boneSpatialData.pcaData = this.GetPCAData(baseBoneFromBoneMap, refVertices);
Transform baseBoneFromBoneMap2 = this.GetBaseBoneFromBoneMap(boneMap, (HumanBodyBones)0); Transform baseBoneFromBoneMap2 = this.GetBaseBoneFromBoneMap(boneMap, HumanBodyBones.Hips);
boneSpatialData.volumeData = this.GetVolumeData(baseBoneFromBoneMap, baseBoneFromBoneMap2, refVertices); boneSpatialData.volumeData = this.GetVolumeData(baseBoneFromBoneMap, baseBoneFromBoneMap2, refVertices);
return boneSpatialData; return boneSpatialData;
} }
private List<Vector3> GetRefVertices(HumanBodyBones[] influencedBones, Dictionary<HumanBodyBones, HashSet<Transform>> boneMap, List<ProfileBakedBodyMesh> sourceBodyBakedMeshes, bool addChildBones = false, float weightThreshold = 0.15f, int sampleStep = 1) private List<Vector3> GetRefVertices(HumanBodyBones[] influencedBones, Dictionary<HumanBodyBones, HashSet<Transform>> boneMap, List<ProfileBakedBodyMesh> sourceBodyBakedMeshes, bool addChildBones = false, float weightThreshold = 0.15f, int sampleStep = 1)
{ {
//IL_001b: 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_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_0212: Unknown result type (might be due to invalid IL or missing references)
List<Vector3> list = new List<Vector3>(); List<Vector3> list = new List<Vector3>();
HashSet<Transform> targetBoneSet = new HashSet<Transform>(); HashSet<Transform> targetBoneSet = new HashSet<Transform>();
foreach (HumanBodyBones key in influencedBones) foreach (HumanBodyBones key in influencedBones)
@@ -44,7 +34,7 @@ public class ProfileUtils_PoseUtil
} }
foreach (Transform item in value) foreach (Transform item in value)
{ {
if ((Object)(object)item != (Object)null) if (item != null)
{ {
targetBoneSet.Add(item); targetBoneSet.Add(item);
} }
@@ -53,7 +43,7 @@ public class ProfileUtils_PoseUtil
if (targetBoneSet.Count == 0) if (targetBoneSet.Count == 0)
{ {
string text = string.Join(", ", influencedBones.Select((HumanBodyBones b) => b.ToString())); string text = string.Join(", ", influencedBones.Select((HumanBodyBones b) => b.ToString()));
Debug.LogError((object)("[ProfileSaver_PoseUtil] CollectBodyPartVerticesWorld: targetBoneSet is empty.\nMissing Humanoid Set : " + text)); Debug.LogError("[ProfileSaver_PoseUtil] CollectBodyPartVerticesWorld: targetBoneSet is empty.\nMissing Humanoid Set : " + text);
return list; return list;
} }
if (addChildBones) if (addChildBones)
@@ -82,12 +72,12 @@ public class ProfileUtils_PoseUtil
int num = Mathf.Min(worldVertices.Length, boneWeights.Length); int num = Mathf.Min(worldVertices.Length, boneWeights.Length);
for (int num2 = 0; num2 < num; num2 += sampleStep) for (int num2 = 0; num2 < num; num2 += sampleStep)
{ {
BoneWeight val = boneWeights[num2]; BoneWeight boneWeight = boneWeights[num2];
float wSum = 0f; float wSum = 0f;
Acc(val.boneIndex0, val.weight0); Acc(boneWeight.boneIndex0, boneWeight.weight0);
Acc(val.boneIndex1, val.weight1); Acc(boneWeight.boneIndex1, boneWeight.weight1);
Acc(val.boneIndex2, val.weight2); Acc(boneWeight.boneIndex2, boneWeight.weight2);
Acc(val.boneIndex3, val.weight3); Acc(boneWeight.boneIndex3, boneWeight.weight3);
if (!(wSum < weightThreshold)) if (!(wSum < weightThreshold))
{ {
list.Add(worldVertices[num2]); list.Add(worldVertices[num2]);
@@ -96,8 +86,8 @@ public class ProfileUtils_PoseUtil
{ {
if (index >= 0 && index < bones.Length && !(w <= 0f)) if (index >= 0 && index < bones.Length && !(w <= 0f))
{ {
Transform val2 = bones[index]; Transform transform = bones[index];
if ((Object)(object)val2 != (Object)null && targetBoneSet.Contains(val2)) if (transform != null && targetBoneSet.Contains(transform))
{ {
wSum += w; wSum += w;
} }
@@ -108,7 +98,7 @@ public class ProfileUtils_PoseUtil
return list; return list;
void AddDescendants(Transform t) void AddDescendants(Transform t)
{ {
if (!((Object)(object)t == (Object)null) && targetBoneSet.Add(t)) if (!(t == null) && targetBoneSet.Add(t))
{ {
for (int j = 0; j < t.childCount; j++) for (int j = 0; j < t.childCount; j++)
{ {
@@ -120,32 +110,23 @@ public class ProfileUtils_PoseUtil
private PCAData GetPCAData(Transform originTransform, List<Vector3> points) private PCAData GetPCAData(Transform originTransform, List<Vector3> points)
{ {
//IL_001f: 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_0029: 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_0036: 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_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)
PCAData pCAData = new ProfileUtils_PCAUtil().ComputeRegionStats(points); PCAData pCAData = new ProfileUtils_PCAUtil().ComputeRegionStats(points);
if ((Object)(object)originTransform == (Object)null) if (originTransform == null)
{ {
return pCAData; return pCAData;
} }
PCAData obj = new PCAData PCAData result = new PCAData
{ {
pcaCenter = originTransform.InverseTransformPoint(pCAData.pcaCenter) pcaCenter = originTransform.InverseTransformPoint(pCAData.pcaCenter),
pcaPrincipalAxis = originTransform.InverseTransformDirection(pCAData.pcaPrincipalAxis).normalized,
pcaLength = pCAData.pcaLength,
pcaAvgRadius = pCAData.pcaAvgRadius
}; };
Vector3 val = originTransform.InverseTransformDirection(pCAData.pcaPrincipalAxis);
obj.pcaPrincipalAxis = val.normalized;
obj.pcaLength = pCAData.pcaLength;
obj.pcaAvgRadius = pCAData.pcaAvgRadius;
if (Mathf.Abs(pCAData.pcaLength) < 0.0001f) if (Mathf.Abs(pCAData.pcaLength) < 0.0001f)
{ {
Debug.LogWarning((object)("[ProfileUtils_PoseUtil] GetPCAData - " + ((Object)originTransform).name + " Pca Length is to Small")); Debug.LogWarning("[ProfileUtils_PoseUtil] GetPCAData - " + originTransform.name + " Pca Length is to Small");
} }
return obj; return result;
} }
private VolumeData GetVolumeData(Transform originTransform, Transform axisTransform, List<Vector3> points) private VolumeData GetVolumeData(Transform originTransform, Transform axisTransform, List<Vector3> points)
@@ -155,7 +136,6 @@ public class ProfileUtils_PoseUtil
private Transform GetBaseBoneFromBoneMap(Dictionary<HumanBodyBones, HashSet<Transform>> boneMap, HumanBodyBones bone) private Transform GetBaseBoneFromBoneMap(Dictionary<HumanBodyBones, HashSet<Transform>> boneMap, HumanBodyBones bone)
{ {
//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;

View File

@@ -1,6 +1,4 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies.
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.profile.ProfileUtils_VertexUtil // Eden.AutoMorpher.profile.ProfileUtils_VertexUtil
using System; using System;
using System.IO; using System.IO;
@@ -15,13 +13,13 @@ public class ProfileUtils_VertexUtil
countInFile = 0; countInFile = 0;
if (string.IsNullOrEmpty(path)) if (string.IsNullOrEmpty(path))
{ {
Debug.LogError((object)"[ProfileUtil_VertexUtil] LoadTable - path is null or empty"); Debug.LogError("[ProfileUtil_VertexUtil] LoadTable - path is null or empty");
return null; return null;
} }
path = Path.Combine(Application.dataPath, path); path = Path.Combine(Application.dataPath, path);
if (!File.Exists(path)) if (!File.Exists(path))
{ {
Debug.LogError((object)"[ProfileUtil_VertexUtil] LoadTable - file not found"); Debug.LogError("[ProfileUtil_VertexUtil] LoadTable - file not found");
return null; return null;
} }
string text; string text;
@@ -31,14 +29,14 @@ public class ProfileUtils_VertexUtil
} }
catch (Exception ex) catch (Exception ex)
{ {
Debug.LogError((object)("[ProfileUtil_VertexUtil] LoadTable - read failed: " + ex.Message)); Debug.LogError("[ProfileUtil_VertexUtil] LoadTable - read failed: " + ex.Message);
return null; return null;
} }
int num = 0; int num = 0;
string baseMagic = new ProfileUtils().GetBaseMagic(); string baseMagic = new ProfileUtils().GetBaseMagic();
if (text.Length < 4 || text.Substring(0, 4) != baseMagic) if (text.Length < 4 || text.Substring(0, 4) != baseMagic)
{ {
Debug.LogError((object)"[ProfileUtil_VertexUtil] LoadTable - MAGIC mismatch"); Debug.LogError("[ProfileUtil_VertexUtil] LoadTable - MAGIC mismatch");
return null; return null;
} }
num += 4; num += 4;
@@ -46,7 +44,7 @@ public class ProfileUtils_VertexUtil
countInFile = this.ReadHexIntSafe(text, ref num); countInFile = this.ReadHexIntSafe(text, ref num);
if (countInFile <= 0) if (countInFile <= 0)
{ {
Debug.LogError((object)"[ProfileUtil_VertexUtil] LoadTable - invalid count"); Debug.LogError("[ProfileUtil_VertexUtil] LoadTable - invalid count");
return null; return null;
} }
BaseKey3[] array = new BaseKey3[countInFile]; BaseKey3[] array = new BaseKey3[countInFile];
@@ -61,7 +59,7 @@ public class ProfileUtils_VertexUtil
{ {
if (p + 8 > s.Length) if (p + 8 > s.Length)
{ {
Debug.LogError((object)"[ProfileUtil_VertexUtil] ReadHexIntSafe - out of range"); Debug.LogError("[ProfileUtil_VertexUtil] ReadHexIntSafe - out of range");
return 0; return 0;
} }
string value = s.Substring(p, 8); string value = s.Substring(p, 8);

View File

@@ -1,6 +1,4 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies.
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.profile.ProfileUtils_VolumeUtil // Eden.AutoMorpher.profile.ProfileUtils_VolumeUtil
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
@@ -9,75 +7,19 @@ public class ProfileUtils_VolumeUtil
{ {
public VolumeData GetVolumeData(Transform originTransform, Transform axisTransform, List<Vector3> points, int sampleStep = 1) public VolumeData GetVolumeData(Transform originTransform, Transform axisTransform, List<Vector3> points, int sampleStep = 1)
{ {
//IL_0048: Unknown result type (might be due to invalid IL or missing references) if (originTransform == null)
//IL_004d: 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_0054: 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_008e: 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_009e: 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_0106: 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_010e: 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_0115: Unknown result type (might be due to invalid IL or missing references)
//IL_011d: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: 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_012a: Unknown result type (might be due to invalid IL or missing references)
//IL_012f: 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_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_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_014e: Unknown result type (might be due to invalid IL or missing references)
//IL_0153: 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_0160: Unknown result type (might be due to invalid IL or missing references)
//IL_0163: Unknown result type (might be due to invalid IL or missing references)
//IL_0168: Unknown result type (might be due to invalid IL or missing references)
//IL_016d: Unknown result type (might be due to invalid IL or missing references)
//IL_0172: Unknown result type (might be due to invalid IL or missing references)
//IL_017a: Unknown result type (might be due to invalid IL or missing references)
//IL_017f: 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_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_0191: 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_01a1: Unknown result type (might be due to invalid IL or missing references)
//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
//IL_01b8: 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_01c0: Unknown result type (might be due to invalid IL or missing references)
//IL_01c5: 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_01cf: 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_00bc: 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)
if ((Object)(object)originTransform == (Object)null)
{ {
Debug.LogError((object)"[ProfileUtils_VolumeUtil] originTransform is null"); Debug.LogError("[ProfileUtils_VolumeUtil] originTransform is null");
return null; return null;
} }
if ((Object)(object)axisTransform == (Object)null) if (axisTransform == null)
{ {
Debug.LogError((object)"[ProfileUtils_VolumeUtil] axisTransform is null"); Debug.LogError("[ProfileUtils_VolumeUtil] axisTransform is null");
return null; return null;
} }
if (points == null || points.Count == 0) if (points == null || points.Count == 0)
{ {
Debug.LogError((object)"[ProfileUtils_VolumeUtil] There is No Points to calculate volume"); Debug.LogError("[ProfileUtils_VolumeUtil] There is No Points to calculate volume");
return null; return null;
} }
VolumeData volumeData = new VolumeData(); VolumeData volumeData = new VolumeData();
@@ -92,8 +34,8 @@ public class ProfileUtils_VolumeUtil
float num6 = float.NegativeInfinity; float num6 = float.NegativeInfinity;
for (int i = 0; i < points.Count; i += sampleStep) for (int i = 0; i < points.Count; i += sampleStep)
{ {
Vector3 val = points[i] - originTransform.position; Vector3 lhs = points[i] - originTransform.position;
float num7 = Vector3.Dot(val, up); float num7 = Vector3.Dot(lhs, up);
if (num7 < num) if (num7 < num)
{ {
num = num7; num = num7;
@@ -102,7 +44,7 @@ public class ProfileUtils_VolumeUtil
{ {
num2 = num7; num2 = num7;
} }
float num8 = Vector3.Dot(val, forward); float num8 = Vector3.Dot(lhs, forward);
if (num8 < num3) if (num8 < num3)
{ {
num3 = num8; num3 = num8;
@@ -111,7 +53,7 @@ public class ProfileUtils_VolumeUtil
{ {
num4 = num8; num4 = num8;
} }
float num9 = Vector3.Dot(val, right); float num9 = Vector3.Dot(lhs, right);
if (num9 < num5) if (num9 < num5)
{ {
num5 = num9; num5 = num9;

View File

@@ -1,6 +1,4 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies.
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.profile.VolumeData // Eden.AutoMorpher.profile.VolumeData
using System; using System;
using UnityEngine; using UnityEngine;

View File

@@ -1,6 +1,4 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies.
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.profile.profileBVHData // Eden.AutoMorpher.profile.profileBVHData
public class profileBVHData public class profileBVHData
{ {

View File

@@ -1,6 +1,4 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies.
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.profile.profileBVHNode // Eden.AutoMorpher.profile.profileBVHNode
using UnityEngine; using UnityEngine;

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: abb5e5470d1cf564b81643da236b85dc guid: 43568339d28ae25468f26127090298f4
folderAsset: yes folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}

View File

@@ -34,7 +34,7 @@ public static class AutoMorpherDev
if (this._enabled && this._sw != null) if (this._enabled && this._sw != null)
{ {
this._sw.Stop(); this._sw.Stop();
UnityEngine.Debug.Log((object)$"[DevTimer] {this._label}: {this._sw.ElapsedMilliseconds} ms"); UnityEngine.Debug.Log($"[DevTimer] {this._label}: {this._sw.ElapsedMilliseconds} ms");
} }
} }
} }
@@ -45,7 +45,7 @@ public static class AutoMorpherDev
{ {
if (isDeveloperMode) if (isDeveloperMode)
{ {
UnityEngine.Debug.Log((object)message); UnityEngine.Debug.Log(message);
} }
} }

View File

@@ -1,2 +1,2 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 02c908beb489bb147953e501aad66b8a guid: 73372fe46c4d1bd4e8f8bb36159b8bb7

View File

@@ -1,2 +1,2 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 563e2675ec324394ea6a384adbe69d10 guid: 514ced1d3e497a246952dc49c763f668

View File

@@ -12,8 +12,6 @@ public class BakedBodyMesh
public BakedBodyMesh(SkinnedMeshRenderer _smr) public BakedBodyMesh(SkinnedMeshRenderer _smr)
{ {
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Expected O, but got Unknown
this.smr = _smr; this.smr = _smr;
this.bakedMesh = new Mesh(); this.bakedMesh = new Mesh();
this.smr.BakeMesh(this.bakedMesh); this.smr.BakeMesh(this.bakedMesh);

View File

@@ -1,2 +1,2 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: b42afbd87f7e5804da861a01f62524d1 guid: 988a170527bb2d74da01c54552bc6b7d

View File

@@ -10,30 +10,22 @@ 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) if (avatarRoot == null)
//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_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_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_00a5: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)avatarRoot == (Object)null)
{ {
Debug.LogWarning((object)"[AvatarBodyMatchUtil] NormalizeAvatarScaleByNeck: avatar == null"); Debug.LogWarning("[AvatarBodyMatchUtil] NormalizeAvatarScaleByNeck: avatar == null");
return; return;
} }
Transform boneFromBoneMap = new BodyPoseMatch_CommonUtil().GetBoneFromBoneMap(humanBoneMap, (HumanBodyBones)9); Transform boneFromBoneMap = new BodyPoseMatch_CommonUtil().GetBoneFromBoneMap(humanBoneMap, HumanBodyBones.Neck);
if ((Object)(object)boneFromBoneMap == (Object)null) if (boneFromBoneMap == null)
{ {
Debug.LogWarning((object)("[AvatarBodyMatchUtil] " + ((Object)avatarRoot).name + " 에서 Neck 본을 찾지 못했습니다. 스케일 정규화를 건너뜁니다.")); Debug.LogWarning("[AvatarBodyMatchUtil] " + avatarRoot.name + " 에서 Neck 본을 찾지 못했습니다. 스케일 정규화를 건너뜁니다.");
return; return;
} }
Transform transform = ((Component)avatarRoot).transform; Transform transform = 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($"[AvatarBodyMatchUtil] {avatarRoot.name} Neck Y가 0에 가까워 스케일 계산을 건너뜁니다. (neckY = {num})");
return; return;
} }
float num2 = targetHeight / num; float num2 = targetHeight / num;
@@ -44,32 +36,30 @@ public class BodyPoseMatchSetupUtil
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_00cc: Unknown result type (might be due to invalid IL or missing references)
proxyBodyMeshes = null; proxyBodyMeshes = null;
if ((Object)(object)sourceAvatar == (Object)null) if (sourceAvatar == null)
{ {
Debug.LogError((object)"[AvatarBodyMatchUtil] CreateSourceBodyProxy: sourceAvatar == null"); Debug.LogError("[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(sourceAvatar.gameObject);
((Object)clone).name = ((Object)sourceAvatar).name + "_BodyProxy"; clone.name = 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 (component != null)
{ {
((Behaviour)component).enabled = false; component.enabled = false;
remainTransforms.Add(((Component)component).transform); remainTransforms.Add(component.transform);
} }
if ((Object)(object)component != (Object)null && (Object)(object)component.avatar != (Object)null && component.avatar.isHuman) if (component != null && component.avatar != null && component.avatar.isHuman)
{ {
for (int i = 0; i < 55; i++) for (int i = 0; i < 55; i++)
{ {
HumanBodyBones val = (HumanBodyBones)i; HumanBodyBones humanBoneId = (HumanBodyBones)i;
Transform boneTransform = component.GetBoneTransform(val); Transform boneTransform = component.GetBoneTransform(humanBoneId);
if ((Object)(object)boneTransform != (Object)null) if (boneTransform != null)
{ {
remainTransforms.Add(boneTransform); remainTransforms.Add(boneTransform);
} }
@@ -80,60 +70,49 @@ public class BodyPoseMatchSetupUtil
{ {
foreach (SkinnedMeshRenderer sourceBodyMesh in sourceBodyMeshes) foreach (SkinnedMeshRenderer sourceBodyMesh in sourceBodyMeshes)
{ {
if (!((Object)(object)sourceBodyMesh == (Object)null) && !((Object)(object)sourceBodyMesh.sharedMesh == (Object)null)) if (!(sourceBodyMesh == null) && !(sourceBodyMesh.sharedMesh == null))
{ {
hashSet.Add(sourceBodyMesh.sharedMesh); hashSet.Add(sourceBodyMesh.sharedMesh);
} }
} }
} }
SkinnedMeshRenderer[] componentsInChildren = clone.GetComponentsInChildren<SkinnedMeshRenderer>(true); SkinnedMeshRenderer[] componentsInChildren = clone.GetComponentsInChildren<SkinnedMeshRenderer>(includeInactive: 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 skinnedMeshRenderer in array)
{ {
if (!((Object)(object)val2 == (Object)null)) if (!(skinnedMeshRenderer == null))
{ {
Mesh sharedMesh = val2.sharedMesh; Mesh sharedMesh = skinnedMeshRenderer.sharedMesh;
if (!((Object)(object)sharedMesh == (Object)null) && hashSet.Contains(sharedMesh)) if (!(sharedMesh == null) && hashSet.Contains(sharedMesh))
{ {
list.Add(val2); list.Add(skinnedMeshRenderer);
} }
} }
} }
if (list.Count == 0) if (list.Count == 0)
{ {
Debug.LogWarning((object)"[AvatarBodyMatchUtil] CreateSourceBodyProxy: clone에서 동일 sharedMesh를 가진 BodyMesh를 찾지 못했습니다."); Debug.LogWarning("[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 (item == null)
{ {
continue; continue;
} }
remainTransforms.Add(((Component)item).transform); remainTransforms.Add(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] Debug.LogWarning("[AvatarBodyMatchUtil] CreateSourceBodyProxy: clone smr '" + item.name + "' has null bones array (mesh='" + item.sharedMesh?.name + "')");
{
"[AvatarBodyMatchUtil] CreateSourceBodyProxy: clone smr '",
((Object)item).name,
"' has null bones array (mesh='",
null,
null
};
Mesh sharedMesh2 = item.sharedMesh;
obj[3] = ((sharedMesh2 != null) ? ((Object)sharedMesh2).name : null);
obj[4] = "')";
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 (!(item2 == null))
{ {
remainTransforms.Add(item2); remainTransforms.Add(item2);
} }
@@ -144,13 +123,13 @@ public class BodyPoseMatchSetupUtil
{ {
AddWithParents(item3); AddWithParents(item3);
} }
Transform[] componentsInChildren2 = clone.GetComponentsInChildren<Transform>(true); Transform[] componentsInChildren2 = clone.GetComponentsInChildren<Transform>(includeInactive: true);
for (int num = componentsInChildren2.Length - 1; num >= 0; num--) for (int num = componentsInChildren2.Length - 1; num >= 0; num--)
{ {
Transform val3 = componentsInChildren2[num]; Transform transform = componentsInChildren2[num];
if (!((Object)(object)val3 == (Object)null) && !((Object)(object)val3 == (Object)(object)clone.transform) && !remainTransforms.Contains(val3)) if (!(transform == null) && !(transform == clone.transform) && !remainTransforms.Contains(transform))
{ {
Object.DestroyImmediate((Object)(object)((Component)val3).gameObject); Object.DestroyImmediate(transform.gameObject);
} }
} }
proxyBodyMeshes = list; proxyBodyMeshes = list;
@@ -158,7 +137,7 @@ public class BodyPoseMatchSetupUtil
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 (t != null && t != clone.transform)
{ {
remainTransforms.Add(t); remainTransforms.Add(t);
t = t.parent; t = t.parent;
@@ -168,27 +147,7 @@ public class BodyPoseMatchSetupUtil
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) if (rootT == null)
//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_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_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_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_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_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_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_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_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_0170: Unknown result type (might be due to invalid IL or missing references)
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");
} }
@@ -196,40 +155,40 @@ public class BodyPoseMatchSetupUtil
{ {
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 transform = null;
if (clothHumanoidBoneMap.TryGetValue((HumanBodyBones)0, out var value) && value != null && value.Count > 0) if (clothHumanoidBoneMap.TryGetValue(HumanBodyBones.Hips, 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 (item != null)
{ {
val = item; transform = item;
break; break;
} }
} }
} }
if ((Object)(object)val == (Object)null) if (transform == 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 boneData = 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 boneData2 = profileData.bones[i];
if (val3 != null && (int)val3.hBone == 0) if (boneData2 != null && boneData2.hBone == HumanBodyBones.Hips)
{ {
val2 = val3; boneData = boneData2;
break; break;
} }
} }
if (val2 == null) if (boneData == 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 = boneData.rootLocalScale;
Vector3 lossyScale = rootT.lossyScale; Vector3 lossyScale = rootT.lossyScale;
Vector3 lossyScale2 = val.lossyScale; Vector3 lossyScale2 = transform.lossyScale;
Vector3 val4 = new Vector3(lossyScale2.x / lossyScale.x, lossyScale2.y / lossyScale.y, lossyScale2.z / lossyScale.z); Vector3 vector = new Vector3(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(vector.x / rootLocalScale.x, vector.y / rootLocalScale.y, vector.z / rootLocalScale.z);
} }
} }

View File

@@ -1,2 +1,2 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: b0c593c395e8c7540bbabeda94629b05 guid: c9574059c6a92f24bbab8bf1fdc02d9a

View File

@@ -24,29 +24,11 @@ public class BodyPoseMatchUtil
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_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_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_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_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_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_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_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_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_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 (component == null || component2 == null)
{ {
Debug.LogError((object)"[AvatarBodyMatchUtil] sourceAvatar 또는 targetAvatar가 null입니다."); Debug.LogError("[AvatarBodyMatchUtil] sourceAvatar 또는 targetAvatar가 null입니다.");
sourceToProxy = new Dictionary<Transform, Transform>(); sourceToProxy = new Dictionary<Transform, Transform>();
return null; return null;
} }
@@ -56,21 +38,21 @@ public class BodyPoseMatchUtil
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 gameObject = bodyPoseMatchSetupUtil.CreateBodyProxy(component, sourceBodyMeshes, out proxyBodyMeshes, out sourceToProxy);
Animator component3 = val.GetComponent<Animator>(); Animator component3 = gameObject.GetComponent<Animator>();
if (onlyScaling) if (onlyScaling)
{ {
val.transform.SetParent(targetAvatar.transform); gameObject.transform.SetParent(targetAvatar.transform);
val.transform.localPosition = Vector3.zero; gameObject.transform.localPosition = Vector3.zero;
return val; return gameObject;
} }
Dictionary<HumanBodyBones, HashSet<Transform>> dictionary2 = this.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); gameObject.transform.SetParent(targetAvatar.transform);
val.transform.localPosition = Vector3.zero; gameObject.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)
{ {
@@ -82,10 +64,10 @@ public class BodyPoseMatchUtil
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(gameObject, list, dictionary2, targetAvatar, list2, dictionary);
if (this.doDebug) if (this.doDebug)
{ {
bodyPoseMatch_Torso.DrawTorsoPcaDebug(val, list, dictionary2, Color.yellow, Color.cyan, 1f, 20f); bodyPoseMatch_Torso.DrawTorsoPcaDebug(gameObject, 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)
@@ -96,7 +78,7 @@ public class BodyPoseMatchUtil
bodyPoseMatch_Arm.AlignUpperArmByArmPcaCenters(list, dictionary2, list2, dictionary); bodyPoseMatch_Arm.AlignUpperArmByArmPcaCenters(list, dictionary2, list2, dictionary);
if (this.doDebug) if (this.doDebug)
{ {
bodyPoseMatch_Arm.DrawArmPcaDebug(val, list, dictionary2, isLeft: true, Color.yellow, Color.cyan, 1f, 20f); bodyPoseMatch_Arm.DrawArmPcaDebug(gameObject, 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)
@@ -109,24 +91,24 @@ public class BodyPoseMatchUtil
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(gameObject, 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(gameObject, list, dictionary2, targetAvatar, list2, dictionary);
if (this.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(gameObject, 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(gameObject, 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(gameObject.gameObject, proxyBodyMeshes, targetAvatar, targetBodyMeshes, isLeft: true, 1f, 5f);
} }
return val; return gameObject;
} }
} }

View File

@@ -1,2 +1,2 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: ad33ffa29854c5841ba95a68e56e6c51 guid: 40b77c723c5c82c40a80c64f4a9d7589

View File

@@ -16,25 +16,6 @@ public class BodyPoseMatch_Arm
public void AlignUpperArmByArmCenters(IReadOnlyCollection<Transform> sourceLeftUpperArmSet, IReadOnlyCollection<Transform> sourceRightUpperArmSet, Vector3 sourceShoulderCenterWorld, Vector3 targetShoulderCenterWorld, Transform axisReferenceTransform, bool lockRightAxis = true) public void AlignUpperArmByArmCenters(IReadOnlyCollection<Transform> sourceLeftUpperArmSet, IReadOnlyCollection<Transform> sourceRightUpperArmSet, Vector3 sourceShoulderCenterWorld, Vector3 targetShoulderCenterWorld, Transform axisReferenceTransform, bool lockRightAxis = true)
{ {
//IL_0050: 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_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_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_0065: 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_006d: 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_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_007a: 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_009f: 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_00e0: 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)
if (sourceLeftUpperArmSet == null || sourceLeftUpperArmSet.Count == 0) if (sourceLeftUpperArmSet == null || sourceLeftUpperArmSet.Count == 0)
{ {
throw new AutoMorpherException("Source Left UpperArm Set is Missing", "[BodyPoseMatch_Arm] AlignUpperArmByArmCenters\n - sourceLeftUpperArmSet is null or empty"); throw new AutoMorpherException("Source Left UpperArm Set is Missing", "[BodyPoseMatch_Arm] AlignUpperArmByArmCenters\n - sourceLeftUpperArmSet is null or empty");
@@ -47,46 +28,36 @@ public class BodyPoseMatch_Arm
{ {
throw new AutoMorpherException("Axis Reference Transform is Missing", "[BodyPoseMatch_Arm] AlignUpperArmByArmCenters\n - axisReferenceTransform is null"); throw new AutoMorpherException("Axis Reference Transform is Missing", "[BodyPoseMatch_Arm] AlignUpperArmByArmCenters\n - axisReferenceTransform is null");
} }
Vector3 val = targetShoulderCenterWorld - sourceShoulderCenterWorld; Vector3 vector = targetShoulderCenterWorld - sourceShoulderCenterWorld;
if (lockRightAxis) if (lockRightAxis)
{ {
Vector3 right = axisReferenceTransform.right; Vector3 right = axisReferenceTransform.right;
float num = Vector3.Dot(val, right); float num = Vector3.Dot(vector, right);
val -= right * num; vector -= right * num;
} }
foreach (Transform item in sourceLeftUpperArmSet) foreach (Transform item in sourceLeftUpperArmSet)
{ {
if (!(item == null)) if (!(item == null))
{ {
item.position += val; item.position += vector;
} }
} }
foreach (Transform item2 in sourceRightUpperArmSet) foreach (Transform item2 in sourceRightUpperArmSet)
{ {
if (!(item2 == null)) if (!(item2 == null))
{ {
item2.position += val; item2.position += vector;
} }
} }
} }
public void AlignUpperArmByArmPcaCenters(IReadOnlyList<BakedBodyMesh> proxyBakedBodyMeshes, Dictionary<HumanBodyBones, HashSet<Transform>> proxyBoneMap, IReadOnlyList<BakedBodyMesh> targetBakedBodyMeshes, Dictionary<HumanBodyBones, HashSet<Transform>> targetBoneMap) public void AlignUpperArmByArmPcaCenters(IReadOnlyList<BakedBodyMesh> proxyBakedBodyMeshes, Dictionary<HumanBodyBones, HashSet<Transform>> proxyBoneMap, IReadOnlyList<BakedBodyMesh> targetBakedBodyMeshes, Dictionary<HumanBodyBones, HashSet<Transform>> targetBoneMap)
{ {
//IL_0082: 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_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_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
//IL_0150: 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)
if (proxyBoneMap == null) if (proxyBoneMap == null)
{ {
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");
} }
Transform boneFromBoneMap = this.poseMatchCommonUtil.GetBoneFromBoneMap(proxyBoneMap, (HumanBodyBones)0); Transform boneFromBoneMap = this.poseMatchCommonUtil.GetBoneFromBoneMap(proxyBoneMap, HumanBodyBones.Hips);
if (boneFromBoneMap == null) if (boneFromBoneMap == null)
{ {
throw new AutoMorpherException("Proxy Hips is Missing", "[BodyPoseMatch_Arm] AlignUpperArmByArmPcaCenters\n - proxy hips transform is null"); throw new AutoMorpherException("Proxy Hips is Missing", "[BodyPoseMatch_Arm] AlignUpperArmByArmPcaCenters\n - proxy hips transform is null");
@@ -97,7 +68,7 @@ public class BodyPoseMatch_Arm
bool flag2 = regionStats2.length > 0.0001f; bool flag2 = regionStats2.length > 0.0001f;
if (!flag && !flag2) if (!flag && !flag2)
{ {
Debug.LogWarning((object)"[BodyPoseMatch_Arm] AlignUpperArmByArmPcaCenters: proxy arm PCA failed. Skip."); Debug.LogWarning("[BodyPoseMatch_Arm] AlignUpperArmByArmPcaCenters: proxy arm PCA failed. Skip.");
return; return;
} }
Vector3 sourceShoulderCenterWorld = this.CalculateShoulderCenter(flag, flag2, regionStats.center, regionStats2.center); Vector3 sourceShoulderCenterWorld = this.CalculateShoulderCenter(flag, flag2, regionStats.center, regionStats2.center);
@@ -107,15 +78,15 @@ public class BodyPoseMatch_Arm
bool flag4 = regionStats4.length > 0.0001f; bool flag4 = regionStats4.length > 0.0001f;
if (!flag3 && !flag4) if (!flag3 && !flag4)
{ {
Debug.LogWarning((object)"[BodyPoseMatch_Arm] AlignUpperArmByArmPcaCenters: target arm PCA failed. Skip."); Debug.LogWarning("[BodyPoseMatch_Arm] AlignUpperArmByArmPcaCenters: target arm PCA failed. Skip.");
return; return;
} }
Vector3 targetShoulderCenterWorld = this.CalculateShoulderCenter(flag3, flag4, regionStats3.center, regionStats4.center); Vector3 targetShoulderCenterWorld = this.CalculateShoulderCenter(flag3, flag4, regionStats3.center, regionStats4.center);
if (!proxyBoneMap.TryGetValue((HumanBodyBones)13, out var value) || value == null || value.Count == 0) if (!proxyBoneMap.TryGetValue(HumanBodyBones.LeftUpperArm, out var value) || value == null || value.Count == 0)
{ {
throw new AutoMorpherException("Proxy Left UpperArm Set is Missing", "[BodyPoseMatch_Arm] AlignUpperArmByArmPcaCenters\n - proxyBoneMap has no LeftUpperArm set"); throw new AutoMorpherException("Proxy Left UpperArm Set is Missing", "[BodyPoseMatch_Arm] AlignUpperArmByArmPcaCenters\n - proxyBoneMap has no LeftUpperArm set");
} }
if (!proxyBoneMap.TryGetValue((HumanBodyBones)14, out var value2) || value2 == null || value2.Count == 0) if (!proxyBoneMap.TryGetValue(HumanBodyBones.RightUpperArm, out var value2) || value2 == null || value2.Count == 0)
{ {
throw new AutoMorpherException("Proxy Right UpperArm Set is Missing", "[BodyPoseMatch_Arm] AlignUpperArmByArmPcaCenters\n - proxyBoneMap has no RightUpperArm set"); throw new AutoMorpherException("Proxy Right UpperArm Set is Missing", "[BodyPoseMatch_Arm] AlignUpperArmByArmPcaCenters\n - proxyBoneMap has no RightUpperArm set");
} }
@@ -124,26 +95,6 @@ public class BodyPoseMatch_Arm
public void AlignUpperArmByArmPcaCenters(IReadOnlyList<BakedBodyMesh> targetBakedBodyMeshes, Dictionary<HumanBodyBones, HashSet<Transform>> targetBoneMap, Dictionary<HumanBodyBones, HashSet<Transform>> clothBoneMap, Transform clothesTransform, ProfileData profileData, Vector3 comprehensiveScale) public void AlignUpperArmByArmPcaCenters(IReadOnlyList<BakedBodyMesh> targetBakedBodyMeshes, Dictionary<HumanBodyBones, HashSet<Transform>> targetBoneMap, Dictionary<HumanBodyBones, HashSet<Transform>> clothBoneMap, Transform clothesTransform, ProfileData profileData, Vector3 comprehensiveScale)
{ {
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: 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_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: 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_0113: 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_011a: 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_0108: 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_016c: Unknown result type (might be due to invalid IL or missing references)
//IL_0173: Unknown result type (might be due to invalid IL or missing references)
//IL_0178: 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_01d6: Unknown result type (might be due to invalid IL or missing references)
//IL_01d8: 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_Arm] AlignUpperArmByArmPcaCenters\n - clothBoneMap is null"); throw new AutoMorpherException("Cloth Bone Map is Missing", "[BodyPoseMatch_Arm] AlignUpperArmByArmPcaCenters\n - clothBoneMap is null");
@@ -152,7 +103,7 @@ public class BodyPoseMatch_Arm
{ {
throw new AutoMorpherException("Profile Data is Missing", "[BodyPoseMatch_Arm] AlignUpperArmByArmPcaCenters\n - profileData is null"); throw new AutoMorpherException("Profile Data is Missing", "[BodyPoseMatch_Arm] AlignUpperArmByArmPcaCenters\n - profileData is null");
} }
Transform boneFromBoneMap = this.poseMatchCommonUtil.GetBoneFromBoneMap(clothBoneMap, (HumanBodyBones)0); Transform boneFromBoneMap = this.poseMatchCommonUtil.GetBoneFromBoneMap(clothBoneMap, HumanBodyBones.Hips);
if (boneFromBoneMap == null) if (boneFromBoneMap == null)
{ {
throw new AutoMorpherException("Cloth Hips is Missing", "[BodyPoseMatch_Arm] AlignUpperArmByArmPcaCenters\n - cloth hips transform is null"); throw new AutoMorpherException("Cloth Hips is Missing", "[BodyPoseMatch_Arm] AlignUpperArmByArmPcaCenters\n - cloth hips transform is null");
@@ -161,7 +112,7 @@ public class BodyPoseMatch_Arm
bool flag2 = profileData.RightUpperArmSpatialData != null && profileData.RightUpperArmSpatialData.pcaData != null && profileData.RightUpperArmSpatialData.pcaData.pcaLength > 0.0001f; bool flag2 = profileData.RightUpperArmSpatialData != null && profileData.RightUpperArmSpatialData.pcaData != null && profileData.RightUpperArmSpatialData.pcaData.pcaLength > 0.0001f;
if (!flag && !flag2) if (!flag && !flag2)
{ {
Debug.LogWarning((object)"[BodyPoseMatch_Arm] AlignUpperArmByArmPcaCenters: profile arm data invalid. Skip."); Debug.LogWarning("[BodyPoseMatch_Arm] AlignUpperArmByArmPcaCenters: profile arm data invalid. Skip.");
return; return;
} }
Vector3 leftCenter = Vector3.zero; Vector3 leftCenter = Vector3.zero;
@@ -181,15 +132,15 @@ public class BodyPoseMatch_Arm
bool flag4 = regionStats2.length > 0.0001f; bool flag4 = regionStats2.length > 0.0001f;
if (!flag3 && !flag4) if (!flag3 && !flag4)
{ {
Debug.LogWarning((object)"[BodyPoseMatch_Arm] AlignUpperArmByArmPcaCenters: target arm PCA failed. Skip."); Debug.LogWarning("[BodyPoseMatch_Arm] AlignUpperArmByArmPcaCenters: target arm PCA failed. Skip.");
return; return;
} }
Vector3 targetShoulderCenterWorld = this.CalculateShoulderCenter(flag3, flag4, regionStats.center, regionStats2.center); Vector3 targetShoulderCenterWorld = this.CalculateShoulderCenter(flag3, flag4, regionStats.center, regionStats2.center);
if (!clothBoneMap.TryGetValue((HumanBodyBones)13, out var value) || value == null || value.Count == 0) if (!clothBoneMap.TryGetValue(HumanBodyBones.LeftUpperArm, out var value) || value == null || value.Count == 0)
{ {
throw new AutoMorpherException("Cloth Left UpperArm Set is Missing", "[BodyPoseMatch_Arm] AlignUpperArmByArmPcaCenters\n - clothBoneMap has no LeftUpperArm set"); throw new AutoMorpherException("Cloth Left UpperArm Set is Missing", "[BodyPoseMatch_Arm] AlignUpperArmByArmPcaCenters\n - clothBoneMap has no LeftUpperArm set");
} }
if (!clothBoneMap.TryGetValue((HumanBodyBones)14, out var value2) || value2 == null || value2.Count == 0) if (!clothBoneMap.TryGetValue(HumanBodyBones.RightUpperArm, out var value2) || value2 == null || value2.Count == 0)
{ {
throw new AutoMorpherException("Cloth Right UpperArm Set is Missing", "[BodyPoseMatch_Arm] AlignUpperArmByArmPcaCenters\n - clothBoneMap has no RightUpperArm set"); throw new AutoMorpherException("Cloth Right UpperArm Set is Missing", "[BodyPoseMatch_Arm] AlignUpperArmByArmPcaCenters\n - clothBoneMap has no RightUpperArm set");
} }
@@ -198,12 +149,6 @@ public class BodyPoseMatch_Arm
private Vector3 CalculateShoulderCenter(bool leftValid, bool rightValid, Vector3 leftCenter, Vector3 rightCenter) private Vector3 CalculateShoulderCenter(bool leftValid, bool rightValid, Vector3 leftCenter, Vector3 rightCenter)
{ {
//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_000d: 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_001d: 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)
if (leftValid && rightValid) if (leftValid && rightValid)
{ {
return 0.5f * (leftCenter + rightCenter); return 0.5f * (leftCenter + rightCenter);
@@ -217,41 +162,27 @@ public class BodyPoseMatch_Arm
public RegionStats ComputeArmRegionStats(IReadOnlyList<BakedBodyMesh> avatarBakedBodyMeshes, Dictionary<HumanBodyBones, HashSet<Transform>> avatarBoneMap, bool isLeft) public RegionStats ComputeArmRegionStats(IReadOnlyList<BakedBodyMesh> avatarBakedBodyMeshes, Dictionary<HumanBodyBones, HashSet<Transform>> avatarBoneMap, bool isLeft)
{ {
//IL_00b8: Unknown result type (might be due to invalid IL or missing references) HumanBodyBones[] targetHumanBones = ((!isLeft) ? new HumanBodyBones[3]
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: 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_00df: 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_00fd: 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_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_0151: Unknown result type (might be due to invalid IL or missing references)
//IL_0153: 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_012e: 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)
HumanBodyBones[] targetHumanBones;
if (!isLeft)
{ {
targetHumanBones = new HumanBodyBones[] { (HumanBodyBones)14, (HumanBodyBones)16, (HumanBodyBones)18 }; HumanBodyBones.RightUpperArm,
} HumanBodyBones.RightLowerArm,
else HumanBodyBones.RightHand
} : new HumanBodyBones[3]
{ {
targetHumanBones = new HumanBodyBones[] { (HumanBodyBones)13, (HumanBodyBones)15, (HumanBodyBones)17 }; HumanBodyBones.LeftUpperArm,
} HumanBodyBones.LeftLowerArm,
HumanBodyBones.LeftHand
});
List<Vector3> list = this.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)$"[BodyPoseMatch_Arm] ComputeArmRegionStats: arm vertices 0. isLeft={isLeft}"); Debug.LogWarning($"[BodyPoseMatch_Arm] ComputeArmRegionStats: arm vertices 0. isLeft={isLeft}");
return default(RegionStats); return default(RegionStats);
} }
RegionStats result = new PcaUtil().ComputeRegionStats(list); RegionStats result = new PcaUtil().ComputeRegionStats(list);
Transform boneFromBoneMap = this.poseMatchCommonUtil.GetBoneFromBoneMap(avatarBoneMap, (HumanBodyBones)(isLeft ? 13 : 14)); Transform boneFromBoneMap = this.poseMatchCommonUtil.GetBoneFromBoneMap(avatarBoneMap, isLeft ? HumanBodyBones.LeftUpperArm : HumanBodyBones.RightUpperArm);
Transform boneFromBoneMap2 = this.poseMatchCommonUtil.GetBoneFromBoneMap(avatarBoneMap, (HumanBodyBones)(isLeft ? 15 : 16)); Transform boneFromBoneMap2 = this.poseMatchCommonUtil.GetBoneFromBoneMap(avatarBoneMap, isLeft ? HumanBodyBones.LeftLowerArm : HumanBodyBones.RightLowerArm);
Transform boneFromBoneMap3 = this.poseMatchCommonUtil.GetBoneFromBoneMap(avatarBoneMap, (HumanBodyBones)(isLeft ? 17 : 18)); Transform boneFromBoneMap3 = this.poseMatchCommonUtil.GetBoneFromBoneMap(avatarBoneMap, isLeft ? HumanBodyBones.LeftHand : HumanBodyBones.RightHand);
Vector3 principalAxis = Vector3.zero; Vector3 principalAxis = Vector3.zero;
if (boneFromBoneMap != null && boneFromBoneMap3 != null) if (boneFromBoneMap != null && boneFromBoneMap3 != null)
{ {
@@ -275,33 +206,23 @@ public class BodyPoseMatch_Arm
private void ScalingUpperArmLength(Dictionary<HumanBodyBones, HashSet<Transform>> sourceBoneMap, Dictionary<HumanBodyBones, HashSet<Transform>> targetBoneMap, bool isLeft, bool autoDetectAxis, int forceAxisIndex) private void ScalingUpperArmLength(Dictionary<HumanBodyBones, HashSet<Transform>> sourceBoneMap, Dictionary<HumanBodyBones, HashSet<Transform>> targetBoneMap, bool isLeft, bool autoDetectAxis, int forceAxisIndex)
{ {
//IL_0009: Unknown result type (might be due to invalid IL or missing references) HumanBodyBones humanBodyBones = (isLeft ? HumanBodyBones.LeftUpperArm : HumanBodyBones.RightUpperArm);
//IL_0013: Unknown result type (might be due to invalid IL or missing references) HumanBodyBones bone = (isLeft ? HumanBodyBones.LeftLowerArm : HumanBodyBones.RightLowerArm);
//IL_001d: Unknown result type (might be due to invalid IL or missing references) HumanBodyBones bone2 = (isLeft ? HumanBodyBones.LeftHand : HumanBodyBones.RightHand);
//IL_0025: Unknown result type (might be due to invalid IL or missing references) Transform boneFromBoneMap = this.poseMatchCommonUtil.GetBoneFromBoneMap(sourceBoneMap, humanBodyBones);
//IL_0033: 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_0051: 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_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
HumanBodyBones val = (HumanBodyBones)(isLeft ? 13 : 14);
HumanBodyBones bone = (HumanBodyBones)(isLeft ? 15 : 16);
HumanBodyBones bone2 = (HumanBodyBones)(isLeft ? 17 : 18);
Transform boneFromBoneMap = this.poseMatchCommonUtil.GetBoneFromBoneMap(sourceBoneMap, val);
Transform boneFromBoneMap2 = this.poseMatchCommonUtil.GetBoneFromBoneMap(sourceBoneMap, bone); Transform boneFromBoneMap2 = this.poseMatchCommonUtil.GetBoneFromBoneMap(sourceBoneMap, bone);
Transform boneFromBoneMap3 = this.poseMatchCommonUtil.GetBoneFromBoneMap(sourceBoneMap, bone2); Transform boneFromBoneMap3 = this.poseMatchCommonUtil.GetBoneFromBoneMap(sourceBoneMap, bone2);
Transform boneFromBoneMap4 = this.poseMatchCommonUtil.GetBoneFromBoneMap(targetBoneMap, val); Transform boneFromBoneMap4 = this.poseMatchCommonUtil.GetBoneFromBoneMap(targetBoneMap, humanBodyBones);
Transform boneFromBoneMap5 = this.poseMatchCommonUtil.GetBoneFromBoneMap(targetBoneMap, bone); Transform boneFromBoneMap5 = this.poseMatchCommonUtil.GetBoneFromBoneMap(targetBoneMap, bone);
Transform boneFromBoneMap6 = this.poseMatchCommonUtil.GetBoneFromBoneMap(targetBoneMap, bone2); Transform boneFromBoneMap6 = this.poseMatchCommonUtil.GetBoneFromBoneMap(targetBoneMap, bone2);
HashSet<Transform> value; HashSet<Transform> value;
if (boneFromBoneMap == null || boneFromBoneMap2 == null || boneFromBoneMap3 == null || boneFromBoneMap4 == null || boneFromBoneMap5 == null || boneFromBoneMap6 == null) if (boneFromBoneMap == null || boneFromBoneMap2 == null || boneFromBoneMap3 == null || boneFromBoneMap4 == null || boneFromBoneMap5 == null || boneFromBoneMap6 == null)
{ {
Debug.LogWarning((object)"[BodyPoseMatch_Arm] ScalingSingArmLenght: some arm bones are null. Skip."); Debug.LogWarning("[BodyPoseMatch_Arm] ScalingSingArmLenght: some arm bones are null. Skip.");
} }
else if (sourceBoneMap == null || !sourceBoneMap.TryGetValue(val, out value) || value == null || value.Count == 0) else if (sourceBoneMap == null || !sourceBoneMap.TryGetValue(humanBodyBones, out value) || value == null || value.Count == 0)
{ {
Debug.LogWarning((object)"[BodyPoseMatch_Arm] ScalingSingArmLenght: sourceUpperSet missing. Skip."); Debug.LogWarning("[BodyPoseMatch_Arm] ScalingSingArmLenght: sourceUpperSet missing. Skip.");
} }
else else
{ {
@@ -311,22 +232,11 @@ public class BodyPoseMatch_Arm
private void ScalingLowerArmLength(Dictionary<HumanBodyBones, HashSet<Transform>> sourceBoneMap, Dictionary<HumanBodyBones, HashSet<Transform>> targetBoneMap, bool isLeft, bool autoDetectAxis, int forceAxisIndex, float sourceLowerarmExtremeX, float targetLowerarmExtremeX) private void ScalingLowerArmLength(Dictionary<HumanBodyBones, HashSet<Transform>> sourceBoneMap, Dictionary<HumanBodyBones, HashSet<Transform>> targetBoneMap, bool isLeft, bool autoDetectAxis, int forceAxisIndex, float sourceLowerarmExtremeX, float targetLowerarmExtremeX)
{ {
//IL_0009: Unknown result type (might be due to invalid IL or missing references) HumanBodyBones humanBodyBones = (isLeft ? HumanBodyBones.LeftLowerArm : HumanBodyBones.RightLowerArm);
//IL_0013: Unknown result type (might be due to invalid IL or missing references) HumanBodyBones bone = (isLeft ? HumanBodyBones.LeftHand : HumanBodyBones.RightHand);
//IL_001b: Unknown result type (might be due to invalid IL or missing references) Transform boneFromBoneMap = this.poseMatchCommonUtil.GetBoneFromBoneMap(sourceBoneMap, humanBodyBones);
//IL_0029: 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_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: 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_0127: 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)
HumanBodyBones val = (HumanBodyBones)(isLeft ? 15 : 16);
HumanBodyBones bone = (HumanBodyBones)(isLeft ? 17 : 18);
Transform boneFromBoneMap = this.poseMatchCommonUtil.GetBoneFromBoneMap(sourceBoneMap, val);
Transform boneFromBoneMap2 = this.poseMatchCommonUtil.GetBoneFromBoneMap(sourceBoneMap, bone); Transform boneFromBoneMap2 = this.poseMatchCommonUtil.GetBoneFromBoneMap(sourceBoneMap, bone);
Transform boneFromBoneMap3 = this.poseMatchCommonUtil.GetBoneFromBoneMap(targetBoneMap, val); Transform boneFromBoneMap3 = this.poseMatchCommonUtil.GetBoneFromBoneMap(targetBoneMap, humanBodyBones);
if (boneFromBoneMap == null || boneFromBoneMap2 == null || boneFromBoneMap3 == null) if (boneFromBoneMap == null || boneFromBoneMap2 == null || boneFromBoneMap3 == null)
{ {
Debug.LogWarning("[BodyPoseMatch_Arm] ScalingSingArmLenght: some arm bones are null. Skip."); Debug.LogWarning("[BodyPoseMatch_Arm] ScalingSingArmLenght: some arm bones are null. Skip.");
@@ -356,7 +266,7 @@ public class BodyPoseMatch_Arm
localScale.z *= num3; localScale.z *= num3;
break; break;
} }
foreach (Transform item in sourceBoneMap[val]) foreach (Transform item in sourceBoneMap[humanBodyBones])
{ {
if (!(item == null)) if (!(item == null))
{ {
@@ -385,27 +295,26 @@ public class BodyPoseMatch_Arm
private void ScalingLowerArmLength_BodyMatch(IReadOnlyList<BakedBodyMesh> proxyBakedBodyMeshes, Dictionary<HumanBodyBones, HashSet<Transform>> proxyBoneMap, IReadOnlyList<BakedBodyMesh> targetBakedBodyMeshes, Dictionary<HumanBodyBones, HashSet<Transform>> targetBoneMap, bool autoDetectAxis, int forceAxisIndex) private void ScalingLowerArmLength_BodyMatch(IReadOnlyList<BakedBodyMesh> proxyBakedBodyMeshes, Dictionary<HumanBodyBones, HashSet<Transform>> proxyBoneMap, IReadOnlyList<BakedBodyMesh> targetBakedBodyMeshes, Dictionary<HumanBodyBones, HashSet<Transform>> targetBoneMap, bool autoDetectAxis, int forceAxisIndex)
{ {
if (this.TryGetForearmExtremeX(proxyBakedBodyMeshes, proxyBoneMap, (HumanBodyBones)17, isLeft: true, out var extremeX) && this.TryGetForearmExtremeX(targetBakedBodyMeshes, targetBoneMap, (HumanBodyBones)17, isLeft: true, out var extremeX2)) if (this.TryGetForearmExtremeX(proxyBakedBodyMeshes, proxyBoneMap, HumanBodyBones.LeftHand, isLeft: true, out var extremeX) && this.TryGetForearmExtremeX(targetBakedBodyMeshes, targetBoneMap, HumanBodyBones.LeftHand, isLeft: true, out var extremeX2))
{ {
this.ScalingLowerArmLength(proxyBoneMap, targetBoneMap, isLeft: true, autoDetectAxis, forceAxisIndex, extremeX, extremeX2); this.ScalingLowerArmLength(proxyBoneMap, targetBoneMap, isLeft: true, autoDetectAxis, forceAxisIndex, extremeX, extremeX2);
} }
else else
{ {
Debug.LogWarning((object)"[BodyPoseMatch_Arm] ScalingLowerArmLength_BodyMatch: left extreme calc failed. Skip left lower."); Debug.LogWarning("[BodyPoseMatch_Arm] ScalingLowerArmLength_BodyMatch: left extreme calc failed. Skip left lower.");
} }
if (this.TryGetForearmExtremeX(proxyBakedBodyMeshes, proxyBoneMap, (HumanBodyBones)18, isLeft: false, out var extremeX3) && this.TryGetForearmExtremeX(targetBakedBodyMeshes, targetBoneMap, (HumanBodyBones)18, isLeft: false, out var extremeX4)) if (this.TryGetForearmExtremeX(proxyBakedBodyMeshes, proxyBoneMap, HumanBodyBones.RightHand, isLeft: false, out var extremeX3) && this.TryGetForearmExtremeX(targetBakedBodyMeshes, targetBoneMap, HumanBodyBones.RightHand, isLeft: false, out var extremeX4))
{ {
this.ScalingLowerArmLength(proxyBoneMap, targetBoneMap, isLeft: false, autoDetectAxis, forceAxisIndex, extremeX3, extremeX4); this.ScalingLowerArmLength(proxyBoneMap, targetBoneMap, isLeft: false, autoDetectAxis, forceAxisIndex, extremeX3, extremeX4);
} }
else else
{ {
Debug.LogWarning((object)"[BodyPoseMatch_Arm] ScalingLowerArmLength_BodyMatch: right extreme calc failed. Skip right lower."); Debug.LogWarning("[BodyPoseMatch_Arm] ScalingLowerArmLength_BodyMatch: right extreme calc failed. Skip right lower.");
} }
} }
public void ScalingBothArmsLength(IReadOnlyList<BakedBodyMesh> targetBakedBodyMeshes, Dictionary<HumanBodyBones, HashSet<Transform>> targetBoneMap, Dictionary<HumanBodyBones, HashSet<Transform>> clothBoneMap, ProfileData profileData, Vector3 comprehensiveScale, bool autoDetectAxis = true, int forceAxisIndex = 1) public void ScalingBothArmsLength(IReadOnlyList<BakedBodyMesh> targetBakedBodyMeshes, Dictionary<HumanBodyBones, HashSet<Transform>> targetBoneMap, Dictionary<HumanBodyBones, HashSet<Transform>> clothBoneMap, ProfileData profileData, Vector3 comprehensiveScale, bool autoDetectAxis = true, int forceAxisIndex = 1)
{ {
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
if (clothBoneMap == null || targetBoneMap == null) if (clothBoneMap == null || targetBoneMap == null)
{ {
throw new AutoMorpherException("Cloth Bone Map is Missing", "[BodyPoseMatch_Arm] ScalingSingArmLenght\n - BoneMap is null"); throw new AutoMorpherException("Cloth Bone Map is Missing", "[BodyPoseMatch_Arm] ScalingSingArmLenght\n - BoneMap is null");
@@ -421,42 +330,38 @@ public class BodyPoseMatch_Arm
private void ScalingLowerArmLength_ProfileMatch(IReadOnlyList<BakedBodyMesh> targetBakedBodyMeshes, Dictionary<HumanBodyBones, HashSet<Transform>> targetBoneMap, Dictionary<HumanBodyBones, HashSet<Transform>> clothBoneMap, ProfileData profileData, Vector3 comprehensiveScale, bool autoDetectAxis, int forceAxisIndex) private void ScalingLowerArmLength_ProfileMatch(IReadOnlyList<BakedBodyMesh> targetBakedBodyMeshes, Dictionary<HumanBodyBones, HashSet<Transform>> targetBoneMap, Dictionary<HumanBodyBones, HashSet<Transform>> clothBoneMap, ProfileData profileData, Vector3 comprehensiveScale, bool autoDetectAxis, int forceAxisIndex)
{ {
//IL_0041: 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)
float extremeX; float extremeX;
if (profileData.LeftLowerArm_HandSpatialData == null || profileData.LeftLowerArm_HandSpatialData.volumeData == null) if (profileData.LeftLowerArm_HandSpatialData == null || profileData.LeftLowerArm_HandSpatialData.volumeData == null)
{ {
Debug.LogWarning((object)"[BodyPoseMatch_Arm] ScalingLowerArmLength_ProfileMatch: left spatial data missing. Skip left lower."); Debug.LogWarning("[BodyPoseMatch_Arm] ScalingLowerArmLength_ProfileMatch: left spatial data missing. Skip left lower.");
} }
else if (this.TryGetForearmExtremeX(targetBakedBodyMeshes, targetBoneMap, (HumanBodyBones)17, isLeft: true, out extremeX)) else if (this.TryGetForearmExtremeX(targetBakedBodyMeshes, targetBoneMap, HumanBodyBones.LeftHand, isLeft: true, out extremeX))
{ {
float profileForearmExtremeX = this.GetProfileForearmExtremeX(clothBoneMap, profileData.LeftLowerArm_HandSpatialData, comprehensiveScale, isLeft: true); float profileForearmExtremeX = this.GetProfileForearmExtremeX(clothBoneMap, profileData.LeftLowerArm_HandSpatialData, comprehensiveScale, isLeft: true);
this.ScalingLowerArmLength(clothBoneMap, targetBoneMap, isLeft: true, autoDetectAxis, forceAxisIndex, profileForearmExtremeX, extremeX); this.ScalingLowerArmLength(clothBoneMap, targetBoneMap, isLeft: true, autoDetectAxis, forceAxisIndex, profileForearmExtremeX, extremeX);
} }
else else
{ {
Debug.LogWarning((object)"[BodyPoseMatch_Arm] ScalingLowerArmLength_ProfileMatch: left target extreme calc failed. Skip left lower."); Debug.LogWarning("[BodyPoseMatch_Arm] ScalingLowerArmLength_ProfileMatch: left target extreme calc failed. Skip left lower.");
} }
float extremeX2; float extremeX2;
if (profileData.RightLowerArm_HandSpatialData == null || profileData.RightLowerArm_HandSpatialData.volumeData == null) if (profileData.RightLowerArm_HandSpatialData == null || profileData.RightLowerArm_HandSpatialData.volumeData == null)
{ {
Debug.LogWarning((object)"[BodyPoseMatch_Arm] ScalingLowerArmLength_ProfileMatch: right spatial data missing. Skip right lower."); Debug.LogWarning("[BodyPoseMatch_Arm] ScalingLowerArmLength_ProfileMatch: right spatial data missing. Skip right lower.");
} }
else if (this.TryGetForearmExtremeX(targetBakedBodyMeshes, targetBoneMap, (HumanBodyBones)18, isLeft: false, out extremeX2)) else if (this.TryGetForearmExtremeX(targetBakedBodyMeshes, targetBoneMap, HumanBodyBones.RightHand, isLeft: false, out extremeX2))
{ {
float profileForearmExtremeX2 = this.GetProfileForearmExtremeX(clothBoneMap, profileData.RightLowerArm_HandSpatialData, comprehensiveScale, isLeft: false); float profileForearmExtremeX2 = this.GetProfileForearmExtremeX(clothBoneMap, profileData.RightLowerArm_HandSpatialData, comprehensiveScale, isLeft: false);
this.ScalingLowerArmLength(clothBoneMap, targetBoneMap, isLeft: false, autoDetectAxis, forceAxisIndex, profileForearmExtremeX2, extremeX2); this.ScalingLowerArmLength(clothBoneMap, targetBoneMap, isLeft: false, autoDetectAxis, forceAxisIndex, profileForearmExtremeX2, extremeX2);
} }
else else
{ {
Debug.LogWarning((object)"[BodyPoseMatch_Arm] ScalingLowerArmLength_ProfileMatch: right target extreme calc failed. Skip right lower."); Debug.LogWarning("[BodyPoseMatch_Arm] ScalingLowerArmLength_ProfileMatch: right target extreme calc failed. Skip right lower.");
} }
} }
private bool TryGetForearmExtremeX(IReadOnlyList<BakedBodyMesh> bakedBodyMeshes, Dictionary<HumanBodyBones, HashSet<Transform>> boneMap, HumanBodyBones targetBone, bool isLeft, out float extremeX, float weightThreshold = 0.15f, int sampleStep = 1) private bool TryGetForearmExtremeX(IReadOnlyList<BakedBodyMesh> bakedBodyMeshes, Dictionary<HumanBodyBones, HashSet<Transform>> boneMap, HumanBodyBones targetBone, bool isLeft, out float extremeX, float weightThreshold = 0.15f, int sampleStep = 1)
{ {
//IL_001c: 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)
extremeX = (isLeft ? float.PositiveInfinity : float.NegativeInfinity); extremeX = (isLeft ? float.PositiveInfinity : float.NegativeInfinity);
if (bakedBodyMeshes == null || boneMap == null) if (bakedBodyMeshes == null || boneMap == null)
{ {
@@ -491,11 +396,6 @@ public class BodyPoseMatch_Arm
private float GetProfileForearmExtremeX(Dictionary<HumanBodyBones, HashSet<Transform>> clothBoneMap, BoneSpatialData spatialData, Vector3 comprehensiveScale, bool isLeft) private float GetProfileForearmExtremeX(Dictionary<HumanBodyBones, HashSet<Transform>> clothBoneMap, BoneSpatialData spatialData, Vector3 comprehensiveScale, bool isLeft)
{ {
//IL_0023: 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_004f: 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_005e: Unknown result type (might be due to invalid IL or missing references)
if (spatialData == null || spatialData.volumeData == null) if (spatialData == null || spatialData.volumeData == null)
{ {
throw new AutoMorpherException("Profile Volume Data is Missing", "[BodyPoseMatch_Arm] GetProfileForearmExtremeX\n - spatialData or spatialData.volumeData is null"); throw new AutoMorpherException("Profile Volume Data is Missing", "[BodyPoseMatch_Arm] GetProfileForearmExtremeX\n - spatialData or spatialData.volumeData is null");
@@ -516,23 +416,15 @@ public class BodyPoseMatch_Arm
private int ResolveArmLengthAxisIndex(Transform lowerArm, Transform hand, bool autoDetectAxis, int forceAxisIndex) private int ResolveArmLengthAxisIndex(Transform lowerArm, Transform hand, bool autoDetectAxis, int forceAxisIndex)
{ {
//IL_000e: 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_001e: 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_0021: 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_0032: Unknown result type (might be due to invalid IL or missing references)
if (!autoDetectAxis) if (!autoDetectAxis)
{ {
return Mathf.Clamp(forceAxisIndex, 0, 2); return Mathf.Clamp(forceAxisIndex, 0, 2);
} }
Vector3 val = hand.position - lowerArm.position; Vector3 direction = hand.position - lowerArm.position;
Vector3 val2 = lowerArm.InverseTransformDirection(val); Vector3 vector = lowerArm.InverseTransformDirection(direction);
float num = Mathf.Abs(val2.x); float num = Mathf.Abs(vector.x);
float num2 = Mathf.Abs(val2.y); float num2 = Mathf.Abs(vector.y);
float num3 = Mathf.Abs(val2.z); float num3 = Mathf.Abs(vector.z);
if (num2 >= num && num2 >= num3) if (num2 >= num && num2 >= num3)
{ {
return 1; return 1;
@@ -546,108 +438,31 @@ public class BodyPoseMatch_Arm
public void DrawArmPcaDebug(GameObject avatarObject, IReadOnlyList<BakedBodyMesh> avatarBakedBodyMeshes, Dictionary<HumanBodyBones, HashSet<Transform>> avatarBoneMap, bool isLeft, Color centerColor, Color axisColor, float axisScale = 1f, float duration = 0.1f) public void DrawArmPcaDebug(GameObject avatarObject, IReadOnlyList<BakedBodyMesh> avatarBakedBodyMeshes, Dictionary<HumanBodyBones, HashSet<Transform>> avatarBoneMap, bool isLeft, Color centerColor, Color axisColor, float axisScale = 1f, float duration = 0.1f)
{ {
//IL_0021: 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_0048: 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_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: 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_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_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_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: 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_0083: 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_0093: 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_009a: 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_00ad: 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_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: 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_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: 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_00e9: 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_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
if (avatarBakedBodyMeshes != null && avatarBoneMap != null) if (avatarBakedBodyMeshes != null && avatarBoneMap != null)
{ {
RegionStats regionStats = this.ComputeArmRegionStats(avatarBakedBodyMeshes, avatarBoneMap, isLeft); RegionStats regionStats = this.ComputeArmRegionStats(avatarBakedBodyMeshes, avatarBoneMap, isLeft);
if (!(regionStats.length < 0.0001f)) if (!(regionStats.length < 0.0001f))
{ {
Vector3 center = regionStats.center; Vector3 center = regionStats.center;
Vector3 val = (regionStats.principalAxis.sqrMagnitude > 1E-08f) ? regionStats.principalAxis.normalized : Vector3.up; Vector3 vector = ((regionStats.principalAxis.sqrMagnitude > 1E-08f) ? regionStats.principalAxis.normalized : Vector3.up);
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);
Debug.DrawLine(center + Vector3.forward * num, center - Vector3.forward * num, centerColor, duration); Debug.DrawLine(center + Vector3.forward * num, center - Vector3.forward * num, centerColor, duration);
float num2 = regionStats.length * 0.5f * axisScale; float num2 = regionStats.length * 0.5f * axisScale;
Debug.DrawLine(center - val * num2, center + val * num2, axisColor, duration); Debug.DrawLine(center - vector * num2, center + vector * num2, axisColor, duration);
} }
} }
} }
public void DrawForearmExtremeDebugPair(GameObject proxyObject, IReadOnlyList<SkinnedMeshRenderer> proxyBodyMeshes, GameObject targetObject, IReadOnlyList<SkinnedMeshRenderer> targetBodyMeshes, bool isLeft, float size = 0.03f, float duration = 3f) public void DrawForearmExtremeDebugPair(GameObject proxyObject, IReadOnlyList<SkinnedMeshRenderer> proxyBodyMeshes, GameObject targetObject, IReadOnlyList<SkinnedMeshRenderer> targetBodyMeshes, bool isLeft, float size = 0.03f, float duration = 3f)
{ {
//IL_0005: 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_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)
this.DrawForearmExtremeDebugSingle(proxyObject, proxyBodyMeshes, isLeft, Color.blue, Color.cyan, size, duration); this.DrawForearmExtremeDebugSingle(proxyObject, proxyBodyMeshes, isLeft, Color.blue, Color.cyan, size, duration);
this.DrawForearmExtremeDebugSingle(targetObject, targetBodyMeshes, isLeft, Color.red, Color.magenta, size, duration); this.DrawForearmExtremeDebugSingle(targetObject, targetBodyMeshes, isLeft, Color.red, Color.magenta, size, duration);
} }
public void DrawForearmExtremeDebugSingle(GameObject avatarObject, IReadOnlyList<SkinnedMeshRenderer> bodyMeshes, bool isLeft, Color lineColor, Color pointColor, float size = 0.03f, float duration = 3f) public void DrawForearmExtremeDebugSingle(GameObject avatarObject, IReadOnlyList<SkinnedMeshRenderer> bodyMeshes, bool isLeft, Color lineColor, Color pointColor, float size = 0.03f, float duration = 3f)
{ {
//IL_002f: 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_007b: 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_0081: 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_008f: 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_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_00a8: 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_00bb: 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_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_00ce: 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_00df: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: 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_00f0: 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_00fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: 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)
if (avatarObject == null || bodyMeshes == null || bodyMeshes.Count == 0) if (avatarObject == null || bodyMeshes == null || bodyMeshes.Count == 0)
{ {
return; return;
@@ -655,8 +470,8 @@ public class BodyPoseMatch_Arm
Animator component = avatarObject.GetComponent<Animator>(); Animator component = avatarObject.GetComponent<Animator>();
if (!(component == null)) if (!(component == null))
{ {
HumanBodyBones val = (HumanBodyBones)(isLeft ? 15 : 16); HumanBodyBones humanBoneId = (isLeft ? HumanBodyBones.LeftLowerArm : HumanBodyBones.RightLowerArm);
Transform boneTransform = component.GetBoneTransform(val); Transform boneTransform = component.GetBoneTransform(humanBoneId);
if (boneTransform == null) if (boneTransform == null)
{ {
Debug.LogWarning($"[BodyPoseMatch_Arm] DrawForearmExtremeDebugSingle: elbow bone missing. isLeft={isLeft}"); Debug.LogWarning($"[BodyPoseMatch_Arm] DrawForearmExtremeDebugSingle: elbow bone missing. isLeft={isLeft}");
@@ -676,25 +491,13 @@ public class BodyPoseMatch_Arm
private bool TryGetForearmExtremePoint(Animator avatar, IReadOnlyList<SkinnedMeshRenderer> bodyMeshes, bool isLeft, out Vector3 extremePos) private bool TryGetForearmExtremePoint(Animator avatar, IReadOnlyList<SkinnedMeshRenderer> bodyMeshes, bool isLeft, out Vector3 extremePos)
{ {
//IL_0002: 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_0029: 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_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: 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_0100: 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_012d: 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_0118: Unknown result type (might be due to invalid IL or missing references)
extremePos = default(Vector3); extremePos = default(Vector3);
if (avatar == null || bodyMeshes == null || bodyMeshes.Count == 0) if (avatar == null || bodyMeshes == null || bodyMeshes.Count == 0)
{ {
return false; return false;
} }
HumanBodyBones val = (HumanBodyBones)(isLeft ? 17 : 18); HumanBodyBones humanBoneId = (isLeft ? HumanBodyBones.LeftHand : HumanBodyBones.RightHand);
Transform boneTransform = avatar.GetBoneTransform(val); Transform boneTransform = avatar.GetBoneTransform(humanBoneId);
if (boneTransform == null) if (boneTransform == null)
{ {
return false; return false;
@@ -703,10 +506,10 @@ public class BodyPoseMatch_Arm
List<BakedBodyMesh> list = new List<BakedBodyMesh>(bodyMeshes.Count); List<BakedBodyMesh> list = new List<BakedBodyMesh>(bodyMeshes.Count);
for (int i = 0; i < bodyMeshes.Count; i++) for (int i = 0; i < bodyMeshes.Count; i++)
{ {
SkinnedMeshRenderer val2 = bodyMeshes[i]; SkinnedMeshRenderer skinnedMeshRenderer = bodyMeshes[i];
if (!(val2 == null)) if (!(skinnedMeshRenderer == null))
{ {
BakedBodyMesh bakedBodyMesh = new BakedBodyMesh(val2); BakedBodyMesh bakedBodyMesh = new BakedBodyMesh(skinnedMeshRenderer);
bakedBodyMesh.ReBakeMesh(); bakedBodyMesh.ReBakeMesh();
list.Add(bakedBodyMesh); list.Add(bakedBodyMesh);
} }
@@ -724,26 +527,26 @@ public class BodyPoseMatch_Arm
float num = (isLeft ? float.PositiveInfinity : float.NegativeInfinity); float num = (isLeft ? float.PositiveInfinity : float.NegativeInfinity);
for (int j = 0; j < list2.Count; j++) for (int j = 0; j < list2.Count; j++)
{ {
Vector3 val3 = list2[j]; Vector3 vector = list2[j];
float x = val3.x; float x = vector.x;
if (!flag) if (!flag)
{ {
flag = true; flag = true;
num = x; num = x;
extremePos = val3; extremePos = vector;
} }
else if (isLeft) else if (isLeft)
{ {
if (x < num) if (x < num)
{ {
num = x; num = x;
extremePos = val3; extremePos = vector;
} }
} }
else if (x > num) else if (x > num)
{ {
num = x; num = x;
extremePos = val3; extremePos = vector;
} }
} }
return flag; return flag;

View File

@@ -1,2 +1,2 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 06c51e8c5c4e47242a901129c827880b guid: 60d86795fca316b438216c5648161dce

View File

@@ -10,7 +10,6 @@ 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)
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;
@@ -20,18 +19,6 @@ public class BodyPoseMatch_CommonUtil
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_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_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_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_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_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_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 + ")");
@@ -41,54 +28,31 @@ public class BodyPoseMatch_CommonUtil
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 = this.GetBoneFromBoneMap(clothBoneMap, boneSpatialData.refBone); Transform boneFromBoneMap = this.GetBoneFromBoneMap(clothBoneMap, boneSpatialData.refBone);
if ((Object)(object)boneFromBoneMap == (Object)null) if (boneFromBoneMap == 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)this.GetBoneFromBoneMap(clothBoneMap, (HumanBodyBones)0) == (Object)null) if (this.GetBoneFromBoneMap(clothBoneMap, HumanBodyBones.Hips) == 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 = new Vector3(pcaCenter.x / comprehensiveScale.x, pcaCenter.y / comprehensiveScale.y, pcaCenter.z / comprehensiveScale.z); Vector3 position = new Vector3(pcaCenter.x / comprehensiveScale.x, pcaCenter.y / comprehensiveScale.y, pcaCenter.z / comprehensiveScale.z);
return boneFromBoneMap.TransformPoint(val); return boneFromBoneMap.TransformPoint(position);
} }
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_0007: Unknown result type (might be due to invalid IL or missing references)
return this.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_0007: Unknown result type (might be due to invalid IL or missing references)
return this.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_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_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_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_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_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_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_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_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_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)
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");
@@ -98,34 +62,23 @@ public class BodyPoseMatch_CommonUtil
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 = this.GetBoneFromBoneMap(clothBoneMap, spatialData.refBone); Transform boneFromBoneMap = this.GetBoneFromBoneMap(clothBoneMap, spatialData.refBone);
if ((Object)(object)boneFromBoneMap == (Object)null) if (boneFromBoneMap == 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 vector = axisIndex switch
switch (axisIndex)
{ {
case 0: 0 => isMin ? spatialData.volumeData.fMinLocalPos : spatialData.volumeData.fMaxLocalPos,
val = (isMin ? spatialData.volumeData.fMinLocalPos : spatialData.volumeData.fMaxLocalPos); 1 => isMin ? spatialData.volumeData.rMinLocalPos : spatialData.volumeData.rMaxLocalPos,
break; 2 => isMin ? spatialData.volumeData.uMinLocalPos : spatialData.volumeData.uMaxLocalPos,
case 1: _ => throw new AutoMorpherException("Unsupported Volume Axis Index", "[BodyPoseMatch_CommonUtil] GetProfileVolumeWorld" + $"\n - axisIndex must be 0(Forward), 1(Right), 2(Up) (axisIndex={axisIndex})"),
val = (isMin ? spatialData.volumeData.rMinLocalPos : spatialData.volumeData.rMaxLocalPos); };
break; Vector3 position = new Vector3(vector.x / comprehensiveScale.x, vector.y / comprehensiveScale.y, vector.z / comprehensiveScale.z);
case 2: return boneFromBoneMap.TransformPoint(position);
val = (isMin ? spatialData.volumeData.uMinLocalPos : spatialData.volumeData.uMaxLocalPos);
break;
default:
throw new AutoMorpherException("Unsupported Volume Axis Index", "[BodyPoseMatch_CommonUtil] GetProfileVolumeWorld" + $"\n - axisIndex must be 0(Forward), 1(Right), 2(Up) (axisIndex={axisIndex})");
}
Vector3 val2 = new Vector3(val.x / comprehensiveScale.x, val.y / comprehensiveScale.y, val.z / comprehensiveScale.z);
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_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)
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)
{ {
@@ -133,12 +86,12 @@ public class BodyPoseMatch_CommonUtil
} }
foreach (BakedBodyMesh bakedBodyMesh in bakedBodyMeshes) foreach (BakedBodyMesh bakedBodyMesh in bakedBodyMeshes)
{ {
if (bakedBodyMesh == null || (Object)(object)bakedBodyMesh.smr == (Object)null) if (bakedBodyMesh == null || bakedBodyMesh.smr == null)
{ {
continue; continue;
} }
Mesh sharedMesh = bakedBodyMesh.smr.sharedMesh; Mesh sharedMesh = bakedBodyMesh.smr.sharedMesh;
if ((Object)(object)sharedMesh == (Object)null) if (sharedMesh == null)
{ {
continue; continue;
} }
@@ -156,12 +109,12 @@ public class BodyPoseMatch_CommonUtil
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 boneWeight = boneWeights[i];
float wSum = 0f; float wSum = 0f;
Acc(val.boneIndex0, val.weight0); Acc(boneWeight.boneIndex0, boneWeight.weight0);
Acc(val.boneIndex1, val.weight1); Acc(boneWeight.boneIndex1, boneWeight.weight1);
Acc(val.boneIndex2, val.weight2); Acc(boneWeight.boneIndex2, boneWeight.weight2);
Acc(val.boneIndex3, val.weight3); Acc(boneWeight.boneIndex3, boneWeight.weight3);
if (!(wSum < weightThreshold)) if (!(wSum < weightThreshold))
{ {
list.Add(worldVerticesWithBakedMesh[i]); list.Add(worldVerticesWithBakedMesh[i]);
@@ -170,8 +123,8 @@ public class BodyPoseMatch_CommonUtil
{ {
if (index >= 0 && index < bones.Length && !(w <= 0f)) if (index >= 0 && index < bones.Length && !(w <= 0f))
{ {
Transform val2 = bones[index]; Transform transform = bones[index];
if ((Object)(object)val2 != (Object)null && targetBoneSet.Contains(val2)) if (transform != null && targetBoneSet.Contains(transform))
{ {
wSum += w; wSum += w;
} }
@@ -184,9 +137,6 @@ public class BodyPoseMatch_CommonUtil
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_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)
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)
{ {
@@ -201,7 +151,7 @@ public class BodyPoseMatch_CommonUtil
} }
foreach (Transform item in value) foreach (Transform item in value)
{ {
if ((Object)(object)item != (Object)null) if (item != null)
{ {
hashSet.Add(item); hashSet.Add(item);
} }
@@ -209,7 +159,7 @@ public class BodyPoseMatch_CommonUtil
} }
if (hashSet.Count == 0) if (hashSet.Count == 0)
{ {
Debug.Log((object)"[AvatarBodyMatchUtil] CollectBodyPartVerticesWorld: targetBoneSet is empty."); Debug.Log("[AvatarBodyMatchUtil] CollectBodyPartVerticesWorld: targetBoneSet is empty.");
return result; return result;
} }
return this.CollectWeightedVerticesWorld(bakedBodyMeshes, hashSet, weightThreshold, sampleStep); return this.CollectWeightedVerticesWorld(bakedBodyMeshes, hashSet, weightThreshold, sampleStep);
@@ -217,42 +167,27 @@ public class BodyPoseMatch_CommonUtil
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) if (proxyParent == null || proxyChild == null || targetParent == null || targetChild == null)
//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_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_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_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_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_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_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)
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("[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($"[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 direction = proxyChild.position - proxyParent.position;
Vector3 val2 = proxyParent.InverseTransformDirection(val); Vector3 vector = proxyParent.InverseTransformDirection(direction);
float num4 = Mathf.Abs(val2.x); float num4 = Mathf.Abs(vector.x);
float num5 = Mathf.Abs(val2.y); float num5 = Mathf.Abs(vector.y);
float num6 = Mathf.Abs(val2.z); float num6 = Mathf.Abs(vector.z);
num7 = ((num5 >= num4 && num5 >= num6) ? 1 : ((!(num4 >= num6)) ? 2 : 0)); num7 = ((num5 >= num4 && num5 >= num6) ? 1 : ((!(num4 >= num6)) ? 2 : 0));
} }
else else
@@ -280,11 +215,7 @@ public class BodyPoseMatch_CommonUtil
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) if (parentTransform == null)
//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_0068: Unknown result type (might be due to invalid IL or missing references)
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");
} }
@@ -293,21 +224,21 @@ public class BodyPoseMatch_CommonUtil
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, worldPositionStays: 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 = 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 transform2 = childTransforms[i];
if (!((Object)(object)val == (Object)null)) if (!(transform2 == null))
{ {
tempBoneMarker.wrappedChildNames.Add(((Object)val).name); tempBoneMarker.wrappedChildNames.Add(transform2.name);
val.SetParent(transform, true); transform2.SetParent(transform, worldPositionStays: true);
} }
} }
return transform; return transform;

View File

@@ -1,2 +1,2 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 572f8fbf842bcaa45a437b3bf23c5542 guid: 365154814e57582478896172f94bfcca

View File

@@ -1,2 +1,2 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 017928fc2466b8148b073c3a55333355 guid: d5c24488eded1b844bc1790158497120

View File

@@ -17,45 +17,31 @@ public class BodyPoseMatch_Torso
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_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_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_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_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_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_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 transform = sourceHipSet.FirstOrDefault((Transform t) => t != null);
if ((Object)(object)val == (Object)null) if (transform == 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 lhs = targetNeckCenterWorld - sourceNeckCenterWorld;
Vector3 forward = val.forward; Vector3 forward = transform.forward;
float num = Vector3.Dot(val2, forward); float num = Vector3.Dot(lhs, forward);
Vector3 val3 = forward * num; Vector3 vector = forward * num;
foreach (Transform item in sourceHipSet) foreach (Transform item in sourceHipSet)
{ {
if (!((Object)(object)item == (Object)null)) if (!(item == null))
{ {
item.position += val3; item.position += vector;
} }
} }
} }
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) if (proxyObject == null || targetObject == null)
//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)
{ {
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");
} }
@@ -63,10 +49,10 @@ public class BodyPoseMatch_Torso
RegionStats regionStats2 = this.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("[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.Hips, 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");
} }
@@ -75,12 +61,7 @@ public class BodyPoseMatch_Torso
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) if (targetTransform == null)
//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_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)
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");
} }
@@ -91,10 +72,10 @@ public class BodyPoseMatch_Torso
RegionStats regionStats = this.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("[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.Hips, 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");
} }
@@ -104,97 +85,48 @@ public class BodyPoseMatch_Torso
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) HumanBodyBones[] targetHumanBones = new HumanBodyBones[1] { HumanBodyBones.Neck };
//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_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_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_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_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_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_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_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)
HumanBodyBones[] targetHumanBones = (HumanBodyBones[])(object)new HumanBodyBones[1] { (HumanBodyBones)9 };
List<Vector3> list = this.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("[AvatarBodyMatchUtil] ComputeNeckRegionStats: neck vertices 0개. avatar=" + avatarTransform?.name);
return default(RegionStats); return default(RegionStats);
} }
RegionStats result = new PcaUtil().ComputeRegionStats(list); RegionStats result = new PcaUtil().ComputeRegionStats(list);
Vector3 val = avatarTransform.up; Vector3 vector = avatarTransform.up;
Transform boneFromBoneMap = this.poseMatchCommonUtil.GetBoneFromBoneMap(avatarBoneMap, (HumanBodyBones)10); Transform boneFromBoneMap = this.poseMatchCommonUtil.GetBoneFromBoneMap(avatarBoneMap, HumanBodyBones.Head);
Transform boneFromBoneMap2 = this.poseMatchCommonUtil.GetBoneFromBoneMap(avatarBoneMap, (HumanBodyBones)54); Transform boneFromBoneMap2 = this.poseMatchCommonUtil.GetBoneFromBoneMap(avatarBoneMap, HumanBodyBones.UpperChest);
Transform boneFromBoneMap3 = this.poseMatchCommonUtil.GetBoneFromBoneMap(avatarBoneMap, (HumanBodyBones)8); Transform boneFromBoneMap3 = this.poseMatchCommonUtil.GetBoneFromBoneMap(avatarBoneMap, HumanBodyBones.Chest);
Transform boneFromBoneMap4 = this.poseMatchCommonUtil.GetBoneFromBoneMap(avatarBoneMap, (HumanBodyBones)0); Transform boneFromBoneMap4 = this.poseMatchCommonUtil.GetBoneFromBoneMap(avatarBoneMap, HumanBodyBones.Hips);
Transform val2 = (((Object)(object)boneFromBoneMap2 != (Object)null) ? boneFromBoneMap2 : boneFromBoneMap3); Transform transform = ((boneFromBoneMap2 != null) ? boneFromBoneMap2 : boneFromBoneMap3);
if ((Object)(object)boneFromBoneMap != (Object)null && (Object)(object)val2 != (Object)null) if (boneFromBoneMap != null && transform != null)
{ {
val = boneFromBoneMap.position - val2.position; vector = boneFromBoneMap.position - transform.position;
} }
else if ((Object)(object)boneFromBoneMap != (Object)null && (Object)(object)boneFromBoneMap4 != (Object)null) else if (boneFromBoneMap != null && boneFromBoneMap4 != null)
{ {
val = boneFromBoneMap.position - boneFromBoneMap4.position; vector = boneFromBoneMap.position - boneFromBoneMap4.position;
} }
if (val.sqrMagnitude > 1E-08f) if (vector.sqrMagnitude > 1E-08f)
{ {
val.Normalize(); vector.Normalize();
} }
if (Vector3.Dot(val, ((Component)avatarTransform).transform.up) < 0f) if (Vector3.Dot(vector, avatarTransform.transform.up) < 0f)
{ {
val = -val; vector = -vector;
} }
result.principalAxis = val; result.principalAxis = vector;
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) if (!(avatarObject == null))
//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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_0106: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)avatarObject == (Object)null))
{ {
RegionStats regionStats = this.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($"[AvatarBodyMatchUtil] DrawNeckPcaDebug: neck.length가 너무 작음. avatar={avatarObject.name}, length={regionStats.length}");
return; return;
} }
Vector3 center = regionStats.center; Vector3 center = regionStats.center;
@@ -203,9 +135,9 @@ public class BodyPoseMatch_Torso
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 end = center + normalized * num2;
Debug.DrawLine(center, val, axisColor, duration); Debug.DrawLine(center, end, axisColor, duration);
Debug.Log((object)$"[AvatarBodyMatchUtil] DrawNeckPcaDebug: avatar={((Object)avatarObject).name}, center={center}, axis={normalized}, halfLen={num2}"); Debug.Log($"[AvatarBodyMatchUtil] DrawNeckPcaDebug: avatar={avatarObject.name}, center={center}, axis={normalized}, halfLen={num2}");
} }
} }
} }

View File

@@ -1,2 +1,2 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: d1a6c91cb56b3a34783a85387746e795 guid: 13807354cce38d84eb41a5a8d38d99ae

View File

@@ -21,20 +21,11 @@ public class BodyPoseToClothApplier
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) if (bodyProxyRoot == null)
//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_0169: Unknown result type (might be due to invalid IL or missing references)
//IL_016d: Invalid comparison between Unknown and I4
//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_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)
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 (clothesRoot == 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");
} }
@@ -47,12 +38,12 @@ public class BodyPoseToClothApplier
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 = bodyProxyRoot.GetComponent<Animator>();
if ((Object)(object)component == (Object)null) if (component == 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.transform;
Dictionary<Transform, int> dictionary = this.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>();
@@ -61,12 +52,12 @@ public class BodyPoseToClothApplier
{ {
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 (key == 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 (t == null || !sourceToProxy.TryGetValue(t, out var value2) || value2 == null)
{ {
continue; continue;
} }
@@ -83,7 +74,7 @@ public class BodyPoseToClothApplier
proxyBone = value2, proxyBone = value2,
clothBone = key, clothBone = key,
depth = depth, depth = depth,
humanBone = (((int)hBone != 55) ? new HumanBodyBones?(hBone) : ((HumanBodyBones?)null)) humanBone = ((hBone != HumanBodyBones.LastBone) ? new HumanBodyBones?(hBone) : ((HumanBodyBones?)null))
}); });
} }
if (!dictionary2.ContainsKey(value2)) if (!dictionary2.ContainsKey(value2))
@@ -93,11 +84,11 @@ public class BodyPoseToClothApplier
} }
this.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 && m.proxyBone != null && m.clothBone != 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 (!(item2.proxyBone == null) && !(item2.clothBone == null))
{ {
if (copyPosition) if (copyPosition)
{ {
@@ -118,16 +109,16 @@ public class BodyPoseToClothApplier
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 (root == null)
{ {
return dictionary; return dictionary;
} }
Transform[] componentsInChildren = ((Component)root).GetComponentsInChildren<Transform>(true); Transform[] componentsInChildren = root.GetComponentsInChildren<Transform>(includeInactive: true);
foreach (Transform val in componentsInChildren) foreach (Transform transform in componentsInChildren)
{ {
if (!((Object)(object)val == (Object)null)) if (!(transform == null))
{ {
dictionary[val] = this.GetDepthFromRoot(val, root); dictionary[transform] = this.GetDepthFromRoot(transform, root);
} }
} }
return dictionary; return dictionary;
@@ -136,26 +127,22 @@ public class BodyPoseToClothApplier
private int GetDepthFromRoot(Transform t, Transform root) private int GetDepthFromRoot(Transform t, Transform root)
{ {
int num = 0; int num = 0;
Transform val = t; Transform transform = t;
while ((Object)(object)val != (Object)null && (Object)(object)val != (Object)(object)root) while (transform != null && transform != root)
{ {
num++; num++;
val = val.parent; transform = transform.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) if (proxyArmature == null || proxyToCloth == null || mappings == null)
//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_0182: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)proxyArmature == (Object)null || proxyToCloth == null || mappings == null)
{ {
return; return;
} }
TempBoneMarker[] componentsInChildren = ((Component)proxyArmature).GetComponentsInChildren<TempBoneMarker>(true); TempBoneMarker[] componentsInChildren = proxyArmature.GetComponentsInChildren<TempBoneMarker>(includeInactive: true);
if (componentsInChildren == null || componentsInChildren.Length == 0) if (componentsInChildren == null || componentsInChildren.Length == 0)
{ {
return; return;
@@ -164,57 +151,56 @@ public class BodyPoseToClothApplier
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 && boneMapping.proxyBone != null)
{ {
hashSet.Add(boneMapping.proxyBone); hashSet.Add(boneMapping.proxyBone);
} }
} }
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 bm != null && bm.transform != null
orderby (proxyDepthMap != null && proxyDepthMap.TryGetValue(((Component)bm).transform, out value3)) ? value3 : int.MaxValue orderby (proxyDepthMap != null && proxyDepthMap.TryGetValue(bm.transform, out var value3)) ? value3 : int.MaxValue
select bm).ToList()) select bm).ToList())
{ {
Transform transform = ((Component)item).transform; Transform transform = item.transform;
if ((Object)(object)transform == (Object)null) if (transform == 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 (originalParent == null || !proxyToCloth.TryGetValue(originalParent, out var value) || value == null)
{ {
continue; continue;
} }
List<Transform> list = this.CollectDirectChilds(value); List<Transform> list = this.CollectDirectChilds(value);
Transform val = this.FindMarkerInChild(value); Transform transform2 = this.FindMarkerInChild(value);
TempBoneMarker tempBoneMarker = null; TempBoneMarker tempBoneMarker = null;
if ((Object)(object)val == (Object)null) if (transform2 == null)
{ {
val = new GameObject(((Object)transform).name).transform; transform2 = new GameObject(transform.name).transform;
val.SetParent(value, true); transform2.SetParent(value, worldPositionStays: true);
tempBoneMarker = ((Component)val).gameObject.AddComponent<TempBoneMarker>(); tempBoneMarker = transform2.gameObject.AddComponent<TempBoneMarker>();
} }
else else
{ {
tempBoneMarker = ((Component)val).GetComponent<TempBoneMarker>(); tempBoneMarker = transform2.GetComponent<TempBoneMarker>();
} }
val.position = transform.position; transform2.position = transform.position;
val.rotation = transform.rotation; transform2.rotation = transform.rotation;
val.localScale = transform.localScale; transform2.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 transform3 = list[num];
if (!((Object)(object)val2 == (Object)null) && !((Object)(object)val2 == (Object)(object)val)) if (!(transform3 == null) && !(transform3 == transform2))
{ {
val2.SetParent(val, true); transform3.SetParent(transform2, worldPositionStays: true);
} }
} }
if (!proxyToCloth.ContainsKey(transform)) if (!proxyToCloth.ContainsKey(transform))
{ {
proxyToCloth.Add(transform, val); proxyToCloth.Add(transform, transform2);
} }
if (hashSet.Add(transform)) if (hashSet.Add(transform))
{ {
@@ -226,7 +212,7 @@ public class BodyPoseToClothApplier
mappings.Add(new BoneMapping mappings.Add(new BoneMapping
{ {
proxyBone = transform, proxyBone = transform,
clothBone = val, clothBone = transform2,
depth = depth, depth = depth,
humanBone = null humanBone = null
}); });
@@ -236,14 +222,14 @@ public class BodyPoseToClothApplier
private Transform FindMarkerInChild(Transform parent) private Transform FindMarkerInChild(Transform parent)
{ {
if ((Object)(object)parent == (Object)null) if (parent == 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 (!(child == null) && child.GetComponent<TempBoneMarker>() != null)
{ {
return child; return child;
} }

View File

@@ -1,2 +1,2 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 3fd7263ca727f7d4aaea10382583c7f2 guid: f39701ad78a777b48a7b931538b63608

View File

@@ -10,14 +10,9 @@ 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) if (cloth == null || targetAvatarAnimator == null)
//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_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)
if (cloth == null || (Object)(object)targetAvatarAnimator == (Object)null)
{ {
Debug.LogWarning((object)"[BoneAlignmentUtil] cloth 또는 targetAvatarAnimator 가 null."); Debug.LogWarning("[BoneAlignmentUtil] cloth 또는 targetAvatarAnimator 가 null.");
return; return;
} }
foreach (KeyValuePair<HumanBodyBones, HashSet<Transform>> humanoidMatchedBone in cloth.humanoidMatchedBones) foreach (KeyValuePair<HumanBodyBones, HashSet<Transform>> humanoidMatchedBone in cloth.humanoidMatchedBones)
@@ -25,14 +20,14 @@ public class BoneAlignmentUtil
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 (!(item == null))
{ {
Transform boneTransform = targetAvatarAnimator.GetBoneTransform(key); Transform boneTransform = targetAvatarAnimator.GetBoneTransform(key);
if (!((Object)(object)boneTransform == (Object)null)) if (!(boneTransform == null))
{ {
item.position = boneTransform.position; item.position = boneTransform.position;
item.localScale = Vector3.one; item.localScale = Vector3.one;
((Object)item).name = ((Object)boneTransform).name; item.name = boneTransform.name;
} }
} }
} }
@@ -41,17 +36,12 @@ public class BoneAlignmentUtil
public void ReparentAccessoryBonesToAvatar(EdenAutoMorpherConfig config) public void ReparentAccessoryBonesToAvatar(EdenAutoMorpherConfig config)
{ {
//IL_005e: Unknown result type (might be due to invalid IL or missing references) if (config.clothBoneTypeMap == null || config.targetAvatarObject == null)
//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_01fa: Unknown result type (might be due to invalid IL or missing references)
//IL_0201: Expected O, but got Unknown
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 (component == null || !component.isHuman)
{ {
return; return;
} }
@@ -64,7 +54,7 @@ public class BoneAlignmentUtil
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 (item2 != null && boneTransform != null)
{ {
dictionary[item2] = boneTransform; dictionary[item2] = boneTransform;
} }
@@ -78,45 +68,44 @@ public class BoneAlignmentUtil
continue; continue;
} }
Transform key2 = item3.Key; Transform key2 = item3.Key;
if ((Object)(object)key2 == (Object)null || !key2.IsChildOf(config.targetClothesObject.transform)) if (key2 == null || !key2.IsChildOf(config.targetClothesObject.transform))
{ {
continue; continue;
} }
Transform parent = key2.parent; Transform parent = key2.parent;
Transform val = null; Transform transform = null;
while ((Object)(object)parent != (Object)null) while (parent != 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; transform = parent;
break; break;
} }
parent = parent.parent; parent = parent.parent;
} }
if (!((Object)(object)val == (Object)null) && dictionary.TryGetValue(val, out var value2)) if (!(transform == null) && dictionary.TryGetValue(transform, out var value2))
{ {
key2.SetParent(value2, true); key2.SetParent(value2, worldPositionStays: 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 (key3 == null || value3 == 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; list.Add(item5);
list.Add(item);
} }
foreach (Transform item6 in list) foreach (Transform item6 in list)
{ {
if (!((Object)(object)item6 == (Object)null) && !config.clothBoneTypeMap.ContainsKey(item6)) if (!(item6 == null) && !config.clothBoneTypeMap.ContainsKey(item6))
{ {
item6.SetParent(value3, true); item6.SetParent(value3, worldPositionStays: true);
} }
} }
} }
@@ -124,51 +113,51 @@ public class BoneAlignmentUtil
public void CleanupTempBones(Transform root) public void CleanupTempBones(Transform root)
{ {
if ((Object)(object)root == (Object)null) if (root == null)
{ {
return; return;
} }
TempBoneMarker[] componentsInChildren = ((Component)root).GetComponentsInChildren<TempBoneMarker>(true); TempBoneMarker[] componentsInChildren = root.GetComponentsInChildren<TempBoneMarker>(includeInactive: 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 m != null
orderby GetDepth(((Component)m).transform) descending orderby GetDepth(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 (tempBoneMarker == null)
{ {
continue; continue;
} }
Transform transform = ((Component)tempBoneMarker).transform; Transform transform = tempBoneMarker.transform;
Transform val = tempBoneMarker.originalParent; Transform transform2 = tempBoneMarker.originalParent;
if ((Object)(object)val == (Object)null) if (transform2 == null)
{ {
val = transform.parent; transform2 = transform.parent;
} }
if ((Object)(object)val != (Object)null) if (transform2 != null)
{ {
while (transform.childCount > 0) while (transform.childCount > 0)
{ {
transform.GetChild(0).SetParent(val, true); transform.GetChild(0).SetParent(transform2, worldPositionStays: true);
} }
} }
if (!Application.isPlaying) if (!Application.isPlaying)
{ {
Object.DestroyImmediate((Object)(object)((Component)transform).gameObject); Object.DestroyImmediate(transform.gameObject);
} }
else else
{ {
Object.Destroy((Object)(object)((Component)transform).gameObject); Object.Destroy(transform.gameObject);
} }
} }
int GetDepth(Transform t) static int GetDepth(Transform t)
{ {
int num2 = 0; int num2 = 0;
while ((Object)(object)t != (Object)null) while (t != null)
{ {
num2++; num2++;
t = t.parent; t = t.parent;

View File

@@ -1,2 +1,2 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 43763a44e7c2a8e44a4fd8a6a6436db3 guid: d079bedd1d590d743a87a7526aac81d0

View File

@@ -134,16 +134,16 @@ public class BoneCorrespondenceUtil
public string GetHierarchyPath(Transform root, Transform t) public string GetHierarchyPath(Transform root, Transform t)
{ {
if ((Object)(object)t == (Object)null) if (t == null)
{ {
return ""; return "";
} }
Stack<string> stack = new Stack<string>(); Stack<string> stack = new Stack<string>();
Transform val = t; Transform transform = t;
while ((Object)(object)val != (Object)null && (Object)(object)val != (Object)(object)root) while (transform != null && transform != root)
{ {
stack.Push(((Object)val).name); stack.Push(transform.name);
val = val.parent; transform = transform.parent;
} }
return string.Join("/", stack); return string.Join("/", stack);
} }

View File

@@ -1,2 +1,2 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 675a70ff79a4c1d43820074163c01b90 guid: 1a08d4f82c8d94f4cadc7d8de2833278

View File

@@ -21,7 +21,7 @@ public class BoneMatchUtil
public Quaternion rootLocalRot; public Quaternion rootLocalRot;
public HumanBodyBones hBone = (HumanBodyBones)55; public HumanBodyBones hBone = HumanBodyBones.LastBone;
} }
private const float PosTolNear = 0.0001f; private const float PosTolNear = 0.0001f;
@@ -36,12 +36,6 @@ public class BoneMatchUtil
public List<BoneRootLocalData> ConvertProfileBoneDataToRootLocalData(List<BoneData> boneDataList) public List<BoneRootLocalData> ConvertProfileBoneDataToRootLocalData(List<BoneData> boneDataList)
{ {
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: 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_008b: 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)
if (boneDataList == null || boneDataList.Count == 0) if (boneDataList == null || boneDataList.Count == 0)
{ {
throw new AutoMorpherException("Profile Bone Data is Missing", "[BoneMatchUtil] ConvertProfileBoneDataToRootLocalData\n - boneDataList is null or empty"); throw new AutoMorpherException("Profile Bone Data is Missing", "[BoneMatchUtil] ConvertProfileBoneDataToRootLocalData\n - boneDataList is null or empty");
@@ -78,11 +72,11 @@ public class BoneMatchUtil
continue; continue;
} }
Transform[] bones = meshRenderer.bones; Transform[] bones = meshRenderer.bones;
foreach (Transform val in bones) foreach (Transform transform in bones)
{ {
if (val != null) if (transform != null)
{ {
hashSet.Add(val); hashSet.Add(transform);
} }
} }
} }
@@ -106,18 +100,6 @@ public class BoneMatchUtil
public List<BoneRootLocalData> GetBodyRootLocalBones(Transform bodyTransform, Animator bodyAnimator, List<SkinnedMeshRenderer> bodyMeshes) public List<BoneRootLocalData> GetBodyRootLocalBones(Transform bodyTransform, Animator bodyAnimator, List<SkinnedMeshRenderer> bodyMeshes)
{ {
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Invalid comparison between Unknown and I4
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: 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_0139: Unknown result type (might be due to invalid IL or missing references)
//IL_013b: Unknown result type (might be due to invalid IL or missing references)
//IL_013f: Invalid comparison between Unknown and I4
//IL_015e: 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_0283: Unknown result type (might be due to invalid IL or missing references)
//IL_0285: Unknown result type (might be due to invalid IL or missing references)
if (bodyTransform == null) if (bodyTransform == null)
{ {
throw new AutoMorpherException("Body Transform is Missing", "[BoneMatchUtil] GetBodyRootLocalBones\n - bodyTransform is null"); throw new AutoMorpherException("Body Transform is Missing", "[BoneMatchUtil] GetBodyRootLocalBones\n - bodyTransform is null");
@@ -141,7 +123,7 @@ public class BoneMatchUtil
HashSet<Transform> hashSet2 = new HashSet<Transform>(); HashSet<Transform> hashSet2 = new HashSet<Transform>();
foreach (KeyValuePair<Transform, HumanBodyBones> item in humanoidBoneList) foreach (KeyValuePair<Transform, HumanBodyBones> item in humanoidBoneList)
{ {
if ((int)item.Value != 55 && !(item.Key == null)) if (item.Value != HumanBodyBones.LastBone && !(item.Key == null))
{ {
if (!dictionary.TryGetValue(item.Value, out var value) || value == null) if (!dictionary.TryGetValue(item.Value, out var value) || value == null)
{ {
@@ -154,7 +136,7 @@ public class BoneMatchUtil
foreach (KeyValuePair<HumanBodyBones, HashSet<Transform>> item2 in dictionary) foreach (KeyValuePair<HumanBodyBones, HashSet<Transform>> item2 in dictionary)
{ {
HumanBodyBones key = item2.Key; HumanBodyBones key = item2.Key;
if ((int)key == 55) if (key == HumanBodyBones.LastBone)
{ {
continue; continue;
} }
@@ -163,19 +145,19 @@ public class BoneMatchUtil
{ {
continue; continue;
} }
Transform val = bodyAnimator.GetBoneTransform(key); Transform transform = bodyAnimator.GetBoneTransform(key);
if (val == null) if (transform == null)
{ {
val = value2.First(); transform = value2.First();
} }
if (val == null) if (transform == null)
{ {
continue; continue;
} }
hashSet.Add(val); hashSet.Add(transform);
foreach (Transform item3 in value2) foreach (Transform item3 in value2)
{ {
if (!(item3 == val) && !(item3 == null)) if (!(item3 == transform) && !(item3 == null))
{ {
hashSet2.Add(item3); hashSet2.Add(item3);
} }
@@ -199,7 +181,7 @@ public class BoneMatchUtil
} }
else else
{ {
item5.hBone = (HumanBodyBones)55; item5.hBone = HumanBodyBones.LastBone;
} }
} }
} }
@@ -208,12 +190,6 @@ public class BoneMatchUtil
private Dictionary<Transform, HumanBodyBones> GetHumanoidBoneList(Animator bodyAnimator) private Dictionary<Transform, HumanBodyBones> GetHumanoidBoneList(Animator bodyAnimator)
{ {
//IL_0049: 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_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Invalid comparison between Unknown and I4
//IL_0055: 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)
Dictionary<Transform, HumanBodyBones> dictionary = new Dictionary<Transform, HumanBodyBones>(); Dictionary<Transform, HumanBodyBones> dictionary = new Dictionary<Transform, HumanBodyBones>();
if (bodyAnimator == null || bodyAnimator.avatar == null || !bodyAnimator.avatar.isHuman) if (bodyAnimator == null || bodyAnimator.avatar == null || !bodyAnimator.avatar.isHuman)
{ {
@@ -221,7 +197,7 @@ public class BoneMatchUtil
} }
foreach (HumanBodyBones value in Enum.GetValues(typeof(HumanBodyBones))) foreach (HumanBodyBones value in Enum.GetValues(typeof(HumanBodyBones)))
{ {
if ((int)value != 55) if (value != HumanBodyBones.LastBone)
{ {
Transform boneTransform = bodyAnimator.GetBoneTransform(value); Transform boneTransform = bodyAnimator.GetBoneTransform(value);
if (!(boneTransform == null)) if (!(boneTransform == null))
@@ -235,16 +211,6 @@ public class BoneMatchUtil
public void MatchClothesToBodyBones(List<BoneRootLocalData> bodyBones, List<BoneRootLocalData> clothesBones, out Dictionary<HumanBodyBones, HashSet<Transform>> clothHumanBones, out Dictionary<Transform, ClothBoneType> clothBoneTypeMap, out Dictionary<Transform, BoneRootLocalData> clothToBodyMatched) public void MatchClothesToBodyBones(List<BoneRootLocalData> bodyBones, List<BoneRootLocalData> clothesBones, out Dictionary<HumanBodyBones, HashSet<Transform>> clothHumanBones, out Dictionary<Transform, ClothBoneType> clothBoneTypeMap, out Dictionary<Transform, BoneRootLocalData> clothToBodyMatched)
{ {
//IL_00ac: 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_0113: 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_035d: Unknown result type (might be due to invalid IL or missing references)
//IL_0362: Unknown result type (might be due to invalid IL or missing references)
//IL_0364: Unknown result type (might be due to invalid IL or missing references)
//IL_0368: Invalid comparison between Unknown and I4
//IL_036c: 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)
clothHumanBones = new Dictionary<HumanBodyBones, HashSet<Transform>>(); clothHumanBones = new Dictionary<HumanBodyBones, HashSet<Transform>>();
clothBoneTypeMap = new Dictionary<Transform, ClothBoneType>(); clothBoneTypeMap = new Dictionary<Transform, ClothBoneType>();
clothToBodyMatched = new Dictionary<Transform, BoneRootLocalData>(); clothToBodyMatched = new Dictionary<Transform, BoneRootLocalData>();
@@ -332,7 +298,7 @@ public class BoneMatchUtil
clothBoneTypeMap[clothesBone2.t] = ClothBoneType.Body; clothBoneTypeMap[clothesBone2.t] = ClothBoneType.Body;
clothToBodyMatched[clothesBone2.t] = value; clothToBodyMatched[clothesBone2.t] = value;
HumanBodyBones hBone = value.hBone; HumanBodyBones hBone = value.hBone;
if ((int)hBone != 55) if (hBone != HumanBodyBones.LastBone)
{ {
if (!clothHumanBones.TryGetValue(hBone, out var value2)) if (!clothHumanBones.TryGetValue(hBone, out var value2))
{ {
@@ -402,9 +368,6 @@ public class BoneMatchUtil
public Dictionary<Transform, Transform> BuildTransformMatchMap(List<BoneRootLocalData> sourceBones, List<BoneRootLocalData> destBones, bool resultReverse = false) public Dictionary<Transform, Transform> BuildTransformMatchMap(List<BoneRootLocalData> sourceBones, List<BoneRootLocalData> destBones, bool resultReverse = false)
{ {
//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
//IL_02be: Unknown result type (might be due to invalid IL or missing references)
//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
if (sourceBones == null || sourceBones.Count == 0) if (sourceBones == null || sourceBones.Count == 0)
{ {
throw new AutoMorpherException("Source Bones are Missing", "[BoneMatchUtil] BuildTransformMatchMap\n - sourceBones is null or empty"); throw new AutoMorpherException("Source Bones are Missing", "[BoneMatchUtil] BuildTransformMatchMap\n - sourceBones is null or empty");
@@ -454,27 +417,27 @@ public class BoneMatchUtil
{ {
continue; continue;
} }
Transform val = null; Transform transform = null;
string text4 = sourceBone.path ?? ""; string text4 = sourceBone.path ?? "";
if (text4.Length > 0 && dictionary2.TryGetValue(text4, out var value2) && value2 != null && value2.t != null && !hashSet.Contains(value2.t)) if (text4.Length > 0 && dictionary2.TryGetValue(text4, out var value2) && value2 != null && value2.t != null && !hashSet.Contains(value2.t))
{ {
val = value2.t; transform = value2.t;
} }
if (val == null && text4.Length > 0) if (transform == null && text4.Length > 0)
{ {
string text5 = boneCorrespondenceUtil.NormalizePath(text4); string text5 = boneCorrespondenceUtil.NormalizePath(text4);
if (text5.Length > 0 && dictionary3.TryGetValue(text5, out var value3) && value3 != null && value3.t != null && !hashSet.Contains(value3.t)) if (text5.Length > 0 && dictionary3.TryGetValue(text5, out var value3) && value3 != null && value3.t != null && !hashSet.Contains(value3.t))
{ {
val = value3.t; transform = value3.t;
} }
} }
if (val == null) if (transform == null)
{ {
string text6 = sourceBone.name ?? sourceBone.t.name; string text6 = sourceBone.name ?? sourceBone.t.name;
if (!string.IsNullOrEmpty(text6) && dictionary4.TryGetValue(text6, out var value4)) if (!string.IsNullOrEmpty(text6) && dictionary4.TryGetValue(text6, out var value4))
{ {
float num = float.PositiveInfinity; float num = float.PositiveInfinity;
Transform val2 = null; Transform transform2 = null;
for (int i = 0; i < value4.Count; i++) for (int i = 0; i < value4.Count; i++)
{ {
BoneRootLocalData boneRootLocalData = value4[i]; BoneRootLocalData boneRootLocalData = value4[i];
@@ -484,24 +447,24 @@ public class BoneMatchUtil
if (num2 < num) if (num2 < num)
{ {
num = num2; num = num2;
val2 = boneRootLocalData.t; transform2 = boneRootLocalData.t;
} }
} }
} }
val = val2; transform = transform2;
} }
} }
if (val != null) if (transform != null)
{ {
if (resultReverse) if (resultReverse)
{ {
dictionary[val] = sourceBone.t; dictionary[transform] = sourceBone.t;
} }
else else
{ {
dictionary[sourceBone.t] = val; dictionary[sourceBone.t] = transform;
} }
hashSet.Add(val); hashSet.Add(transform);
} }
} }
return dictionary; return dictionary;
@@ -509,10 +472,6 @@ public class BoneMatchUtil
public void RemapSourceClothMatchToTargetCloth(Transform sourceClothRoot, Transform targetClothRoot, Dictionary<HumanBodyBones, HashSet<Transform>> sourceClothHumanBones, Dictionary<Transform, ClothBoneType> sourceClothBoneTypeMap, out Dictionary<HumanBodyBones, HashSet<Transform>> targetClothHumanBones, out Dictionary<Transform, ClothBoneType> targetClothBoneTypeMap) public void RemapSourceClothMatchToTargetCloth(Transform sourceClothRoot, Transform targetClothRoot, Dictionary<HumanBodyBones, HashSet<Transform>> sourceClothHumanBones, Dictionary<Transform, ClothBoneType> sourceClothBoneTypeMap, out Dictionary<HumanBodyBones, HashSet<Transform>> targetClothHumanBones, out Dictionary<Transform, ClothBoneType> targetClothBoneTypeMap)
{ {
//IL_025c: Unknown result type (might be due to invalid IL or missing references)
//IL_0261: Unknown result type (might be due to invalid IL or missing references)
//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
targetClothHumanBones = new Dictionary<HumanBodyBones, HashSet<Transform>>(); targetClothHumanBones = new Dictionary<HumanBodyBones, HashSet<Transform>>();
targetClothBoneTypeMap = new Dictionary<Transform, ClothBoneType>(); targetClothBoneTypeMap = new Dictionary<Transform, ClothBoneType>();
if (sourceClothRoot == null || targetClothRoot == null) if (sourceClothRoot == null || targetClothRoot == null)
@@ -550,7 +509,7 @@ public class BoneMatchUtil
{ {
throw new AutoMorpherException("Source Cloth Bone Candidates are Missing", "[BoneMatchUtil] RemapClothMatchResultToTargetCloth\n - sourceBoneSet is empty (no bones found in sourceClothBoneTypeMap/sourceClothHumanBones)"); throw new AutoMorpherException("Source Cloth Bone Candidates are Missing", "[BoneMatchUtil] RemapClothMatchResultToTargetCloth\n - sourceBoneSet is empty (no bones found in sourceClothBoneTypeMap/sourceClothHumanBones)");
} }
HashSet<Transform> meshBones = this.GetMeshBones(((Component)targetClothRoot).GetComponentsInChildren<SkinnedMeshRenderer>(true).ToList()); HashSet<Transform> meshBones = this.GetMeshBones(targetClothRoot.GetComponentsInChildren<SkinnedMeshRenderer>(includeInactive: true).ToList());
if (meshBones == null || meshBones.Count == 0) if (meshBones == null || meshBones.Count == 0)
{ {
throw new AutoMorpherException("Target Cloth Bone Candidates are Missing", "[BoneMatchUtil] RemapClothMatchResultToTargetCloth\n - targetBoneSet is null or empty (GetMeshBones returned no bones)"); throw new AutoMorpherException("Target Cloth Bone Candidates are Missing", "[BoneMatchUtil] RemapClothMatchResultToTargetCloth\n - targetBoneSet is null or empty (GetMeshBones returned no bones)");
@@ -620,14 +579,14 @@ public class BoneMatchUtil
{ {
throw new AutoMorpherException("Proxy Avatar is Missing", "[AvatarBodyMatchUtil] BuildSourceToProxyBoneMap\n - proxyAvatar is null"); throw new AutoMorpherException("Proxy Avatar is Missing", "[AvatarBodyMatchUtil] BuildSourceToProxyBoneMap\n - proxyAvatar is null");
} }
Transform transform = ((Component)sourceAvatar).transform; Transform transform = sourceAvatar.transform;
Transform transform2 = ((Component)proxyAvatar).transform; Transform transform2 = proxyAvatar.transform;
HashSet<Transform> meshBones = this.GetMeshBones(((Component)transform2).GetComponentsInChildren<SkinnedMeshRenderer>(true).ToList()); HashSet<Transform> meshBones = this.GetMeshBones(transform2.GetComponentsInChildren<SkinnedMeshRenderer>(includeInactive: true).ToList());
if (meshBones == null || meshBones.Count == 0) if (meshBones == null || meshBones.Count == 0)
{ {
throw new AutoMorpherException("Proxy Body Bone Candidates are Missing", "[AvatarBodyMatchUtil] BuildSourceToProxyBoneMap\n - proxyBoneSet is null or empty (GetMeshBones returned no bones)"); throw new AutoMorpherException("Proxy Body Bone Candidates are Missing", "[AvatarBodyMatchUtil] BuildSourceToProxyBoneMap\n - proxyBoneSet is null or empty (GetMeshBones returned no bones)");
} }
HashSet<Transform> meshBones2 = this.GetMeshBones(((Component)transform).GetComponentsInChildren<SkinnedMeshRenderer>(true).ToList()); HashSet<Transform> meshBones2 = this.GetMeshBones(transform.GetComponentsInChildren<SkinnedMeshRenderer>(includeInactive: true).ToList());
if (meshBones2 == null || meshBones2.Count == 0) if (meshBones2 == null || meshBones2.Count == 0)
{ {
throw new AutoMorpherException("Source Body Bone Candidates are Missing", "[AvatarBodyMatchUtil] BuildSourceToProxyBoneMap\n - sourceBoneSet is null or empty (GetMeshBones returned no bones)"); throw new AutoMorpherException("Source Body Bone Candidates are Missing", "[AvatarBodyMatchUtil] BuildSourceToProxyBoneMap\n - sourceBoneSet is null or empty (GetMeshBones returned no bones)");

View File

@@ -1,2 +1,2 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: f86c83d34b8a02f43957580934fc99d5 guid: 1b3f5d2f72b363c4a89a5c46103505c5

View File

@@ -1,2 +1,2 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 9b5eed04003cc164caea2b92431ac42e guid: 8cff8387b82491d47a5ad0ba7d35a706

View File

@@ -1,2 +1,2 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 44ba3839eef03a64c9c499a67dc02420 guid: 32009a1b0b1882e4f87cdff91a494b17

View File

@@ -22,7 +22,43 @@ public class BvhTriangleMesh
private TriangleUtil triangleUtil; private TriangleUtil triangleUtil;
private HumanBodyBones[] humanBones; private HumanBodyBones[] humanBones = new HumanBodyBones[34]
{
HumanBodyBones.Hips,
HumanBodyBones.Spine,
HumanBodyBones.Chest,
HumanBodyBones.UpperChest,
HumanBodyBones.Neck,
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.LeftToes,
HumanBodyBones.RightUpperLeg,
HumanBodyBones.RightLowerLeg,
HumanBodyBones.RightFoot,
HumanBodyBones.RightToes,
HumanBodyBones.Head,
HumanBodyBones.LeftEye,
HumanBodyBones.RightEye
};
public BvhTriangle[] triangles; public BvhTriangle[] triangles;
@@ -34,64 +70,25 @@ public class BvhTriangleMesh
public BvhTriangleMesh() public BvhTriangleMesh()
{ {
this.humanBones = new HumanBodyBones[34]
{
HumanBodyBones.Hips,
HumanBodyBones.LeftUpperLeg,
HumanBodyBones.RightUpperLeg,
HumanBodyBones.LeftLowerLeg,
HumanBodyBones.RightLowerLeg,
HumanBodyBones.LeftFoot,
HumanBodyBones.RightFoot,
HumanBodyBones.Spine,
HumanBodyBones.Chest,
HumanBodyBones.Neck,
HumanBodyBones.Head,
HumanBodyBones.LeftShoulder,
HumanBodyBones.RightShoulder,
HumanBodyBones.LeftUpperArm,
HumanBodyBones.RightUpperArm,
HumanBodyBones.LeftLowerArm,
HumanBodyBones.RightLowerArm,
HumanBodyBones.LeftHand,
HumanBodyBones.RightHand,
HumanBodyBones.LeftToes,
HumanBodyBones.RightToes,
HumanBodyBones.LeftEye,
HumanBodyBones.RightEye,
HumanBodyBones.Jaw,
HumanBodyBones.LeftThumbProximal,
HumanBodyBones.LeftIndexProximal,
HumanBodyBones.LeftMiddleProximal,
HumanBodyBones.LeftRingProximal,
HumanBodyBones.RightThumbProximal,
HumanBodyBones.RightIndexProximal,
HumanBodyBones.RightMiddleProximal,
HumanBodyBones.RightRingProximal,
HumanBodyBones.LeftLittleProximal,
HumanBodyBones.RightLittleProximal
};
this.triangleUtil = new TriangleUtil(); this.triangleUtil = new TriangleUtil();
} }
private HumanBodyBones[] BuildVertexMainHumanBone(SkinnedMeshRenderer smr, Animator animator, HumanBodyBones[] bodyBones) private HumanBodyBones[] BuildVertexMainHumanBone(SkinnedMeshRenderer smr, Animator animator, HumanBodyBones[] bodyBones)
{ {
//IL_0035: 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)
Mesh sharedMesh = smr.sharedMesh; Mesh sharedMesh = smr.sharedMesh;
BoneWeight[] boneWeights = sharedMesh.boneWeights; BoneWeight[] boneWeights = sharedMesh.boneWeights;
int[] boneToBodyIndex = this.BuildBoneToBodyIndexMap(smr, animator, bodyBones); int[] boneToBodyIndex = this.BuildBoneToBodyIndexMap(smr, animator, bodyBones);
HumanBodyBones[] array = (HumanBodyBones[])(object)new HumanBodyBones[sharedMesh.vertexCount]; HumanBodyBones[] array = new HumanBodyBones[sharedMesh.vertexCount];
for (int i = 0; i < sharedMesh.vertexCount; i++) for (int i = 0; i < sharedMesh.vertexCount; i++)
{ {
BoneWeight val = boneWeights[i]; BoneWeight boneWeight = boneWeights[i];
int bestBodyIdx = -1; int bestBodyIdx = -1;
float bestWeight = 0f; float bestWeight = 0f;
Try(val.boneIndex0, val.weight0); Try(boneWeight.boneIndex0, boneWeight.weight0);
Try(val.boneIndex1, val.weight1); Try(boneWeight.boneIndex1, boneWeight.weight1);
Try(val.boneIndex2, val.weight2); Try(boneWeight.boneIndex2, boneWeight.weight2);
Try(val.boneIndex3, val.weight3); Try(boneWeight.boneIndex3, boneWeight.weight3);
array[i] = (HumanBodyBones)((bestBodyIdx >= 0) ? ((int)bodyBones[bestBodyIdx]) : 55); array[i] = ((bestBodyIdx >= 0) ? bodyBones[bestBodyIdx] : HumanBodyBones.LastBone);
void Try(int boneIdx, float w) void Try(int boneIdx, float w)
{ {
if (!(w <= 0f) && boneIdx >= 0 && boneIdx < boneToBodyIndex.Length) if (!(w <= 0f) && boneIdx >= 0 && boneIdx < boneToBodyIndex.Length)
@@ -110,51 +107,6 @@ public class BvhTriangleMesh
public BvhTriangleMesh BuildFromSkinnedMeshes(IReadOnlyList<SkinnedMeshRenderer> renderers, Animator animator) public BvhTriangleMesh BuildFromSkinnedMeshes(IReadOnlyList<SkinnedMeshRenderer> renderers, Animator animator)
{ {
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Expected O, but got Unknown
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
//IL_0111: Unknown result type (might be due to invalid IL or missing references)
//IL_011a: 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_0148: 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_0166: Unknown result type (might be due to invalid IL or missing references)
//IL_016b: 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_019f: Unknown result type (might be due to invalid IL or missing references)
//IL_01a4: 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_01b1: 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_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_01cd: 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_01d1: Unknown result type (might be due to invalid IL or missing references)
//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
//IL_01d8: 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_01dc: Unknown result type (might be due to invalid IL or missing references)
//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
//IL_0207: Unknown result type (might be due to invalid IL or missing references)
//IL_020c: 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_01fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0203: 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_0251: Unknown result type (might be due to invalid IL or missing references)
//IL_0253: 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_025c: Unknown result type (might be due to invalid IL or missing references)
//IL_0263: 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_026c: 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_0275: Unknown result type (might be due to invalid IL or missing references)
//IL_0277: Unknown result type (might be due to invalid IL or missing references)
if (renderers == null || renderers.Count == 0) if (renderers == null || renderers.Count == 0)
{ {
return null; return null;
@@ -174,46 +126,53 @@ public class BvhTriangleMesh
} }
bvhTriangleMesh.triangles = new BvhTriangle[num]; bvhTriangleMesh.triangles = new BvhTriangle[num];
int num2 = 0; int num2 = 0;
Mesh val = new Mesh(); Mesh mesh = new Mesh();
Vector3 val2 = default(Vector3);
foreach (SkinnedMeshRenderer renderer2 in renderers) foreach (SkinnedMeshRenderer renderer2 in renderers)
{ {
if (!(renderer2 == null) && !(renderer2.sharedMesh == null)) if (renderer2 == null || renderer2.sharedMesh == null)
{ {
val.Clear(); continue;
renderer2.BakeMesh(val); }
Vector3[] vertices = val.vertices; mesh.Clear();
renderer2.BakeMesh(mesh);
Vector3[] vertices = mesh.vertices;
int[] array = renderer2.sharedMesh.triangles; int[] array = renderer2.sharedMesh.triangles;
BoneWeight[] boneWeights = renderer2.sharedMesh.boneWeights; BoneWeight[] boneWeights = renderer2.sharedMesh.boneWeights;
int[] boneToBodyIndex = this.BuildBoneToBodyIndexMap(renderer2, animator, this.humanBones); int[] boneToBodyIndex = this.BuildBoneToBodyIndexMap(renderer2, animator, this.humanBones);
int num3 = array.Length / 3; int num3 = array.Length / 3;
Transform transform = ((Component)renderer2).transform; Transform transform = renderer2.transform;
Vector3 lossyScale = transform.lossyScale; Vector3 lossyScale = transform.lossyScale;
val2 = new Vector3(1f / Mathf.Max(lossyScale.x, 1E-08f), 1f / Mathf.Max(lossyScale.y, 1E-08f), 1f / Mathf.Max(lossyScale.z, 1E-08f)); Vector3 vector = new Vector3(1f / Mathf.Max(lossyScale.x, 1E-08f), 1f / Mathf.Max(lossyScale.y, 1E-08f), 1f / Mathf.Max(lossyScale.z, 1E-08f));
Matrix4x4 val3 = transform.localToWorldMatrix * Matrix4x4.Scale(val2); Matrix4x4 matrix4x = transform.localToWorldMatrix * Matrix4x4.Scale(vector);
for (int i = 0; i < num3; i++) for (int i = 0; i < num3; i++)
{ {
int num4 = array[i * 3]; int num4 = array[i * 3];
int num5 = array[i * 3 + 1]; int num5 = array[i * 3 + 1];
int num6 = array[i * 3 + 2]; int num6 = array[i * 3 + 2];
Vector3 val4 = val3.MultiplyPoint3x4(vertices[num4]); Vector3 vector2 = matrix4x.MultiplyPoint3x4(vertices[num4]);
Vector3 val5 = val3.MultiplyPoint3x4(vertices[num5]); Vector3 vector3 = matrix4x.MultiplyPoint3x4(vertices[num5]);
Vector3 val6 = val3.MultiplyPoint3x4(vertices[num6]); Vector3 vector4 = matrix4x.MultiplyPoint3x4(vertices[num6]);
Vector3 val7 = Vector3.Cross(val5 - val4, val6 - val4); Vector3 normal = Vector3.Cross(vector3 - vector2, vector4 - vector2);
float magnitude = val7.magnitude; float magnitude = normal.magnitude;
val7 = ((!(magnitude > 1E-08f)) ? Vector3.up : (val7 / magnitude)); if (magnitude > 1E-08f)
{
normal /= magnitude;
}
else
{
normal = Vector3.up;
}
int num7 = this.ComputeTriangleMainHumanBoneIndex(num4, num5, num6, boneWeights, boneToBodyIndex, this.humanBones.Length); int num7 = this.ComputeTriangleMainHumanBoneIndex(num4, num5, num6, boneWeights, boneToBodyIndex, this.humanBones.Length);
HumanBodyBones mainHumanBone = (HumanBodyBones)((num7 >= 0) ? ((int)this.humanBones[num7]) : 55); HumanBodyBones mainHumanBone = ((num7 >= 0) ? this.humanBones[num7] : HumanBodyBones.LastBone);
bvhTriangleMesh.triangles[num2++] = new BvhTriangle bvhTriangleMesh.triangles[num2++] = new BvhTriangle
{ {
a = val4, a = vector2,
b = val5, b = vector3,
c = val6, c = vector4,
normal = val7, normal = normal,
mainHumanBone = mainHumanBone mainHumanBone = mainHumanBone
}; };
val.Clear(); mesh.Clear();
}
} }
} }
int num8 = num; int num8 = num;
@@ -231,8 +190,6 @@ public class BvhTriangleMesh
private int[] BuildBoneToBodyIndexMap(SkinnedMeshRenderer smr, Animator animator, HumanBodyBones[] bodyBones) private int[] BuildBoneToBodyIndexMap(SkinnedMeshRenderer smr, Animator animator, HumanBodyBones[] bodyBones)
{ {
//IL_009d: 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)
Transform[] bones = smr.bones; Transform[] bones = smr.bones;
int[] array = new int[bones.Length]; int[] array = new int[bones.Length];
for (int i = 0; i < array.Length; i++) for (int i = 0; i < array.Length; i++)
@@ -251,7 +208,7 @@ public class BvhTriangleMesh
dictionary.Add(bones[j], j); dictionary.Add(bones[j], j);
} }
} }
Dictionary<HumanBodyBones, HashSet<Transform>> dictionary2 = new MeshClassifier().MeshHumanoidBoneMatcher(animator, (IReadOnlyList<SkinnedMeshRenderer>)(object)new SkinnedMeshRenderer[1] { smr }); Dictionary<HumanBodyBones, HashSet<Transform>> dictionary2 = new MeshClassifier().MeshHumanoidBoneMatcher(animator, new SkinnedMeshRenderer[1] { smr });
for (int k = 0; k < bodyBones.Length; k++) for (int k = 0; k < bodyBones.Length; k++)
{ {
HumanBodyBones key = bodyBones[k]; HumanBodyBones key = bodyBones[k];
@@ -273,12 +230,12 @@ public class BvhTriangleMesh
{ {
continue; continue;
} }
Transform val = bones[l]; Transform transform = bones[l];
if (val == null) if (transform == null)
{ {
continue; continue;
} }
Transform parent = val.parent; Transform parent = transform.parent;
if (!(parent == null) && dictionary.TryGetValue(parent, out var value3)) if (!(parent == null) && dictionary.TryGetValue(parent, out var value3))
{ {
int num = array[value3]; int num = array[value3];
@@ -314,15 +271,13 @@ public class BvhTriangleMesh
return result; return result;
void Accumulate(int v) void Accumulate(int v)
{ {
//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)
if (v >= 0 && v < weights.Length) if (v >= 0 && v < weights.Length)
{ {
BoneWeight val = weights[v]; BoneWeight boneWeight = weights[v];
Add(val.boneIndex0, val.weight0); Add(boneWeight.boneIndex0, boneWeight.weight0);
Add(val.boneIndex1, val.weight1); Add(boneWeight.boneIndex1, boneWeight.weight1);
Add(val.boneIndex2, val.weight2); Add(boneWeight.boneIndex2, boneWeight.weight2);
Add(val.boneIndex3, val.weight3); Add(boneWeight.boneIndex3, boneWeight.weight3);
} }
} }
void Add(int boneIdx, float w) void Add(int boneIdx, float w)
@@ -340,36 +295,6 @@ public class BvhTriangleMesh
public BvhTriangleMesh BuildFromSkinnedMeshes(IList<SkinnedMeshRenderer> renderers) public BvhTriangleMesh BuildFromSkinnedMeshes(IList<SkinnedMeshRenderer> renderers)
{ {
//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_010d: 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_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_0131: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: Unknown result type (might be due to invalid IL or missing references)
//IL_013b: 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_013f: 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_0148: 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_014f: 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_0175: Unknown result type (might be due to invalid IL or missing references)
//IL_017a: 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_016c: Unknown result type (might be due to invalid IL or missing references)
//IL_0171: 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_0193: Unknown result type (might be due to invalid IL or missing references)
//IL_019a: 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_01a3: Unknown result type (might be due to invalid IL or missing references)
//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
//IL_01ac: 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)
if (renderers == null || renderers.Count == 0) if (renderers == null || renderers.Count == 0)
{ {
return null; return null;
@@ -391,8 +316,10 @@ public class BvhTriangleMesh
int num2 = 0; int num2 = 0;
foreach (SkinnedMeshRenderer renderer2 in renderers) foreach (SkinnedMeshRenderer renderer2 in renderers)
{ {
if (!(renderer2 == null) && !(renderer2.sharedMesh == null)) if (renderer2 == null || renderer2.sharedMesh == null)
{ {
continue;
}
Mesh sharedMesh = renderer2.sharedMesh; Mesh sharedMesh = renderer2.sharedMesh;
Vector3[] vertices = sharedMesh.vertices; Vector3[] vertices = sharedMesh.vertices;
int[] array = sharedMesh.triangles; int[] array = sharedMesh.triangles;
@@ -402,22 +329,28 @@ public class BvhTriangleMesh
int num4 = array[i * 3]; int num4 = array[i * 3];
int num5 = array[i * 3 + 1]; int num5 = array[i * 3 + 1];
int num6 = array[i * 3 + 2]; int num6 = array[i * 3 + 2];
Vector3 val = ((Component)renderer2).transform.TransformPoint(vertices[num4]); Vector3 vector = renderer2.transform.TransformPoint(vertices[num4]);
Vector3 val2 = ((Component)renderer2).transform.TransformPoint(vertices[num5]); Vector3 vector2 = renderer2.transform.TransformPoint(vertices[num5]);
Vector3 val3 = ((Component)renderer2).transform.TransformPoint(vertices[num6]); Vector3 vector3 = renderer2.transform.TransformPoint(vertices[num6]);
Vector3 val4 = Vector3.Cross(val2 - val, val3 - val); Vector3 normal = Vector3.Cross(vector2 - vector, vector3 - vector);
float magnitude = val4.magnitude; float magnitude = normal.magnitude;
val4 = ((!(magnitude > 1E-08f)) ? Vector3.up : (val4 / magnitude)); if (magnitude > 1E-08f)
{
normal /= magnitude;
}
else
{
normal = Vector3.up;
}
bvhTriangleMesh.triangles[num2++] = new BvhTriangle bvhTriangleMesh.triangles[num2++] = new BvhTriangle
{ {
a = val, a = vector,
b = val2, b = vector2,
c = val3, c = vector3,
normal = val4 normal = normal
}; };
} }
} }
}
int num7 = num; int num7 = num;
int[] array2 = new int[num7]; int[] array2 = new int[num7];
for (int j = 0; j < num7; j++) for (int j = 0; j < num7; j++)
@@ -433,36 +366,6 @@ public class BvhTriangleMesh
public BvhTriangleMesh BuildFromMesh(Mesh mesh, Transform transform) public BvhTriangleMesh BuildFromMesh(Mesh mesh, Transform transform)
{ {
//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_0058: 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_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_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: 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_007c: 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_0085: 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_008c: 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_00b2: 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_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: 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_00d4: 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_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
BvhTriangleMesh bvhTriangleMesh = new BvhTriangleMesh(); BvhTriangleMesh bvhTriangleMesh = new BvhTriangleMesh();
Vector3[] vertices = mesh.vertices; Vector3[] vertices = mesh.vertices;
int[] array = mesh.triangles; int[] array = mesh.triangles;
@@ -473,18 +376,25 @@ public class BvhTriangleMesh
int num2 = array[i * 3]; int num2 = array[i * 3];
int num3 = array[i * 3 + 1]; int num3 = array[i * 3 + 1];
int num4 = array[i * 3 + 2]; int num4 = array[i * 3 + 2];
Vector3 val = transform.TransformPoint(vertices[num2]); Vector3 vector = transform.TransformPoint(vertices[num2]);
Vector3 val2 = transform.TransformPoint(vertices[num3]); Vector3 vector2 = transform.TransformPoint(vertices[num3]);
Vector3 val3 = transform.TransformPoint(vertices[num4]); Vector3 vector3 = transform.TransformPoint(vertices[num4]);
Vector3 val4 = Vector3.Cross(val2 - val, val3 - val); Vector3 normal = Vector3.Cross(vector2 - vector, vector3 - vector);
float magnitude = val4.magnitude; float magnitude = normal.magnitude;
val4 = ((!(magnitude > 1E-08f)) ? Vector3.up : (val4 / magnitude)); if (magnitude > 1E-08f)
{
normal /= magnitude;
}
else
{
normal = Vector3.up;
}
bvhTriangleMesh.triangles[i] = new BvhTriangle bvhTriangleMesh.triangles[i] = new BvhTriangle
{ {
a = val, a = vector,
b = val2, b = vector2,
c = val3, c = vector3,
normal = val4 normal = normal
}; };
} }
int[] array2 = new int[num]; int[] array2 = new int[num];
@@ -501,33 +411,6 @@ public class BvhTriangleMesh
private int BuildRecursive(BvhTriangle[] tris, int[] triIndices, int start, int count, List<BvhNode> outNodes) private int BuildRecursive(BvhTriangle[] tris, int[] triIndices, int start, int count, List<BvhNode> outNodes)
{ {
//IL_0012: 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_009c: 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_0073: 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_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_0045: 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_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: 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_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_011a: Unknown result type (might be due to invalid IL or missing references)
//IL_0121: 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_014e: Unknown result type (might be due to invalid IL or missing references)
//IL_0153: 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_015f: 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_016e: Unknown result type (might be due to invalid IL or missing references)
int count2 = outNodes.Count; int count2 = outNodes.Count;
BvhNode bvhNode = default(BvhNode); BvhNode bvhNode = default(BvhNode);
Bounds bounds = default(Bounds); Bounds bounds = default(Bounds);
@@ -574,8 +457,7 @@ public class BvhTriangleMesh
for (int j = start; j < start + count; j++) for (int j = start; j < start + count; j++)
{ {
BvhTriangle bvhTriangle2 = tris[triIndices[j]]; BvhTriangle bvhTriangle2 = tris[triIndices[j]];
Vector3 val = (bvhTriangle2.a + bvhTriangle2.b + bvhTriangle2.c) / 3f; num2 += ((bvhTriangle2.a + bvhTriangle2.b + bvhTriangle2.c) / 3f)[num];
num2 += val[num];
} }
num2 /= (float)count; num2 /= (float)count;
int num3 = this.Partition(tris, triIndices, start, count, num, num2); int num3 = this.Partition(tris, triIndices, start, count, num, num2);
@@ -620,7 +502,6 @@ public class BvhTriangleMesh
public ClosestHit QueryClosest(Vector3 point) public ClosestHit QueryClosest(Vector3 point)
{ {
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
ClosestHit best = new ClosestHit ClosestHit best = new ClosestHit
{ {
triangleIndex = -1, triangleIndex = -1,
@@ -636,8 +517,6 @@ public class BvhTriangleMesh
public ClosestHit QueryClosest(Vector3 point, HashSet<HumanBodyBones> allowedBones) public ClosestHit QueryClosest(Vector3 point, HashSet<HumanBodyBones> allowedBones)
{ {
//IL_003e: 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)
ClosestHit best = new ClosestHit ClosestHit best = new ClosestHit
{ {
triangleIndex = -1, triangleIndex = -1,
@@ -660,33 +539,6 @@ public class BvhTriangleMesh
private void QueryClosestRecursiveFiltered(int nodeIndex, Vector3 p, ref ClosestHit best, HashSet<HumanBodyBones> allowedBones) private void QueryClosestRecursiveFiltered(int nodeIndex, Vector3 p, ref ClosestHit best, HashSet<HumanBodyBones> allowedBones)
{ {
//IL_000e: 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_00fd: 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_0116: 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_0150: 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_0137: 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_0063: 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_0078: 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_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: 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_0092: 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_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_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: 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_00ce: 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_00db: Unknown result type (might be due to invalid IL or missing references)
BvhNode bvhNode = this.nodes[nodeIndex]; BvhNode bvhNode = this.nodes[nodeIndex];
if (this.DistanceSqPointAABB(p, bvhNode.bounds) > best.sqrDistance) if (this.DistanceSqPointAABB(p, bvhNode.bounds) > best.sqrDistance)
{ {
@@ -701,14 +553,13 @@ public class BvhTriangleMesh
BvhTriangle bvhTriangle = this.triangles[num2]; BvhTriangle bvhTriangle = this.triangles[num2];
if (allowedBones.Contains(bvhTriangle.mainHumanBone)) if (allowedBones.Contains(bvhTriangle.mainHumanBone))
{ {
Vector3 val = this.triangleUtil.ClosestPointOnTriangle(p, bvhTriangle.a, bvhTriangle.b, bvhTriangle.c); Vector3 vector = this.triangleUtil.ClosestPointOnTriangle(p, bvhTriangle.a, bvhTriangle.b, bvhTriangle.c);
Vector3 val2 = p - val; float sqrMagnitude = (p - vector).sqrMagnitude;
float sqrMagnitude = val2.sqrMagnitude;
if (sqrMagnitude < best.sqrDistance) if (sqrMagnitude < best.sqrDistance)
{ {
best.sqrDistance = sqrMagnitude; best.sqrDistance = sqrMagnitude;
best.triangleIndex = num2; best.triangleIndex = num2;
best.closestPoint = val; best.closestPoint = vector;
best.normal = bvhTriangle.normal; best.normal = bvhTriangle.normal;
best.mainHumanBone = bvhTriangle.mainHumanBone; best.mainHumanBone = bvhTriangle.mainHumanBone;
} }
@@ -736,32 +587,6 @@ public class BvhTriangleMesh
private void QueryClosestRecursive(int nodeIndex, Vector3 p, ref ClosestHit best) private void QueryClosestRecursive(int nodeIndex, Vector3 p, ref ClosestHit best)
{ {
//IL_000e: 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_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0106: 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_013c: 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_0127: 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_0065: 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_0076: 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_0080: 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_0083: 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_00af: 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_00b9: 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_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)
BvhNode bvhNode = this.nodes[nodeIndex]; BvhNode bvhNode = this.nodes[nodeIndex];
if (this.DistanceSqPointAABB(p, bvhNode.bounds) > best.sqrDistance) if (this.DistanceSqPointAABB(p, bvhNode.bounds) > best.sqrDistance)
{ {
@@ -774,14 +599,13 @@ public class BvhTriangleMesh
{ {
int num2 = this.triIndices[i]; int num2 = this.triIndices[i];
BvhTriangle bvhTriangle = this.triangles[num2]; BvhTriangle bvhTriangle = this.triangles[num2];
Vector3 val = this.triangleUtil.ClosestPointOnTriangle(p, bvhTriangle.a, bvhTriangle.b, bvhTriangle.c); Vector3 vector = this.triangleUtil.ClosestPointOnTriangle(p, bvhTriangle.a, bvhTriangle.b, bvhTriangle.c);
Vector3 val2 = p - val; float sqrMagnitude = (p - vector).sqrMagnitude;
float sqrMagnitude = val2.sqrMagnitude;
if (sqrMagnitude < best.sqrDistance) if (sqrMagnitude < best.sqrDistance)
{ {
best.sqrDistance = sqrMagnitude; best.sqrDistance = sqrMagnitude;
best.triangleIndex = num2; best.triangleIndex = num2;
best.closestPoint = val; best.closestPoint = vector;
best.normal = bvhTriangle.normal; best.normal = bvhTriangle.normal;
best.mainHumanBone = bvhTriangle.mainHumanBone; best.mainHumanBone = bvhTriangle.mainHumanBone;
} }
@@ -808,42 +632,14 @@ public class BvhTriangleMesh
private float DistanceSqPointAABB(Vector3 p, Bounds b) private float DistanceSqPointAABB(Vector3 p, Bounds b)
{ {
//IL_000a: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Max(b.min.x - p.x, 0f, p.x - b.max.x);
//IL_0014: Unknown result type (might be due to invalid IL or missing references) float num2 = Mathf.Max(b.min.y - p.y, 0f, p.y - b.max.y);
//IL_001e: Unknown result type (might be due to invalid IL or missing references) float num3 = Mathf.Max(b.min.z - p.z, 0f, p.z - b.max.z);
//IL_0026: 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_004c: 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_005e: 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_0084: 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_0096: Unknown result type (might be due to invalid IL or missing references)
float num = Mathf.Max(new float[3]
{
b.min.x - p.x,
0f,
p.x - b.max.x
});
float num2 = Mathf.Max(new float[3]
{
b.min.y - p.y,
0f,
p.y - b.max.y
});
float num3 = Mathf.Max(new float[3]
{
b.min.z - p.z,
0f,
p.z - b.max.z
});
return num * num + num2 * num2 + num3 * num3; return num * num + num2 * num2 + num3 * num3;
} }
public int QueryClosestN(Vector3 point, int maxCount, float maxDistance, List<ClosestHit> results) public int QueryClosestN(Vector3 point, int maxCount, float maxDistance, List<ClosestHit> results)
{ {
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
results.Clear(); results.Clear();
if (this.nodes == null || this.nodes.Length == 0 || maxCount <= 0) if (this.nodes == null || this.nodes.Length == 0 || maxCount <= 0)
{ {
@@ -857,36 +653,6 @@ public class BvhTriangleMesh
private void QueryClosestNRecursive(int nodeIndex, Vector3 p, int maxCount, float maxDistanceSq, List<ClosestHit> bestHits, ref float currentMaxSq) private void QueryClosestNRecursive(int nodeIndex, Vector3 p, int maxCount, float maxDistanceSq, List<ClosestHit> bestHits, ref float currentMaxSq)
{ {
//IL_000e: 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_01c8: 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_01e1: Unknown result type (might be due to invalid IL or missing references)
//IL_01ef: 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_0233: Unknown result type (might be due to invalid IL or missing references)
//IL_0202: 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_0062: 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_006c: 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_0078: 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_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_0082: 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_00b9: 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_00c4: 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_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: 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_017b: Unknown result type (might be due to invalid IL or missing references)
//IL_0184: Unknown result type (might be due to invalid IL or missing references)
//IL_0189: Unknown result type (might be due to invalid IL or missing references)
BvhNode bvhNode = this.nodes[nodeIndex]; BvhNode bvhNode = this.nodes[nodeIndex];
if (this.DistanceSqPointAABB(p, bvhNode.bounds) > currentMaxSq) if (this.DistanceSqPointAABB(p, bvhNode.bounds) > currentMaxSq)
{ {
@@ -899,9 +665,8 @@ public class BvhTriangleMesh
{ {
int num2 = this.triIndices[i]; int num2 = this.triIndices[i];
BvhTriangle bvhTriangle = this.triangles[num2]; BvhTriangle bvhTriangle = this.triangles[num2];
Vector3 val = this.triangleUtil.ClosestPointOnTriangle(p, bvhTriangle.a, bvhTriangle.b, bvhTriangle.c); Vector3 vector = this.triangleUtil.ClosestPointOnTriangle(p, bvhTriangle.a, bvhTriangle.b, bvhTriangle.c);
Vector3 val2 = p - val; float sqrMagnitude = (p - vector).sqrMagnitude;
float sqrMagnitude = val2.sqrMagnitude;
if (sqrMagnitude > maxDistanceSq) if (sqrMagnitude > maxDistanceSq)
{ {
continue; continue;
@@ -911,7 +676,7 @@ public class BvhTriangleMesh
bestHits.Add(new ClosestHit bestHits.Add(new ClosestHit
{ {
triangleIndex = num2, triangleIndex = num2,
closestPoint = val, closestPoint = vector,
normal = bvhTriangle.normal, normal = bvhTriangle.normal,
sqrDistance = sqrMagnitude, sqrDistance = sqrMagnitude,
mainHumanBone = bvhTriangle.mainHumanBone mainHumanBone = bvhTriangle.mainHumanBone
@@ -940,7 +705,7 @@ public class BvhTriangleMesh
bestHits[index] = new ClosestHit bestHits[index] = new ClosestHit
{ {
triangleIndex = num2, triangleIndex = num2,
closestPoint = val, closestPoint = vector,
normal = bvhTriangle.normal, normal = bvhTriangle.normal,
sqrDistance = sqrMagnitude sqrDistance = sqrMagnitude
}; };
@@ -986,28 +751,16 @@ public class BvhTriangleMesh
public Vector3 ComputeMoveVectorToSurface(Vector3 p, float targetGap = 0f) public Vector3 ComputeMoveVectorToSurface(Vector3 p, float targetGap = 0f)
{ {
//IL_0001: 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_001d: 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_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: 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_0034: 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_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)
ClosestHit closestHit = this.QueryClosest(p); ClosestHit closestHit = this.QueryClosest(p);
if (closestHit.triangleIndex < 0) if (closestHit.triangleIndex < 0)
{ {
return Vector3.zero; return Vector3.zero;
} }
Vector3 val = closestHit.closestPoint - p; Vector3 result = closestHit.closestPoint - p;
if (targetGap > 0f) if (targetGap > 0f)
{ {
val += closestHit.normal.normalized * targetGap; result += closestHit.normal.normalized * targetGap;
} }
return val; return result;
} }
} }

View File

@@ -1,2 +1,2 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: b11038f4c94c79a419d6d3b4c5bf1810 guid: 26359c45f906f7346836cb8290c0ae62

View File

@@ -1,2 +1,2 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 7a85f954ffdaea34ba8dd2b70733ae6a guid: 5f2e2dc7719ac914497c5f6f71c28f66

View File

@@ -9,74 +9,72 @@ 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) if (clothInstance == null || clothInstance.smr == null)
//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
if (clothInstance == null || (Object)(object)clothInstance.smr == (Object)null)
{ {
Debug.LogWarning((object)"[ClothHumanoidMaskUtil] clothInstance / smr 가 null"); Debug.LogWarning("[ClothHumanoidMaskUtil] clothInstance / smr 가 null");
return; return;
} }
SkinnedMeshRenderer smr = clothInstance.smr; SkinnedMeshRenderer smr = clothInstance.smr;
Mesh val = clothInstance.editableMesh ?? smr.sharedMesh; Mesh mesh = clothInstance.editableMesh ?? smr.sharedMesh;
if ((Object)(object)val == (Object)null) if (mesh == null)
{ {
Debug.LogWarning((object)"[ClothHumanoidMaskUtil] mesh 가 null"); Debug.LogWarning("[ClothHumanoidMaskUtil] mesh 가 null");
return; return;
} }
BoneWeight[] boneWeights = val.boneWeights; BoneWeight[] boneWeights = mesh.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("[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("[ClothHumanoidMaskUtil] humanoidMatchedBones 가 비어있음 (BodyToClothPoseApplier에서 매칭 안 되었을 가능성)");
return; return;
} }
int num = val.vertexCount; int num = mesh.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.Head, out var value) && value != null)
{ {
foreach (Transform item in value) foreach (Transform item in value)
{ {
if (!((Object)(object)item == (Object)null)) if (!(item == null))
{ {
AddHierarchy(item, includeRoot: true); AddHierarchy(item, includeRoot: true);
} }
} }
} }
if (humanoidMatchedBones.TryGetValue((HumanBodyBones)17, out var value2) && value2 != null) if (humanoidMatchedBones.TryGetValue(HumanBodyBones.LeftHand, out var value2) && value2 != null)
{ {
foreach (Transform item2 in value2) foreach (Transform item2 in value2)
{ {
if (!((Object)(object)item2 == (Object)null)) if (!(item2 == null))
{ {
AddHierarchy(item2, excludeHandRoot); AddHierarchy(item2, excludeHandRoot);
} }
} }
} }
if (humanoidMatchedBones.TryGetValue((HumanBodyBones)18, out var value3) && value3 != null) if (humanoidMatchedBones.TryGetValue(HumanBodyBones.RightHand, out var value3) && value3 != null)
{ {
foreach (Transform item3 in value3) foreach (Transform item3 in value3)
{ {
if (!((Object)(object)item3 == (Object)null)) if (!(item3 == null))
{ {
AddHierarchy(item3, excludeHandRoot); AddHierarchy(item3, excludeHandRoot);
} }
} }
} }
if (humanoidMatchedBones.TryGetValue((HumanBodyBones)24, out var value4) && value4 != null) if (humanoidMatchedBones.TryGetValue(HumanBodyBones.LeftThumbProximal, out var value4) && value4 != null)
{ {
foreach (Transform item4 in value4) foreach (Transform item4 in value4)
{ {
if (!((Object)(object)item4 == (Object)null)) if (!(item4 == null))
{ {
if (excludeThumbRoot) if (excludeThumbRoot)
{ {
@@ -89,11 +87,11 @@ public class ClothHumanoidMaskUtil
} }
} }
} }
if (humanoidMatchedBones.TryGetValue((HumanBodyBones)39, out var value5) && value5 != null) if (humanoidMatchedBones.TryGetValue(HumanBodyBones.RightThumbProximal, out var value5) && value5 != null)
{ {
foreach (Transform item5 in value5) foreach (Transform item5 in value5)
{ {
if (!((Object)(object)item5 == (Object)null)) if (!(item5 == null))
{ {
if (excludeThumbRoot) if (excludeThumbRoot)
{ {
@@ -109,8 +107,8 @@ public class ClothHumanoidMaskUtil
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 transform = bones[i];
if ((Object)(object)val2 != (Object)null && excludedBones.Contains(val2)) if (transform != null && excludedBones.Contains(transform))
{ {
boneIndexExcluded[i] = true; boneIndexExcluded[i] = true;
} }
@@ -118,12 +116,12 @@ public class ClothHumanoidMaskUtil
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 boneWeight = boneWeights[j];
float excludedWeightSum = 0f; float excludedWeightSum = 0f;
AddExcludedWeight(val3.weight0, val3.boneIndex0); AddExcludedWeight(boneWeight.weight0, boneWeight.boneIndex0);
AddExcludedWeight(val3.weight1, val3.boneIndex1); AddExcludedWeight(boneWeight.weight1, boneWeight.boneIndex1);
AddExcludedWeight(val3.weight2, val3.boneIndex2); AddExcludedWeight(boneWeight.weight2, boneWeight.boneIndex2);
AddExcludedWeight(val3.weight3, val3.boneIndex3); AddExcludedWeight(boneWeight.weight3, boneWeight.boneIndex3);
array[j] = excludedWeightSum >= 0.8f; array[j] = excludedWeightSum >= 0.8f;
void AddExcludedWeight(float w, int bi) void AddExcludedWeight(float w, int bi)
{ {
@@ -137,7 +135,7 @@ public class ClothHumanoidMaskUtil
this.BuildLegVertexMasks(clothInstance); this.BuildLegVertexMasks(clothInstance);
void AddHierarchy(Transform root, bool includeRoot) void AddHierarchy(Transform root, bool includeRoot)
{ {
if (!((Object)(object)root == (Object)null)) if (!(root == null))
{ {
Stack<Transform> stack = new Stack<Transform>(); Stack<Transform> stack = new Stack<Transform>();
if (includeRoot) if (includeRoot)
@@ -153,12 +151,12 @@ public class ClothHumanoidMaskUtil
} }
while (stack.Count > 0) while (stack.Count > 0)
{ {
Transform val4 = stack.Pop(); Transform transform2 = stack.Pop();
if (!((Object)(object)val4 == (Object)null) && excludedBones.Add(val4)) if (!(transform2 == null) && excludedBones.Add(transform2))
{ {
for (int l = 0; l < val4.childCount; l++) for (int l = 0; l < transform2.childCount; l++)
{ {
stack.Push(val4.GetChild(l)); stack.Push(transform2.GetChild(l));
} }
} }
} }
@@ -168,33 +166,31 @@ public class ClothHumanoidMaskUtil
public void BuildLegVertexMasks(ClothInstance clothInstance) public void BuildLegVertexMasks(ClothInstance clothInstance)
{ {
//IL_020b: Unknown result type (might be due to invalid IL or missing references) if (clothInstance == null || clothInstance.smr == null)
//IL_0210: Unknown result type (might be due to invalid IL or missing references)
if (clothInstance == null || (Object)(object)clothInstance.smr == (Object)null)
{ {
Debug.LogWarning((object)"[ClothHumanoidMaskUtil] clothInstance / smr 가 null"); Debug.LogWarning("[ClothHumanoidMaskUtil] clothInstance / smr 가 null");
return; return;
} }
SkinnedMeshRenderer smr = clothInstance.smr; SkinnedMeshRenderer smr = clothInstance.smr;
Mesh val = clothInstance.editableMesh ?? smr.sharedMesh; Mesh mesh = clothInstance.editableMesh ?? smr.sharedMesh;
if ((Object)(object)val == (Object)null) if (mesh == null)
{ {
Debug.LogWarning((object)"[ClothHumanoidMaskUtil] mesh 가 null"); Debug.LogWarning("[ClothHumanoidMaskUtil] mesh 가 null");
return; return;
} }
BoneWeight[] boneWeights = val.boneWeights; BoneWeight[] boneWeights = mesh.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("[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("[ClothHumanoidMaskUtil] humanoidMatchedBones 가 비어있음 (BodyToClothPoseApplier에서 매칭 필요)");
return; return;
} }
int num = val.vertexCount; int num = mesh.vertexCount;
if (boneWeights.Length != num) if (boneWeights.Length != num)
{ {
num = Mathf.Min(num, boneWeights.Length); num = Mathf.Min(num, boneWeights.Length);
@@ -202,21 +198,21 @@ public class ClothHumanoidMaskUtil
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.LeftUpperLeg, out var value) && value != null)
{ {
foreach (Transform item in value) foreach (Transform item in value)
{ {
if (!((Object)(object)item == (Object)null)) if (!(item == null))
{ {
CollectHierarchy(item, hashSet); CollectHierarchy(item, hashSet);
} }
} }
} }
if (humanoidMatchedBones.TryGetValue((HumanBodyBones)2, out var value2) && value2 != null) if (humanoidMatchedBones.TryGetValue(HumanBodyBones.RightUpperLeg, out var value2) && value2 != null)
{ {
foreach (Transform item2 in value2) foreach (Transform item2 in value2)
{ {
if (!((Object)(object)item2 == (Object)null)) if (!(item2 == null))
{ {
CollectHierarchy(item2, hashSet2); CollectHierarchy(item2, hashSet2);
} }
@@ -226,14 +222,14 @@ public class ClothHumanoidMaskUtil
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 transform = bones[i];
if (!((Object)(object)val2 == (Object)null)) if (!(transform == null))
{ {
if (hashSet.Contains(val2)) if (hashSet.Contains(transform))
{ {
boneIsLeftLeg[i] = true; boneIsLeftLeg[i] = true;
} }
if (hashSet2.Contains(val2)) if (hashSet2.Contains(transform))
{ {
boneIsRightLeg[i] = true; boneIsRightLeg[i] = true;
} }
@@ -243,13 +239,13 @@ public class ClothHumanoidMaskUtil
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 boneWeight = boneWeights[j];
float leftWeight = 0f; float leftWeight = 0f;
float rightWeight = 0f; float rightWeight = 0f;
Check(val3.boneIndex0, val3.weight0); Check(boneWeight.boneIndex0, boneWeight.weight0);
Check(val3.boneIndex1, val3.weight1); Check(boneWeight.boneIndex1, boneWeight.weight1);
Check(val3.boneIndex2, val3.weight2); Check(boneWeight.boneIndex2, boneWeight.weight2);
Check(val3.boneIndex3, val3.weight3); Check(boneWeight.boneIndex3, boneWeight.weight3);
if (leftWeight > 0.8f) if (leftWeight > 0.8f)
{ {
array[j] = true; array[j] = true;
@@ -282,20 +278,20 @@ public class ClothHumanoidMaskUtil
} }
clothInstance.isLeftLegVertex = array; clothInstance.isLeftLegVertex = array;
clothInstance.isRightLegVertex = array2; clothInstance.isRightLegVertex = array2;
void CollectHierarchy(Transform root, HashSet<Transform> set) static void CollectHierarchy(Transform root, HashSet<Transform> set)
{ {
if (!((Object)(object)root == (Object)null)) if (!(root == 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 transform2 = stack.Pop();
if (!((Object)(object)val4 == (Object)null) && set.Add(val4)) if (!(transform2 == null) && set.Add(transform2))
{ {
for (int k = 0; k < val4.childCount; k++) for (int k = 0; k < transform2.childCount; k++)
{ {
stack.Push(val4.GetChild(k)); stack.Push(transform2.GetChild(k));
} }
} }
} }

View File

@@ -1,2 +1,2 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 9a879c7a5d70cc44d91ba2a65259927d guid: 47dc065d4616e574a92830eba48a0269

View File

@@ -4,6 +4,7 @@
// Eden.AutoMorpher.ClothInstance // Eden.AutoMorpher.ClothInstance
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Eden.AutoMorpher;
using UnityEngine; using UnityEngine;
[Serializable] [Serializable]
@@ -47,162 +48,78 @@ public class ClothInstance
public ClothInstance(SkinnedMeshRenderer clotheSMR, bool duplicateMesh = true) public ClothInstance(SkinnedMeshRenderer clotheSMR, bool duplicateMesh = true)
{ {
this.smr = clotheSMR; smr = clotheSMR;
if (duplicateMesh) if (duplicateMesh)
{ {
string name = this.smr.sharedMesh.name; string name = smr.sharedMesh.name;
this.editableMesh = UnityEngine.Object.Instantiate<Mesh>(clotheSMR.sharedMesh); editableMesh = UnityEngine.Object.Instantiate(clotheSMR.sharedMesh);
this.editableMesh.name = name + "_EditableMesh"; editableMesh.name = name + "_EditableMesh";
this.smr.sharedMesh = this.editableMesh; smr.sharedMesh = editableMesh;
} }
else else
{ {
this.editableMesh = this.smr.sharedMesh; editableMesh = smr.sharedMesh;
} }
this.UpdateWorldVertices(); UpdateWorldVertices();
int vertexCount = this.editableMesh.vertexCount; int vertexCount = editableMesh.vertexCount;
this.minDistanceVector = (Vector3[])(object)new Vector3[vertexCount]; minDistanceVector = new Vector3[vertexCount];
this.deltas = (Vector3[])(object)new Vector3[vertexCount]; deltas = new Vector3[vertexCount];
this.minDistance = new float[vertexCount]; minDistance = new float[vertexCount];
this.isInsideVertex = new bool[vertexCount]; isInsideVertex = new bool[vertexCount];
this.excludedVertices = new bool[vertexCount]; excludedVertices = new bool[vertexCount];
this.isLeftLegVertex = new bool[vertexCount]; isLeftLegVertex = new bool[vertexCount];
this.isRightLegVertex = new bool[vertexCount]; isRightLegVertex = new bool[vertexCount];
this.humanoidMatchedBones = new Dictionary<HumanBodyBones, HashSet<Transform>>(); humanoidMatchedBones = new Dictionary<HumanBodyBones, HashSet<Transform>>();
this.vertexAdjacency = this.BuildVertexAdjacency(this.editableMesh); vertexAdjacency = BuildVertexAdjacency(editableMesh);
this.BuildEquivalentVerticesFromWorld(); BuildEquivalentVerticesFromWorld();
} }
public void UpdateWorldVertices() public void UpdateWorldVertices()
{ {
//IL_000f: Unknown result type (might be due to invalid IL or missing references) if (bakedMesh == null)
//IL_0019: Expected O, but got Unknown
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_0185: Unknown result type (might be due to invalid IL or missing references)
//IL_018a: Unknown result type (might be due to invalid IL or missing references)
//IL_018f: Unknown result type (might be due to invalid IL or missing references)
//IL_0193: Unknown result type (might be due to invalid IL or missing references)
//IL_0198: Unknown result type (might be due to invalid IL or missing references)
//IL_01da: Unknown result type (might be due to invalid IL or missing references)
//IL_01df: Unknown result type (might be due to invalid IL or missing references)
//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0205: Unknown result type (might be due to invalid IL or missing references)
//IL_021a: Unknown result type (might be due to invalid IL or missing references)
//IL_021f: Unknown result type (might be due to invalid IL or missing references)
if (this.bakedMesh == null)
{ {
this.bakedMesh = new Mesh(); bakedMesh = new Mesh();
} }
else else
{ {
this.bakedMesh.Clear(); bakedMesh.Clear();
} }
this.smr.BakeMesh(this.bakedMesh); smr.BakeMesh(bakedMesh);
int vertexCount = this.editableMesh.vertexCount; int vertexCount = editableMesh.vertexCount;
Vector3 lossyScale = ((Component)this.smr).transform.lossyScale; Vector3 lossyScale = smr.transform.lossyScale;
Vector3 val = new Vector3(1f / Mathf.Max(lossyScale.x, 1E-08f), 1f / Mathf.Max(lossyScale.y, 1E-08f), 1f / Mathf.Max(lossyScale.z, 1E-08f)); Vector3 vector = new Vector3(1f / Mathf.Max(lossyScale.x, 1E-08f), 1f / Mathf.Max(lossyScale.y, 1E-08f), 1f / Mathf.Max(lossyScale.z, 1E-08f));
this.worldNoScale = ((Component)this.smr).transform.localToWorldMatrix * Matrix4x4.Scale(val); worldNoScale = smr.transform.localToWorldMatrix * Matrix4x4.Scale(vector);
this.worldVertices = (Vector3[])(object)new Vector3[vertexCount]; worldVertices = new Vector3[vertexCount];
this.deltasLocal = (Vector3[])(object)new Vector3[vertexCount]; deltasLocal = new Vector3[vertexCount];
for (int i = 0; i < vertexCount; i++) for (int i = 0; i < vertexCount; i++)
{ {
this.worldVertices[i] = this.worldNoScale.MultiplyPoint3x4(this.bakedMesh.vertices[i]); worldVertices[i] = worldNoScale.MultiplyPoint3x4(bakedMesh.vertices[i]);
this.deltasLocal[i] = Vector3.zero; deltasLocal[i] = Vector3.zero;
} }
Vector3[] normals = this.bakedMesh.normals; Vector3[] normals = bakedMesh.normals;
Vector4[] tangents = this.bakedMesh.tangents; Vector4[] tangents = bakedMesh.tangents;
this.bakedWorldNormals = (Vector3[])(object)new Vector3[vertexCount]; bakedWorldNormals = new Vector3[vertexCount];
if (tangents != null && tangents.Length == vertexCount) if (tangents != null && tangents.Length == vertexCount)
{ {
this.bakedWorldTangents = (Vector4[])(object)new Vector4[vertexCount]; bakedWorldTangents = new Vector4[vertexCount];
} }
else else
{ {
this.bakedWorldTangents = null; bakedWorldTangents = null;
} }
for (int j = 0; j < vertexCount; j++) for (int j = 0; j < vertexCount; j++)
{ {
Vector3[] array = this.bakedWorldNormals; bakedWorldNormals[j] = smr.transform.TransformDirection(normals[j]).normalized;
int num = j; if (bakedWorldTangents != null)
Vector3 val2 = ((Component)this.smr).transform.TransformDirection(normals[j]);
array[num] = val2.normalized;
if (this.bakedWorldTangents != null)
{ {
val2 = ((Component)this.smr).transform.TransformDirection(new Vector3(tangents[j].x, tangents[j].y, tangents[j].z)); Vector3 normalized = smr.transform.TransformDirection(new Vector3(tangents[j].x, tangents[j].y, tangents[j].z)).normalized;
Vector3 normalized = val2.normalized; bakedWorldTangents[j] = new Vector4(normalized.x, normalized.y, normalized.z, tangents[j].w);
this.bakedWorldTangents[j] = new Vector4(normalized.x, normalized.y, normalized.z, tangents[j].w);
} }
} }
} }
public List<int>[] BuildVertexAdjacency(Mesh mesh, float seamThreshold = 0.0001f, float proximityThreshold = 0f) public List<int>[] BuildVertexAdjacency(Mesh mesh, float seamThreshold = 0.0001f, float proximityThreshold = 0f)
{ {
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_0123: Unknown result type (might be due to invalid IL or missing references)
//IL_0367: Unknown result type (might be due to invalid IL or missing references)
//IL_036c: Unknown result type (might be due to invalid IL or missing references)
//IL_0370: Unknown result type (might be due to invalid IL or missing references)
//IL_037f: Unknown result type (might be due to invalid IL or missing references)
//IL_038e: Unknown result type (might be due to invalid IL or missing references)
//IL_03a4: Unknown result type (might be due to invalid IL or missing references)
//IL_0137: Unknown result type (might be due to invalid IL or missing references)
//IL_03b8: Unknown result type (might be due to invalid IL or missing references)
//IL_016d: Unknown result type (might be due to invalid IL or missing references)
//IL_0172: Unknown result type (might be due to invalid IL or missing references)
//IL_03ee: Unknown result type (might be due to invalid IL or missing references)
//IL_03f3: Unknown result type (might be due to invalid IL or missing references)
//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
//IL_0461: Unknown result type (might be due to invalid IL or missing references)
//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
//IL_046f: Unknown result type (might be due to invalid IL or missing references)
//IL_0471: Unknown result type (might be due to invalid IL or missing references)
//IL_0290: Unknown result type (might be due to invalid IL or missing references)
//IL_0295: Unknown result type (might be due to invalid IL or missing references)
//IL_020f: Unknown result type (might be due to invalid IL or missing references)
//IL_0214: Unknown result type (might be due to invalid IL or missing references)
//IL_0511: Unknown result type (might be due to invalid IL or missing references)
//IL_0516: Unknown result type (might be due to invalid IL or missing references)
//IL_0490: Unknown result type (might be due to invalid IL or missing references)
//IL_0495: Unknown result type (might be due to invalid IL or missing references)
//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
//IL_02af: Unknown result type (might be due to invalid IL or missing references)
//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
//IL_022c: Unknown result type (might be due to invalid IL or missing references)
//IL_0231: Unknown result type (might be due to invalid IL or missing references)
//IL_0233: Unknown result type (might be due to invalid IL or missing references)
//IL_0238: Unknown result type (might be due to invalid IL or missing references)
//IL_052b: Unknown result type (might be due to invalid IL or missing references)
//IL_0530: Unknown result type (might be due to invalid IL or missing references)
//IL_0532: Unknown result type (might be due to invalid IL or missing references)
//IL_0537: Unknown result type (might be due to invalid IL or missing references)
//IL_04ad: Unknown result type (might be due to invalid IL or missing references)
//IL_04b2: Unknown result type (might be due to invalid IL or missing references)
//IL_04b4: Unknown result type (might be due to invalid IL or missing references)
//IL_04b9: Unknown result type (might be due to invalid IL or missing references)
if (mesh == null) if (mesh == null)
{ {
throw new AutoMorpherException("Mesh is Missing", "[VertexAdjacencyUtil] BuildVertexAdjacency\n - mesh is null"); throw new AutoMorpherException("Mesh is Missing", "[VertexAdjacencyUtil] BuildVertexAdjacency\n - mesh is null");
@@ -228,24 +145,21 @@ public class ClothInstance
AddNeighbor(array, num4, num2); AddNeighbor(array, num4, num2);
AddNeighbor(array, num2, num4); AddNeighbor(array, num2, num4);
} }
Vector3 val4;
if (seamThreshold > 0f) if (seamThreshold > 0f)
{ {
float num5 = seamThreshold * 2f; float num5 = seamThreshold * 2f;
float num6 = seamThreshold * seamThreshold; float num6 = seamThreshold * seamThreshold;
Dictionary<Vector3Int, List<int>> dictionary = new Dictionary<Vector3Int, List<int>>(); Dictionary<Vector3Int, List<int>> dictionary = new Dictionary<Vector3Int, List<int>>();
Vector3Int key = default(Vector3Int);
for (int k = 0; k < vertexCount; k++) for (int k = 0; k < vertexCount; k++)
{ {
Vector3 val = vertices[k]; Vector3 vector = vertices[k];
key = new Vector3Int(Mathf.FloorToInt(val.x / num5), Mathf.FloorToInt(val.y / num5), Mathf.FloorToInt(val.z / num5)); Vector3Int key = new Vector3Int(Mathf.FloorToInt(vector.x / num5), Mathf.FloorToInt(vector.y / num5), Mathf.FloorToInt(vector.z / num5));
if (!dictionary.TryGetValue(key, out var value)) if (!dictionary.TryGetValue(key, out var value))
{ {
value = (dictionary[key] = new List<int>()); value = (dictionary[key] = new List<int>());
} }
value.Add(k); value.Add(k);
} }
Vector3Int val2 = default(Vector3Int);
foreach (KeyValuePair<Vector3Int, List<int>> item in dictionary) foreach (KeyValuePair<Vector3Int, List<int>> item in dictionary)
{ {
Vector3Int key2 = item.Key; Vector3Int key2 = item.Key;
@@ -260,22 +174,21 @@ public class ClothInstance
{ {
continue; continue;
} }
val2 = new(key2.x + l, key2.y + m, key2.z + n); Vector3Int vector3Int = new Vector3Int(key2.x + l, key2.y + m, key2.z + n);
if (!dictionary.TryGetValue(val2, out var value3)) if (!dictionary.TryGetValue(vector3Int, out var value3))
{ {
continue; continue;
} }
if (val2 == key2) if (vector3Int == key2)
{ {
for (int num7 = 0; num7 < value2.Count; num7++) for (int num7 = 0; num7 < value2.Count; num7++)
{ {
int num8 = value2[num7]; int num8 = value2[num7];
Vector3 val3 = vertices[num8]; Vector3 vector2 = vertices[num8];
for (int num9 = num7 + 1; num9 < value2.Count; num9++) for (int num9 = num7 + 1; num9 < value2.Count; num9++)
{ {
int num10 = value2[num9]; int num10 = value2[num9];
val4 = vertices[num10] - val3; if ((vertices[num10] - vector2).sqrMagnitude <= num6)
if (val4.sqrMagnitude <= num6)
{ {
AddNeighbor(array, num8, num10); AddNeighbor(array, num8, num10);
AddNeighbor(array, num10, num8); AddNeighbor(array, num10, num8);
@@ -287,12 +200,11 @@ public class ClothInstance
for (int num11 = 0; num11 < value2.Count; num11++) for (int num11 = 0; num11 < value2.Count; num11++)
{ {
int num12 = value2[num11]; int num12 = value2[num11];
Vector3 val5 = vertices[num12]; Vector3 vector3 = vertices[num12];
for (int num13 = 0; num13 < value3.Count; num13++) for (int num13 = 0; num13 < value3.Count; num13++)
{ {
int num14 = value3[num13]; int num14 = value3[num13];
val4 = vertices[num14] - val5; if ((vertices[num14] - vector3).sqrMagnitude <= num6)
if (val4.sqrMagnitude <= num6)
{ {
AddNeighbor(array, num12, num14); AddNeighbor(array, num12, num14);
AddNeighbor(array, num14, num12); AddNeighbor(array, num14, num12);
@@ -309,18 +221,16 @@ public class ClothInstance
float num15 = proximityThreshold * 2f; float num15 = proximityThreshold * 2f;
float num16 = proximityThreshold * proximityThreshold; float num16 = proximityThreshold * proximityThreshold;
Dictionary<Vector3Int, List<int>> dictionary2 = new Dictionary<Vector3Int, List<int>>(); Dictionary<Vector3Int, List<int>> dictionary2 = new Dictionary<Vector3Int, List<int>>();
Vector3Int key3 = default(Vector3Int);
for (int num17 = 0; num17 < vertexCount; num17++) for (int num17 = 0; num17 < vertexCount; num17++)
{ {
Vector3 val6 = vertices[num17]; Vector3 vector4 = vertices[num17];
key3 = new Vector3Int(Mathf.FloorToInt(val6.x / num15), Mathf.FloorToInt(val6.y / num15), Mathf.FloorToInt(val6.z / num15)); Vector3Int key3 = new Vector3Int(Mathf.FloorToInt(vector4.x / num15), Mathf.FloorToInt(vector4.y / num15), Mathf.FloorToInt(vector4.z / num15));
if (!dictionary2.TryGetValue(key3, out var value4)) if (!dictionary2.TryGetValue(key3, out var value4))
{ {
value4 = (dictionary2[key3] = new List<int>()); value4 = (dictionary2[key3] = new List<int>());
} }
value4.Add(num17); value4.Add(num17);
} }
Vector3Int val7 = default(Vector3Int);
foreach (KeyValuePair<Vector3Int, List<int>> item2 in dictionary2) foreach (KeyValuePair<Vector3Int, List<int>> item2 in dictionary2)
{ {
Vector3Int key4 = item2.Key; Vector3Int key4 = item2.Key;
@@ -335,22 +245,21 @@ public class ClothInstance
{ {
continue; continue;
} }
val7 = new Vector3Int(key4.x + num18, key4.y + num19, key4.z + num20); Vector3Int vector3Int2 = new Vector3Int(key4.x + num18, key4.y + num19, key4.z + num20);
if (!dictionary2.TryGetValue(val7, out var value6)) if (!dictionary2.TryGetValue(vector3Int2, out var value6))
{ {
continue; continue;
} }
if (val7 == key4) if (vector3Int2 == key4)
{ {
for (int num21 = 0; num21 < value5.Count; num21++) for (int num21 = 0; num21 < value5.Count; num21++)
{ {
int num22 = value5[num21]; int num22 = value5[num21];
Vector3 val8 = vertices[num22]; Vector3 vector5 = vertices[num22];
for (int num23 = num21 + 1; num23 < value5.Count; num23++) for (int num23 = num21 + 1; num23 < value5.Count; num23++)
{ {
int num24 = value5[num23]; int num24 = value5[num23];
val4 = vertices[num24] - val8; if ((vertices[num24] - vector5).sqrMagnitude <= num16)
if (val4.sqrMagnitude <= num16)
{ {
AddNeighbor(array, num22, num24); AddNeighbor(array, num22, num24);
AddNeighbor(array, num24, num22); AddNeighbor(array, num24, num22);
@@ -362,12 +271,11 @@ public class ClothInstance
for (int num25 = 0; num25 < value5.Count; num25++) for (int num25 = 0; num25 < value5.Count; num25++)
{ {
int num26 = value5[num25]; int num26 = value5[num25];
Vector3 val9 = vertices[num26]; Vector3 vector6 = vertices[num26];
for (int num27 = 0; num27 < value6.Count; num27++) for (int num27 = 0; num27 < value6.Count; num27++)
{ {
int num28 = value6[num27]; int num28 = value6[num27];
val4 = vertices[num28] - val9; if ((vertices[num28] - vector6).sqrMagnitude <= num16)
if (val4.sqrMagnitude <= num16)
{ {
AddNeighbor(array, num26, num28); AddNeighbor(array, num26, num28);
AddNeighbor(array, num28, num26); AddNeighbor(array, num28, num26);
@@ -380,7 +288,7 @@ public class ClothInstance
} }
} }
return array; return array;
void AddNeighbor(List<int>[] adj, int from, int to) static void AddNeighbor(List<int>[] adj, int from, int to)
{ {
List<int> list3 = adj[from]; List<int> list3 = adj[from];
if (!list3.Contains(to)) if (!list3.Contains(to))
@@ -392,205 +300,137 @@ public class ClothInstance
public void ApplyWorldVerticesToMesh() public void ApplyWorldVerticesToMesh()
{ {
//IL_0147: Unknown result type (might be due to invalid IL or missing references) if (editableMesh == null || smr == null || worldVertices == null)
//IL_014c: Unknown result type (might be due to invalid IL or missing references)
//IL_0151: Unknown result type (might be due to invalid IL or missing references)
//IL_016c: Unknown result type (might be due to invalid IL or missing references)
//IL_016e: Unknown result type (might be due to invalid IL or missing references)
//IL_0157: Unknown result type (might be due to invalid IL or missing references)
//IL_015d: Unknown result type (might be due to invalid IL or missing references)
//IL_0162: Unknown result type (might be due to invalid IL or missing references)
//IL_0167: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: Unknown result type (might be due to invalid IL or missing references)
//IL_0107: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
//IL_0111: Unknown result type (might be due to invalid IL or missing references)
//IL_02fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0303: Unknown result type (might be due to invalid IL or missing references)
//IL_0308: Unknown result type (might be due to invalid IL or missing references)
//IL_023f: Unknown result type (might be due to invalid IL or missing references)
//IL_0248: Unknown result type (might be due to invalid IL or missing references)
//IL_024f: Unknown result type (might be due to invalid IL or missing references)
//IL_0254: Unknown result type (might be due to invalid IL or missing references)
//IL_0259: Unknown result type (might be due to invalid IL or missing references)
//IL_0268: Unknown result type (might be due to invalid IL or missing references)
//IL_0271: Unknown result type (might be due to invalid IL or missing references)
//IL_0278: Unknown result type (might be due to invalid IL or missing references)
//IL_027d: Unknown result type (might be due to invalid IL or missing references)
//IL_0282: Unknown result type (might be due to invalid IL or missing references)
//IL_0326: Unknown result type (might be due to invalid IL or missing references)
//IL_032b: Unknown result type (might be due to invalid IL or missing references)
//IL_030e: Unknown result type (might be due to invalid IL or missing references)
//IL_0314: Unknown result type (might be due to invalid IL or missing references)
//IL_0319: Unknown result type (might be due to invalid IL or missing references)
//IL_031e: Unknown result type (might be due to invalid IL or missing references)
//IL_037e: Unknown result type (might be due to invalid IL or missing references)
//IL_0380: Unknown result type (might be due to invalid IL or missing references)
//IL_0385: Unknown result type (might be due to invalid IL or missing references)
//IL_039f: Unknown result type (might be due to invalid IL or missing references)
//IL_03a4: Unknown result type (might be due to invalid IL or missing references)
//IL_03aa: Unknown result type (might be due to invalid IL or missing references)
//IL_03b1: Unknown result type (might be due to invalid IL or missing references)
//IL_03b8: Unknown result type (might be due to invalid IL or missing references)
//IL_03d1: Unknown result type (might be due to invalid IL or missing references)
//IL_03d6: Unknown result type (might be due to invalid IL or missing references)
//IL_038b: Unknown result type (might be due to invalid IL or missing references)
//IL_0391: Unknown result type (might be due to invalid IL or missing references)
//IL_0396: Unknown result type (might be due to invalid IL or missing references)
//IL_039b: Unknown result type (might be due to invalid IL or missing references)
if (this.editableMesh == null || this.smr == null || this.worldVertices == null)
{ {
return; return;
} }
Mesh val = this.editableMesh; Mesh mesh = editableMesh;
int vertexCount = val.vertexCount; int vertexCount = mesh.vertexCount;
Vector3[] vertices = val.vertices; Vector3[] vertices = mesh.vertices;
SkinningUtil skinningUtil = new SkinningUtil(); SkinningUtil skinningUtil = new SkinningUtil();
Vector3[] array = null; Vector3[] array = null;
int blendShapeCount = val.blendShapeCount; int blendShapeCount = mesh.blendShapeCount;
if (blendShapeCount > 0) if (blendShapeCount > 0)
{ {
array = (Vector3[])(object)new Vector3[vertexCount]; array = new Vector3[vertexCount];
Vector3[] array2 = new Vector3[vertexCount]; Vector3[] array2 = new Vector3[vertexCount];
Vector3[] array3 = new Vector3[vertexCount]; Vector3[] deltaNormals = new Vector3[vertexCount];
Vector3[] array4 = new Vector3[vertexCount]; Vector3[] deltaTangents = new Vector3[vertexCount];
for (int i = 0; i < blendShapeCount; i++) for (int i = 0; i < blendShapeCount; i++)
{ {
float blendShapeWeight = this.smr.GetBlendShapeWeight(i); float blendShapeWeight = smr.GetBlendShapeWeight(i);
if (Mathf.Approximately(blendShapeWeight, 0f)) if (Mathf.Approximately(blendShapeWeight, 0f))
{ {
continue; continue;
} }
int num = val.GetBlendShapeFrameCount(i) - 1; int frameIndex = mesh.GetBlendShapeFrameCount(i) - 1;
float blendShapeFrameWeight = val.GetBlendShapeFrameWeight(i, num); float blendShapeFrameWeight = mesh.GetBlendShapeFrameWeight(i, frameIndex);
val.GetBlendShapeFrameVertices(i, num, array2, array3, array4); mesh.GetBlendShapeFrameVertices(i, frameIndex, array2, deltaNormals, deltaTangents);
float num2 = ((blendShapeFrameWeight != 0f) ? (blendShapeWeight / blendShapeFrameWeight) : 0f); float num = ((blendShapeFrameWeight != 0f) ? (blendShapeWeight / blendShapeFrameWeight) : 0f);
if (!Mathf.Approximately(num2, 0f)) if (!Mathf.Approximately(num, 0f))
{ {
for (int j = 0; j < vertexCount; j++) for (int j = 0; j < vertexCount; j++)
{ {
ref Vector3 reference = ref array[j]; array[j] += array2[j] * num;
reference += array2[j] * num2;
} }
} }
} }
} }
for (int k = 0; k < vertexCount; k++) for (int k = 0; k < vertexCount; k++)
{ {
Vector3 val2 = skinningUtil.WorldPosToBindPos_Full(this.smr, val, k, this.worldVertices[k]); Vector3 vector = skinningUtil.WorldPosToBindPos_Full(smr, mesh, k, worldVertices[k]);
if (array != null) if (array != null)
{ {
val2 -= array[k]; vector -= array[k];
} }
vertices[k] = val2; vertices[k] = vector;
} }
val.vertices = vertices; mesh.vertices = vertices;
Vector3[] array5 = null; Vector3[] array3 = null;
Vector3[] array6 = null; Vector3[] array4 = null;
if (blendShapeCount > 0) if (blendShapeCount > 0)
{ {
array5 = (Vector3[])(object)new Vector3[vertexCount]; array3 = new Vector3[vertexCount];
array6 = (Vector3[])(object)new Vector3[vertexCount]; array4 = new Vector3[vertexCount];
Vector3[] array7 = (Vector3[])(object)new Vector3[vertexCount]; Vector3[] deltaVertices = new Vector3[vertexCount];
Vector3[] array8 = (Vector3[])(object)new Vector3[vertexCount]; Vector3[] array5 = new Vector3[vertexCount];
Vector3[] array9 = (Vector3[])(object)new Vector3[vertexCount]; Vector3[] array6 = new Vector3[vertexCount];
for (int l = 0; l < blendShapeCount; l++) for (int l = 0; l < blendShapeCount; l++)
{ {
float blendShapeWeight2 = this.smr.GetBlendShapeWeight(l); float blendShapeWeight2 = smr.GetBlendShapeWeight(l);
if (Mathf.Approximately(blendShapeWeight2, 0f)) if (Mathf.Approximately(blendShapeWeight2, 0f))
{ {
continue; continue;
} }
int num3 = val.GetBlendShapeFrameCount(l) - 1; int frameIndex2 = mesh.GetBlendShapeFrameCount(l) - 1;
float blendShapeFrameWeight2 = val.GetBlendShapeFrameWeight(l, num3); float blendShapeFrameWeight2 = mesh.GetBlendShapeFrameWeight(l, frameIndex2);
val.GetBlendShapeFrameVertices(l, num3, array7, array8, array9); mesh.GetBlendShapeFrameVertices(l, frameIndex2, deltaVertices, array5, array6);
float num4 = ((blendShapeFrameWeight2 != 0f) ? (blendShapeWeight2 / blendShapeFrameWeight2) : 0f); float num2 = ((blendShapeFrameWeight2 != 0f) ? (blendShapeWeight2 / blendShapeFrameWeight2) : 0f);
if (!Mathf.Approximately(num4, 0f)) if (!Mathf.Approximately(num2, 0f))
{ {
for (int m = 0; m < vertexCount; m++) for (int m = 0; m < vertexCount; m++)
{ {
ref Vector3 reference2 = ref array5[m]; array3[m] += array5[m] * num2;
reference2 += array8[m] * num4; array4[m] += array6[m] * num2;
ref Vector3 reference3 = ref array6[m];
reference3 += array9[m] * num4;
} }
} }
} }
} }
if (this.bakedWorldNormals == null || this.bakedWorldNormals.Length != vertexCount) if (bakedWorldNormals == null || bakedWorldNormals.Length != vertexCount)
{ {
return; return;
} }
Vector3[] array10 = (Vector3[])(object)new Vector3[vertexCount]; Vector3[] array7 = new Vector3[vertexCount];
bool flag = this.bakedWorldTangents != null && this.bakedWorldTangents.Length == vertexCount; bool flag = bakedWorldTangents != null && bakedWorldTangents.Length == vertexCount;
Vector4[] array11 = (Vector4[])(object)(flag ? new Vector4[vertexCount] : null); Vector4[] array8 = (flag ? new Vector4[vertexCount] : null);
Vector3 targetWorldDir = default(Vector3);
for (int n = 0; n < vertexCount; n++) for (int n = 0; n < vertexCount; n++)
{ {
Vector3 val3 = skinningUtil.WorldDirToBindDir_Full(this.smr, val, n, this.bakedWorldNormals[n]); Vector3 vector2 = skinningUtil.WorldDirToBindDir_Full(smr, mesh, n, bakedWorldNormals[n]);
if (array5 != null) if (array3 != null)
{ {
val3 -= array5[n]; vector2 -= array3[n];
} }
array10[n] = val3.normalized; array7[n] = vector2.normalized;
if (flag) if (flag)
{ {
targetWorldDir = new Vector3(this.bakedWorldTangents[n].x, this.bakedWorldTangents[n].y, this.bakedWorldTangents[n].z); Vector3 vector3 = skinningUtil.WorldDirToBindDir_Full(targetWorldDir: new Vector3(bakedWorldTangents[n].x, bakedWorldTangents[n].y, bakedWorldTangents[n].z), smr: smr, bindMesh: mesh, vertexIndex: n);
Vector3 val4 = skinningUtil.WorldDirToBindDir_Full(this.smr, val, n, targetWorldDir); if (array4 != null)
if (array6 != null)
{ {
val4 -= array6[n]; vector3 -= array4[n];
} }
val4 = val4.normalized; vector3 = vector3.normalized;
array11[n] = new Vector4(val4.x, val4.y, val4.z, this.bakedWorldTangents[n].w); array8[n] = new Vector4(vector3.x, vector3.y, vector3.z, bakedWorldTangents[n].w);
} }
} }
val.normals = array10; mesh.normals = array7;
if (array11 != null) if (array8 != null)
{ {
val.tangents = array11; mesh.tangents = array8;
} }
} }
public void BuildEquivalentVerticesFromWorld(float maxDistance = 1E-05f) public void BuildEquivalentVerticesFromWorld(float maxDistance = 1E-05f)
{ {
//IL_005e: Unknown result type (might be due to invalid IL or missing references) if (worldVertices == null || worldVertices.Length == 0)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_013a: Unknown result type (might be due to invalid IL or missing references)
//IL_013f: Unknown result type (might be due to invalid IL or missing references)
//IL_015c: Unknown result type (might be due to invalid IL or missing references)
//IL_0161: Unknown result type (might be due to invalid IL or missing references)
//IL_0163: Unknown result type (might be due to invalid IL or missing references)
//IL_0165: Unknown result type (might be due to invalid IL or missing references)
//IL_0167: Unknown result type (might be due to invalid IL or missing references)
//IL_016c: Unknown result type (might be due to invalid IL or missing references)
if (this.worldVertices == null || this.worldVertices.Length == 0)
{ {
Debug.LogWarning((object)"[ClothInstance] BuildEquivalentVerticesFromWorld: worldVertices is null or empty. Call UpdateWorldVertices() first."); Debug.LogWarning("[ClothInstance] BuildEquivalentVerticesFromWorld: worldVertices is null or empty. Call UpdateWorldVertices() first.");
return; return;
} }
int num = this.worldVertices.Length; int num = worldVertices.Length;
if (this.equivalentVertices == null) if (equivalentVertices == null)
{ {
this.equivalentVertices = new List<List<int>>(); equivalentVertices = new List<List<int>>();
} }
else else
{ {
this.equivalentVertices.Clear(); equivalentVertices.Clear();
} }
float num2 = maxDistance * maxDistance; float num2 = maxDistance * maxDistance;
Dictionary<Vector3Int, List<int>> dictionary = new Dictionary<Vector3Int, List<int>>(); Dictionary<Vector3Int, List<int>> dictionary = new Dictionary<Vector3Int, List<int>>();
Vector3Int key = default(Vector3Int);
for (int i = 0; i < num; i++) for (int i = 0; i < num; i++)
{ {
Vector3 val = this.worldVertices[i]; Vector3 vector = worldVertices[i];
key = new Vector3Int(Mathf.FloorToInt(val.x / maxDistance), Mathf.FloorToInt(val.y / maxDistance), Mathf.FloorToInt(val.z / maxDistance)); Vector3Int key = new Vector3Int(Mathf.FloorToInt(vector.x / maxDistance), Mathf.FloorToInt(vector.y / maxDistance), Mathf.FloorToInt(vector.z / maxDistance));
if (!dictionary.TryGetValue(key, out var value)) if (!dictionary.TryGetValue(key, out var value))
{ {
value = (dictionary[key] = new List<int>()); value = (dictionary[key] = new List<int>());
@@ -613,13 +453,12 @@ public class ClothInstance
for (int k = 0; k < count; k++) for (int k = 0; k < count; k++)
{ {
int num3 = value2[k]; int num3 = value2[k];
Vector3 val2 = this.worldVertices[num3]; Vector3 vector2 = worldVertices[num3];
for (int l = k + 1; l < count; l++) for (int l = k + 1; l < count; l++)
{ {
int num4 = value2[l]; int num4 = value2[l];
Vector3 val3 = this.worldVertices[num4]; Vector3 vector3 = worldVertices[num4];
Vector3 val4 = val2 - val3; if ((vector2 - vector3).sqrMagnitude <= num2)
if (val4.sqrMagnitude <= num2)
{ {
Union(k, l); Union(k, l);
} }
@@ -639,7 +478,7 @@ public class ClothInstance
{ {
if (value4.Count >= 2) if (value4.Count >= 2)
{ {
this.equivalentVertices.Add(value4); equivalentVertices.Add(value4);
} }
} }
int Find(int x) int Find(int x)
@@ -664,37 +503,37 @@ public class ClothInstance
~ClothInstance() ~ClothInstance()
{ {
this.Dispose(); Dispose();
} }
public void Dispose() public void Dispose()
{ {
if (this.bakedMesh != null) if (bakedMesh != null)
{ {
UnityEngine.Object.DestroyImmediate(this.bakedMesh); UnityEngine.Object.DestroyImmediate(bakedMesh);
this.bakedMesh = null; bakedMesh = null;
} }
this.worldVertices = null; worldVertices = null;
this.minDistanceVector = null; minDistanceVector = null;
this.minDistance = null; minDistance = null;
this.deltas = null; deltas = null;
this.deltasLocal = null; deltasLocal = null;
this.isInsideVertex = null; isInsideVertex = null;
this.excludedVertices = null; excludedVertices = null;
this.isLeftLegVertex = null; isLeftLegVertex = null;
this.isRightLegVertex = null; isRightLegVertex = null;
this.vertexAdjacency = null; vertexAdjacency = null;
if (this.equivalentVertices != null) if (equivalentVertices != null)
{ {
for (int i = 0; i < this.equivalentVertices.Count; i++) for (int i = 0; i < equivalentVertices.Count; i++)
{ {
this.equivalentVertices[i]?.Clear(); equivalentVertices[i]?.Clear();
} }
this.equivalentVertices.Clear(); equivalentVertices.Clear();
this.equivalentVertices = null; equivalentVertices = null;
} }
this.humanoidMatchedBones = null; humanoidMatchedBones = null;
this.smr = null; smr = null;
this.editableMesh = null; editableMesh = null;
} }
} }

View File

@@ -1,2 +1,2 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: bbcb7e551afcb6b42899d57659e00ff2 guid: 40c5e34f6a4ef45489dc16cd660022ca

View File

@@ -50,10 +50,6 @@ public class ClothInstanceTotal
public void UpdateGlobalBuffersFromClothInstances() public void UpdateGlobalBuffersFromClothInstances()
{ {
//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_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)
this.ValidateGlobalBufferReady("[ClothInstanceTotal] UpdateGlobalBuffersFromClothInstances"); this.ValidateGlobalBufferReady("[ClothInstanceTotal] UpdateGlobalBuffersFromClothInstances");
for (int i = 0; i < this.clothInstances.Count; i++) for (int i = 0; i < this.clothInstances.Count; i++)
{ {
@@ -81,8 +77,6 @@ public class ClothInstanceTotal
public void ApplyGlobalDeltasToClothInstances() public void ApplyGlobalDeltasToClothInstances()
{ {
//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)
this.ValidateGlobalBufferReady("[ClothInstanceTotal] ApplyGlobalDeltasToClothInstances"); this.ValidateGlobalBufferReady("[ClothInstanceTotal] ApplyGlobalDeltasToClothInstances");
for (int i = 0; i < this.clothInstances.Count; i++) for (int i = 0; i < this.clothInstances.Count; i++)
{ {
@@ -117,17 +111,13 @@ public class ClothInstanceTotal
private void BuildTopologyCache() private void BuildTopologyCache()
{ {
//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_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)
this.TotalVertexCount = this.CalculateTotalVertexCount(this.clothInstances); this.TotalVertexCount = this.CalculateTotalVertexCount(this.clothInstances);
if (this.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");
} }
this.GlobalPositions = (Vector3[])(object)new Vector3[this.TotalVertexCount]; this.GlobalPositions = new Vector3[this.TotalVertexCount];
this.GlobalDeltas = (Vector3[])(object)new Vector3[this.TotalVertexCount]; this.GlobalDeltas = new Vector3[this.TotalVertexCount];
this.GlobalAdjacencyTopology = new List<int>[this.TotalVertexCount]; this.GlobalAdjacencyTopology = new List<int>[this.TotalVertexCount];
this.VertexOffsets = new int[this.clothInstances.Count]; this.VertexOffsets = new int[this.clothInstances.Count];
int num = 0; int num = 0;
@@ -247,23 +237,6 @@ public class ClothInstanceTotal
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_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_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_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_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_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_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_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_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)
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");
@@ -281,11 +254,10 @@ public class ClothInstanceTotal
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);
for (int j = 0; j < num; j++) for (int j = 0; j < num; j++)
{ {
Vector3 val = referencePositions[j]; Vector3 vector = referencePositions[j];
key = new Vector3Int(Mathf.FloorToInt(val.x * num2), Mathf.FloorToInt(val.y * num2), Mathf.FloorToInt(val.z * num2)); Vector3Int key = new Vector3Int(Mathf.FloorToInt(vector.x * num2), Mathf.FloorToInt(vector.y * num2), Mathf.FloorToInt(vector.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);
@@ -293,12 +265,10 @@ public class ClothInstanceTotal
} }
value.Add(j); value.Add(j);
} }
Vector3Int val3 = 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 vector2 = referencePositions[k];
val3 = new Vector3Int(Mathf.FloorToInt(val2.x * num2), Mathf.FloorToInt(val2.y * num2), Mathf.FloorToInt(val2.z * num2)); Vector3Int vector3Int = new Vector3Int(Mathf.FloorToInt(vector2.x * num2), Mathf.FloorToInt(vector2.y * num2), Mathf.FloorToInt(vector2.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++)
{ {
@@ -306,7 +276,7 @@ public class ClothInstanceTotal
{ {
for (int n = -1; n <= 1; n++) for (int n = -1; n <= 1; n++)
{ {
key2 = new Vector3Int(val3.x + l, val3.y + m, val3.z + n); Vector3Int key2 = new Vector3Int(vector3Int.x + l, vector3Int.y + m, vector3Int.z + n);
if (!dictionary.TryGetValue(key2, out var value2)) if (!dictionary.TryGetValue(key2, out var value2))
{ {
continue; continue;
@@ -314,12 +284,7 @@ public class ClothInstanceTotal
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 && !((referencePositions[num5] - vector2).sqrMagnitude > num3))
{
continue;
}
Vector3 val4 = referencePositions[num5] - val2;
if (!(val4.sqrMagnitude > num3))
{ {
list.Add(num5); list.Add(num5);
if (maxNeighborsPerVertex > 0 && list.Count >= maxNeighborsPerVertex) if (maxNeighborsPerVertex > 0 && list.Count >= maxNeighborsPerVertex)

View File

@@ -1,2 +1,2 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: f9343c3cb8e18224385a0b0d1c5723bf guid: 565127c44f3596f4f88203da517ee42d

View File

@@ -175,8 +175,6 @@ public class EdenAutoMorpher : MonoBehaviour
public void AutoPoseSetup(MorpherMode morpherMode) public void AutoPoseSetup(MorpherMode morpherMode)
{ {
//IL_0095: 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)
TransformInfo transformInfo = new TransformInfo(this.sourceAvatarObject.transform); TransformInfo transformInfo = new TransformInfo(this.sourceAvatarObject.transform);
TransformInfo transformInfo2 = new TransformInfo(this.targetAvatarObject.transform); TransformInfo transformInfo2 = new TransformInfo(this.targetAvatarObject.transform);
try try
@@ -184,9 +182,9 @@ public class EdenAutoMorpher : MonoBehaviour
EdenAutoMorpher_SetUpUtil edenAutoMorpher_SetUpUtil = new EdenAutoMorpher_SetUpUtil(); EdenAutoMorpher_SetUpUtil edenAutoMorpher_SetUpUtil = new EdenAutoMorpher_SetUpUtil();
this.sourceBodyMeshesReadOnly = edenAutoMorpher_SetUpUtil.SetupBodyMeshes(this.sourceAvatarObject, this.isBodyAutoSetup, this.sourceBodyMeshes, "Source ").AsReadOnly(); this.sourceBodyMeshesReadOnly = edenAutoMorpher_SetUpUtil.SetupBodyMeshes(this.sourceAvatarObject, this.isBodyAutoSetup, this.sourceBodyMeshes, "Source ").AsReadOnly();
this.targetBodyMeshesReadOnly = edenAutoMorpher_SetUpUtil.SetupBodyMeshes(this.targetAvatarObject, this.isBodyAutoSetup, this.targetBodyMeshes, "Target ").AsReadOnly(); this.targetBodyMeshesReadOnly = edenAutoMorpher_SetUpUtil.SetupBodyMeshes(this.targetAvatarObject, this.isBodyAutoSetup, this.targetBodyMeshes, "Target ").AsReadOnly();
this.targetAvatarObject.transform.SetParent((Transform)null, true); this.targetAvatarObject.transform.SetParent(null, worldPositionStays: true);
this.targetAvatarObject.transform.localRotation = Quaternion.identity; this.targetAvatarObject.transform.localRotation = Quaternion.identity;
this.sourceAvatarObject.transform.SetParent((Transform)null, true); this.sourceAvatarObject.transform.SetParent(null, worldPositionStays: true);
this.sourceAvatarObject.transform.localRotation = Quaternion.identity; this.sourceAvatarObject.transform.localRotation = Quaternion.identity;
EdenAutoMorpherConfig config = this.SetupConfigData(morpherMode); EdenAutoMorpherConfig config = this.SetupConfigData(morpherMode);
new EdenAutoMorpher_SetUpUtil().AutoSetup(ref config, out this.clothesHumanoidMatchedBones, out this.clothBoneTypeMap); new EdenAutoMorpher_SetUpUtil().AutoSetup(ref config, out this.clothesHumanoidMatchedBones, out this.clothBoneTypeMap);
@@ -202,18 +200,15 @@ public class EdenAutoMorpher : MonoBehaviour
public void ProfileSetup(MorpherMode morpherMode) public void ProfileSetup(MorpherMode morpherMode)
{ {
//IL_006d: 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_00a9: Unknown result type (might be due to invalid IL or missing references)
TransformInfo transformInfo = new TransformInfo(this.sourceClothesObject.transform); TransformInfo transformInfo = new TransformInfo(this.sourceClothesObject.transform);
TransformInfo transformInfo2 = new TransformInfo(this.targetAvatarObject.transform); TransformInfo transformInfo2 = new TransformInfo(this.targetAvatarObject.transform);
try try
{ {
EdenAutoMorpher_SetUpUtil edenAutoMorpher_SetUpUtil = new EdenAutoMorpher_SetUpUtil(); EdenAutoMorpher_SetUpUtil edenAutoMorpher_SetUpUtil = new EdenAutoMorpher_SetUpUtil();
this.targetBodyMeshesReadOnly = edenAutoMorpher_SetUpUtil.SetupBodyMeshes(this.targetAvatarObject, this.isBodyAutoSetup, this.targetBodyMeshes, "Target ").AsReadOnly(); this.targetBodyMeshesReadOnly = edenAutoMorpher_SetUpUtil.SetupBodyMeshes(this.targetAvatarObject, this.isBodyAutoSetup, this.targetBodyMeshes, "Target ").AsReadOnly();
this.targetAvatarObject.transform.SetParent((Transform)null, true); this.targetAvatarObject.transform.SetParent(null, worldPositionStays: true);
this.targetAvatarObject.transform.localRotation = Quaternion.identity; this.targetAvatarObject.transform.localRotation = Quaternion.identity;
this.sourceClothesObject.transform.SetParent((Transform)null, true); this.sourceClothesObject.transform.SetParent(null, worldPositionStays: true);
this.sourceClothesObject.transform.localScale = Vector3.one; this.sourceClothesObject.transform.localScale = Vector3.one;
this.sourceClothesObject.transform.localRotation = Quaternion.identity; this.sourceClothesObject.transform.localRotation = Quaternion.identity;
EdenAutoMorpherConfig config = this.SetupConfigData(morpherMode); EdenAutoMorpherConfig config = this.SetupConfigData(morpherMode);
@@ -237,7 +232,7 @@ public class EdenAutoMorpher : MonoBehaviour
IEnumerator fitEnum = null; IEnumerator fitEnum = null;
this.morpherMode = morpherMode; this.morpherMode = morpherMode;
yield return null; yield return null;
Debug.Log((object)"[Eden Auto Morpher] Run ALL - Start Fitting"); Debug.Log("[Eden Auto Morpher] Run ALL - Start Fitting");
switch (morpherMode) switch (morpherMode)
{ {
case MorpherMode.AutoMorpher: case MorpherMode.AutoMorpher:
@@ -250,7 +245,7 @@ public class EdenAutoMorpher : MonoBehaviour
fitEnum = this.ProfileFitting(morpherMode); fitEnum = this.ProfileFitting(morpherMode);
break; break;
default: default:
Debug.LogError((object)"Unknown Mode Index"); Debug.LogError("Unknown Mode Index");
break; break;
} }
while (fitEnum != null && fitEnum.MoveNext() && this.doProcess) while (fitEnum != null && fitEnum.MoveNext() && this.doProcess)
@@ -261,36 +256,34 @@ public class EdenAutoMorpher : MonoBehaviour
yield return null; yield return null;
this.morpherState = MorpherState.Weighting_Doing; this.morpherState = MorpherState.Weighting_Doing;
yield return null; yield return null;
Debug.Log((object)"[Eden Auto Morpher] Run ALL - Start Weighting"); Debug.Log("[Eden Auto Morpher] Run ALL - Start Weighting");
using (EdenAutoMorpherManager eamManager = new EdenAutoMorpherManager()) using (EdenAutoMorpherManager eamManager = new EdenAutoMorpherManager())
{ {
EdenAutoMorpherConfig config = this.SetupConfigData(morpherMode); EdenAutoMorpherConfig config = this.SetupConfigData(morpherMode);
IEnumerator eamFitting = eamManager.WeightingEnumerator(config); IEnumerator eamFitting = eamManager.WeightingEnumerator(config);
while (eamFitting.MoveNext() && this.doProcess) while (eamFitting.MoveNext() && this.doProcess)
{ {
string title = this.processInfo.title; var (title, text, progress) = eamManager.GetProgressInfo();
string text = this.processInfo.text; this.processInfo.title = title;
float progress = this.processInfo.progress; this.processInfo.text = text;
(title, text, progress) = eamManager.GetProgressInfo(); this.processInfo.progress = progress;
yield return eamFitting.Current; yield return eamFitting.Current;
} }
} }
yield return null; yield return null;
this.doProcess = false; this.doProcess = false;
this.morpherState = MorpherState.Idle; this.morpherState = MorpherState.Idle;
Debug.Log((object)"[Eden Auto Morpher] Ended Run ALL"); Debug.Log("[Eden Auto Morpher] Ended Run ALL");
yield return null; yield return null;
} }
public IEnumerator FittingEnumerator(MorpherMode morpherMode) public IEnumerator FittingEnumerator(MorpherMode morpherMode)
{ {
this.doProcess = true; this.doProcess = true;
string title = this.processInfo.title; this.processInfo.title = "Setup Avatar Pose";
string text = this.processInfo.text; this.processInfo.text = "Calculating avatar shape and skeletal data.";
float progress = this.processInfo.progress; this.processInfo.progress = 0f;
title = "Setup Avatar Pose";
text = "Calculating avatar shape and skeletal data.";
progress = 0f;
yield return null; yield return null;
this.ProcessInfoDebug(morpherMode, "Fitting"); this.ProcessInfoDebug(morpherMode, "Fitting");
yield return null; yield return null;
@@ -310,7 +303,7 @@ public class EdenAutoMorpher : MonoBehaviour
fitEnum = this.ProfileFitting(morpherMode); fitEnum = this.ProfileFitting(morpherMode);
break; break;
default: default:
Debug.LogError((object)"Unknown Mode Index"); Debug.LogError("Unknown Mode Index");
break; break;
} }
while (fitEnum != null && fitEnum.MoveNext() && this.doProcess) while (fitEnum != null && fitEnum.MoveNext() && this.doProcess)
@@ -320,7 +313,7 @@ public class EdenAutoMorpher : MonoBehaviour
this.morpherState = MorpherState.Fitting_End; this.morpherState = MorpherState.Fitting_End;
yield return null; yield return null;
this.doProcess = false; this.doProcess = false;
Debug.Log((object)"[Eden Auto Morpher] Ended Fitting"); Debug.Log("[Eden Auto Morpher] Ended Fitting");
yield return null; yield return null;
} }
@@ -336,17 +329,17 @@ public class EdenAutoMorpher : MonoBehaviour
IEnumerator eamFitting = eamManager.WeightingEnumerator(config); IEnumerator eamFitting = eamManager.WeightingEnumerator(config);
while (eamFitting.MoveNext() && this.doProcess) while (eamFitting.MoveNext() && this.doProcess)
{ {
string title = this.processInfo.title; var (title, text, progress) = eamManager.GetProgressInfo();
string text = this.processInfo.text; this.processInfo.title = title;
float progress = this.processInfo.progress; this.processInfo.text = text;
(title, text, progress) = eamManager.GetProgressInfo(); this.processInfo.progress = progress;
yield return eamFitting.Current; yield return eamFitting.Current;
} }
} }
yield return null; yield return null;
this.doProcess = false; this.doProcess = false;
this.morpherState = MorpherState.Idle; this.morpherState = MorpherState.Idle;
Debug.Log((object)"[Eden Auto Morpher] Ended Weighting"); Debug.Log("[Eden Auto Morpher] Ended Weighting");
yield return null; yield return null;
} }
@@ -359,9 +352,9 @@ public class EdenAutoMorpher : MonoBehaviour
EdenAutoMorpher_SetUpUtil edenAutoMorpher_SetUpUtil = new EdenAutoMorpher_SetUpUtil(); EdenAutoMorpher_SetUpUtil edenAutoMorpher_SetUpUtil = new EdenAutoMorpher_SetUpUtil();
this.sourceBodyMeshesReadOnly = edenAutoMorpher_SetUpUtil.SetupBodyMeshes(this.sourceAvatarObject, this.isBodyAutoSetup, this.sourceBodyMeshes, "Source ").AsReadOnly(); this.sourceBodyMeshesReadOnly = edenAutoMorpher_SetUpUtil.SetupBodyMeshes(this.sourceAvatarObject, this.isBodyAutoSetup, this.sourceBodyMeshes, "Source ").AsReadOnly();
this.targetBodyMeshesReadOnly = edenAutoMorpher_SetUpUtil.SetupBodyMeshes(this.targetAvatarObject, this.isBodyAutoSetup, this.targetBodyMeshes, "Target ").AsReadOnly(); this.targetBodyMeshesReadOnly = edenAutoMorpher_SetUpUtil.SetupBodyMeshes(this.targetAvatarObject, this.isBodyAutoSetup, this.targetBodyMeshes, "Target ").AsReadOnly();
this.targetAvatarObject.transform.SetParent((Transform)null, true); this.targetAvatarObject.transform.SetParent(null, worldPositionStays: true);
this.targetAvatarObject.transform.localRotation = Quaternion.identity; this.targetAvatarObject.transform.localRotation = Quaternion.identity;
this.sourceAvatarObject.transform.SetParent((Transform)null, true); this.sourceAvatarObject.transform.SetParent(null, worldPositionStays: true);
this.sourceAvatarObject.transform.localRotation = Quaternion.identity; this.sourceAvatarObject.transform.localRotation = Quaternion.identity;
EdenAutoMorpherConfig configData = this.SetupConfigData(morpherMode); EdenAutoMorpherConfig configData = this.SetupConfigData(morpherMode);
new EdenAutoMorpher_SetUpUtil().AutoSetup(ref configData, out this.clothesHumanoidMatchedBones, out this.clothBoneTypeMap); new EdenAutoMorpher_SetUpUtil().AutoSetup(ref configData, out this.clothesHumanoidMatchedBones, out this.clothBoneTypeMap);
@@ -377,10 +370,10 @@ public class EdenAutoMorpher : MonoBehaviour
IEnumerator eamFitting = eamManager.FittingIteration(configData, morpherMode); IEnumerator eamFitting = eamManager.FittingIteration(configData, morpherMode);
while (eamFitting.MoveNext() && this.doProcess) while (eamFitting.MoveNext() && this.doProcess)
{ {
string title = this.processInfo.title; var (title, text, progress) = eamManager.GetProgressInfo();
string text = this.processInfo.text; this.processInfo.title = title;
float progress = this.processInfo.progress; this.processInfo.text = text;
(title, text, progress) = eamManager.GetProgressInfo(); this.processInfo.progress = progress;
yield return eamFitting.Current; yield return eamFitting.Current;
} }
} }
@@ -417,10 +410,10 @@ public class EdenAutoMorpher : MonoBehaviour
IEnumerator eamFitting = eamManager.FittingIteration(configData, morpherMode); IEnumerator eamFitting = eamManager.FittingIteration(configData, morpherMode);
while (eamFitting.MoveNext() && this.doProcess) while (eamFitting.MoveNext() && this.doProcess)
{ {
string title = this.processInfo.title; var (title, text, progress) = eamManager.GetProgressInfo();
string text = this.processInfo.text; this.processInfo.title = title;
float progress = this.processInfo.progress; this.processInfo.text = text;
(title, text, progress) = eamManager.GetProgressInfo(); this.processInfo.progress = progress;
yield return eamFitting.Current; yield return eamFitting.Current;
} }
} }
@@ -444,9 +437,9 @@ public class EdenAutoMorpher : MonoBehaviour
{ {
EdenAutoMorpher_SetUpUtil edenAutoMorpher_SetUpUtil = new EdenAutoMorpher_SetUpUtil(); EdenAutoMorpher_SetUpUtil edenAutoMorpher_SetUpUtil = new EdenAutoMorpher_SetUpUtil();
this.targetBodyMeshesReadOnly = edenAutoMorpher_SetUpUtil.SetupBodyMeshes(this.targetAvatarObject, this.isBodyAutoSetup, this.targetBodyMeshes, "Target ").AsReadOnly(); this.targetBodyMeshesReadOnly = edenAutoMorpher_SetUpUtil.SetupBodyMeshes(this.targetAvatarObject, this.isBodyAutoSetup, this.targetBodyMeshes, "Target ").AsReadOnly();
this.targetAvatarObject.transform.SetParent((Transform)null, true); this.targetAvatarObject.transform.SetParent(null, worldPositionStays: true);
this.targetAvatarObject.transform.localRotation = Quaternion.identity; this.targetAvatarObject.transform.localRotation = Quaternion.identity;
this.sourceClothesObject.transform.SetParent((Transform)null, true); this.sourceClothesObject.transform.SetParent(null, worldPositionStays: true);
this.sourceClothesObject.transform.localScale = Vector3.one; this.sourceClothesObject.transform.localScale = Vector3.one;
this.sourceClothesObject.transform.localRotation = Quaternion.identity; this.sourceClothesObject.transform.localRotation = Quaternion.identity;
EdenAutoMorpherConfig configData = this.SetupConfigData(morpherMode); EdenAutoMorpherConfig configData = this.SetupConfigData(morpherMode);
@@ -463,10 +456,10 @@ public class EdenAutoMorpher : MonoBehaviour
IEnumerator eamFitting = eamManager.FittingIteration(configData, morpherMode); IEnumerator eamFitting = eamManager.FittingIteration(configData, morpherMode);
while (eamFitting.MoveNext() && this.doProcess) while (eamFitting.MoveNext() && this.doProcess)
{ {
string title = this.processInfo.title; var (title, text, progress) = eamManager.GetProgressInfo();
string text = this.processInfo.text; this.processInfo.title = title;
float progress = this.processInfo.progress; this.processInfo.text = text;
(title, text, progress) = eamManager.GetProgressInfo(); this.processInfo.progress = progress;
yield return eamFitting.Current; yield return eamFitting.Current;
} }
} }
@@ -484,10 +477,10 @@ public class EdenAutoMorpher : MonoBehaviour
public bool IsWeightingReady(bool isAutoMode) public bool IsWeightingReady(bool isAutoMode)
{ {
bool flag = this.morpherState == MorpherState.Fitting_End && (Object)(object)this.fittedTargetAvatar != (Object)null && (Object)(object)this.fittedTargetAvatar == (Object)(object)this.targetAvatarObject; bool flag = this.morpherState == MorpherState.Fitting_End && this.fittedTargetAvatar != null && this.fittedTargetAvatar == this.targetAvatarObject;
if (!isAutoMode) if (!isAutoMode)
{ {
flag = flag && (Object)(object)this.fittedTargetClothes == (Object)(object)this.targetClothesObjectOriginal; flag = flag && this.fittedTargetClothes == this.targetClothesObjectOriginal;
} }
return flag; return flag;
} }
@@ -497,10 +490,10 @@ public class EdenAutoMorpher : MonoBehaviour
StringBuilder stringBuilder = new StringBuilder(); StringBuilder stringBuilder = new StringBuilder();
stringBuilder.AppendLine($"Start Process [{processType} / {morpherMode}]"); stringBuilder.AppendLine($"Start Process [{processType} / {morpherMode}]");
EdenAutoMorpherConfig edenAutoMorpherConfig = this.SetupConfigData(morpherMode); EdenAutoMorpherConfig edenAutoMorpherConfig = this.SetupConfigData(morpherMode);
string text = (((Object)(object)edenAutoMorpherConfig.sourceAvatarObject != (Object)null) ? ((Object)edenAutoMorpherConfig.sourceAvatarObject).name : "null"); string text = ((edenAutoMorpherConfig.sourceAvatarObject != null) ? edenAutoMorpherConfig.sourceAvatarObject.name : "null");
string text2 = (((Object)(object)edenAutoMorpherConfig.sourceClothesObject != (Object)null) ? ((Object)edenAutoMorpherConfig.sourceClothesObject).name : "null"); string text2 = ((edenAutoMorpherConfig.sourceClothesObject != null) ? edenAutoMorpherConfig.sourceClothesObject.name : "null");
string text3 = (((Object)(object)edenAutoMorpherConfig.targetAvatarObject != (Object)null) ? ((Object)edenAutoMorpherConfig.targetAvatarObject).name : "null"); string text3 = ((edenAutoMorpherConfig.targetAvatarObject != null) ? edenAutoMorpherConfig.targetAvatarObject.name : "null");
string text4 = (((Object)(object)edenAutoMorpherConfig.targetClothesObject != (Object)null) ? ((Object)edenAutoMorpherConfig.targetClothesObject).name : "null"); string text4 = ((edenAutoMorpherConfig.targetClothesObject != null) ? edenAutoMorpherConfig.targetClothesObject.name : "null");
stringBuilder.AppendLine("[Objects]"); stringBuilder.AppendLine("[Objects]");
if (morpherMode == MorpherMode.ProfileMorpher) if (morpherMode == MorpherMode.ProfileMorpher)
{ {
@@ -508,17 +501,17 @@ public class EdenAutoMorpher : MonoBehaviour
} }
stringBuilder.AppendLine("- sourceAvatarObject: " + text); stringBuilder.AppendLine("- sourceAvatarObject: " + text);
stringBuilder.AppendLine("- sourceClothesObject: " + text2); stringBuilder.AppendLine("- sourceClothesObject: " + text2);
if ((Object)(object)edenAutoMorpherConfig.sourceClothesObject != (Object)null) if (edenAutoMorpherConfig.sourceClothesObject != null)
{ {
SkinnedMeshRenderer[] componentsInChildren = edenAutoMorpherConfig.sourceClothesObject.GetComponentsInChildren<SkinnedMeshRenderer>(true); SkinnedMeshRenderer[] componentsInChildren = edenAutoMorpherConfig.sourceClothesObject.GetComponentsInChildren<SkinnedMeshRenderer>(includeInactive: true);
stringBuilder.AppendLine($" - sourceClothes SkinnedMeshRenderers Count: {componentsInChildren.Length}"); stringBuilder.AppendLine($" - sourceClothes SkinnedMeshRenderers Count: {componentsInChildren.Length}");
int num = Mathf.Min(componentsInChildren.Length, 10); int num = Mathf.Min(componentsInChildren.Length, 10);
for (int i = 0; i < num; i++) for (int i = 0; i < num; i++)
{ {
SkinnedMeshRenderer val = componentsInChildren[i]; SkinnedMeshRenderer skinnedMeshRenderer = componentsInChildren[i];
string text5 = (((Object)(object)val != (Object)null) ? ((Object)val).name : "null"); string text5 = ((skinnedMeshRenderer != null) ? skinnedMeshRenderer.name : "null");
string text6 = (((Object)(object)val != (Object)null && (Object)(object)val.rootBone != (Object)null) ? ((Object)val.rootBone).name : "null"); string text6 = ((skinnedMeshRenderer != null && skinnedMeshRenderer.rootBone != null) ? skinnedMeshRenderer.rootBone.name : "null");
string text7 = (((Object)(object)val != (Object)null && (Object)(object)val.sharedMesh != (Object)null) ? ((Object)val.sharedMesh).name : "null"); string text7 = ((skinnedMeshRenderer != null && skinnedMeshRenderer.sharedMesh != null) ? skinnedMeshRenderer.sharedMesh.name : "null");
stringBuilder.AppendLine($" - [{i}] SMR: {text5} / rootBone: {text6} / mesh: {text7}"); stringBuilder.AppendLine($" - [{i}] SMR: {text5} / rootBone: {text6} / mesh: {text7}");
} }
if (componentsInChildren.Length > num) if (componentsInChildren.Length > num)
@@ -528,17 +521,17 @@ public class EdenAutoMorpher : MonoBehaviour
} }
stringBuilder.AppendLine("- targetAvatarObject: " + text3); stringBuilder.AppendLine("- targetAvatarObject: " + text3);
stringBuilder.AppendLine("- targetClothesObject: " + text4); stringBuilder.AppendLine("- targetClothesObject: " + text4);
if ((Object)(object)edenAutoMorpherConfig.targetClothesObject != (Object)null) if (edenAutoMorpherConfig.targetClothesObject != null)
{ {
SkinnedMeshRenderer[] componentsInChildren2 = edenAutoMorpherConfig.targetClothesObject.GetComponentsInChildren<SkinnedMeshRenderer>(true); SkinnedMeshRenderer[] componentsInChildren2 = edenAutoMorpherConfig.targetClothesObject.GetComponentsInChildren<SkinnedMeshRenderer>(includeInactive: true);
stringBuilder.AppendLine($" - targetClothes SkinnedMeshRenderers Count: {componentsInChildren2.Length}"); stringBuilder.AppendLine($" - targetClothes SkinnedMeshRenderers Count: {componentsInChildren2.Length}");
int num2 = Mathf.Min(componentsInChildren2.Length, 10); int num2 = Mathf.Min(componentsInChildren2.Length, 10);
for (int j = 0; j < num2; j++) for (int j = 0; j < num2; j++)
{ {
SkinnedMeshRenderer val2 = componentsInChildren2[j]; SkinnedMeshRenderer skinnedMeshRenderer2 = componentsInChildren2[j];
string text8 = (((Object)(object)val2 != (Object)null) ? ((Object)val2).name : "null"); string text8 = ((skinnedMeshRenderer2 != null) ? skinnedMeshRenderer2.name : "null");
string text9 = (((Object)(object)val2 != (Object)null && (Object)(object)val2.rootBone != (Object)null) ? ((Object)val2.rootBone).name : "null"); string text9 = ((skinnedMeshRenderer2 != null && skinnedMeshRenderer2.rootBone != null) ? skinnedMeshRenderer2.rootBone.name : "null");
string text10 = (((Object)(object)val2 != (Object)null && (Object)(object)val2.sharedMesh != (Object)null) ? ((Object)val2.sharedMesh).name : "null"); string text10 = ((skinnedMeshRenderer2 != null && skinnedMeshRenderer2.sharedMesh != null) ? skinnedMeshRenderer2.sharedMesh.name : "null");
stringBuilder.AppendLine($" - [{j}] SMR: {text8} / rootBone: {text9} / mesh: {text10}"); stringBuilder.AppendLine($" - [{j}] SMR: {text8} / rootBone: {text9} / mesh: {text10}");
} }
if (componentsInChildren2.Length > num2) if (componentsInChildren2.Length > num2)
@@ -560,10 +553,10 @@ public class EdenAutoMorpher : MonoBehaviour
stringBuilder.AppendLine($"- sourceBodyMeshes Count: {this.sourceBodyMeshes.Count}"); stringBuilder.AppendLine($"- sourceBodyMeshes Count: {this.sourceBodyMeshes.Count}");
for (int k = 0; k < this.sourceBodyMeshes.Count; k++) for (int k = 0; k < this.sourceBodyMeshes.Count; k++)
{ {
SkinnedMeshRenderer val3 = this.sourceBodyMeshes[k]; SkinnedMeshRenderer skinnedMeshRenderer3 = this.sourceBodyMeshes[k];
string text11 = (((Object)(object)val3 != (Object)null) ? ((Object)val3).name : "null"); string text11 = ((skinnedMeshRenderer3 != null) ? skinnedMeshRenderer3.name : "null");
string text12 = (((Object)(object)val3 != (Object)null && (Object)(object)val3.rootBone != (Object)null) ? ((Object)val3.rootBone).name : "null"); string text12 = ((skinnedMeshRenderer3 != null && skinnedMeshRenderer3.rootBone != null) ? skinnedMeshRenderer3.rootBone.name : "null");
string text13 = (((Object)(object)val3 != (Object)null && (Object)(object)val3.sharedMesh != (Object)null) ? ((Object)val3.sharedMesh).name : "null"); string text13 = ((skinnedMeshRenderer3 != null && skinnedMeshRenderer3.sharedMesh != null) ? skinnedMeshRenderer3.sharedMesh.name : "null");
stringBuilder.AppendLine($" - [{k}] SMR: {text11} / rootBone: {text12} / mesh: {text13}"); stringBuilder.AppendLine($" - [{k}] SMR: {text11} / rootBone: {text12} / mesh: {text13}");
} }
} }
@@ -576,10 +569,10 @@ public class EdenAutoMorpher : MonoBehaviour
stringBuilder.AppendLine($"- targetBodyMeshes Count: {this.targetBodyMeshes.Count}"); stringBuilder.AppendLine($"- targetBodyMeshes Count: {this.targetBodyMeshes.Count}");
for (int l = 0; l < this.targetBodyMeshes.Count; l++) for (int l = 0; l < this.targetBodyMeshes.Count; l++)
{ {
SkinnedMeshRenderer val4 = this.targetBodyMeshes[l]; SkinnedMeshRenderer skinnedMeshRenderer4 = this.targetBodyMeshes[l];
string text14 = (((Object)(object)val4 != (Object)null) ? ((Object)val4).name : "null"); string text14 = ((skinnedMeshRenderer4 != null) ? skinnedMeshRenderer4.name : "null");
string text15 = (((Object)(object)val4 != (Object)null && (Object)(object)val4.rootBone != (Object)null) ? ((Object)val4.rootBone).name : "null"); string text15 = ((skinnedMeshRenderer4 != null && skinnedMeshRenderer4.rootBone != null) ? skinnedMeshRenderer4.rootBone.name : "null");
string text16 = (((Object)(object)val4 != (Object)null && (Object)(object)val4.sharedMesh != (Object)null) ? ((Object)val4.sharedMesh).name : "null"); string text16 = ((skinnedMeshRenderer4 != null && skinnedMeshRenderer4.sharedMesh != null) ? skinnedMeshRenderer4.sharedMesh.name : "null");
stringBuilder.AppendLine($" - [{l}] SMR: {text14} / rootBone: {text15} / mesh: {text16}"); stringBuilder.AppendLine($" - [{l}] SMR: {text14} / rootBone: {text15} / mesh: {text16}");
} }
} }
@@ -596,6 +589,6 @@ public class EdenAutoMorpher : MonoBehaviour
stringBuilder.AppendLine("[Options]"); stringBuilder.AppendLine("[Options]");
stringBuilder.AppendLine($"- isReparentAccessoryBonesToTargetAvatar: {edenAutoMorpherConfig.isReparentAccessoryBonesToTargetAvatar}"); stringBuilder.AppendLine($"- isReparentAccessoryBonesToTargetAvatar: {edenAutoMorpherConfig.isReparentAccessoryBonesToTargetAvatar}");
stringBuilder.AppendLine($"- skipFootFitting: {edenAutoMorpherConfig.skipFootFitting}"); stringBuilder.AppendLine($"- skipFootFitting: {edenAutoMorpherConfig.skipFootFitting}");
Debug.Log((object)stringBuilder.ToString()); Debug.Log(stringBuilder.ToString());
} }
} }

View File

@@ -1,2 +1,2 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 036fbcf460e6d274db05499e9c3cfa70 guid: 50552370e41d31140a52da99bcc7ab74

View File

@@ -1,2 +1,2 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: aa8bd605c6ebdef4dac9c03b09ac0c8c guid: 36c114e39fc870440b90581fce2b9b1c

View File

@@ -35,7 +35,7 @@ public class EdenAutoMorpherManager : IDisposable
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)
{ {
this.clothInstances = new List<ClothInstance>(); this.clothInstances = new List<ClothInstance>();
SkinnedMeshRenderer[] targetClothesSMRs = targetClothesObject.GetComponentsInChildren<SkinnedMeshRenderer>(false); SkinnedMeshRenderer[] targetClothesSMRs = targetClothesObject.GetComponentsInChildren<SkinnedMeshRenderer>(includeInactive: 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");
@@ -43,7 +43,7 @@ public class EdenAutoMorpherManager : IDisposable
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++)
{ {
this.SetupProgress("Set Up", $"Setup Clothes Info [{rendereri}/{targetClothesSMRs.Length}] - ({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, 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)
@@ -60,12 +60,12 @@ public class EdenAutoMorpherManager : IDisposable
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)
{ {
this.clothInstances = new List<ClothInstance>(); this.clothInstances = new List<ClothInstance>();
SkinnedMeshRenderer[] targetClothesSMRs = targetClothesObject.GetComponentsInChildren<SkinnedMeshRenderer>(false); SkinnedMeshRenderer[] targetClothesSMRs = targetClothesObject.GetComponentsInChildren<SkinnedMeshRenderer>(includeInactive: 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>(includeInactive: 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");
@@ -73,7 +73,7 @@ public class EdenAutoMorpherManager : IDisposable
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++)
{ {
this.SetupProgress("Set Up", $"Setup Clothes Info [{rendereri}/{targetClothesSMRs.Length}] - ({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, 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)
@@ -114,7 +114,7 @@ public class EdenAutoMorpherManager : IDisposable
break; break;
} }
default: default:
Debug.LogError((object)"Unknown MorpherMode"); Debug.LogError("Unknown MorpherMode");
break; break;
} }
yield return null; yield return null;
@@ -235,13 +235,13 @@ public class EdenAutoMorpherManager : IDisposable
List<Mesh> bakedTargetBodyMeshes = new List<Mesh>(); List<Mesh> bakedTargetBodyMeshes = new List<Mesh>();
foreach (SkinnedMeshRenderer bodyMesh in config.targetBodyMeshes) foreach (SkinnedMeshRenderer bodyMesh in config.targetBodyMeshes)
{ {
this.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, bakedTargetBodyMeshes.Count / config.targetBodyMeshes.Count));
yield return null; yield return null;
Mesh val = new Mesh(); Mesh mesh = new Mesh();
bodyMesh.BakeMesh(val); bodyMesh.BakeMesh(mesh);
val.triangles = bodyMesh.sharedMesh.triangles; mesh.triangles = bodyMesh.sharedMesh.triangles;
val.boneWeights = bodyMesh.sharedMesh.boneWeights; mesh.boneWeights = bodyMesh.sharedMesh.boneWeights;
bakedTargetBodyMeshes.Add(val); bakedTargetBodyMeshes.Add(mesh);
} }
yield return null; yield return null;
IEnumerator setupClothEnum = this.SetupClothInstances(config.targetClothesObject, config.clothesHumanoidMatchedBones, duplicateMesh: false); IEnumerator setupClothEnum = this.SetupClothInstances(config.targetClothesObject, config.clothesHumanoidMatchedBones, duplicateMesh: false);
@@ -288,8 +288,8 @@ public class EdenAutoMorpherManager : IDisposable
{ {
yield return null; yield return null;
step++; step++;
float num5 = 1f - 1f / ((float)step + 1f); float t = 1f - 1f / ((float)step + 1f);
float progress = Mathf.Lerp(weightingStart, weightingEnd, num5); float progress = Mathf.Lerp(weightingStart, weightingEnd, t);
this.SetupProgress("Weighting", $"Weighting | Step {step} [{weightingI + 1}/{this.clothInstances.Count}] - {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;
} }
@@ -298,12 +298,12 @@ public class EdenAutoMorpherManager : IDisposable
this.SetupProgress("Weighting", $"Weighting | Step {step} - Apply to Mesh [{weightingI + 1}/{this.clothInstances.Count}] - {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); clothInstance.smr.localBounds = new Bounds(Vector3.zero, Vector3.one * 2f);
EditorUtility.SetDirty(clothInstance.smr.sharedMesh); EditorUtility.SetDirty(clothInstance.smr.sharedMesh);
EditorUtility.SetDirty(clothInstance.smr); EditorUtility.SetDirty(clothInstance.smr);
yield return null; yield return null;
int num6 = weightingI + 1; int num5 = weightingI + 1;
weightingI = num6; weightingI = num5;
} }
this.SetupProgress("Weighting", "Allocate Bones", 0.95f); this.SetupProgress("Weighting", "Allocate Bones", 0.95f);
yield return null; yield return null;
@@ -323,17 +323,14 @@ public class EdenAutoMorpherManager : IDisposable
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_00f3: Unknown result type (might be due to invalid IL or missing references)
//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("[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 (config.targetClothesObject == null || config.targetAvatarObject == null) if (config.targetClothesObject == null || config.targetAvatarObject == null)
{ {
Debug.LogWarning((object)"[EdenAutoMorpher] targetClothesObject 또는 targetAvatarObject 가 null 입니다. 메쉬 저장 경로를 만들 수 없습니다."); Debug.LogWarning("[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";
@@ -366,10 +363,10 @@ public class EdenAutoMorpherManager : IDisposable
Mesh sharedMesh = clothInstance.smr.sharedMesh; Mesh sharedMesh = clothInstance.smr.sharedMesh;
if (!(sharedMesh == null)) if (!(sharedMesh == null))
{ {
Mesh val = UnityEngine.Object.Instantiate<Mesh>(sharedMesh); Mesh mesh = UnityEngine.Object.Instantiate(sharedMesh);
val.name = SanitizeForAssetName(clothInstance.smr.gameObject.name + "_EditedMesh"); mesh.name = SanitizeForAssetName(clothInstance.smr.gameObject.name + "_EditedMesh");
AssetDatabase.AddObjectToAsset(val, text6); AssetDatabase.AddObjectToAsset(mesh, text6);
clothInstance.smr.sharedMesh = val; clothInstance.smr.sharedMesh = mesh;
clothInstance.editableMesh = clothInstance.smr.sharedMesh; clothInstance.editableMesh = clothInstance.smr.sharedMesh;
EditorUtility.SetDirty(clothInstance.smr); EditorUtility.SetDirty(clothInstance.smr);
EditorUtility.SetDirty(clothInstance.smr.sharedMesh); EditorUtility.SetDirty(clothInstance.smr.sharedMesh);
@@ -380,8 +377,8 @@ public class EdenAutoMorpherManager : IDisposable
} }
AssetDatabase.SaveAssets(); AssetDatabase.SaveAssets();
AssetDatabase.Refresh(); AssetDatabase.Refresh();
Debug.Log((object)($"[EdenAutoMorpher] 편집된 메쉬 {num}개를 " + "'" + text6 + "' 에 서브 에셋으로 저장했습니다. (원본 프리팹은 변경하지 않음)")); Debug.Log($"[EdenAutoMorpher] 편집된 메쉬 {num}개를 " + "'" + text6 + "' 에 서브 에셋으로 저장했습니다. (원본 프리팹은 변경하지 않음)");
string SanitizeForAssetName(string rawName) static string SanitizeForAssetName(string rawName)
{ {
char[] invalidFileNameChars = Path.GetInvalidFileNameChars(); char[] invalidFileNameChars = Path.GetInvalidFileNameChars();
foreach (char oldChar in invalidFileNameChars) foreach (char oldChar in invalidFileNameChars)

View File

@@ -1,2 +1,2 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: e0340c83a1a3e004c872bca551da7361 guid: a0a53153b37b0594c8d32b305724f9b9

View File

@@ -16,19 +16,16 @@ public class EdenAutoMorpher_SetUpUtil
{ {
public GameObject InstantiateTargetClothes(GameObject sourceClothesObject, GameObject targetAvatarObject, string tagEdenMorpherCloth, bool removeAutoMorphedClothes) public GameObject InstantiateTargetClothes(GameObject sourceClothesObject, GameObject targetAvatarObject, string tagEdenMorpherCloth, bool removeAutoMorphedClothes)
{ {
//IL_0095: 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_00b5: Unknown result type (might be due to invalid IL or missing references)
EnsureTagExists(tagEdenMorpherCloth); EnsureTagExists(tagEdenMorpherCloth);
if (removeAutoMorphedClothes) if (removeAutoMorphedClothes)
{ {
List<GameObject> list = new List<GameObject>(); List<GameObject> list = new List<GameObject>();
Transform[] componentsInChildren = targetAvatarObject.GetComponentsInChildren<Transform>(true); Transform[] componentsInChildren = targetAvatarObject.GetComponentsInChildren<Transform>(includeInactive: true);
foreach (Transform val in componentsInChildren) foreach (Transform transform in componentsInChildren)
{ {
if (!(val.gameObject == targetAvatarObject) && val.CompareTag(tagEdenMorpherCloth)) if (!(transform.gameObject == targetAvatarObject) && transform.CompareTag(tagEdenMorpherCloth))
{ {
list.Add(((Component)val).gameObject); list.Add(transform.gameObject);
} }
} }
foreach (GameObject item in list) foreach (GameObject item in list)
@@ -36,19 +33,17 @@ public class EdenAutoMorpher_SetUpUtil
UnityEngine.Object.DestroyImmediate(item); UnityEngine.Object.DestroyImmediate(item);
} }
} }
GameObject obj = UnityEngine.Object.Instantiate<GameObject>(sourceClothesObject, targetAvatarObject.transform); GameObject gameObject = UnityEngine.Object.Instantiate(sourceClothesObject, targetAvatarObject.transform);
obj.SetActive(true); gameObject.SetActive(value: true);
obj.transform.localPosition = Vector3.zero; gameObject.transform.localPosition = Vector3.zero;
obj.transform.localRotation = Quaternion.identity; gameObject.transform.localRotation = Quaternion.identity;
obj.transform.localScale = Vector3.one; gameObject.transform.localScale = Vector3.one;
obj.tag = tagEdenMorpherCloth; gameObject.tag = tagEdenMorpherCloth;
return obj; return gameObject;
} }
private static void EnsureTagExists(string tag) private static void EnsureTagExists(string tag)
{ {
//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)
if (string.IsNullOrEmpty(tag)) if (string.IsNullOrEmpty(tag))
{ {
throw new AutoMorpherException("Clothes Tag is Invalid", "[EdenAutoMorpherManager] EnsureTagExists\n - tagEdenMorpherCloth is null or empty"); throw new AutoMorpherException("Clothes Tag is Invalid", "[EdenAutoMorpherManager] EnsureTagExists\n - tagEdenMorpherCloth is null or empty");
@@ -61,12 +56,12 @@ public class EdenAutoMorpher_SetUpUtil
return; return;
} }
} }
SerializedObject val = new SerializedObject(AssetDatabase.LoadAllAssetsAtPath("ProjectSettings/TagManager.asset")[0]); SerializedObject serializedObject = new SerializedObject(AssetDatabase.LoadAllAssetsAtPath("ProjectSettings/TagManager.asset")[0]);
SerializedProperty obj = val.FindProperty("tags"); SerializedProperty serializedProperty = serializedObject.FindProperty("tags");
int arraySize = obj.arraySize; int arraySize = serializedProperty.arraySize;
obj.InsertArrayElementAtIndex(arraySize); serializedProperty.InsertArrayElementAtIndex(arraySize);
obj.GetArrayElementAtIndex(arraySize).stringValue = tag; serializedProperty.GetArrayElementAtIndex(arraySize).stringValue = tag;
val.ApplyModifiedProperties(); serializedObject.ApplyModifiedProperties();
} }
public void AutoSetup(ref EdenAutoMorpherConfig config, out Dictionary<HumanBodyBones, HashSet<Transform>> clothesHumanoidMatchedBones, out Dictionary<Transform, ClothBoneType> clothBoneTypeMap) public void AutoSetup(ref EdenAutoMorpherConfig config, out Dictionary<HumanBodyBones, HashSet<Transform>> clothesHumanoidMatchedBones, out Dictionary<Transform, ClothBoneType> clothBoneTypeMap)
@@ -81,8 +76,8 @@ public class EdenAutoMorpher_SetUpUtil
List<BoneMatchUtil.BoneRootLocalData> rootLocalBones = boneMatchUtil.GetRootLocalBones(config.targetClothesObject.transform, boneMatchUtil.GetMeshBones(config.targetClothesObject.GetComponentsInChildren<SkinnedMeshRenderer>().ToList())); List<BoneMatchUtil.BoneRootLocalData> rootLocalBones = boneMatchUtil.GetRootLocalBones(config.targetClothesObject.transform, boneMatchUtil.GetMeshBones(config.targetClothesObject.GetComponentsInChildren<SkinnedMeshRenderer>().ToList()));
boneMatchUtil.MatchClothesToBodyBones(bodyRootLocalBones, rootLocalBones, out clothesHumanoidMatchedBones, out clothBoneTypeMap, out var clothToBodyMatched); boneMatchUtil.MatchClothesToBodyBones(bodyRootLocalBones, rootLocalBones, out clothesHumanoidMatchedBones, out clothBoneTypeMap, out var clothToBodyMatched);
Dictionary<Transform, Transform> sourceToProxy; Dictionary<Transform, Transform> sourceToProxy;
GameObject val = new BodyPoseMatchUtil().AutoAdjustBodyPose(config.sourceAvatarObject, config.sourceBodyMeshes, config.targetAvatarObject, config.targetBodyMeshes, out sourceToProxy); GameObject gameObject = new BodyPoseMatchUtil().AutoAdjustBodyPose(config.sourceAvatarObject, config.sourceBodyMeshes, config.targetAvatarObject, config.targetBodyMeshes, out sourceToProxy);
if (val == null) if (gameObject == null)
{ {
throw new AutoMorpherException(LanguageManager.Get("UI.Exception.title.BodyProxyNull"), LanguageManager.Get("UI.Exception.message.BodyProxyNull")); throw new AutoMorpherException(LanguageManager.Get("UI.Exception.title.BodyProxyNull"), LanguageManager.Get("UI.Exception.message.BodyProxyNull"));
} }
@@ -100,11 +95,11 @@ public class EdenAutoMorpher_SetUpUtil
{ {
this.DebugPrintSameNameBonePaths(clothToBodyMatched, sourceToProxy); this.DebugPrintSameNameBonePaths(clothToBodyMatched, sourceToProxy);
} }
new BodyPoseToClothApplier().ApplyBodyPoseToClothes(val.transform, config.targetClothesObject.transform, clothToBodyMatched, sourceToProxy); new BodyPoseToClothApplier().ApplyBodyPoseToClothes(gameObject.transform, config.targetClothesObject.transform, clothToBodyMatched, sourceToProxy);
} }
finally finally
{ {
UnityEngine.Object.DestroyImmediate(val); UnityEngine.Object.DestroyImmediate(gameObject);
} }
} }
@@ -138,18 +133,18 @@ public class EdenAutoMorpher_SetUpUtil
foreach (KeyValuePair<Transform, BoneMatchUtil.BoneRootLocalData> item2 in clothToBodyMatched) foreach (KeyValuePair<Transform, BoneMatchUtil.BoneRootLocalData> item2 in clothToBodyMatched)
{ {
_ = item2.Key; _ = item2.Key;
Transform val = GetSourceTransform(item2.Value); Transform transform = GetSourceTransform(item2.Value);
if (val == null) if (transform == null)
{ {
continue; continue;
} }
string name = val.name; string name = transform.name;
if (!dictionary.TryGetValue(name, out var value2)) if (!dictionary.TryGetValue(name, out var value2))
{ {
continue; continue;
} }
stringBuilder.AppendLine("[Bone Name] " + name); stringBuilder.AppendLine("[Bone Name] " + name);
stringBuilder.AppendLine(" - BoneRootLocalData Source Path: " + GetPath(val)); stringBuilder.AppendLine(" - BoneRootLocalData Source Path: " + GetPath(transform));
foreach (Transform item3 in value2) foreach (Transform item3 in value2)
{ {
stringBuilder.AppendLine(" - sourceToProxy Source Path : " + GetPath(item3)); stringBuilder.AppendLine(" - sourceToProxy Source Path : " + GetPath(item3));
@@ -157,7 +152,7 @@ public class EdenAutoMorpher_SetUpUtil
stringBuilder.AppendLine("--------------------------------------------------"); stringBuilder.AppendLine("--------------------------------------------------");
} }
Debug.Log(stringBuilder.ToString()); Debug.Log(stringBuilder.ToString());
string GetPath(Transform t) static string GetPath(Transform t)
{ {
if (t == null) if (t == null)
{ {
@@ -175,7 +170,7 @@ public class EdenAutoMorpher_SetUpUtil
} }
return stringBuilder2.ToString(); return stringBuilder2.ToString();
} }
Transform GetSourceTransform(BoneMatchUtil.BoneRootLocalData data) static Transform GetSourceTransform(BoneMatchUtil.BoneRootLocalData data)
{ {
if (data == null) if (data == null)
{ {
@@ -186,8 +181,7 @@ public class EdenAutoMorpher_SetUpUtil
{ {
if (typeof(Transform).IsAssignableFrom(fieldInfo.FieldType)) if (typeof(Transform).IsAssignableFrom(fieldInfo.FieldType))
{ {
object value3 = fieldInfo.GetValue(data); return fieldInfo.GetValue(data) as Transform;
return (Transform)((value3 is Transform) ? value3 : null);
} }
} }
return null; return null;
@@ -224,13 +218,13 @@ public class EdenAutoMorpher_SetUpUtil
{ {
throw new AutoMorpherException("Target Clothes Object is Null", "[EdenAutoMorpher_SetUpUtil] ProfileAutoSetup\n - config.targetClothesObject is null"); throw new AutoMorpherException("Target Clothes Object is Null", "[EdenAutoMorpher_SetUpUtil] ProfileAutoSetup\n - config.targetClothesObject is null");
} }
ProfileData val = new ProfileLoader().LoadProfileData(config.profileName); ProfileData profileData = new ProfileLoader().LoadProfileData(config.profileName);
if (val == null) if (profileData == null)
{ {
throw new AutoMorpherException("Clothes Humanoid Matched Bones is Null", "[EdenAutoMorpher_SetUpUtil] ProfileAutoSetup\n - profile Data is null"); throw new AutoMorpherException("Clothes Humanoid Matched Bones is Null", "[EdenAutoMorpher_SetUpUtil] ProfileAutoSetup\n - profile Data is null");
} }
BoneMatchUtil boneMatchUtil = new BoneMatchUtil(); BoneMatchUtil boneMatchUtil = new BoneMatchUtil();
List<BoneMatchUtil.BoneRootLocalData> bodyBones = boneMatchUtil.ConvertProfileBoneDataToRootLocalData(val.bones); List<BoneMatchUtil.BoneRootLocalData> bodyBones = boneMatchUtil.ConvertProfileBoneDataToRootLocalData(profileData.bones);
List<BoneMatchUtil.BoneRootLocalData> rootLocalBones = boneMatchUtil.GetRootLocalBones(config.targetClothesObject.transform, boneMatchUtil.GetMeshBones(config.targetClothesObject.GetComponentsInChildren<SkinnedMeshRenderer>().ToList())); List<BoneMatchUtil.BoneRootLocalData> rootLocalBones = boneMatchUtil.GetRootLocalBones(config.targetClothesObject.transform, boneMatchUtil.GetMeshBones(config.targetClothesObject.GetComponentsInChildren<SkinnedMeshRenderer>().ToList()));
boneMatchUtil.MatchClothesToBodyBones(bodyBones, rootLocalBones, out clothesHumanoidMatchedBones, out clothBoneTypeMap, out var _); boneMatchUtil.MatchClothesToBodyBones(bodyBones, rootLocalBones, out clothesHumanoidMatchedBones, out clothBoneTypeMap, out var _);
if (clothesHumanoidMatchedBones == null || clothesHumanoidMatchedBones.Count == 0) if (clothesHumanoidMatchedBones == null || clothesHumanoidMatchedBones.Count == 0)
@@ -241,7 +235,7 @@ public class EdenAutoMorpher_SetUpUtil
{ {
throw new AutoMorpherException("Cloth Bone Type Map is Null", "[EdenAutoMorpher_SetUpUtil] ProfileAutoSetup\n - clothBoneTypeMap is null\n - Please check whether you have selected the correct profile for the outfit."); throw new AutoMorpherException("Cloth Bone Type Map is Null", "[EdenAutoMorpher_SetUpUtil] ProfileAutoSetup\n - clothBoneTypeMap is null\n - Please check whether you have selected the correct profile for the outfit.");
} }
new ProfilePoseMatchUtil().ProfilePoseMatcher(config.targetAvatarObject, config.targetBodyMeshes, config.targetClothesObject, val, clothesHumanoidMatchedBones, clothBoneTypeMap); new ProfilePoseMatchUtil().ProfilePoseMatcher(config.targetAvatarObject, config.targetBodyMeshes, config.targetClothesObject, profileData, clothesHumanoidMatchedBones, clothBoneTypeMap);
} }
public List<SkinnedMeshRenderer> SetupBodyMeshes(GameObject bodyObject, bool isBodyAutoSetup, List<SkinnedMeshRenderer> userAllocatedBoeyMeshes, string errorPreFix = "") public List<SkinnedMeshRenderer> SetupBodyMeshes(GameObject bodyObject, bool isBodyAutoSetup, List<SkinnedMeshRenderer> userAllocatedBoeyMeshes, string errorPreFix = "")
@@ -332,27 +326,6 @@ public class EdenAutoMorpher_SetUpUtil
public Transform CreateClothesArmature(EdenAutoMorpherConfig config, out Dictionary<Transform, Transform> clonedBoneMap) public Transform CreateClothesArmature(EdenAutoMorpherConfig config, out Dictionary<Transform, Transform> clonedBoneMap)
{ {
//IL_00df: 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_00fe: 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_0170: Unknown result type (might be due to invalid IL or missing references)
//IL_0175: 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_04d2: Unknown result type (might be due to invalid IL or missing references)
//IL_04eb: Unknown result type (might be due to invalid IL or missing references)
//IL_04f9: Unknown result type (might be due to invalid IL or missing references)
//IL_051d: Unknown result type (might be due to invalid IL or missing references)
//IL_050f: Unknown result type (might be due to invalid IL or missing references)
//IL_0491: Unknown result type (might be due to invalid IL or missing references)
//IL_0403: Unknown result type (might be due to invalid IL or missing references)
//IL_041c: Unknown result type (might be due to invalid IL or missing references)
//IL_042a: Unknown result type (might be due to invalid IL or missing references)
//IL_0436: Unknown result type (might be due to invalid IL or missing references)
//IL_0464: Unknown result type (might be due to invalid IL or missing references)
//IL_0470: Unknown result type (might be due to invalid IL or missing references)
//IL_04bf: Unknown result type (might be due to invalid IL or missing references)
//IL_04b1: Unknown result type (might be due to invalid IL or missing references)
clonedBoneMap = null; clonedBoneMap = null;
if (config.targetClothesObject == null) if (config.targetClothesObject == null)
{ {
@@ -367,7 +340,7 @@ public class EdenAutoMorpher_SetUpUtil
{ {
throw new AutoMorpherException("Target Avatar Animator is Invalid", "[EdenAutoMorpherManager] CreateClothesArmature\n - targetAvatarAnimator is null or not a Humanoid"); throw new AutoMorpherException("Target Avatar Animator is Invalid", "[EdenAutoMorpherManager] CreateClothesArmature\n - targetAvatarAnimator is null or not a Humanoid");
} }
Transform boneTransform = component.GetBoneTransform((HumanBodyBones)0); Transform boneTransform = component.GetBoneTransform(HumanBodyBones.Hips);
if (boneTransform == null) if (boneTransform == null)
{ {
throw new AutoMorpherException("Humanoid Root Bone is Missing", "[EdenAutoMorpherManager] CreateClothesArmature\n - Animator.GetBoneTransform(HumanBodyBones.Hips) returned null"); throw new AutoMorpherException("Humanoid Root Bone is Missing", "[EdenAutoMorpherManager] CreateClothesArmature\n - Animator.GetBoneTransform(HumanBodyBones.Hips) returned null");
@@ -377,18 +350,18 @@ public class EdenAutoMorpher_SetUpUtil
throw new AutoMorpherException("Target Body Meshes are Missing", "[EdenAutoMorpherManager] CreateClothesArmature\n - config.targetBodyMeshes is null or empty"); throw new AutoMorpherException("Target Body Meshes are Missing", "[EdenAutoMorpherManager] CreateClothesArmature\n - config.targetBodyMeshes is null or empty");
} }
Transform transform = config.targetClothesObject.transform; Transform transform = config.targetClothesObject.transform;
Transform val = this.FindArmature(config, config.targetClothesObject.transform); Transform transform2 = this.FindArmature(config, config.targetClothesObject.transform);
if (val == null) if (transform2 == null)
{ {
val = new GameObject("Armature.1").transform; transform2 = new GameObject("Armature.1").transform;
val.SetParent(transform, false); transform2.SetParent(transform, worldPositionStays: false);
val.localPosition = Vector3.zero; transform2.localPosition = Vector3.zero;
val.localRotation = Quaternion.identity; transform2.localRotation = Quaternion.identity;
val.localScale = Vector3.one; transform2.localScale = Vector3.one;
} }
if (val.name == "Armature") if (transform2.name == "Armature")
{ {
val.name = "Armature.1"; transform2.name = "Armature.1";
} }
Dictionary<Transform, Transform> dictionary = new Dictionary<Transform, Transform>(); Dictionary<Transform, Transform> dictionary = new Dictionary<Transform, Transform>();
if (config.clothesHumanoidMatchedBones != null && config.clothesHumanoidMatchedBones.Count > 0) if (config.clothesHumanoidMatchedBones != null && config.clothesHumanoidMatchedBones.Count > 0)
@@ -406,33 +379,33 @@ public class EdenAutoMorpher_SetUpUtil
{ {
continue; continue;
} }
Transform val2 = null; Transform transform3 = null;
int num = int.MaxValue; int num = int.MaxValue;
foreach (Transform item in value) foreach (Transform item in value)
{ {
if (!(item == null)) if (!(item == null))
{ {
int num2 = 0; int num2 = 0;
Transform val3 = item; Transform transform4 = item;
while (val3 != null) while (transform4 != null)
{ {
num2++; num2++;
val3 = val3.parent; transform4 = transform4.parent;
} }
if (num2 < num) if (num2 < num)
{ {
num = num2; num = num2;
val2 = item; transform3 = item;
} }
else if (num2 == num && val2 != null && string.Compare(item.name, val2.name, StringComparison.Ordinal) < 0) else if (num2 == num && transform3 != null && string.Compare(item.name, transform3.name, StringComparison.Ordinal) < 0)
{ {
val2 = item; transform3 = item;
} }
} }
} }
if (!(val2 == null) && !dictionary.ContainsKey(boneTransform2)) if (!(transform3 == null) && !dictionary.ContainsKey(boneTransform2))
{ {
dictionary.Add(boneTransform2, val2); dictionary.Add(boneTransform2, transform3);
} }
} }
} }
@@ -440,12 +413,12 @@ public class EdenAutoMorpher_SetUpUtil
HashSet<Transform> hashSet = new HashSet<Transform>(); HashSet<Transform> hashSet = new HashSet<Transform>();
for (int i = 0; i < config.targetBodyMeshes.Count; i++) for (int i = 0; i < config.targetBodyMeshes.Count; i++)
{ {
SkinnedMeshRenderer val4 = config.targetBodyMeshes[i]; SkinnedMeshRenderer skinnedMeshRenderer = config.targetBodyMeshes[i];
if (val4 == null) if (skinnedMeshRenderer == null)
{ {
continue; continue;
} }
HashSet<Transform> activeBones = meshClassifier.GetActiveBones(val4); HashSet<Transform> activeBones = meshClassifier.GetActiveBones(skinnedMeshRenderer);
if (activeBones == null) if (activeBones == null)
{ {
continue; continue;
@@ -465,15 +438,15 @@ public class EdenAutoMorpher_SetUpUtil
{ {
continue; continue;
} }
Transform val5 = item3; Transform transform5 = item3;
while (val5 != null) while (transform5 != null)
{ {
hashSet2.Add(val5); hashSet2.Add(transform5);
if (val5 == (object)boneTransform) if (transform5 == boneTransform)
{ {
break; break;
} }
val5 = val5.parent; transform5 = transform5.parent;
} }
} }
Dictionary<Transform, Transform> dictionary2 = new Dictionary<Transform, Transform>(hashSet2.Count); Dictionary<Transform, Transform> dictionary2 = new Dictionary<Transform, Transform>(hashSet2.Count);
@@ -484,57 +457,57 @@ public class EdenAutoMorpher_SetUpUtil
{ {
continue; continue;
} }
Transform val6 = null; Transform transform6 = null;
Transform val7 = null; Transform transform7 = null;
if (dictionary.TryGetValue(item4, out var value2) && value2 != null) if (dictionary.TryGetValue(item4, out var value2) && value2 != null)
{ {
val6 = value2; transform6 = value2;
if (config.addAnchorBone) if (config.addAnchorBone)
{ {
val7 = new GameObject(item4.name).transform; transform7 = new GameObject(item4.name).transform;
val7.SetParent(val, false); transform7.SetParent(transform2, worldPositionStays: false);
val7.position = item4.position; transform7.position = item4.position;
val7.rotation = item4.rotation; transform7.rotation = item4.rotation;
val7.localScale = Vector3.one; transform7.localScale = Vector3.one;
val6.SetParent(val7, true); transform6.SetParent(transform7, worldPositionStays: true);
val6.name = item4.name + "_clothes"; transform6.name = item4.name + "_clothes";
val6.localPosition = Vector3.zero; transform6.localPosition = Vector3.zero;
val6.localScale = Vector3.one; transform6.localScale = Vector3.one;
} }
else else
{ {
val6.name = item4.name; transform6.name = item4.name;
val6.position = item4.position; transform6.position = item4.position;
this.ChildBonePositionPreserve(val6, item4); this.ChildBonePositionPreserve(transform6, item4);
if (config.armatureBoneScaleCopy) if (config.armatureBoneScaleCopy)
{ {
val6.localScale = item4.localScale; transform6.localScale = item4.localScale;
} }
else else
{ {
val6.localScale = Vector3.one; transform6.localScale = Vector3.one;
} }
} }
} }
else else
{ {
val6 = new GameObject(item4.name).transform; transform6 = new GameObject(item4.name).transform;
val6.SetParent(val, false); transform6.SetParent(transform2, worldPositionStays: false);
val6.position = item4.position; transform6.position = item4.position;
val6.rotation = item4.rotation; transform6.rotation = item4.rotation;
if (config.armatureBoneScaleCopy) if (config.armatureBoneScaleCopy)
{ {
val6.localScale = item4.localScale; transform6.localScale = item4.localScale;
} }
else else
{ {
val6.localScale = Vector3.one; transform6.localScale = Vector3.one;
} }
} }
if (!(val6 == null)) if (!(transform6 == null))
{ {
dictionary2[item4] = val6; dictionary2[item4] = transform6;
dictionary3[item4] = ((val7 != null) ? val7 : val6); dictionary3[item4] = ((transform7 != null) ? transform7 : transform6);
} }
} }
foreach (Transform item5 in hashSet2) foreach (Transform item5 in hashSet2)
@@ -551,33 +524,33 @@ public class EdenAutoMorpher_SetUpUtil
{ {
throw new AutoMorpherException("Mapped Anchor Bone is Missing", "[EdenAutoMorpherManager] CreateClothesArmature\n - parentAnchorByOriginal does not contain originalBone or mappedAnchorBone is null\n - originalBone: " + item5.name); throw new AutoMorpherException("Mapped Anchor Bone is Missing", "[EdenAutoMorpherManager] CreateClothesArmature\n - parentAnchorByOriginal does not contain originalBone or mappedAnchorBone is null\n - originalBone: " + item5.name);
} }
if (item5 == (object)boneTransform) if (item5 == boneTransform)
{ {
value4.SetParent(val, true); value4.SetParent(transform2, worldPositionStays: true);
continue; continue;
} }
Transform parent = item5.parent; Transform parent = item5.parent;
Transform value5; Transform value5;
if (parent == null) if (parent == null)
{ {
value4.SetParent(val, true); value4.SetParent(transform2, worldPositionStays: true);
} }
else if (dictionary3.TryGetValue(parent, out value5) && value5 != null) else if (dictionary3.TryGetValue(parent, out value5) && value5 != null)
{ {
value4.SetParent(value5, true); value4.SetParent(value5, worldPositionStays: true);
} }
else else
{ {
value4.SetParent(val, true); value4.SetParent(transform2, worldPositionStays: true);
} }
} }
if (!dictionary3.TryGetValue(boneTransform, out var value6) || value6 == null) if (!dictionary3.TryGetValue(boneTransform, out var value6) || value6 == null)
{ {
throw new AutoMorpherException("Cloned Humanoid Root Bone is Missing", "[EdenAutoMorpherManager] CreateClothesArmature\n - failed to map clone for HumanBodyBones.Hips"); throw new AutoMorpherException("Cloned Humanoid Root Bone is Missing", "[EdenAutoMorpherManager] CreateClothesArmature\n - failed to map clone for HumanBodyBones.Hips");
} }
value6.SetParent(val, true); value6.SetParent(transform2, worldPositionStays: true);
clonedBoneMap = dictionary2; clonedBoneMap = dictionary2;
return val; return transform2;
} }
private Transform FindArmature(EdenAutoMorpherConfig config, Transform clothesRoot) private Transform FindArmature(EdenAutoMorpherConfig config, Transform clothesRoot)
@@ -590,7 +563,7 @@ public class EdenAutoMorpher_SetUpUtil
{ {
return null; return null;
} }
Transform val = null; Transform transform = null;
bool flag = false; bool flag = false;
foreach (KeyValuePair<HumanBodyBones, HashSet<Transform>> clothesHumanoidMatchedBone in config.clothesHumanoidMatchedBones) foreach (KeyValuePair<HumanBodyBones, HashSet<Transform>> clothesHumanoidMatchedBone in config.clothesHumanoidMatchedBones)
{ {
@@ -609,11 +582,11 @@ public class EdenAutoMorpher_SetUpUtil
{ {
return null; return null;
} }
if (val == null) if (transform == null)
{ {
val = topChildUnderRoot; transform = topChildUnderRoot;
} }
else if (val != topChildUnderRoot) else if (transform != topChildUnderRoot)
{ {
return null; return null;
} }
@@ -624,11 +597,11 @@ public class EdenAutoMorpher_SetUpUtil
{ {
return null; return null;
} }
if (val == null || val == clothesRoot) if (transform == null || transform == clothesRoot)
{ {
return null; return null;
} }
return val; return transform;
} }
private Transform GetTopChildUnderRoot(Transform bone, Transform clothesRoot) private Transform GetTopChildUnderRoot(Transform bone, Transform clothesRoot)
@@ -641,25 +614,20 @@ public class EdenAutoMorpher_SetUpUtil
{ {
return clothesRoot; return clothesRoot;
} }
Transform val = bone; Transform transform = bone;
while (val.parent != null && val.parent != clothesRoot) while (transform.parent != null && transform.parent != clothesRoot)
{ {
val = val.parent; transform = transform.parent;
} }
if (val.parent == clothesRoot) if (transform.parent == clothesRoot)
{ {
return val; return transform;
} }
return clothesRoot; return clothesRoot;
} }
private void ChildBonePositionPreserve(Transform reusableClothBone, Transform referenceAvatarBone) private void ChildBonePositionPreserve(Transform reusableClothBone, Transform referenceAvatarBone)
{ {
//IL_0073: 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_009c: 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_00be: Unknown result type (might be due to invalid IL or missing references)
if (reusableClothBone == null || referenceAvatarBone == null) if (reusableClothBone == null || referenceAvatarBone == null)
{ {
throw new AutoMorpherException("Reusable Bone Sync Failed", "[EdenAutoMorpherManager] SyncReusableBoneRotationPreserveChildrenWorld\n - reusableClothBone or referenceAvatarBone is null"); throw new AutoMorpherException("Reusable Bone Sync Failed", "[EdenAutoMorpherManager] SyncReusableBoneRotationPreserveChildrenWorld\n - reusableClothBone or referenceAvatarBone is null");
@@ -677,9 +645,9 @@ public class EdenAutoMorpher_SetUpUtil
} }
for (int j = 0; j < list.Count; j++) for (int j = 0; j < list.Count; j++)
{ {
Transform val = list[j]; Transform transform = list[j];
list2.Add(val.position); list2.Add(transform.position);
list3.Add(val.rotation); list3.Add(transform.rotation);
} }
reusableClothBone.localRotation = referenceAvatarBone.localRotation; reusableClothBone.localRotation = referenceAvatarBone.localRotation;
for (int k = 0; k < list.Count; k++) for (int k = 0; k < list.Count; k++)

View File

@@ -1,2 +1,2 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 1db8e97e7f1e5484b9e4f10fe266c6f8 guid: ee9b28aa8763b004c9d0f631d797bb28

View File

@@ -4,267 +4,12 @@
// Eden.AutoMorpher.MeshClassifier // Eden.AutoMorpher.MeshClassifier
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Eden.AutoMorpher;
using UnityEngine; using UnityEngine;
public class MeshClassifier public class MeshClassifier
{ {
private HumanBodyBones[] bodyBones; private HumanBodyBones[] bodyBones = new HumanBodyBones[28]
private HumanBodyBones[] headBones;
public SkinnedMeshRenderer GetBodyMesh(Transform root, Animator animator)
{
List<Transform> list = this.HumanBodyBonesTrsnforms(this.bodyBones, animator);
if (list.Count != this.bodyBones.Length)
{
if (AutoMorpherDev.isDeveloperMode)
{
Debug.LogWarning("[Body Mesh] Animator Bone is not enough");
}
return null;
}
return this.GetBoneMatchedMesh(root, list);
}
public SkinnedMeshRenderer GetHeadMesh(Transform root, Animator animator)
{
List<Transform> list = this.HumanBodyBonesTrsnforms(this.headBones, animator);
if (list.Count != this.headBones.Length)
{
return null;
}
return this.GetBoneMatchedMesh(root, list);
}
private List<Transform> HumanBodyBonesTrsnforms(HumanBodyBones[] humanBonesList, Animator animator)
{
//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_002c: Unknown result type (might be due to invalid IL or missing references)
List<Transform> list = new List<Transform>();
List<HumanBodyBones> list2 = new List<HumanBodyBones>();
foreach (HumanBodyBones val in humanBonesList)
{
Transform boneTransform = animator.GetBoneTransform(val);
if (boneTransform == null)
{
list2.Add(val);
}
else
{
list.Add(boneTransform);
}
}
if (list2.Count > 0)
{
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].");
}
return list;
}
private SkinnedMeshRenderer GetBoneMatchedMesh(Transform root, List<Transform> humanBoneTransforms)
{
SkinnedMeshRenderer[] componentsInChildren = ((Component)root).GetComponentsInChildren<SkinnedMeshRenderer>(false);
foreach (SkinnedMeshRenderer val in componentsInChildren)
{
bool flag = true;
HashSet<Transform> activeBones = this.GetActiveBones(val);
if (AutoMorpherDev.isDeveloperMode)
{
Debug.Log($"[Body Mesh] {val.gameObject.name} have bone Set {activeBones.Count}");
}
foreach (Transform humanBoneTransform in humanBoneTransforms)
{
if (!activeBones.Contains(humanBoneTransform) && !this.BoneExistsByPosition(humanBoneTransform, activeBones))
{
flag = false;
if (AutoMorpherDev.isDeveloperMode)
{
Debug.Log(("[Body Mesh] " + val.gameObject.name + " Doesn't hav bone " + humanBoneTransform.name));
}
break;
}
}
if (flag)
{
return val;
}
}
return null;
}
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_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_0020: Unknown result type (might be due to invalid IL or missing references)
foreach (Transform item in smrBoneSet)
{
Vector3 val = item.position - boneToCheck.position;
if (val.sqrMagnitude <= posTolerance * posTolerance)
{
return true;
}
}
return false;
}
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_0043: Unknown result type (might be due to invalid IL or missing references)
Mesh sharedMesh = smr.sharedMesh;
if (sharedMesh == null)
{
Debug.LogWarning("SkinnedMeshRenderer에 연결된 Mesh가 없습니다.");
return new HashSet<Transform>();
}
Transform[] bones = smr.bones;
BoneWeight[] boneWeights = sharedMesh.boneWeights;
HashSet<int> hashSet = new HashSet<int>();
BoneWeight[] array = boneWeights;
for (int i = 0; i < array.Length; i++)
{
BoneWeight val = array[i];
if (val.weight0 > weightThreshold)
{
hashSet.Add(val.boneIndex0);
}
if (val.weight1 > weightThreshold)
{
hashSet.Add(val.boneIndex1);
}
if (val.weight2 > weightThreshold)
{
hashSet.Add(val.boneIndex2);
}
if (val.weight3 > weightThreshold)
{
hashSet.Add(val.boneIndex3);
}
}
HashSet<Transform> hashSet2 = new HashSet<Transform>();
foreach (int item in hashSet)
{
if (item >= 0 && item < bones.Length)
{
hashSet2.Add(bones[item]);
}
}
return hashSet2;
}
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_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)
Dictionary<HumanBodyBones, HashSet<Transform>> dictionary = new Dictionary<HumanBodyBones, HashSet<Transform>>();
if (animator == null)
{
throw new AutoMorpherException("Animator is Missing", "[MeshHumanoidBoneMatcher] MeshHumanoidBoneMatcher\n - animator is null");
}
HashSet<Transform> hashSet = new HashSet<Transform>();
if (bodyMeshes != null)
{
foreach (SkinnedMeshRenderer bodyMesh in bodyMeshes)
{
if (bodyMesh == null)
{
continue;
}
foreach (Transform activeBone in this.GetActiveBones(bodyMesh, weightThreshold))
{
if (activeBone != null)
{
hashSet.Add(activeBone);
}
}
}
}
for (int i = 0; i < 55; i++)
{
HumanBodyBones val = (HumanBodyBones)i;
Transform boneTransform = animator.GetBoneTransform(val);
if (boneTransform == null)
{
continue;
}
HashSet<Transform> hashSet2 = new HashSet<Transform>();
hashSet2.Add(boneTransform);
foreach (Transform item in this.FindBonesByPosition(boneTransform, hashSet, posTolerance))
{
hashSet2.Add(item);
}
dictionary[val] = hashSet2;
}
return dictionary;
}
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_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_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_006e: Unknown result type (might be due to invalid IL or missing references)
List<Transform> list = new List<Transform>();
if (boneToCheck == null)
{
return list;
}
float num = posTolerance * posTolerance;
Vector3 position = boneToCheck.position;
foreach (Transform item in smrBoneSet)
{
if (!(item == null) && !(item == boneToCheck) && this.NameMatches((((Component)item).gameObject).name, (((Component)boneToCheck).gameObject).name))
{
Vector3 val = item.position - position;
if (val.sqrMagnitude <= num)
{
list.Add(item);
}
}
}
return list;
}
private string[] TokenizeBoneName(string name)
{
if (string.IsNullOrWhiteSpace(name))
{
return Array.Empty<string>();
}
char[] separator = new char[5] { '-', '_', ':', '.', '|' };
name = name.Trim();
return name.Split(separator, StringSplitOptions.RemoveEmptyEntries);
}
private bool NameMatches(string boneToCheckName, string candidateName)
{
string[] array = this.TokenizeBoneName(boneToCheckName);
string[] array2 = this.TokenizeBoneName(candidateName);
if (array.Length == 0 || array2.Length == 0)
{
return false;
}
if (!array[0].Equals(array2[0], StringComparison.OrdinalIgnoreCase))
{
return false;
}
if (array.Length > 1 && array2.Length > 1 && !array[1].Equals(array2[1], StringComparison.OrdinalIgnoreCase))
{
return false;
}
return true;
}
public MeshClassifier()
{
this.bodyBones = new HumanBodyBones[28]
{ {
HumanBodyBones.Hips, HumanBodyBones.Hips,
HumanBodyBones.Spine, HumanBodyBones.Spine,
@@ -296,11 +41,237 @@ public class MeshClassifier
HumanBodyBones.RightFoot HumanBodyBones.RightFoot
}; };
this.headBones = new HumanBodyBones[3] private HumanBodyBones[] headBones = new HumanBodyBones[3]
{ {
HumanBodyBones.Head, HumanBodyBones.Head,
HumanBodyBones.LeftEye, HumanBodyBones.LeftEye,
HumanBodyBones.RightEye HumanBodyBones.RightEye
}; };
public SkinnedMeshRenderer GetBodyMesh(Transform root, Animator animator)
{
List<Transform> list = HumanBodyBonesTrsnforms(bodyBones, animator);
if (list.Count != bodyBones.Length)
{
if (AutoMorpherDev.isDeveloperMode)
{
Debug.LogWarning("[Body Mesh] Animator Bone is not enough");
}
return null;
}
return GetBoneMatchedMesh(root, list);
}
public SkinnedMeshRenderer GetHeadMesh(Transform root, Animator animator)
{
List<Transform> list = HumanBodyBonesTrsnforms(headBones, animator);
if (list.Count != headBones.Length)
{
return null;
}
return GetBoneMatchedMesh(root, list);
}
private List<Transform> HumanBodyBonesTrsnforms(HumanBodyBones[] humanBonesList, Animator animator)
{
List<Transform> list = new List<Transform>();
List<HumanBodyBones> list2 = new List<HumanBodyBones>();
foreach (HumanBodyBones humanBodyBones in humanBonesList)
{
Transform boneTransform = animator.GetBoneTransform(humanBodyBones);
if (boneTransform == null)
{
list2.Add(humanBodyBones);
}
else
{
list.Add(boneTransform);
}
}
if (list2.Count > 0)
{
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].");
}
return list;
}
private SkinnedMeshRenderer GetBoneMatchedMesh(Transform root, List<Transform> humanBoneTransforms)
{
SkinnedMeshRenderer[] componentsInChildren = root.GetComponentsInChildren<SkinnedMeshRenderer>(includeInactive: false);
foreach (SkinnedMeshRenderer skinnedMeshRenderer in componentsInChildren)
{
bool flag = true;
HashSet<Transform> activeBones = GetActiveBones(skinnedMeshRenderer);
if (AutoMorpherDev.isDeveloperMode)
{
Debug.Log($"[Body Mesh] {skinnedMeshRenderer.gameObject.name} have bone Set {activeBones.Count}");
}
foreach (Transform humanBoneTransform in humanBoneTransforms)
{
if (!activeBones.Contains(humanBoneTransform) && !BoneExistsByPosition(humanBoneTransform, activeBones))
{
flag = false;
if (AutoMorpherDev.isDeveloperMode)
{
Debug.Log("[Body Mesh] " + skinnedMeshRenderer.gameObject.name + " Doesn't hav bone " + humanBoneTransform.name);
}
break;
}
}
if (flag)
{
return skinnedMeshRenderer;
}
}
return null;
}
private bool BoneExistsByPosition(Transform boneToCheck, HashSet<Transform> smrBoneSet, float posTolerance = 0.0001f)
{
foreach (Transform item in smrBoneSet)
{
if ((item.position - boneToCheck.position).sqrMagnitude <= posTolerance * posTolerance)
{
return true;
}
}
return false;
}
public HashSet<Transform> GetActiveBones(SkinnedMeshRenderer smr, float weightThreshold = 0.0001f)
{
Mesh sharedMesh = smr.sharedMesh;
if (sharedMesh == null)
{
Debug.LogWarning("SkinnedMeshRenderer에 연결된 Mesh가 없습니다.");
return new HashSet<Transform>();
}
Transform[] bones = smr.bones;
BoneWeight[] boneWeights = sharedMesh.boneWeights;
HashSet<int> hashSet = new HashSet<int>();
BoneWeight[] array = boneWeights;
for (int i = 0; i < array.Length; i++)
{
BoneWeight boneWeight = array[i];
if (boneWeight.weight0 > weightThreshold)
{
hashSet.Add(boneWeight.boneIndex0);
}
if (boneWeight.weight1 > weightThreshold)
{
hashSet.Add(boneWeight.boneIndex1);
}
if (boneWeight.weight2 > weightThreshold)
{
hashSet.Add(boneWeight.boneIndex2);
}
if (boneWeight.weight3 > weightThreshold)
{
hashSet.Add(boneWeight.boneIndex3);
}
}
HashSet<Transform> hashSet2 = new HashSet<Transform>();
foreach (int item in hashSet)
{
if (item >= 0 && item < bones.Length)
{
hashSet2.Add(bones[item]);
}
}
return hashSet2;
}
public Dictionary<HumanBodyBones, HashSet<Transform>> MeshHumanoidBoneMatcher(Animator animator, IReadOnlyList<SkinnedMeshRenderer> bodyMeshes, float posTolerance = 0.0001f, float weightThreshold = 0.0001f)
{
Dictionary<HumanBodyBones, HashSet<Transform>> dictionary = new Dictionary<HumanBodyBones, HashSet<Transform>>();
if (animator == null)
{
throw new AutoMorpherException("Animator is Missing", "[MeshHumanoidBoneMatcher] MeshHumanoidBoneMatcher\n - animator is null");
}
HashSet<Transform> hashSet = new HashSet<Transform>();
if (bodyMeshes != null)
{
foreach (SkinnedMeshRenderer bodyMesh in bodyMeshes)
{
if (bodyMesh == null)
{
continue;
}
foreach (Transform activeBone in GetActiveBones(bodyMesh, weightThreshold))
{
if (activeBone != null)
{
hashSet.Add(activeBone);
}
}
}
}
for (int i = 0; i < 55; i++)
{
HumanBodyBones humanBodyBones = (HumanBodyBones)i;
Transform boneTransform = animator.GetBoneTransform(humanBodyBones);
if (boneTransform == null)
{
continue;
}
HashSet<Transform> hashSet2 = new HashSet<Transform>();
hashSet2.Add(boneTransform);
foreach (Transform item in FindBonesByPosition(boneTransform, hashSet, posTolerance))
{
hashSet2.Add(item);
}
dictionary[humanBodyBones] = hashSet2;
}
return dictionary;
}
private List<Transform> FindBonesByPosition(Transform boneToCheck, HashSet<Transform> smrBoneSet, float posTolerance = 0.0001f)
{
List<Transform> list = new List<Transform>();
if (boneToCheck == null)
{
return list;
}
float num = posTolerance * posTolerance;
Vector3 position = boneToCheck.position;
foreach (Transform item in smrBoneSet)
{
if (!(item == null) && !(item == boneToCheck) && NameMatches(item.gameObject.name, boneToCheck.gameObject.name) && (item.position - position).sqrMagnitude <= num)
{
list.Add(item);
}
}
return list;
}
private string[] TokenizeBoneName(string name)
{
if (string.IsNullOrWhiteSpace(name))
{
return Array.Empty<string>();
}
char[] separator = new char[5] { '-', '_', ':', '.', '|' };
name = name.Trim();
return name.Split(separator, StringSplitOptions.RemoveEmptyEntries);
}
private bool NameMatches(string boneToCheckName, string candidateName)
{
string[] array = TokenizeBoneName(boneToCheckName);
string[] array2 = TokenizeBoneName(candidateName);
if (array.Length == 0 || array2.Length == 0)
{
return false;
}
if (!array[0].Equals(array2[0], StringComparison.OrdinalIgnoreCase))
{
return false;
}
if (array.Length > 1 && array2.Length > 1 && !array[1].Equals(array2[1], StringComparison.OrdinalIgnoreCase))
{
return false;
}
return true;
} }
} }

View File

@@ -1,2 +1,2 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: f991af22c535af544ba5652d9ba5f408 guid: ff16c8420ee112443862fd5a7b3c0903

View File

@@ -23,18 +23,18 @@ public class MeshMatcher
private readonly HashSet<HumanBodyBones> LeftLegBones = new HashSet<HumanBodyBones> private readonly HashSet<HumanBodyBones> LeftLegBones = new HashSet<HumanBodyBones>
{ {
(HumanBodyBones)1, HumanBodyBones.LeftUpperLeg,
(HumanBodyBones)3, HumanBodyBones.LeftLowerLeg,
(HumanBodyBones)5, HumanBodyBones.LeftFoot,
(HumanBodyBones)19 HumanBodyBones.LeftToes
}; };
private readonly HashSet<HumanBodyBones> RightLegBones = new HashSet<HumanBodyBones> private readonly HashSet<HumanBodyBones> RightLegBones = new HashSet<HumanBodyBones>
{ {
(HumanBodyBones)2, HumanBodyBones.RightUpperLeg,
(HumanBodyBones)4, HumanBodyBones.RightLowerLeg,
(HumanBodyBones)6, HumanBodyBones.RightFoot,
(HumanBodyBones)20 HumanBodyBones.RightToes
}; };
public BvhTriangleMesh BuildBvhMulti(IReadOnlyList<SkinnedMeshRenderer> bodies, Animator bodyAnimator) public BvhTriangleMesh BuildBvhMulti(IReadOnlyList<SkinnedMeshRenderer> bodies, Animator bodyAnimator)
@@ -46,10 +46,10 @@ public class MeshMatcher
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("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, bodyAnimator.gameObject.name,
bvhTriangleMesh == null, bvhTriangleMesh == null,
bvhTriangleMesh.triangles == null bvhTriangleMesh.triangles == null
})); }));
@@ -59,49 +59,6 @@ public class MeshMatcher
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_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_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_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_012b: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: Invalid comparison between Unknown and I4
//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_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_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_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_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_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_0135: Unknown result type (might be due to invalid IL or missing references)
//IL_013b: Invalid comparison between Unknown and I4
//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_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_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_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_0146: Invalid comparison between Unknown and I4
//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_014a: Unknown result type (might be due to invalid IL or missing references)
//IL_0151: Invalid comparison between Unknown and I4
//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_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_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_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 (this.bodyBVH == null) if (this.bodyBVH == null)
@@ -114,18 +71,18 @@ public class MeshMatcher
} }
if (worldVertices.Length == 0) if (worldVertices.Length == 0)
{ {
Debug.LogWarning((object)"clothes mesh has no vertices"); Debug.LogWarning("clothes mesh has no vertices");
return null; return null;
} }
if (minDistance == null) if (minDistance == null)
{ {
Debug.LogWarning((object)"minDists is null"); Debug.LogWarning("minDists is null");
} }
if (minDistance.Length != worldVertices.Length) if (minDistance.Length != worldVertices.Length)
{ {
Debug.LogWarning((object)"minDists.Length != worldVertexs.Length"); Debug.LogWarning("minDists.Length != worldVertexs.Length");
} }
Vector3[] array = (Vector3[])(object)new Vector3[worldVertices.Length]; Vector3[] array = 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++)
{ {
@@ -141,7 +98,7 @@ public class MeshMatcher
} }
float num2 = minDistance[i] + defaultMinDist; float num2 = minDistance[i] + defaultMinDist;
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))); 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 && (closestHit.mainHumanBone == HumanBodyBones.LeftFoot || closestHit.mainHumanBone == HumanBodyBones.RightFoot || closestHit.mainHumanBone == HumanBodyBones.RightToes || closestHit.mainHumanBone == HumanBodyBones.LeftToes))
{ {
array[i] = Vector3.zero; array[i] = Vector3.zero;
continue; continue;
@@ -151,8 +108,7 @@ public class MeshMatcher
array[i] = Vector3.zero; array[i] = Vector3.zero;
continue; continue;
} }
Vector3 val = closestHit.closestPoint - worldVertices[i]; Vector3 normalized = (closestHit.closestPoint - worldVertices[i]).normalized;
Vector3 normalized = val.normalized;
float num3 = Vector3.Dot(normalized, closestHit.normal.normalized); float num3 = Vector3.Dot(normalized, closestHit.normal.normalized);
if (num3 > 0.7f) if (num3 > 0.7f)
{ {
@@ -175,49 +131,6 @@ public class MeshMatcher
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_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_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_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_0150: Unknown result type (might be due to invalid IL or missing references)
//IL_0156: Invalid comparison between Unknown and I4
//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_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_015a: Unknown result type (might be due to invalid IL or missing references)
//IL_0160: Invalid comparison between Unknown and I4
//IL_0164: Unknown result type (might be due to invalid IL or missing references)
//IL_016b: Invalid comparison between Unknown and I4
//IL_016f: Unknown result type (might be due to invalid IL or missing references)
//IL_0176: Invalid comparison between Unknown and I4
//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_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_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_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_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_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_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_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_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_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_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_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)
Vector3[] worldVertices = clothInstance.worldVertices; Vector3[] worldVertices = clothInstance.worldVertices;
float[] minDistance = clothInstance.minDistance; float[] minDistance = clothInstance.minDistance;
if (this.bodyBVH == null) if (this.bodyBVH == null)
@@ -230,18 +143,18 @@ public class MeshMatcher
} }
if (worldVertices.Length == 0) if (worldVertices.Length == 0)
{ {
Debug.LogWarning((object)"clothes mesh has no vertices"); Debug.LogWarning("clothes mesh has no vertices");
return null; return null;
} }
if (minDistance == null) if (minDistance == null)
{ {
Debug.LogWarning((object)"minDists is null"); Debug.LogWarning("minDists is null");
} }
if (minDistance.Length != worldVertices.Length) if (minDistance.Length != worldVertices.Length)
{ {
Debug.LogWarning((object)"minDists.Length != worldVertexs.Length"); Debug.LogWarning("minDists.Length != worldVertexs.Length");
} }
Vector3[] array = (Vector3[])(object)new Vector3[worldVertices.Length]; Vector3[] array = new Vector3[worldVertices.Length];
float num = maxMatchDistance * maxMatchDistance; float num = maxMatchDistance * maxMatchDistance;
_ = clothInstance.isLeftLegVertex; _ = clothInstance.isLeftLegVertex;
_ = clothInstance.isRightLegVertex; _ = clothInstance.isRightLegVertex;
@@ -264,13 +177,12 @@ public class MeshMatcher
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 (closestHit.mainHumanBone == HumanBodyBones.LeftFoot || closestHit.mainHumanBone == HumanBodyBones.RightFoot || closestHit.mainHumanBone == HumanBodyBones.RightToes || closestHit.mainHumanBone == HumanBodyBones.LeftToes)
{ {
array[i] = Vector3.zero; array[i] = Vector3.zero;
continue; continue;
} }
Vector3 val = closestHit.closestPoint - worldVertices[i]; Vector3 normalized = (closestHit.closestPoint - worldVertices[i]).normalized;
Vector3 normalized = val.normalized;
float num3 = Vector3.Dot(normalized, closestHit.normal.normalized); float num3 = Vector3.Dot(normalized, closestHit.normal.normalized);
if (num3 < -0.7f) if (num3 < -0.7f)
{ {
@@ -293,15 +205,6 @@ public class MeshMatcher
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_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_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_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_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)
if (this.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");
@@ -310,40 +213,32 @@ public class MeshMatcher
{ {
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 = 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 vector = clothesVertices[i];
Vector3 val2 = this.bodyBVH.QueryClosest(val).closestPoint - val; Vector3 vector2 = this.bodyBVH.QueryClosest(vector).closestPoint - vector;
array[i] = val2; array[i] = vector2;
} }
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_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_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_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)
if (this.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("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 = this.bodyBVH.QueryClosest(worldVertices[i]); BvhTriangleMesh.ClosestHit closestHit = this.bodyBVH.QueryClosest(worldVertices[i]);
Vector3 val = closestHit.closestPoint - worldVertices[i]; float num = Vector3.Dot((closestHit.closestPoint - worldVertices[i]).normalized, 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,2 +1,2 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 418eea2f0ad202a45a8bdb4f4ec77b2b guid: ff91f6ef8c92bde45be01d6a9a72de14

View File

@@ -1,2 +1,2 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: b1f6c2c3a41c0334b837ba300e8680e3 guid: 4034d900027327e4f852772dcfe8e365

View File

@@ -1,2 +1,2 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: a7ddfac124d756d47a695db1966c6710 guid: bc2c9a1228ed1e048ad890b466973f9b

View File

@@ -9,62 +9,18 @@ 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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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 zero = Vector3.zero;
for (int i = 0; i < count; i++) for (int i = 0; i < count; i++)
{ {
val += points[i]; zero += points[i];
} }
val /= (float)count; zero /= (float)count;
float num = 0f; float num = 0f;
float num2 = 0f; float num2 = 0f;
float num3 = 0f; float num3 = 0f;
@@ -73,13 +29,13 @@ public class PcaUtil
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 vector = points[j] - zero;
num += val2.x * val2.x; num += vector.x * vector.x;
num2 += val2.x * val2.y; num2 += vector.x * vector.y;
num3 += val2.x * val2.z; num3 += vector.x * vector.z;
num4 += val2.y * val2.y; num4 += vector.y * vector.y;
num5 += val2.y * val2.z; num5 += vector.y * vector.z;
num6 += val2.z * val2.z; num6 += vector.z * vector.z;
} }
float num7 = 1f / (float)count; float num7 = 1f / (float)count;
num *= num7; num *= num7;
@@ -104,7 +60,7 @@ public class PcaUtil
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] - zero, normalized);
if (num12 < num9) if (num12 < num9)
{ {
num9 = num12; num9 = num12;
@@ -113,12 +69,11 @@ public class PcaUtil
{ {
num10 = num12; num10 = num12;
} }
Vector3 val3 = val + normalized * num12; Vector3 vector2 = zero + normalized * num12;
Vector3 val4 = points[k] - val3; float magnitude = (points[k] - vector2).magnitude;
float magnitude = val4.magnitude;
num11 += magnitude; num11 += magnitude;
} }
result.center = val; result.center = zero;
result.principalAxis = normalized; result.principalAxis = normalized;
result.length = num10 - num9; result.length = num10 - num9;
result.avgRadius = num11 / (float)count; result.avgRadius = num11 / (float)count;
@@ -127,12 +82,6 @@ public class PcaUtil
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_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_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_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 },
@@ -171,37 +120,37 @@ public class PcaUtil
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 f = 0.5f * Mathf.Atan2(2f * num8, num7 - num6);
float num10 = Mathf.Cos(num9); float num9 = Mathf.Cos(f);
float num11 = Mathf.Sin(num9); float num10 = Mathf.Sin(f);
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 num11 = array[j, num];
float num13 = array[j, num2]; float num12 = array[j, num2];
array[j, num] = num10 * num12 - num11 * num13; array[j, num] = num9 * num11 - num10 * num12;
array[num, j] = array[j, num]; array[num, j] = array[j, num];
array[j, num2] = num11 * num12 + num10 * num13; array[j, num2] = num10 * num11 + num9 * num12;
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 num13 = num9 * num9 * num6 - 2f * num10 * num9 * num8 + num10 * num10 * num7;
float num15 = num11 * num11 * num6 + 2f * num11 * num10 * num8 + num10 * num10 * num7; float num14 = num10 * num10 * num6 + 2f * num10 * num9 * num8 + num9 * num9 * num7;
array[num, num] = num14; array[num, num] = num13;
array[num2, num2] = num15; array[num2, num2] = num14;
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 num15 = array2[k, num];
float num17 = array2[k, num2]; float num16 = array2[k, num2];
array2[k, num] = num10 * num16 - num11 * num17; array2[k, num] = num9 * num15 - num10 * num16;
array2[k, num2] = num11 * num16 + num10 * num17; array2[k, num2] = num10 * num15 + num9 * num16;
} }
} }
eigenValues = new float[3]; eigenValues = new float[3];
eigenVectors = (Vector3[])(object)new Vector3[3]; eigenVectors = 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];

View File

@@ -1,2 +1,2 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 16f14c8f4290f7f4dbe5bd00ac634a53 guid: e4e18ad2e82437b4e9ac73ad1a2f08df

View File

@@ -1,2 +1,2 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 50bf17664b463a64a843fa1b8a18516b guid: a1fa6f19a17c1cc4cbec5095fc7f64e5

View File

@@ -0,0 +1,296 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts,
// for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies.
// EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.profile.ProfileLoader
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using UnityEngine;
public class ProfileLoader
{
private ProfileData loadedProfileData;
private const int HEX32_W = 8;
public List<string> GetProfileList()
{
ProfileUtils profileUtils = new ProfileUtils();
string text = Path.Combine(Application.dataPath, profileUtils.GetProfileBasePath());
List<string> list = new List<string>();
if (!Directory.Exists(text))
{
Debug.LogWarning("[ProfileUtils] Profile base path does not exist: " + text);
return list;
}
string[] directories = Directory.GetDirectories(text);
foreach (string text2 in directories)
{
string fileName = Path.GetFileName(text2);
if (!string.IsNullOrEmpty(fileName))
{
string path = Path.Combine(text2, fileName + ".json");
string path2 = Path.Combine(text2, fileName + ".eb");
if (File.Exists(path) && File.Exists(path2))
{
list.Add(fileName);
}
}
}
return list;
}
public ProfileData LoadProfileData(string profileName)
{
ProfileUtils profileUtils = new ProfileUtils();
string path = Path.Combine(Application.dataPath, profileUtils.GetProfileBasePath());
path = Path.Combine(path, profileName);
path = Path.Combine(path, profileName + ".json");
if (string.IsNullOrWhiteSpace(path))
{
throw new AutoMorpherException("Profile File Path is Invalid", "[ProfileLoader] LoadProfileData\n - Profile Path is null, empty, or whitespace");
}
if (!File.Exists(path))
{
throw new AutoMorpherException("Profile File Does Not Exist", "[ProfileLoader] LoadProfileData\n - profile file does not exist\n - path : " + path);
}
string json = File.ReadAllText(path);
this.loadedProfileData = JsonUtility.FromJson<ProfileData>(json);
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);
}
return this.loadedProfileData;
}
public BvhTriangleMesh LoadBvhWithRootTransform(Transform rootTransform, string profileName)
{
ProfileUtils profileUtils = new ProfileUtils();
string path = Path.Combine(Application.dataPath, profileUtils.GetProfileBasePath());
path = Path.Combine(path, profileName);
path = Path.Combine(path, profileName + ".eb");
if (rootTransform == null)
{
throw new AutoMorpherException("Root Transform is Null", "[ProfileLoader] LoadBvhWithRootTransform\n - rootTransform is null");
}
if (string.IsNullOrEmpty(path))
{
throw new AutoMorpherException("Profile BVH Path is Invalid", "[ProfileLoader] LoadBvhWithRootTransform\n - profileBvhPath is null or empty");
}
int version;
ProfileBVH profileBVH = this.LoadProfileBVHData(path, out version);
if (profileBVH == null || profileBVH.vertices == null || profileBVH.datas == null || profileBVH.nodes == null || profileBVH.dataIndices == 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;
int num = profileBVH.datas.Length;
BvhTriangleMesh bvhTriangleMesh = new BvhTriangleMesh
{
triangles = new BvhTriangle[num],
triIndices = new int[profileBVH.dataIndices.Length],
nodes = new BvhNode[profileBVH.nodes.Length]
};
for (int i = 0; i < num; i++)
{
profileBVHData profileBVHData2 = profileBVH.datas[i];
Vector3 point = profileBVH.vertices[profileBVHData2.verA];
Vector3 point2 = profileBVH.vertices[profileBVHData2.verB];
Vector3 point3 = profileBVH.vertices[profileBVHData2.verC];
Vector3 a = localToWorldMatrix.MultiplyPoint3x4(point);
Vector3 b = localToWorldMatrix.MultiplyPoint3x4(point2);
Vector3 c = localToWorldMatrix.MultiplyPoint3x4(point3);
Vector3 normal = this.ComputeTriangleNormal(a, b, c);
bvhTriangleMesh.triangles[i] = new BvhTriangle
{
a = a,
b = b,
c = c,
normal = normal,
mainHumanBone = HumanBodyBones.LastBone
};
}
Array.Copy(profileBVH.dataIndices, bvhTriangleMesh.triIndices, profileBVH.dataIndices.Length);
for (int j = 0; j < profileBVH.nodes.Length; j++)
{
profileBVHNode profileBVHNode2 = profileBVH.nodes[j];
bvhTriangleMesh.nodes[j] = new BvhNode
{
isLeaf = profileBVHNode2.isLeaf,
leftChild = profileBVHNode2.leftChild,
rightChild = profileBVHNode2.rightChild,
start = profileBVHNode2.start,
count = profileBVHNode2.count,
bounds = this.TransformBoundsToWorldAABB(localToWorldMatrix, profileBVHNode2.bounds)
};
}
return bvhTriangleMesh;
}
private ProfileBVH LoadProfileBVHData(string path, out int version)
{
version = 0;
int num = 0;
if (!File.Exists(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);
int num2 = 0;
ProfileUtils profileUtils = new ProfileUtils();
string profileMagic = profileUtils.GetProfileMagic();
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");
}
num2 += profileMagic.Length;
version = this.ReadHexIntSafe(text, ref num2);
num = this.ReadHexIntSafe(text, ref num2);
int num3 = this.ReadHexIntSafe(text, ref num2);
int num4 = this.ReadHexIntSafe(text, ref num2);
int num5 = this.ReadHexIntSafe(text, ref num2);
int num6 = this.ReadHexIntSafe(text, ref num2);
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");
}
Vector3[] array = new Vector3[num3];
for (int i = 0; i < num3; i++)
{
array[i] = this.ReadHexVec3Safe(text, ref num2);
}
int version2;
int countInFile;
BaseKey3[] array2 = new ProfileUtils_VertexUtil().LoadTable(profileUtils.GetBaseDataPath(), out version2, out countInFile);
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");
}
ProfileUtil_IndexUtil profileUtil_IndexUtil = new ProfileUtil_IndexUtil();
profileUtil_IndexUtil.Build(num);
Vector3[] array3 = new Vector3[num3];
profileUtil_IndexUtil.DecodeInto(array, array3);
Vector3[] array4 = new Vector3[num3];
for (int j = 0; j < num3; j++)
{
array4[j] = this.TransformVec3(array3[j], array2[j % array2.Length]);
}
ProfileBVH profileBVH = new ProfileBVH
{
vertices = new List<Vector3>(num3),
datas = new profileBVHData[num4],
nodes = new profileBVHNode[num5],
dataIndices = new int[num6]
};
profileBVH.vertices.AddRange(array4);
for (int k = 0; k < num4; k++)
{
profileBVH.datas[k] = new profileBVHData
{
verA = this.ReadHexIntSafe(text, ref num2),
verB = this.ReadHexIntSafe(text, ref num2),
verC = this.ReadHexIntSafe(text, ref num2)
};
}
for (int l = 0; l < num5; l++)
{
Vector3 center = this.ReadHexVec3Safe(text, ref num2);
Vector3 vector = this.ReadHexVec3Safe(text, ref num2);
profileBVH.nodes[l] = new profileBVHNode
{
bounds = new Bounds(center, vector * 2f),
leftChild = this.ReadHexIntSafe(text, ref num2),
rightChild = this.ReadHexIntSafe(text, ref num2),
start = this.ReadHexIntSafe(text, ref num2),
count = this.ReadHexIntSafe(text, ref num2),
isLeaf = (num2 < text.Length && text[num2++] == '1')
};
}
for (int m = 0; m < num6; m++)
{
profileBVH.dataIndices[m] = this.ReadHexIntSafe(text, ref num2);
}
return profileBVH;
}
private int ReadHexIntSafe(string s, ref int p)
{
if (p + 8 > s.Length)
{
p = s.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);
p += 8;
return (int)result;
}
private Vector3 ReadHexVec3Safe(string s, ref int 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)
{
if (p + 8 > s.Length)
{
p = s.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);
p += 8;
return BitConverter.Int32BitsToSingle((int)value);
}
private Vector3 TransformVec3(Vector3 v, BaseKey3 k)
{
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)
{
return BitConverter.Int32BitsToSingle(BitConverter.SingleToInt32Bits(a) ^ (int)keyBits);
}
private Vector3 ComputeTriangleNormal(Vector3 a, Vector3 b, Vector3 c)
{
Vector3 vector = Vector3.Cross(b - a, c - a);
float magnitude = vector.magnitude;
if (magnitude > 1E-08f)
{
return vector / magnitude;
}
return Vector3.up;
}
private Bounds TransformBoundsToWorldAABB(Matrix4x4 l2w, Bounds localBounds)
{
Vector3 center = localBounds.center;
Vector3 extents = localBounds.extents;
Vector3 vector = l2w.MultiplyPoint3x4(center + new Vector3(0f - extents.x, 0f - extents.y, 0f - extents.z));
Vector3 p = l2w.MultiplyPoint3x4(center + new Vector3(0f - extents.x, 0f - extents.y, extents.z));
Vector3 p2 = l2w.MultiplyPoint3x4(center + new Vector3(0f - extents.x, extents.y, 0f - extents.z));
Vector3 p3 = l2w.MultiplyPoint3x4(center + new Vector3(0f - extents.x, extents.y, extents.z));
Vector3 p4 = l2w.MultiplyPoint3x4(center + new Vector3(extents.x, 0f - extents.y, 0f - extents.z));
Vector3 p5 = l2w.MultiplyPoint3x4(center + new Vector3(extents.x, 0f - extents.y, extents.z));
Vector3 p6 = l2w.MultiplyPoint3x4(center + new Vector3(extents.x, extents.y, 0f - extents.z));
Vector3 p7 = l2w.MultiplyPoint3x4(center + new Vector3(extents.x, extents.y, extents.z));
Vector3 min = vector;
Vector3 max = vector;
this.Encapsulate(ref min, ref max, p);
this.Encapsulate(ref min, ref max, p2);
this.Encapsulate(ref min, ref max, p3);
this.Encapsulate(ref min, ref max, p4);
this.Encapsulate(ref min, ref max, p5);
this.Encapsulate(ref min, ref max, p6);
this.Encapsulate(ref min, ref max, p7);
return new Bounds((min + max) * 0.5f, max - min);
}
private void Encapsulate(ref Vector3 min, ref Vector3 max, Vector3 p)
{
min = Vector3.Min(min, p);
max = Vector3.Max(max, p);
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 28844442e65718447b17317ed2155ea6

View File

@@ -19,20 +19,11 @@ public class ProfilePoseMatchUtil
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) if (targetAvatar == null)
//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_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_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_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)
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 (targetAvatar.GetComponent<Animator>() == 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");
} }
@@ -40,7 +31,7 @@ public class ProfilePoseMatchUtil
{ {
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 (targetCloth == 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");
} }
@@ -55,9 +46,9 @@ public class ProfilePoseMatchUtil
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(null, worldPositionStays: true);
Transform parent2 = transform2.parent; Transform parent2 = transform2.parent;
transform2.SetParent((Transform)null, true); transform2.SetParent(null, worldPositionStays: true);
transform2.position = transform.position; transform2.position = transform.position;
Dictionary<HumanBodyBones, HashSet<Transform>> dictionary = this.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)
@@ -66,7 +57,7 @@ public class ProfilePoseMatchUtil
} }
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($"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>();
@@ -81,7 +72,7 @@ public class ProfilePoseMatchUtil
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, worldPositionStays: true);
transform2.SetParent(parent2, true); transform2.SetParent(parent2, worldPositionStays: true);
} }
} }

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: a0ba475a2b0c45145b7cf6306c6bddf7

View File

@@ -1,2 +1,2 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 38753bd14c0b09949b739c6a386161e6 guid: f15328957f9a0184783cda194c88bc85

View File

@@ -8,51 +8,6 @@ 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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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)
if (smr == null || bindMesh == null) if (smr == null || bindMesh == null)
{ {
return Vector3.zero; return Vector3.zero;
@@ -62,140 +17,81 @@ public class SkinningUtil
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 smr.transform.InverseTransformPoint(targetWorld);
} }
if (vertexIndex < 0 || vertexIndex >= boneWeights.Length) if (vertexIndex < 0 || vertexIndex >= boneWeights.Length)
{ {
return ((Component)smr).transform.InverseTransformPoint(targetWorld); return smr.transform.InverseTransformPoint(targetWorld);
} }
if (bindposes.Length != bones.Length) if (bindposes.Length != bones.Length)
{ {
return ((Component)smr).transform.InverseTransformPoint(targetWorld); return smr.transform.InverseTransformPoint(targetWorld);
} }
BoneWeight val = boneWeights[vertexIndex]; BoneWeight boneWeight = boneWeights[vertexIndex];
bool flag = val.boneIndex0 >= 0 && val.boneIndex0 < bones.Length && bones[val.boneIndex0] != null && val.weight0 > 0f; bool flag = boneWeight.boneIndex0 >= 0 && boneWeight.boneIndex0 < bones.Length && bones[boneWeight.boneIndex0] != null && boneWeight.weight0 > 0f;
bool flag2 = val.boneIndex1 >= 0 && val.boneIndex1 < bones.Length && bones[val.boneIndex1] != null && val.weight1 > 0f; bool flag2 = boneWeight.boneIndex1 >= 0 && boneWeight.boneIndex1 < bones.Length && bones[boneWeight.boneIndex1] != null && boneWeight.weight1 > 0f;
bool flag3 = val.boneIndex2 >= 0 && val.boneIndex2 < bones.Length && bones[val.boneIndex2] != null && val.weight2 > 0f; bool flag3 = boneWeight.boneIndex2 >= 0 && boneWeight.boneIndex2 < bones.Length && bones[boneWeight.boneIndex2] != null && boneWeight.weight2 > 0f;
bool num = val.boneIndex3 >= 0 && val.boneIndex3 < bones.Length && bones[val.boneIndex3] != null && val.weight3 > 0f; bool num = boneWeight.boneIndex3 >= 0 && boneWeight.boneIndex3 < bones.Length && bones[boneWeight.boneIndex3] != null && boneWeight.weight3 > 0f;
float num2 = (flag ? val.weight0 : 0f); float num2 = (flag ? boneWeight.weight0 : 0f);
float num3 = (flag2 ? val.weight1 : 0f); float num3 = (flag2 ? boneWeight.weight1 : 0f);
float num4 = (flag3 ? val.weight2 : 0f); float num4 = (flag3 ? boneWeight.weight2 : 0f);
float num5 = (num ? val.weight3 : 0f); float num5 = (num ? boneWeight.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 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 vector = smr.transform.InverseTransformPoint(targetWorld);
Matrix4x4 objWorldInv = ((Component)smr).transform.worldToLocalMatrix; Matrix4x4 objWorldInv = smr.transform.worldToLocalMatrix;
Matrix4x4 acc = Matrix4x4.zero; Matrix4x4 acc = Matrix4x4.zero;
if (num2 > 0f) if (num2 > 0f)
{ {
Acc(ref acc, val.boneIndex0, num2); Acc(ref acc, boneWeight.boneIndex0, num2);
} }
if (num3 > 0f) if (num3 > 0f)
{ {
Acc(ref acc, val.boneIndex1, num3); Acc(ref acc, boneWeight.boneIndex1, num3);
} }
if (num4 > 0f) if (num4 > 0f)
{ {
Acc(ref acc, val.boneIndex2, num4); Acc(ref acc, boneWeight.boneIndex2, num4);
} }
if (num5 > 0f) if (num5 > 0f)
{ {
Acc(ref acc, val.boneIndex3, num5); Acc(ref acc, boneWeight.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 vector;
} }
acc.m33 = 1f; acc.m33 = 1f;
Matrix4x4 val3 = Matrix4x4.Inverse(acc); Vector3 vector2 = Matrix4x4.Inverse(acc).MultiplyPoint3x4(vector);
Vector3 val4 = val3.MultiplyPoint3x4(val2); Debug.Log($"Diff{smr.transform.TransformPoint(vector2) - targetWorld}");
Debug.Log($"Diff{((Component)smr).transform.TransformPoint(val4) - targetWorld}"); return vector2;
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_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_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_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_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_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_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_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)
if (!(w <= 0f)) if (!(w <= 0f))
{ {
Matrix4x4 val5 = objWorldInv * bones[boneIndex].localToWorldMatrix * bindposes[boneIndex]; Matrix4x4 matrix4x = objWorldInv * bones[boneIndex].localToWorldMatrix * bindposes[boneIndex];
reference.m00 += val5.m00 * w; reference.m00 += matrix4x.m00 * w;
reference.m01 += val5.m01 * w; reference.m01 += matrix4x.m01 * w;
reference.m02 += val5.m02 * w; reference.m02 += matrix4x.m02 * w;
reference.m10 += val5.m10 * w; reference.m10 += matrix4x.m10 * w;
reference.m11 += val5.m11 * w; reference.m11 += matrix4x.m11 * w;
reference.m12 += val5.m12 * w; reference.m12 += matrix4x.m12 * w;
reference.m20 += val5.m20 * w; reference.m20 += matrix4x.m20 * w;
reference.m21 += val5.m21 * w; reference.m21 += matrix4x.m21 * w;
reference.m22 += val5.m22 * w; reference.m22 += matrix4x.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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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)
if (smr == null || bindMesh == null) if (smr == null || bindMesh == null)
{ {
return Vector3.zero; return Vector3.zero;
@@ -205,27 +101,27 @@ public class SkinningUtil
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 smr.transform.InverseTransformPoint(targetWorld);
} }
if (vertexIndex < 0 || vertexIndex >= boneWeights.Length) if (vertexIndex < 0 || vertexIndex >= boneWeights.Length)
{ {
return ((Component)smr).transform.InverseTransformPoint(targetWorld); return smr.transform.InverseTransformPoint(targetWorld);
} }
if (bindposes.Length != bones.Length) if (bindposes.Length != bones.Length)
{ {
return ((Component)smr).transform.InverseTransformPoint(targetWorld); return smr.transform.InverseTransformPoint(targetWorld);
} }
BoneWeight val = boneWeights[vertexIndex]; BoneWeight boneWeight = boneWeights[vertexIndex];
float[] array = new float[4]; float[] array = new float[4];
int[] array2 = new int[4]; int[] array2 = new int[4];
array[0] = val.weight0; array[0] = boneWeight.weight0;
array2[0] = val.boneIndex0; array2[0] = boneWeight.boneIndex0;
array[1] = val.weight1; array[1] = boneWeight.weight1;
array2[1] = val.boneIndex1; array2[1] = boneWeight.boneIndex1;
array[2] = val.weight2; array[2] = boneWeight.weight2;
array2[2] = val.boneIndex2; array2[2] = boneWeight.boneIndex2;
array[3] = val.weight3; array[3] = boneWeight.weight3;
array2[3] = val.boneIndex3; array2[3] = boneWeight.boneIndex3;
float num = 0f; float num = 0f;
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
{ {
@@ -236,15 +132,15 @@ public class SkinningUtil
} }
if (num < 1E-08f) if (num < 1E-08f)
{ {
return ((Component)smr).transform.InverseTransformPoint(targetWorld); return 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 = smr.transform.InverseTransformPoint(targetWorld); Vector3 result = smr.transform.InverseTransformPoint(targetWorld);
Vector4 val3 = new Vector4(val2.x, val2.y, val2.z, 1f); Vector4 vector = new Vector4(result.x, result.y, result.z, 1f);
Matrix4x4 objWorldInv = ((Component)smr).transform.worldToLocalMatrix; Matrix4x4 objWorldInv = 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++)
{ {
@@ -255,93 +151,36 @@ public class SkinningUtil
} }
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 result;
} }
Matrix4x4 val4 = Matrix4x4.Inverse(acc); return Matrix4x4.Inverse(acc).MultiplyPoint3x4(vector);
return val4.MultiplyPoint3x4((Vector4)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_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_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_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_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_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_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_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_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_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_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_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 matrix4x = objWorldInv * bones[bi].localToWorldMatrix * bindposes[bi];
reference.m00 += val5.m00 * w; reference.m00 += matrix4x.m00 * w;
reference.m01 += val5.m01 * w; reference.m01 += matrix4x.m01 * w;
reference.m02 += val5.m02 * w; reference.m02 += matrix4x.m02 * w;
reference.m03 += val5.m03 * w; reference.m03 += matrix4x.m03 * w;
reference.m10 += val5.m10 * w; reference.m10 += matrix4x.m10 * w;
reference.m11 += val5.m11 * w; reference.m11 += matrix4x.m11 * w;
reference.m12 += val5.m12 * w; reference.m12 += matrix4x.m12 * w;
reference.m13 += val5.m13 * w; reference.m13 += matrix4x.m13 * w;
reference.m20 += val5.m20 * w; reference.m20 += matrix4x.m20 * w;
reference.m21 += val5.m21 * w; reference.m21 += matrix4x.m21 * w;
reference.m22 += val5.m22 * w; reference.m22 += matrix4x.m22 * w;
reference.m23 += val5.m23 * w; reference.m23 += matrix4x.m23 * w;
reference.m30 += val5.m30 * w; reference.m30 += matrix4x.m30 * w;
reference.m31 += val5.m31 * w; reference.m31 += matrix4x.m31 * w;
reference.m32 += val5.m32 * w; reference.m32 += matrix4x.m32 * w;
reference.m33 += val5.m33 * w; reference.m33 += matrix4x.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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_0245: Unknown result type (might be due to invalid IL or missing references)
if (smr == null || bindMesh == null) if (smr == null || bindMesh == null)
{ {
return Vector3.zero; return Vector3.zero;
@@ -349,33 +188,29 @@ public class SkinningUtil
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;
if (boneWeights == null || bindposes == null || bones == null) if (boneWeights == null || bindposes == null || bones == null)
{ {
val = ((Component)smr).transform.InverseTransformDirection(targetWorldDir); return smr.transform.InverseTransformDirection(targetWorldDir).normalized;
return val.normalized;
} }
if (vertexIndex < 0 || vertexIndex >= boneWeights.Length) if (vertexIndex < 0 || vertexIndex >= boneWeights.Length)
{ {
val = ((Component)smr).transform.InverseTransformDirection(targetWorldDir); return smr.transform.InverseTransformDirection(targetWorldDir).normalized;
return val.normalized;
} }
if (bindposes.Length != bones.Length) if (bindposes.Length != bones.Length)
{ {
val = ((Component)smr).transform.InverseTransformDirection(targetWorldDir); return smr.transform.InverseTransformDirection(targetWorldDir).normalized;
return val.normalized;
} }
BoneWeight val2 = boneWeights[vertexIndex]; BoneWeight boneWeight = boneWeights[vertexIndex];
float[] array = new float[4]; float[] array = new float[4];
int[] array2 = new int[4]; int[] array2 = new int[4];
array[0] = val2.weight0; array[0] = boneWeight.weight0;
array2[0] = val2.boneIndex0; array2[0] = boneWeight.boneIndex0;
array[1] = val2.weight1; array[1] = boneWeight.weight1;
array2[1] = val2.boneIndex1; array2[1] = boneWeight.boneIndex1;
array[2] = val2.weight2; array[2] = boneWeight.weight2;
array2[2] = val2.boneIndex2; array2[2] = boneWeight.boneIndex2;
array[3] = val2.weight3; array[3] = boneWeight.weight3;
array2[3] = val2.boneIndex3; array2[3] = boneWeight.boneIndex3;
float num = 0f; float num = 0f;
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
{ {
@@ -386,19 +221,18 @@ public class SkinningUtil
} }
if (num < 1E-08f) if (num < 1E-08f)
{ {
val = ((Component)smr).transform.InverseTransformDirection(targetWorldDir); return smr.transform.InverseTransformDirection(targetWorldDir).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 vector = smr.transform.InverseTransformDirection(targetWorldDir);
if (val3.sqrMagnitude < 1E-12f) if (vector.sqrMagnitude < 1E-12f)
{ {
return Vector3.up; return Vector3.up;
} }
Matrix4x4 objWorldInv = ((Component)smr).transform.worldToLocalMatrix; Matrix4x4 objWorldInv = 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++)
{ {
@@ -407,56 +241,33 @@ public class SkinningUtil
Accumulate(ref acc, array2[k], array[k]); Accumulate(ref acc, array2[k], array[k]);
} }
} }
Matrix4x4 transpose = acc.transpose; Vector3 vector2 = acc.transpose.MultiplyVector(vector);
Vector3 val4 = transpose.MultiplyVector(val3); if (vector2.sqrMagnitude < 1E-12f)
if (val4.sqrMagnitude < 1E-12f)
{ {
return val3.normalized; return vector.normalized;
} }
return val4.normalized; return vector2.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_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_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_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_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_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_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_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_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_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_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_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 matrix4x = objWorldInv * bones[bi].localToWorldMatrix * bindposes[bi];
reference.m00 += val5.m00 * w; reference.m00 += matrix4x.m00 * w;
reference.m01 += val5.m01 * w; reference.m01 += matrix4x.m01 * w;
reference.m02 += val5.m02 * w; reference.m02 += matrix4x.m02 * w;
reference.m03 += val5.m03 * w; reference.m03 += matrix4x.m03 * w;
reference.m10 += val5.m10 * w; reference.m10 += matrix4x.m10 * w;
reference.m11 += val5.m11 * w; reference.m11 += matrix4x.m11 * w;
reference.m12 += val5.m12 * w; reference.m12 += matrix4x.m12 * w;
reference.m13 += val5.m13 * w; reference.m13 += matrix4x.m13 * w;
reference.m20 += val5.m20 * w; reference.m20 += matrix4x.m20 * w;
reference.m21 += val5.m21 * w; reference.m21 += matrix4x.m21 * w;
reference.m22 += val5.m22 * w; reference.m22 += matrix4x.m22 * w;
reference.m23 += val5.m23 * w; reference.m23 += matrix4x.m23 * w;
reference.m30 += val5.m30 * w; reference.m30 += matrix4x.m30 * w;
reference.m31 += val5.m31 * w; reference.m31 += matrix4x.m31 * w;
reference.m32 += val5.m32 * w; reference.m32 += matrix4x.m32 * w;
reference.m33 += val5.m33 * w; reference.m33 += matrix4x.m33 * w;
} }
} }
} }

View File

@@ -1,2 +1,2 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 2ab752a64b8a60b408a43d8e90e52123 guid: c723a3f7b3bf302429eb5f6b80030ed2

View File

@@ -1,2 +1,2 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 87c4265006020574d9a04594d52dc1af guid: 9f6f7aa7d54dbcc409c4af15cf457d7b

View File

@@ -22,36 +22,20 @@ public class TransformInfo
public TransformInfo(Transform t) public TransformInfo(Transform t)
{ {
//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_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_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_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_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)
this.parentTransform = t.parent; this.parentTransform = t.parent;
this.position = t.position; this.position = t.position;
this.localPosition = t.localPosition; this.localPosition = t.localPosition;
this.rotation = t.rotation; this.rotation = t.rotation;
this.localRotation = t.localRotation; this.localRotation = t.localRotation;
this.localScale = t.localScale; this.localScale = t.localScale;
this.name = ((Object)t).name; this.name = 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_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_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_0035: Unknown result type (might be due to invalid IL or missing references)
if (applyParent) if (applyParent)
{ {
t.SetParent(this.parentTransform, true); t.SetParent(this.parentTransform, worldPositionStays: true);
if (applyPosition) if (applyPosition)
{ {
t.localPosition = this.localPosition; t.localPosition = this.localPosition;
@@ -82,7 +66,7 @@ public class TransformInfo
} }
if (applyName) if (applyName)
{ {
((Object)t).name = this.name; t.name = this.name;
} }
} }
} }

View File

@@ -1,2 +1,2 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: a05f15886e661c74686318b7e00ec174 guid: 076524bdea516c44384a07cc7c600c74

View File

@@ -8,74 +8,18 @@ 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) Vector3 vector = b - a;
//IL_0001: Unknown result type (might be due to invalid IL or missing references) Vector3 vector2 = c - a;
//IL_0002: Unknown result type (might be due to invalid IL or missing references) Vector3 rhs = p - a;
//IL_0007: Unknown result type (might be due to invalid IL or missing references) float num = Vector3.Dot(vector, rhs);
//IL_0008: Unknown result type (might be due to invalid IL or missing references) float num2 = Vector3.Dot(vector2, rhs);
//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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_0169: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = b - a;
Vector3 val2 = c - a;
Vector3 val3 = p - a;
float num = Vector3.Dot(val, 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 rhs2 = p - b;
float num3 = Vector3.Dot(val, val4); float num3 = Vector3.Dot(vector, rhs2);
float num4 = Vector3.Dot(val2, val4); float num4 = Vector3.Dot(vector2, rhs2);
if (num3 >= 0f && num4 <= num3) if (num3 >= 0f && num4 <= num3)
{ {
return b; return b;
@@ -84,11 +28,11 @@ public class TriangleUtil
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 * vector;
} }
Vector3 val5 = p - c; Vector3 rhs3 = p - c;
float num7 = Vector3.Dot(val, val5); float num7 = Vector3.Dot(vector, rhs3);
float num8 = Vector3.Dot(val2, val5); float num8 = Vector3.Dot(vector2, rhs3);
if (num8 >= 0f && num7 <= num8) if (num8 >= 0f && num7 <= num8)
{ {
return c; return c;
@@ -97,7 +41,7 @@ public class TriangleUtil
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 * vector2;
} }
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)
@@ -108,6 +52,6 @@ public class TriangleUtil
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 + vector * num14 + vector2 * num15;
} }
} }

View File

@@ -1,2 +1,2 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: ed297cb26c6110d48bd8cda0add7dc85 guid: f0f259ffb91dc6e4387819375a0d8353

View File

@@ -4,6 +4,7 @@
// Eden.AutoMorpher.VertexFittingUtil // Eden.AutoMorpher.VertexFittingUtil
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using Eden.AutoMorpher;
using UnityEngine; using UnityEngine;
public class VertexFittingUtil public class VertexFittingUtil
@@ -17,23 +18,6 @@ public class VertexFittingUtil
public void ExpandClothes_World_Test(List<ClothInstance> clothInstances, MeshMatcher meshMatcher, EdenAutoMorpherConfig config, ClothInstanceTotal clothInstanceTotal) public void ExpandClothes_World_Test(List<ClothInstance> clothInstances, MeshMatcher meshMatcher, EdenAutoMorpherConfig config, ClothInstanceTotal clothInstanceTotal)
{ {
//IL_0122: Unknown result type (might be due to invalid IL or missing references)
//IL_0130: 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_0148: 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_0181: Unknown result type (might be due to invalid IL or missing references)
//IL_0186: 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_019f: Unknown result type (might be due to invalid IL or missing references)
//IL_01a4: 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_01bc: Unknown result type (might be due to invalid IL or missing references)
//IL_01c6: 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_01e2: Unknown result type (might be due to invalid IL or missing references)
//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
using (AutoMorpherDev.Profile("[Expand] BVH Mesh Matching time")) using (AutoMorpherDev.Profile("[Expand] BVH Mesh Matching time"))
{ {
foreach (ClothInstance clothInstance in clothInstances) foreach (ClothInstance clothInstance in clothInstances)
@@ -47,7 +31,7 @@ public class VertexFittingUtil
} }
Vector3[] deltas = clothInstanceTotal.GlobalDeltas; Vector3[] deltas = clothInstanceTotal.GlobalDeltas;
clothInstanceTotal.UpdateGlobalBuffersFromClothInstances(); clothInstanceTotal.UpdateGlobalBuffersFromClothInstances();
this.SmoothDeltasByDistance(clothInstanceTotal.GlobalPositions, ref deltas, clothInstanceTotal.GlobalAdjacencyMerged, config.worldRadius, 1, config.smoothingIteration, 0.5f, config.sigma); SmoothDeltasByDistance(clothInstanceTotal.GlobalPositions, ref deltas, clothInstanceTotal.GlobalAdjacencyMerged, config.worldRadius, 1, config.smoothingIteration, 0.5f, config.sigma);
clothInstanceTotal.SetGlobalDeltas(deltas); clothInstanceTotal.SetGlobalDeltas(deltas);
clothInstanceTotal.ApplyGlobalDeltasToClothInstances(); clothInstanceTotal.ApplyGlobalDeltasToClothInstances();
foreach (ClothInstance clothInstance3 in clothInstances) foreach (ClothInstance clothInstance3 in clothInstances)
@@ -56,22 +40,21 @@ public class VertexFittingUtil
{ {
if (!clothInstance3.excludedVertices[i] || !clothInstance3.isInsideVertex[i]) if (!clothInstance3.excludedVertices[i] || !clothInstance3.isInsideVertex[i])
{ {
ref Vector3 reference = ref clothInstance3.worldVertices[i]; clothInstance3.worldVertices[i] += clothInstance3.deltasLocal[i];
reference += clothInstance3.deltasLocal[i];
} }
clothInstance3.deltasLocal[i] = Vector3.zero; clothInstance3.deltasLocal[i] = Vector3.zero;
} }
foreach (List<int> equivalentVertex in clothInstance3.equivalentVertices) foreach (List<int> equivalentVertex in clothInstance3.equivalentVertices)
{ {
Vector3 val = Vector3.zero; Vector3 zero = Vector3.zero;
for (int j = 0; j < equivalentVertex.Count; j++) for (int j = 0; j < equivalentVertex.Count; j++)
{ {
val += clothInstance3.worldVertices[equivalentVertex[j]]; zero += clothInstance3.worldVertices[equivalentVertex[j]];
} }
val /= (float)equivalentVertex.Count; zero /= (float)equivalentVertex.Count;
for (int k = 0; k < equivalentVertex.Count; k++) for (int k = 0; k < equivalentVertex.Count; k++)
{ {
clothInstance3.worldVertices[equivalentVertex[k]] = val; clothInstance3.worldVertices[equivalentVertex[k]] = zero;
} }
} }
} }
@@ -79,23 +62,6 @@ public class VertexFittingUtil
public void ShrinkClothes_World_Test(List<ClothInstance> clothInstances, MeshMatcher meshMatcher, EdenAutoMorpherConfig config, ClothInstanceTotal clothInstanceTotal) public void ShrinkClothes_World_Test(List<ClothInstance> clothInstances, MeshMatcher meshMatcher, EdenAutoMorpherConfig config, ClothInstanceTotal clothInstanceTotal)
{ {
//IL_013b: 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_0153: Unknown result type (might be due to invalid IL or missing references)
//IL_0161: Unknown result type (might be due to invalid IL or missing references)
//IL_0166: Unknown result type (might be due to invalid IL or missing references)
//IL_019a: 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_01a6: Unknown result type (might be due to invalid IL or missing references)
//IL_01b8: 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_01c2: 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_01df: Unknown result type (might be due to invalid IL or missing references)
//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
using (AutoMorpherDev.Profile("[Expand] BVH Mesh Matching time")) using (AutoMorpherDev.Profile("[Expand] BVH Mesh Matching time"))
{ {
foreach (ClothInstance clothInstance in clothInstances) foreach (ClothInstance clothInstance in clothInstances)
@@ -109,32 +75,31 @@ public class VertexFittingUtil
} }
Vector3[] deltas = clothInstanceTotal.GlobalDeltas; Vector3[] deltas = clothInstanceTotal.GlobalDeltas;
clothInstanceTotal.UpdateGlobalBuffersFromClothInstances(); clothInstanceTotal.UpdateGlobalBuffersFromClothInstances();
this.SmoothDeltasByDistance(clothInstanceTotal.GlobalPositions, ref deltas, clothInstanceTotal.GlobalAdjacencyMerged, config.worldRadius, 3, config.smoothingIteration, 0.5f, config.sigma); SmoothDeltasByDistance(clothInstanceTotal.GlobalPositions, ref deltas, clothInstanceTotal.GlobalAdjacencyMerged, config.worldRadius, 3, config.smoothingIteration, 0.5f, config.sigma);
clothInstanceTotal.SetGlobalDeltas(deltas); clothInstanceTotal.SetGlobalDeltas(deltas);
clothInstanceTotal.ApplyGlobalDeltasToClothInstances(); clothInstanceTotal.ApplyGlobalDeltasToClothInstances();
this.SmoothAllClothesDeltasByDistance(clothInstances, config.worldRadius, config.smoothingIteration, config.sigma); SmoothAllClothesDeltasByDistance(clothInstances, config.worldRadius, config.smoothingIteration, config.sigma);
foreach (ClothInstance clothInstance3 in clothInstances) foreach (ClothInstance clothInstance3 in clothInstances)
{ {
for (int i = 0; i < clothInstance3.worldVertices.Length; i++) for (int i = 0; i < clothInstance3.worldVertices.Length; i++)
{ {
if (!clothInstance3.excludedVertices[i] || !clothInstance3.isInsideVertex[i]) if (!clothInstance3.excludedVertices[i] || !clothInstance3.isInsideVertex[i])
{ {
ref Vector3 reference = ref clothInstance3.worldVertices[i]; clothInstance3.worldVertices[i] += clothInstance3.deltasLocal[i];
reference += clothInstance3.deltasLocal[i];
} }
clothInstance3.deltasLocal[i] = Vector3.zero; clothInstance3.deltasLocal[i] = Vector3.zero;
} }
foreach (List<int> equivalentVertex in clothInstance3.equivalentVertices) foreach (List<int> equivalentVertex in clothInstance3.equivalentVertices)
{ {
Vector3 val = Vector3.zero; Vector3 zero = Vector3.zero;
for (int j = 0; j < equivalentVertex.Count; j++) for (int j = 0; j < equivalentVertex.Count; j++)
{ {
val += clothInstance3.worldVertices[equivalentVertex[j]]; zero += clothInstance3.worldVertices[equivalentVertex[j]];
} }
val /= (float)equivalentVertex.Count; zero /= (float)equivalentVertex.Count;
for (int k = 0; k < equivalentVertex.Count; k++) for (int k = 0; k < equivalentVertex.Count; k++)
{ {
clothInstance3.worldVertices[equivalentVertex[k]] = val; clothInstance3.worldVertices[equivalentVertex[k]] = zero;
} }
} }
} }
@@ -142,43 +107,9 @@ public class VertexFittingUtil
public void ExpandClothes_World(ClothInstance clothInstance, List<ClothInstance> clothInstances, MeshMatcher meshMatcher, EdenAutoMorpherConfig config, float fittingRadius) public void ExpandClothes_World(ClothInstance clothInstance, List<ClothInstance> clothInstances, MeshMatcher meshMatcher, EdenAutoMorpherConfig config, float fittingRadius)
{ {
//IL_020c: 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_01d0: Unknown result type (might be due to invalid IL or missing references)
//IL_044b: Unknown result type (might be due to invalid IL or missing references)
//IL_0450: Unknown result type (might be due to invalid IL or missing references)
//IL_0425: Unknown result type (might be due to invalid IL or missing references)
//IL_0433: Unknown result type (might be due to invalid IL or missing references)
//IL_0438: Unknown result type (might be due to invalid IL or missing references)
//IL_043d: Unknown result type (might be due to invalid IL or missing references)
//IL_0246: 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_0265: 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_0278: Unknown result type (might be due to invalid IL or missing references)
//IL_0484: Unknown result type (might be due to invalid IL or missing references)
//IL_0489: Unknown result type (might be due to invalid IL or missing references)
//IL_0490: Unknown result type (might be due to invalid IL or missing references)
//IL_04a2: Unknown result type (might be due to invalid IL or missing references)
//IL_04a7: Unknown result type (might be due to invalid IL or missing references)
//IL_04ac: Unknown result type (might be due to invalid IL or missing references)
//IL_04bf: Unknown result type (might be due to invalid IL or missing references)
//IL_04c9: Unknown result type (might be due to invalid IL or missing references)
//IL_04ce: Unknown result type (might be due to invalid IL or missing references)
//IL_04e5: Unknown result type (might be due to invalid IL or missing references)
//IL_04e7: Unknown result type (might be due to invalid IL or missing references)
//IL_02eb: Unknown result type (might be due to invalid IL or missing references)
//IL_0313: Unknown result type (might be due to invalid IL or missing references)
//IL_032c: Unknown result type (might be due to invalid IL or missing references)
//IL_0331: Unknown result type (might be due to invalid IL or missing references)
//IL_034c: Unknown result type (might be due to invalid IL or missing references)
//IL_0355: 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_035f: Unknown result type (might be due to invalid IL or missing references)
if (AutoMorpherDev.isDeveloperMode) if (AutoMorpherDev.isDeveloperMode)
{ {
UnityEngine.Debug.Log((object)("[Expand] Start " + ((Object)((Component)clothInstance.smr).gameObject).name + "//===============================================================================================================")); UnityEngine.Debug.Log("[Expand] Start " + clothInstance.smr.gameObject.name + "//===============================================================================================================");
} }
Stopwatch stopwatch = (AutoMorpherDev.isDeveloperMode ? Stopwatch.StartNew() : null); Stopwatch stopwatch = (AutoMorpherDev.isDeveloperMode ? Stopwatch.StartNew() : null);
Stopwatch.StartNew(); Stopwatch.StartNew();
@@ -189,19 +120,19 @@ public class VertexFittingUtil
List<int> list = null; List<int> list = null;
using (AutoMorpherDev.Profile("[Expand] Select Anchors time")) using (AutoMorpherDev.Profile("[Expand] Select Anchors time"))
{ {
list = this.SelectAnchors(clothInstance, fittingRadius); list = SelectAnchors(clothInstance, fittingRadius);
} }
if (AutoMorpherDev.isDeveloperMode) if (AutoMorpherDev.isDeveloperMode)
{ {
UnityEngine.Debug.Log((object)$"[Expand] Anchor Count {list.Count}"); UnityEngine.Debug.Log($"[Expand] Anchor Count {list.Count}");
} }
if (list.Count == 0) if (list.Count == 0)
{ {
if (AutoMorpherDev.isDeveloperMode) if (AutoMorpherDev.isDeveloperMode)
{ {
stopwatch.Stop(); stopwatch.Stop();
UnityEngine.Debug.Log((object)$"[Expand] TOTAL ShrinkClothes time: {stopwatch.ElapsedMilliseconds} ms"); UnityEngine.Debug.Log($"[Expand] TOTAL ShrinkClothes time: {stopwatch.ElapsedMilliseconds} ms");
UnityEngine.Debug.Log((object)("[Expand] End " + ((Object)((Component)clothInstance.smr).gameObject).name + "//===============================================================================================================")); UnityEngine.Debug.Log("[Expand] End " + clothInstance.smr.gameObject.name + "//===============================================================================================================");
} }
return; return;
} }
@@ -218,8 +149,8 @@ public class VertexFittingUtil
Stopwatch stopwatch3 = (AutoMorpherDev.isDeveloperMode ? Stopwatch.StartNew() : null); Stopwatch stopwatch3 = (AutoMorpherDev.isDeveloperMode ? Stopwatch.StartNew() : null);
if (AutoMorpherDev.isDeveloperMode) if (AutoMorpherDev.isDeveloperMode)
{ {
UnityEngine.Debug.Log((object)$"[Expand] Selected Expand Vertes: {((Object)((Component)clothInstance.smr).gameObject).name} / {item}"); UnityEngine.Debug.Log($"[Expand] Selected Expand Vertes: {clothInstance.smr.gameObject.name} / {item}");
UnityEngine.Debug.Log((object)$"[Expand] SelectedCEnter {item} {clothInstance.deltas[item]} {clothInstance.worldVertices[item]}"); UnityEngine.Debug.Log($"[Expand] SelectedCEnter {item} {clothInstance.deltas[item]} {clothInstance.worldVertices[item]}");
} }
Vector3[] array = vertexMoverUtil.MoveVertices(clothInstance, item, clothInstance.isLeftLegVertex[item], clothInstance.isRightLegVertex[item], fittingRadius, config.sigma, clothInstance.deltas[item]); Vector3[] array = vertexMoverUtil.MoveVertices(clothInstance, item, clothInstance.isLeftLegVertex[item], clothInstance.isRightLegVertex[item], fittingRadius, config.sigma, clothInstance.deltas[item]);
if (array == null) if (array == null)
@@ -235,8 +166,7 @@ public class VertexFittingUtil
{ {
if (array[i] != Vector3.zero) if (array[i] != Vector3.zero)
{ {
ref Vector3 reference = ref clothInstance.deltasLocal[i]; clothInstance.deltasLocal[i] += array[i];
reference += array[i];
} }
} }
if (AutoMorpherDev.isDeveloperMode) if (AutoMorpherDev.isDeveloperMode)
@@ -260,8 +190,7 @@ public class VertexFittingUtil
{ {
if (array2[j] != Vector3.zero) if (array2[j] != Vector3.zero)
{ {
ref Vector3 reference2 = ref clothInstance2.deltasLocal[j]; clothInstance2.deltasLocal[j] += array2[j];
reference2 += array2[j];
} }
} }
} }
@@ -271,83 +200,48 @@ public class VertexFittingUtil
num2 += (float)stopwatch4.ElapsedMilliseconds; num2 += (float)stopwatch4.ElapsedMilliseconds;
} }
} }
this.SmoothAllClothesDeltasByDistance(clothInstances, fittingRadius, config.smoothingIteration, config.sigma); SmoothAllClothesDeltasByDistance(clothInstances, fittingRadius, config.smoothingIteration, config.sigma);
foreach (ClothInstance clothInstance3 in clothInstances) foreach (ClothInstance clothInstance3 in clothInstances)
{ {
for (int k = 0; k < clothInstance3.worldVertices.Length; k++) for (int k = 0; k < clothInstance3.worldVertices.Length; k++)
{ {
if (!clothInstance3.excludedVertices[k]) if (!clothInstance3.excludedVertices[k])
{ {
ref Vector3 reference3 = ref clothInstance3.worldVertices[k]; clothInstance3.worldVertices[k] += clothInstance3.deltasLocal[k];
reference3 += clothInstance3.deltasLocal[k];
} }
clothInstance3.deltasLocal[k] = Vector3.zero; clothInstance3.deltasLocal[k] = Vector3.zero;
} }
foreach (List<int> equivalentVertex in clothInstance3.equivalentVertices) foreach (List<int> equivalentVertex in clothInstance3.equivalentVertices)
{ {
Vector3 val = Vector3.zero; Vector3 zero = Vector3.zero;
for (int l = 0; l < equivalentVertex.Count; l++) for (int l = 0; l < equivalentVertex.Count; l++)
{ {
val += clothInstance3.worldVertices[equivalentVertex[l]]; zero += clothInstance3.worldVertices[equivalentVertex[l]];
} }
val /= (float)equivalentVertex.Count; zero /= (float)equivalentVertex.Count;
for (int m = 0; m < equivalentVertex.Count; m++) for (int m = 0; m < equivalentVertex.Count; m++)
{ {
clothInstance3.worldVertices[equivalentVertex[m]] = val; clothInstance3.worldVertices[equivalentVertex[m]] = zero;
} }
} }
} }
if (AutoMorpherDev.isDeveloperMode) if (AutoMorpherDev.isDeveloperMode)
{ {
stopwatch2.Stop(); stopwatch2.Stop();
UnityEngine.Debug.Log((object)$"[Expand] Renderer Move Vector Calculate: {((Object)((Component)clothInstance.smr).gameObject).name} : {num}"); UnityEngine.Debug.Log($"[Expand] Renderer Move Vector Calculate: {clothInstance.smr.gameObject.name} : {num}");
UnityEngine.Debug.Log((object)$"[Expand] Other Renderer Move Vector Calculate: {((Object)((Component)clothInstance.smr).gameObject).name} : {num2}"); UnityEngine.Debug.Log($"[Expand] Other Renderer Move Vector Calculate: {clothInstance.smr.gameObject.name} : {num2}");
UnityEngine.Debug.Log((object)$"[Expand] Total Move Vector Calculate: {((Object)((Component)clothInstance.smr).gameObject).name} : {stopwatch2.ElapsedMilliseconds}"); UnityEngine.Debug.Log($"[Expand] Total Move Vector Calculate: {clothInstance.smr.gameObject.name} : {stopwatch2.ElapsedMilliseconds}");
stopwatch.Stop(); stopwatch.Stop();
UnityEngine.Debug.Log((object)$"[Expand] TOTAL ShrinkClothes time: {stopwatch.ElapsedMilliseconds} ms"); UnityEngine.Debug.Log($"[Expand] TOTAL ShrinkClothes time: {stopwatch.ElapsedMilliseconds} ms");
UnityEngine.Debug.Log((object)("[Expand] End " + ((Object)((Component)clothInstance.smr).gameObject).name + "//===============================================================================================================")); UnityEngine.Debug.Log("[Expand] End " + clothInstance.smr.gameObject.name + "//===============================================================================================================");
} }
} }
public void ShrinkClothes_World(ClothInstance clothInstance, List<ClothInstance> clothInstances, MeshMatcher meshMatcher, EdenAutoMorpherConfig config, float fittingRadius) public void ShrinkClothes_World(ClothInstance clothInstance, List<ClothInstance> clothInstances, MeshMatcher meshMatcher, EdenAutoMorpherConfig config, float fittingRadius)
{ {
//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
//IL_01b1: 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_0434: Unknown result type (might be due to invalid IL or missing references)
//IL_0439: Unknown result type (might be due to invalid IL or missing references)
//IL_040e: Unknown result type (might be due to invalid IL or missing references)
//IL_041c: Unknown result type (might be due to invalid IL or missing references)
//IL_0421: Unknown result type (might be due to invalid IL or missing references)
//IL_0426: 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_0234: 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_0257: Unknown result type (might be due to invalid IL or missing references)
//IL_025c: Unknown result type (might be due to invalid IL or missing references)
//IL_0261: Unknown result type (might be due to invalid IL or missing references)
//IL_046d: Unknown result type (might be due to invalid IL or missing references)
//IL_0472: Unknown result type (might be due to invalid IL or missing references)
//IL_0479: Unknown result type (might be due to invalid IL or missing references)
//IL_048b: Unknown result type (might be due to invalid IL or missing references)
//IL_0490: Unknown result type (might be due to invalid IL or missing references)
//IL_0495: Unknown result type (might be due to invalid IL or missing references)
//IL_04a8: Unknown result type (might be due to invalid IL or missing references)
//IL_04b2: Unknown result type (might be due to invalid IL or missing references)
//IL_04b7: Unknown result type (might be due to invalid IL or missing references)
//IL_04ce: Unknown result type (might be due to invalid IL or missing references)
//IL_04d0: Unknown result type (might be due to invalid IL or missing references)
//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
//IL_02fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0315: Unknown result type (might be due to invalid IL or missing references)
//IL_031a: Unknown result type (might be due to invalid IL or missing references)
//IL_0335: Unknown result type (might be due to invalid IL or missing references)
//IL_033e: Unknown result type (might be due to invalid IL or missing references)
//IL_0343: Unknown result type (might be due to invalid IL or missing references)
//IL_0348: Unknown result type (might be due to invalid IL or missing references)
if (AutoMorpherDev.isDeveloperMode) if (AutoMorpherDev.isDeveloperMode)
{ {
UnityEngine.Debug.Log((object)("[Shrink] Start " + ((Object)((Component)clothInstance.smr).gameObject).name + "//===============================================================================================================")); UnityEngine.Debug.Log("[Shrink] Start " + clothInstance.smr.gameObject.name + "//===============================================================================================================");
} }
Stopwatch stopwatch = (AutoMorpherDev.isDeveloperMode ? Stopwatch.StartNew() : null); Stopwatch stopwatch = (AutoMorpherDev.isDeveloperMode ? Stopwatch.StartNew() : null);
using (AutoMorpherDev.Profile("[Shrink] BVH Mesh Matching time")) using (AutoMorpherDev.Profile("[Shrink] BVH Mesh Matching time"))
@@ -357,19 +251,19 @@ public class VertexFittingUtil
List<int> list = null; List<int> list = null;
using (AutoMorpherDev.Profile("[Shrink] Select Anchors time")) using (AutoMorpherDev.Profile("[Shrink] Select Anchors time"))
{ {
list = this.SelectAnchors(clothInstance, fittingRadius); list = SelectAnchors(clothInstance, fittingRadius);
} }
if (AutoMorpherDev.isDeveloperMode) if (AutoMorpherDev.isDeveloperMode)
{ {
UnityEngine.Debug.Log((object)$"[Shrink] Anchor Count {list.Count}"); UnityEngine.Debug.Log($"[Shrink] Anchor Count {list.Count}");
} }
if (list.Count == 0) if (list.Count == 0)
{ {
if (AutoMorpherDev.isDeveloperMode) if (AutoMorpherDev.isDeveloperMode)
{ {
stopwatch.Stop(); stopwatch.Stop();
UnityEngine.Debug.Log((object)$"[Shrink] TOTAL ShrinkClothes time: {stopwatch.ElapsedMilliseconds} ms"); UnityEngine.Debug.Log($"[Shrink] TOTAL ShrinkClothes time: {stopwatch.ElapsedMilliseconds} ms");
UnityEngine.Debug.Log((object)("[Shrink] End " + ((Object)((Component)clothInstance.smr).gameObject).name + "//===============================================================================================================")); UnityEngine.Debug.Log("[Shrink] End " + clothInstance.smr.gameObject.name + "//===============================================================================================================");
} }
return; return;
} }
@@ -386,8 +280,8 @@ public class VertexFittingUtil
Stopwatch stopwatch3 = (AutoMorpherDev.isDeveloperMode ? Stopwatch.StartNew() : null); Stopwatch stopwatch3 = (AutoMorpherDev.isDeveloperMode ? Stopwatch.StartNew() : null);
if (AutoMorpherDev.isDeveloperMode) if (AutoMorpherDev.isDeveloperMode)
{ {
UnityEngine.Debug.Log((object)$"[Shrink] Selected Expand Vertes: {((Object)((Component)clothInstance.smr).gameObject).name} / {item}"); UnityEngine.Debug.Log($"[Shrink] Selected Expand Vertes: {clothInstance.smr.gameObject.name} / {item}");
UnityEngine.Debug.Log((object)$"[Shrink] SelectedCEnter {item} {clothInstance.deltas[item]} {clothInstance.worldVertices[item]}"); UnityEngine.Debug.Log($"[Shrink] SelectedCEnter {item} {clothInstance.deltas[item]} {clothInstance.worldVertices[item]}");
} }
Vector3[] array = vertexMoverUtil.MoveVertices(clothInstance, item, clothInstance.isLeftLegVertex[item], clothInstance.isRightLegVertex[item], fittingRadius, config.sigma, clothInstance.deltas[item]); Vector3[] array = vertexMoverUtil.MoveVertices(clothInstance, item, clothInstance.isLeftLegVertex[item], clothInstance.isRightLegVertex[item], fittingRadius, config.sigma, clothInstance.deltas[item]);
if (array == null) if (array == null)
@@ -400,8 +294,7 @@ public class VertexFittingUtil
{ {
if (array[i] != Vector3.zero) if (array[i] != Vector3.zero)
{ {
ref Vector3 reference = ref clothInstance.deltasLocal[i]; clothInstance.deltasLocal[i] += array[i];
reference += array[i];
} }
} }
if (AutoMorpherDev.isDeveloperMode) if (AutoMorpherDev.isDeveloperMode)
@@ -425,8 +318,7 @@ public class VertexFittingUtil
{ {
if (array2[j] != Vector3.zero) if (array2[j] != Vector3.zero)
{ {
ref Vector3 reference2 = ref clothInstance2.deltasLocal[j]; clothInstance2.deltasLocal[j] += array2[j];
reference2 += array2[j];
} }
} }
} }
@@ -436,107 +328,76 @@ public class VertexFittingUtil
num2 += (float)stopwatch4.ElapsedMilliseconds; num2 += (float)stopwatch4.ElapsedMilliseconds;
} }
} }
this.SmoothAllClothesDeltasByDistance(clothInstances, fittingRadius, config.smoothingIteration, config.sigma); SmoothAllClothesDeltasByDistance(clothInstances, fittingRadius, config.smoothingIteration, config.sigma);
foreach (ClothInstance clothInstance3 in clothInstances) foreach (ClothInstance clothInstance3 in clothInstances)
{ {
for (int k = 0; k < clothInstance3.worldVertices.Length; k++) for (int k = 0; k < clothInstance3.worldVertices.Length; k++)
{ {
if (!clothInstance3.excludedVertices[k]) if (!clothInstance3.excludedVertices[k])
{ {
ref Vector3 reference3 = ref clothInstance3.worldVertices[k]; clothInstance3.worldVertices[k] += clothInstance3.deltasLocal[k];
reference3 += clothInstance3.deltasLocal[k];
} }
clothInstance3.deltasLocal[k] = Vector3.zero; clothInstance3.deltasLocal[k] = Vector3.zero;
} }
foreach (List<int> equivalentVertex in clothInstance3.equivalentVertices) foreach (List<int> equivalentVertex in clothInstance3.equivalentVertices)
{ {
Vector3 val = Vector3.zero; Vector3 zero = Vector3.zero;
for (int l = 0; l < equivalentVertex.Count; l++) for (int l = 0; l < equivalentVertex.Count; l++)
{ {
val += clothInstance3.worldVertices[equivalentVertex[l]]; zero += clothInstance3.worldVertices[equivalentVertex[l]];
} }
val /= (float)equivalentVertex.Count; zero /= (float)equivalentVertex.Count;
for (int m = 0; m < equivalentVertex.Count; m++) for (int m = 0; m < equivalentVertex.Count; m++)
{ {
clothInstance3.worldVertices[equivalentVertex[m]] = val; clothInstance3.worldVertices[equivalentVertex[m]] = zero;
} }
} }
} }
if (AutoMorpherDev.isDeveloperMode) if (AutoMorpherDev.isDeveloperMode)
{ {
stopwatch2.Stop(); stopwatch2.Stop();
UnityEngine.Debug.Log((object)$"[Shrink] Renderer Move Vector Calculate: {((Object)((Component)clothInstance.smr).gameObject).name} : {num}"); UnityEngine.Debug.Log($"[Shrink] Renderer Move Vector Calculate: {clothInstance.smr.gameObject.name} : {num}");
UnityEngine.Debug.Log((object)$"[Shrink] Other Renderer Move Vector Calculate: {((Object)((Component)clothInstance.smr).gameObject).name} : {num2}"); UnityEngine.Debug.Log($"[Shrink] Other Renderer Move Vector Calculate: {clothInstance.smr.gameObject.name} : {num2}");
UnityEngine.Debug.Log((object)$"[Shrink] Total Move Vector Calculate: {((Object)((Component)clothInstance.smr).gameObject).name} : {stopwatch2.ElapsedMilliseconds}"); UnityEngine.Debug.Log($"[Shrink] Total Move Vector Calculate: {clothInstance.smr.gameObject.name} : {stopwatch2.ElapsedMilliseconds}");
stopwatch.Stop(); stopwatch.Stop();
UnityEngine.Debug.Log((object)$"[Shrink] TOTAL ShrinkClothes time: {stopwatch.ElapsedMilliseconds} ms"); UnityEngine.Debug.Log($"[Shrink] TOTAL ShrinkClothes time: {stopwatch.ElapsedMilliseconds} ms");
UnityEngine.Debug.Log((object)("[Shrink] End " + ((Object)((Component)clothInstance.smr).gameObject).name + "//===============================================================================================================")); UnityEngine.Debug.Log("[Shrink] End " + clothInstance.smr.gameObject.name + "//===============================================================================================================");
} }
} }
public void ExpandFitClothes_World(ClothInstance clothInstance, List<ClothInstance> clothInstances, MeshMatcher meshMatcher, float worldRadius, float sigma, float minMargin) public void ExpandFitClothes_World(ClothInstance clothInstance, List<ClothInstance> clothInstances, MeshMatcher meshMatcher, float worldRadius, float sigma, float minMargin)
{ {
//IL_0076: Unknown result type (might be due to invalid IL or missing references) UnityEngine.Debug.Log("[Expand] " + clothInstance.smr.gameObject.name + "//===============================================================================================================");
//IL_0082: 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_008c: 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_009d: 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_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_010f: 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_012a: 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)
UnityEngine.Debug.Log((object)("[Expand] " + ((Object)((Component)clothInstance.smr).gameObject).name + "//==============================================================================================================="));
Stopwatch stopwatch = Stopwatch.StartNew(); Stopwatch stopwatch = Stopwatch.StartNew();
Stopwatch stopwatch2 = Stopwatch.StartNew(); Stopwatch stopwatch2 = Stopwatch.StartNew();
clothInstance.deltas = meshMatcher.ExpandVertexMatch(clothInstance, minMargin); clothInstance.deltas = meshMatcher.ExpandVertexMatch(clothInstance, minMargin);
stopwatch2.Stop(); stopwatch2.Stop();
UnityEngine.Debug.Log((object)$"[Expand] BVH Mesh Matching time: {stopwatch2.ElapsedMilliseconds} ms"); UnityEngine.Debug.Log($"[Expand] BVH Mesh Matching time: {stopwatch2.ElapsedMilliseconds} ms");
for (int i = 0; i < clothInstance.worldVertices.Length; i++) for (int i = 0; i < clothInstance.worldVertices.Length; i++)
{ {
ref Vector3 reference = ref clothInstance.worldVertices[i]; clothInstance.worldVertices[i] += clothInstance.deltas[i];
reference += clothInstance.deltas[i];
clothInstance.deltasLocal[i] = Vector3.zero; clothInstance.deltasLocal[i] = Vector3.zero;
} }
foreach (List<int> equivalentVertex in clothInstance.equivalentVertices) foreach (List<int> equivalentVertex in clothInstance.equivalentVertices)
{ {
Vector3 val = Vector3.zero; Vector3 zero = Vector3.zero;
for (int j = 0; j < equivalentVertex.Count; j++) for (int j = 0; j < equivalentVertex.Count; j++)
{ {
val += clothInstance.worldVertices[equivalentVertex[j]]; zero += clothInstance.worldVertices[equivalentVertex[j]];
} }
val /= (float)equivalentVertex.Count; zero /= (float)equivalentVertex.Count;
for (int k = 0; k < equivalentVertex.Count; k++) for (int k = 0; k < equivalentVertex.Count; k++)
{ {
clothInstance.worldVertices[equivalentVertex[k]] = val; clothInstance.worldVertices[equivalentVertex[k]] = zero;
} }
} }
stopwatch.Stop(); stopwatch.Stop();
UnityEngine.Debug.Log((object)$"[Expand] TOTAL ShrinkClothes time: {stopwatch.ElapsedMilliseconds} ms"); UnityEngine.Debug.Log($"[Expand] TOTAL ShrinkClothes time: {stopwatch.ElapsedMilliseconds} ms");
UnityEngine.Debug.Log((object)("[Expand] " + ((Object)((Component)clothInstance.smr).gameObject).name + "//===============================================================================================================")); UnityEngine.Debug.Log("[Expand] " + clothInstance.smr.gameObject.name + "//===============================================================================================================");
} }
private List<int> SelectAnchors(ClothInstance clothInstance, float worldRadius, float minDeltaSq = 1E-05f, float maxDelta = 0.1f) private List<int> SelectAnchors(ClothInstance clothInstance, float worldRadius, float minDeltaSq = 1E-05f, float maxDelta = 0.1f)
{ {
//IL_00c7: 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_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: 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_01c5: 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_011a: Unknown result type (might be due to invalid IL or missing references)
//IL_0142: 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_015e: Unknown result type (might be due to invalid IL or missing references)
List<int> list = new List<int>(); List<int> list = new List<int>();
List<int> list2 = new List<int>(); List<int> list2 = new List<int>();
int num = clothInstance.worldVertices.Length; int num = clothInstance.worldVertices.Length;
@@ -571,7 +432,6 @@ public class VertexFittingUtil
float num3 = num2 * num2; float num3 = num2 * num2;
float cellSize = num2; float cellSize = num2;
Dictionary<Vector3Int, List<int>> dictionary = new Dictionary<Vector3Int, List<int>>(); Dictionary<Vector3Int, List<int>> dictionary = new Dictionary<Vector3Int, List<int>>();
Vector3Int key2 = default(Vector3Int);
foreach (int item in list2) foreach (int item in list2)
{ {
Vector3 p = clothInstance.worldVertices[item]; Vector3 p = clothInstance.worldVertices[item];
@@ -595,7 +455,7 @@ public class VertexFittingUtil
{ {
break; break;
} }
key2 = new Vector3Int(key.x + num4, key.y + num5, key.z + num6); Vector3Int key2 = new Vector3Int(key.x + num4, key.y + num5, key.z + num6);
if (!dictionary.TryGetValue(key2, out var value)) if (!dictionary.TryGetValue(key2, out var value))
{ {
continue; continue;
@@ -603,8 +463,7 @@ public class VertexFittingUtil
for (int num7 = 0; num7 < value.Count; num7++) for (int num7 = 0; num7 < value.Count; num7++)
{ {
int num8 = value[num7]; int num8 = value[num7];
Vector3 val = clothInstance.worldVertices[item] - clothInstance.worldVertices[num8]; if ((clothInstance.worldVertices[item] - clothInstance.worldVertices[num8]).sqrMagnitude < num3)
if (val.sqrMagnitude < num3)
{ {
flag = true; flag = true;
break; break;
@@ -624,58 +483,14 @@ public class VertexFittingUtil
} }
} }
return list; return list;
Vector3Int GetCellIndex(Vector3 val2) Vector3Int GetCellIndex(Vector3 vector)
{ {
//IL_0000: Unknown result type (might be due to invalid IL or missing references) return new Vector3Int(Mathf.FloorToInt(vector.x / cellSize), Mathf.FloorToInt(vector.y / cellSize), Mathf.FloorToInt(vector.z / cellSize));
//IL_0012: 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_0036: Unknown result type (might be due to invalid IL or missing references)
return new Vector3Int(Mathf.FloorToInt(val2.x / cellSize), Mathf.FloorToInt(val2.y / cellSize), Mathf.FloorToInt(val2.z / cellSize));
} }
} }
public void SmoothDeltasByDistance(Vector3[] positions, ref Vector3[] deltas, List<int>[] adjacency, float radius, int maxDepth = 3, int iterations = 1, float smoothFactor = 0.5f, float gaussianSigma = -1f) public void SmoothDeltasByDistance(Vector3[] positions, ref Vector3[] deltas, List<int>[] adjacency, float radius, int maxDepth = 3, int iterations = 1, float smoothFactor = 0.5f, float gaussianSigma = -1f)
{ {
//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_00e3: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: 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_02b9: Unknown result type (might be due to invalid IL or missing references)
//IL_02be: 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_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_010f: 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_0113: Unknown result type (might be due to invalid IL or missing references)
//IL_0118: Unknown result type (might be due to invalid IL or missing references)
//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
//IL_01e9: 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_0205: 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_020c: 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_022d: 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_023a: 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_0244: Unknown result type (might be due to invalid IL or missing references)
//IL_0295: Unknown result type (might be due to invalid IL or missing references)
//IL_029a: 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_026b: Unknown result type (might be due to invalid IL or missing references)
//IL_0270: Unknown result type (might be due to invalid IL or missing references)
//IL_0279: Unknown result type (might be due to invalid IL or missing references)
//IL_027e: Unknown result type (might be due to invalid IL or missing references)
//IL_0282: Unknown result type (might be due to invalid IL or missing references)
//IL_0287: Unknown result type (might be due to invalid IL or missing references)
//IL_0163: Unknown result type (might be due to invalid IL or missing references)
//IL_0168: Unknown result type (might be due to invalid IL or missing references)
//IL_016a: 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)
if (positions == null || deltas == null || adjacency == null || positions.Length != deltas.Length || positions.Length != adjacency.Length) if (positions == null || deltas == null || adjacency == null || positions.Length != deltas.Length || positions.Length != adjacency.Length)
{ {
return; return;
@@ -691,7 +506,7 @@ public class VertexFittingUtil
} }
float num2 = radius * radius; float num2 = radius * radius;
float num3 = 2f * gaussianSigma * gaussianSigma; float num3 = 2f * gaussianSigma * gaussianSigma;
Vector3[] array = (Vector3[])(object)new Vector3[num]; Vector3[] array = new Vector3[num];
Queue<Node> queue = new Queue<Node>(); Queue<Node> queue = new Queue<Node>();
List<int> list = new List<int>(32); List<int> list = new List<int>(32);
int[] array2 = new int[num]; int[] array2 = new int[num];
@@ -713,16 +528,14 @@ public class VertexFittingUtil
index = j, index = j,
depth = 0 depth = 0
}); });
Vector3 val = positions[j]; Vector3 vector = positions[j];
Vector3 val3;
while (queue.Count > 0) while (queue.Count > 0)
{ {
Node node = queue.Dequeue(); Node node = queue.Dequeue();
int index = node.index; int index = node.index;
int depth = node.depth; int depth = node.depth;
Vector3 val2 = positions[index]; Vector3 vector2 = positions[index];
val3 = val2 - val; float sqrMagnitude = (vector2 - vector).sqrMagnitude;
float sqrMagnitude = val3.sqrMagnitude;
if (index != j && sqrMagnitude <= num2) if (index != j && sqrMagnitude <= num2)
{ {
list.Add(index); list.Add(index);
@@ -739,10 +552,7 @@ public class VertexFittingUtil
for (int k = 0; k < list2.Count; k++) for (int k = 0; k < list2.Count; k++)
{ {
int num5 = list2[k]; int num5 = list2[k];
if (array2[num5] != num4) if (array2[num5] != num4 && !((positions[num5] - vector2).sqrMagnitude > num2))
{
val3 = positions[num5] - val2;
if (!(val3.sqrMagnitude > num2))
{ {
array2[num5] = num4; array2[num5] = num4;
queue.Enqueue(new Node queue.Enqueue(new Node
@@ -753,30 +563,28 @@ public class VertexFittingUtil
} }
} }
} }
}
if (list.Count == 0) if (list.Count == 0)
{ {
array[j] = deltas[j]; array[j] = deltas[j];
continue; continue;
} }
Vector3 val4 = Vector3.zero; Vector3 zero = Vector3.zero;
float num6 = 0f; float num6 = 0f;
for (int l = 0; l < list.Count; l++) for (int l = 0; l < list.Count; l++)
{ {
int num7 = list[l]; int num7 = list[l];
val3 = positions[num7] - val; float sqrMagnitude2 = (positions[num7] - vector).sqrMagnitude;
float sqrMagnitude2 = val3.sqrMagnitude;
if (!(sqrMagnitude2 > num2)) if (!(sqrMagnitude2 > num2))
{ {
float num8 = Mathf.Exp((0f - sqrMagnitude2) / num3); float num8 = Mathf.Exp((0f - sqrMagnitude2) / num3);
val4 += deltas[num7] * num8; zero += deltas[num7] * num8;
num6 += num8; num6 += num8;
} }
} }
if (num6 > 1E-08f) if (num6 > 1E-08f)
{ {
Vector3 val5 = val4 / num6; Vector3 b = zero / num6;
array[j] = Vector3.Lerp(deltas[j], val5, smoothFactor); array[j] = Vector3.Lerp(deltas[j], b, smoothFactor);
} }
else else
{ {
@@ -792,12 +600,6 @@ public class VertexFittingUtil
public void SmoothAllClothesDeltasByDistance(List<ClothInstance> clothesInstances, float radius, int iterations = 1, float gaussianSigma = -1f, int maxDepth = 3, float smoothFactor = 0.5f) public void SmoothAllClothesDeltasByDistance(List<ClothInstance> clothesInstances, float radius, int iterations = 1, float gaussianSigma = -1f, int maxDepth = 3, float smoothFactor = 0.5f)
{ {
//IL_00bf: 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_00d3: 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_01b4: Unknown result type (might be due to invalid IL or missing references)
//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
if (clothesInstances == null || clothesInstances.Count == 0) if (clothesInstances == null || clothesInstances.Count == 0)
{ {
return; return;
@@ -815,8 +617,8 @@ public class VertexFittingUtil
{ {
return; return;
} }
Vector3[] array = (Vector3[])(object)new Vector3[num]; Vector3[] array = new Vector3[num];
Vector3[] deltas = (Vector3[])(object)new Vector3[num]; Vector3[] deltas = new Vector3[num];
List<int>[] array2 = new List<int>[num]; List<int>[] array2 = new List<int>[num];
int[] array3 = new int[clothesInstances.Count]; int[] array3 = new int[clothesInstances.Count];
int num2 = 0; int num2 = 0;
@@ -855,7 +657,7 @@ public class VertexFittingUtil
} }
num2 += num3; num2 += num3;
} }
this.SmoothDeltasByDistance(array, ref deltas, array2, radius, maxDepth, iterations, smoothFactor, gaussianSigma); SmoothDeltasByDistance(array, ref deltas, array2, radius, maxDepth, iterations, smoothFactor, gaussianSigma);
for (int n = 0; n < clothesInstances.Count; n++) for (int n = 0; n < clothesInstances.Count; n++)
{ {
ClothInstance clothInstance3 = clothesInstances[n]; ClothInstance clothInstance3 = clothesInstances[n];

View File

@@ -1,2 +1,2 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: b923b2ac94268c749a4ab1b5eb358b66 guid: 1b54ca9533d091a428ae9f61c754901c

View File

@@ -8,16 +8,6 @@ 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_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_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_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_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_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");
@@ -31,7 +21,7 @@ public class VertexMoverUtil
return null; return null;
} }
float[] array2 = this.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 = 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++)
@@ -59,15 +49,6 @@ public class VertexMoverUtil
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_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_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_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_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)
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");
@@ -81,7 +62,7 @@ public class VertexMoverUtil
return null; return null;
} }
float[] array2 = this.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 = 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++)
@@ -109,14 +90,11 @@ public class VertexMoverUtil
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)
return this.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_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];

View File

@@ -1,2 +1,2 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: e83db865267e03546aac703a26c1a297 guid: 432823d8c328a744d9b31f59f2b2e418

Some files were not shown because too many files have changed in this diff Show More