포매팅

This commit is contained in:
2026-02-01 19:30:24 +09:00
parent 34507ca208
commit 6c2bb74df3
42 changed files with 8571 additions and 6960 deletions

View File

@@ -1,11 +1,9 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts,
// for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies. // for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies.
// EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null // EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.AutoMorpherDev // Eden.AutoMorpher.AutoMorpherDev
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using Eden.AutoMorpher;
using UnityEngine;
public static class AutoMorpherDev public static class AutoMorpherDev
{ {
@@ -19,24 +17,24 @@ public static class AutoMorpherDev
public ScopeTimer(bool enabled, string label) public ScopeTimer(bool enabled, string label)
{ {
_enabled = enabled; this._enabled = enabled;
_label = label; this._label = label;
if (enabled) if (enabled)
{ {
_sw = Stopwatch.StartNew(); this._sw = Stopwatch.StartNew();
} }
else else
{ {
_sw = null; this._sw = null;
} }
} }
public void Dispose() public void Dispose()
{ {
if (_enabled && _sw != null) if (this._enabled && this._sw != null)
{ {
_sw.Stop(); this._sw.Stop();
UnityEngine.Debug.Log($"[DevTimer] {_label}: {_sw.ElapsedMilliseconds} ms"); UnityEngine.Debug.Log($"[DevTimer] {this._label}: {this._sw.ElapsedMilliseconds} ms");
} }
} }
} }

View File

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

View File

@@ -1,4 +1,4 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts,
// for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies. // for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies.
// EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null // EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.BakedBodyMesh // Eden.AutoMorpher.BakedBodyMesh
@@ -12,19 +12,19 @@ public class BakedBodyMesh
public BakedBodyMesh(SkinnedMeshRenderer _smr) public BakedBodyMesh(SkinnedMeshRenderer _smr)
{ {
smr = _smr; this.smr = _smr;
bakedMesh = new Mesh(); this.bakedMesh = new Mesh();
smr.BakeMesh(bakedMesh); this.smr.BakeMesh(this.bakedMesh);
} }
public void ReBakeMesh() public void ReBakeMesh()
{ {
smr.BakeMesh(bakedMesh); this.smr.BakeMesh(this.bakedMesh);
} }
~BakedBodyMesh() ~BakedBodyMesh()
{ {
smr = null; this.smr = null;
bakedMesh = null; this.bakedMesh = null;
} }
} }

View File

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

View File

@@ -1,9 +1,8 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts,
// for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies. // for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies.
// EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null // EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.BodyPoseMatchUtil // Eden.AutoMorpher.BodyPoseMatchUtil
using System.Collections.Generic; using System.Collections.Generic;
using Eden.AutoMorpher;
using UnityEngine; using UnityEngine;
public class BodyPoseMatchUtil public class BodyPoseMatchUtil
@@ -18,9 +17,9 @@ public class BodyPoseMatchUtil
public BodyPoseMatchUtil() public BodyPoseMatchUtil()
{ {
_worldVertexUtil = new WorldVertexUtil(); this._worldVertexUtil = new WorldVertexUtil();
meshClassifier = new MeshClassifier(); this.meshClassifier = new MeshClassifier();
poseMatchCommonUtil = new BodyPoseMatch_CommonUtil(); this.poseMatchCommonUtil = new BodyPoseMatch_CommonUtil();
} }
public GameObject AutoAdjustBodyPose(GameObject sourceAvatar, IReadOnlyList<SkinnedMeshRenderer> sourceBodyMeshes, GameObject targetAvatar, IReadOnlyList<SkinnedMeshRenderer> targetBodyMeshes, out Dictionary<Transform, Transform> sourceToProxy, float neckTargetHeight = 1.5f, bool onlyScaling = false) public GameObject AutoAdjustBodyPose(GameObject sourceAvatar, IReadOnlyList<SkinnedMeshRenderer> sourceBodyMeshes, GameObject targetAvatar, IReadOnlyList<SkinnedMeshRenderer> targetBodyMeshes, out Dictionary<Transform, Transform> sourceToProxy, float neckTargetHeight = 1.5f, bool onlyScaling = false)
@@ -33,8 +32,8 @@ public class BodyPoseMatchUtil
sourceToProxy = new Dictionary<Transform, Transform>(); sourceToProxy = new Dictionary<Transform, Transform>();
return null; return null;
} }
Dictionary<HumanBodyBones, HashSet<Transform>> humanBoneMap = meshClassifier.MeshHumanoidBoneMatcher(component, sourceBodyMeshes); Dictionary<HumanBodyBones, HashSet<Transform>> humanBoneMap = this.meshClassifier.MeshHumanoidBoneMatcher(component, sourceBodyMeshes);
Dictionary<HumanBodyBones, HashSet<Transform>> dictionary = meshClassifier.MeshHumanoidBoneMatcher(component2, targetBodyMeshes); Dictionary<HumanBodyBones, HashSet<Transform>> dictionary = this.meshClassifier.MeshHumanoidBoneMatcher(component2, targetBodyMeshes);
BodyPoseMatchSetupUtil bodyPoseMatchSetupUtil = new BodyPoseMatchSetupUtil(); BodyPoseMatchSetupUtil bodyPoseMatchSetupUtil = new BodyPoseMatchSetupUtil();
bodyPoseMatchSetupUtil.AdjustAvatarScaleByNeck(sourceAvatar.transform, humanBoneMap, neckTargetHeight); bodyPoseMatchSetupUtil.AdjustAvatarScaleByNeck(sourceAvatar.transform, humanBoneMap, neckTargetHeight);
bodyPoseMatchSetupUtil.AdjustAvatarScaleByNeck(targetAvatar.transform, dictionary, neckTargetHeight); bodyPoseMatchSetupUtil.AdjustAvatarScaleByNeck(targetAvatar.transform, dictionary, neckTargetHeight);
@@ -47,7 +46,7 @@ public class BodyPoseMatchUtil
gameObject.transform.localPosition = Vector3.zero; gameObject.transform.localPosition = Vector3.zero;
return gameObject; return gameObject;
} }
Dictionary<HumanBodyBones, HashSet<Transform>> dictionary2 = meshClassifier.MeshHumanoidBoneMatcher(component3, proxyBodyMeshes); Dictionary<HumanBodyBones, HashSet<Transform>> dictionary2 = this.meshClassifier.MeshHumanoidBoneMatcher(component3, proxyBodyMeshes);
if (dictionary2 == null || dictionary2.Count == 0) if (dictionary2 == null || dictionary2.Count == 0)
{ {
throw new AutoMorpherException("Proxy Bone Map is Missing", "[BodyPoseMatch_Arm] AlignUpperArmByArmPcaCenters\n - proxyBoneMap is null"); throw new AutoMorpherException("Proxy Bone Map is Missing", "[BodyPoseMatch_Arm] AlignUpperArmByArmPcaCenters\n - proxyBoneMap is null");
@@ -66,7 +65,7 @@ public class BodyPoseMatchUtil
} }
BodyPoseMatch_Torso bodyPoseMatch_Torso = new BodyPoseMatch_Torso(); BodyPoseMatch_Torso bodyPoseMatch_Torso = new BodyPoseMatch_Torso();
bodyPoseMatch_Torso.AlignTorsoByNeck(gameObject, list, dictionary2, targetAvatar, list2, dictionary); bodyPoseMatch_Torso.AlignTorsoByNeck(gameObject, list, dictionary2, targetAvatar, list2, dictionary);
if (doDebug) if (this.doDebug)
{ {
bodyPoseMatch_Torso.DrawTorsoPcaDebug(gameObject, 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);
@@ -77,7 +76,7 @@ public class BodyPoseMatchUtil
} }
BodyPoseMatch_Arm bodyPoseMatch_Arm = new BodyPoseMatch_Arm(); BodyPoseMatch_Arm bodyPoseMatch_Arm = new BodyPoseMatch_Arm();
bodyPoseMatch_Arm.AlignUpperArmByArmPcaCenters(list, dictionary2, list2, dictionary); bodyPoseMatch_Arm.AlignUpperArmByArmPcaCenters(list, dictionary2, list2, dictionary);
if (doDebug) if (this.doDebug)
{ {
bodyPoseMatch_Arm.DrawArmPcaDebug(gameObject, 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);
@@ -98,7 +97,7 @@ public class BodyPoseMatchUtil
item5.ReBakeMesh(); item5.ReBakeMesh();
} }
bodyPoseMatch_Leg.ScalingBothLegsAndFoots(gameObject, list, dictionary2, targetAvatar, list2, dictionary); bodyPoseMatch_Leg.ScalingBothLegsAndFoots(gameObject, list, dictionary2, targetAvatar, list2, dictionary);
if (doDebug) if (this.doDebug)
{ {
foreach (BakedBodyMesh item6 in list) foreach (BakedBodyMesh item6 in list)
{ {

View File

@@ -1,10 +1,8 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts,
// for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies. // for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies.
// EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null // EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.BodyPoseMatch_Arm // Eden.AutoMorpher.BodyPoseMatch_Arm
using System.Collections.Generic; using System.Collections.Generic;
using Eden.AutoMorpher;
using Eden.AutoMorpher.profile;
using UnityEngine; using UnityEngine;
public class BodyPoseMatch_Arm public class BodyPoseMatch_Arm
@@ -13,7 +11,7 @@ public class BodyPoseMatch_Arm
public BodyPoseMatch_Arm() public BodyPoseMatch_Arm()
{ {
poseMatchCommonUtil = new BodyPoseMatch_CommonUtil(); this.poseMatchCommonUtil = new BodyPoseMatch_CommonUtil();
} }
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)
@@ -59,13 +57,13 @@ public class BodyPoseMatch_Arm
{ {
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 = poseMatchCommonUtil.GetBoneFromBoneMap(proxyBoneMap, HumanBodyBones.Hips); 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");
} }
RegionStats regionStats = ComputeArmRegionStats(proxyBakedBodyMeshes, proxyBoneMap, isLeft: true); RegionStats regionStats = this.ComputeArmRegionStats(proxyBakedBodyMeshes, proxyBoneMap, isLeft: true);
RegionStats regionStats2 = ComputeArmRegionStats(proxyBakedBodyMeshes, proxyBoneMap, isLeft: false); RegionStats regionStats2 = this.ComputeArmRegionStats(proxyBakedBodyMeshes, proxyBoneMap, isLeft: false);
bool flag = regionStats.length > 0.0001f; bool flag = regionStats.length > 0.0001f;
bool flag2 = regionStats2.length > 0.0001f; bool flag2 = regionStats2.length > 0.0001f;
if (!flag && !flag2) if (!flag && !flag2)
@@ -73,9 +71,9 @@ public class BodyPoseMatch_Arm
Debug.LogWarning("[BodyPoseMatch_Arm] AlignUpperArmByArmPcaCenters: proxy arm PCA failed. Skip."); Debug.LogWarning("[BodyPoseMatch_Arm] AlignUpperArmByArmPcaCenters: proxy arm PCA failed. Skip.");
return; return;
} }
Vector3 sourceShoulderCenterWorld = CalculateShoulderCenter(flag, flag2, regionStats.center, regionStats2.center); Vector3 sourceShoulderCenterWorld = this.CalculateShoulderCenter(flag, flag2, regionStats.center, regionStats2.center);
RegionStats regionStats3 = ComputeArmRegionStats(targetBakedBodyMeshes, targetBoneMap, isLeft: true); RegionStats regionStats3 = this.ComputeArmRegionStats(targetBakedBodyMeshes, targetBoneMap, isLeft: true);
RegionStats regionStats4 = ComputeArmRegionStats(targetBakedBodyMeshes, targetBoneMap, isLeft: false); RegionStats regionStats4 = this.ComputeArmRegionStats(targetBakedBodyMeshes, targetBoneMap, isLeft: false);
bool flag3 = regionStats3.length > 0.0001f; bool flag3 = regionStats3.length > 0.0001f;
bool flag4 = regionStats4.length > 0.0001f; bool flag4 = regionStats4.length > 0.0001f;
if (!flag3 && !flag4) if (!flag3 && !flag4)
@@ -83,7 +81,7 @@ public class BodyPoseMatch_Arm
Debug.LogWarning("[BodyPoseMatch_Arm] AlignUpperArmByArmPcaCenters: target arm PCA failed. Skip."); Debug.LogWarning("[BodyPoseMatch_Arm] AlignUpperArmByArmPcaCenters: target arm PCA failed. Skip.");
return; return;
} }
Vector3 targetShoulderCenterWorld = CalculateShoulderCenter(flag3, flag4, regionStats3.center, regionStats4.center); Vector3 targetShoulderCenterWorld = this.CalculateShoulderCenter(flag3, flag4, regionStats3.center, regionStats4.center);
if (!proxyBoneMap.TryGetValue(HumanBodyBones.LeftUpperArm, 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");
@@ -92,7 +90,7 @@ public class BodyPoseMatch_Arm
{ {
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");
} }
AlignUpperArmByArmCenters(value, value2, sourceShoulderCenterWorld, targetShoulderCenterWorld, boneFromBoneMap); this.AlignUpperArmByArmCenters(value, value2, sourceShoulderCenterWorld, targetShoulderCenterWorld, boneFromBoneMap);
} }
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)
@@ -105,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 = poseMatchCommonUtil.GetBoneFromBoneMap(clothBoneMap, HumanBodyBones.Hips); 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");
@@ -120,16 +118,16 @@ public class BodyPoseMatch_Arm
Vector3 leftCenter = Vector3.zero; Vector3 leftCenter = Vector3.zero;
if (flag) if (flag)
{ {
leftCenter = poseMatchCommonUtil.GetProfilePcaCenterWorld(clothBoneMap, profileData.LeftUpperArmSpatialData, comprehensiveScale); leftCenter = this.poseMatchCommonUtil.GetProfilePcaCenterWorld(clothBoneMap, profileData.LeftUpperArmSpatialData, comprehensiveScale);
} }
Vector3 rightCenter = Vector3.zero; Vector3 rightCenter = Vector3.zero;
if (flag2) if (flag2)
{ {
rightCenter = poseMatchCommonUtil.GetProfilePcaCenterWorld(clothBoneMap, profileData.RightUpperArmSpatialData, comprehensiveScale); rightCenter = this.poseMatchCommonUtil.GetProfilePcaCenterWorld(clothBoneMap, profileData.RightUpperArmSpatialData, comprehensiveScale);
} }
Vector3 sourceShoulderCenterWorld = CalculateShoulderCenter(flag, flag2, leftCenter, rightCenter); Vector3 sourceShoulderCenterWorld = this.CalculateShoulderCenter(flag, flag2, leftCenter, rightCenter);
RegionStats regionStats = ComputeArmRegionStats(targetBakedBodyMeshes, targetBoneMap, isLeft: true); RegionStats regionStats = this.ComputeArmRegionStats(targetBakedBodyMeshes, targetBoneMap, isLeft: true);
RegionStats regionStats2 = ComputeArmRegionStats(targetBakedBodyMeshes, targetBoneMap, isLeft: false); RegionStats regionStats2 = this.ComputeArmRegionStats(targetBakedBodyMeshes, targetBoneMap, isLeft: false);
bool flag3 = regionStats.length > 0.0001f; bool flag3 = regionStats.length > 0.0001f;
bool flag4 = regionStats2.length > 0.0001f; bool flag4 = regionStats2.length > 0.0001f;
if (!flag3 && !flag4) if (!flag3 && !flag4)
@@ -137,7 +135,7 @@ public class BodyPoseMatch_Arm
Debug.LogWarning("[BodyPoseMatch_Arm] AlignUpperArmByArmPcaCenters: target arm PCA failed. Skip."); Debug.LogWarning("[BodyPoseMatch_Arm] AlignUpperArmByArmPcaCenters: target arm PCA failed. Skip.");
return; return;
} }
Vector3 targetShoulderCenterWorld = CalculateShoulderCenter(flag3, flag4, regionStats.center, regionStats2.center); Vector3 targetShoulderCenterWorld = this.CalculateShoulderCenter(flag3, flag4, regionStats.center, regionStats2.center);
if (!clothBoneMap.TryGetValue(HumanBodyBones.LeftUpperArm, 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");
@@ -146,7 +144,7 @@ public class BodyPoseMatch_Arm
{ {
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");
} }
AlignUpperArmByArmCenters(value, value2, sourceShoulderCenterWorld, targetShoulderCenterWorld, boneFromBoneMap); this.AlignUpperArmByArmCenters(value, value2, sourceShoulderCenterWorld, targetShoulderCenterWorld, boneFromBoneMap);
} }
private Vector3 CalculateShoulderCenter(bool leftValid, bool rightValid, Vector3 leftCenter, Vector3 rightCenter) private Vector3 CalculateShoulderCenter(bool leftValid, bool rightValid, Vector3 leftCenter, Vector3 rightCenter)
@@ -175,16 +173,16 @@ public class BodyPoseMatch_Arm
HumanBodyBones.LeftLowerArm, HumanBodyBones.LeftLowerArm,
HumanBodyBones.LeftHand HumanBodyBones.LeftHand
}); });
List<Vector3> list = poseMatchCommonUtil.CollectHumanoidVerticesWorld(targetHumanBones, avatarBakedBodyMeshes, avatarBoneMap); List<Vector3> list = this.poseMatchCommonUtil.CollectHumanoidVerticesWorld(targetHumanBones, avatarBakedBodyMeshes, avatarBoneMap);
if (list == null || list.Count == 0) if (list == null || list.Count == 0)
{ {
Debug.LogWarning($"[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 = poseMatchCommonUtil.GetBoneFromBoneMap(avatarBoneMap, isLeft ? HumanBodyBones.LeftUpperArm : HumanBodyBones.RightUpperArm); Transform boneFromBoneMap = this.poseMatchCommonUtil.GetBoneFromBoneMap(avatarBoneMap, isLeft ? HumanBodyBones.LeftUpperArm : HumanBodyBones.RightUpperArm);
Transform boneFromBoneMap2 = poseMatchCommonUtil.GetBoneFromBoneMap(avatarBoneMap, isLeft ? HumanBodyBones.LeftLowerArm : HumanBodyBones.RightLowerArm); Transform boneFromBoneMap2 = this.poseMatchCommonUtil.GetBoneFromBoneMap(avatarBoneMap, isLeft ? HumanBodyBones.LeftLowerArm : HumanBodyBones.RightLowerArm);
Transform boneFromBoneMap3 = poseMatchCommonUtil.GetBoneFromBoneMap(avatarBoneMap, isLeft ? HumanBodyBones.LeftHand : HumanBodyBones.RightHand); 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)
{ {
@@ -211,12 +209,12 @@ public class BodyPoseMatch_Arm
HumanBodyBones humanBodyBones = (isLeft ? HumanBodyBones.LeftUpperArm : HumanBodyBones.RightUpperArm); HumanBodyBones humanBodyBones = (isLeft ? HumanBodyBones.LeftUpperArm : HumanBodyBones.RightUpperArm);
HumanBodyBones bone = (isLeft ? HumanBodyBones.LeftLowerArm : HumanBodyBones.RightLowerArm); HumanBodyBones bone = (isLeft ? HumanBodyBones.LeftLowerArm : HumanBodyBones.RightLowerArm);
HumanBodyBones bone2 = (isLeft ? HumanBodyBones.LeftHand : HumanBodyBones.RightHand); HumanBodyBones bone2 = (isLeft ? HumanBodyBones.LeftHand : HumanBodyBones.RightHand);
Transform boneFromBoneMap = poseMatchCommonUtil.GetBoneFromBoneMap(sourceBoneMap, humanBodyBones); Transform boneFromBoneMap = this.poseMatchCommonUtil.GetBoneFromBoneMap(sourceBoneMap, humanBodyBones);
Transform boneFromBoneMap2 = poseMatchCommonUtil.GetBoneFromBoneMap(sourceBoneMap, bone); Transform boneFromBoneMap2 = this.poseMatchCommonUtil.GetBoneFromBoneMap(sourceBoneMap, bone);
Transform boneFromBoneMap3 = poseMatchCommonUtil.GetBoneFromBoneMap(sourceBoneMap, bone2); Transform boneFromBoneMap3 = this.poseMatchCommonUtil.GetBoneFromBoneMap(sourceBoneMap, bone2);
Transform boneFromBoneMap4 = poseMatchCommonUtil.GetBoneFromBoneMap(targetBoneMap, humanBodyBones); Transform boneFromBoneMap4 = this.poseMatchCommonUtil.GetBoneFromBoneMap(targetBoneMap, humanBodyBones);
Transform boneFromBoneMap5 = poseMatchCommonUtil.GetBoneFromBoneMap(targetBoneMap, bone); Transform boneFromBoneMap5 = this.poseMatchCommonUtil.GetBoneFromBoneMap(targetBoneMap, bone);
Transform boneFromBoneMap6 = 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)
{ {
@@ -228,7 +226,7 @@ public class BodyPoseMatch_Arm
} }
else else
{ {
poseMatchCommonUtil.BoneLengthAdjust(boneFromBoneMap, boneFromBoneMap2, boneFromBoneMap4, boneFromBoneMap5, value, autoDetectAxis, forceAxisIndex); this.poseMatchCommonUtil.BoneLengthAdjust(boneFromBoneMap, boneFromBoneMap2, boneFromBoneMap4, boneFromBoneMap5, value, autoDetectAxis, forceAxisIndex);
} }
} }
@@ -236,9 +234,9 @@ public class BodyPoseMatch_Arm
{ {
HumanBodyBones humanBodyBones = (isLeft ? HumanBodyBones.LeftLowerArm : HumanBodyBones.RightLowerArm); HumanBodyBones humanBodyBones = (isLeft ? HumanBodyBones.LeftLowerArm : HumanBodyBones.RightLowerArm);
HumanBodyBones bone = (isLeft ? HumanBodyBones.LeftHand : HumanBodyBones.RightHand); HumanBodyBones bone = (isLeft ? HumanBodyBones.LeftHand : HumanBodyBones.RightHand);
Transform boneFromBoneMap = poseMatchCommonUtil.GetBoneFromBoneMap(sourceBoneMap, humanBodyBones); Transform boneFromBoneMap = this.poseMatchCommonUtil.GetBoneFromBoneMap(sourceBoneMap, humanBodyBones);
Transform boneFromBoneMap2 = poseMatchCommonUtil.GetBoneFromBoneMap(sourceBoneMap, bone); Transform boneFromBoneMap2 = this.poseMatchCommonUtil.GetBoneFromBoneMap(sourceBoneMap, bone);
Transform boneFromBoneMap3 = poseMatchCommonUtil.GetBoneFromBoneMap(targetBoneMap, humanBodyBones); 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.");
@@ -254,7 +252,7 @@ public class BodyPoseMatch_Arm
return; return;
} }
float num3 = num2 / num; float num3 = num2 / num;
int num4 = ResolveArmLengthAxisIndex(boneFromBoneMap, boneFromBoneMap2, autoDetectAxis, forceAxisIndex); int num4 = this.ResolveArmLengthAxisIndex(boneFromBoneMap, boneFromBoneMap2, autoDetectAxis, forceAxisIndex);
Vector3 localScale = boneFromBoneMap.localScale; Vector3 localScale = boneFromBoneMap.localScale;
switch (num4) switch (num4)
{ {
@@ -283,8 +281,8 @@ public class BodyPoseMatch_Arm
{ {
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");
} }
ScalingUpperArmLength(proxyBoneMap, targetBoneMap, isLeft: true, autoDetectAxis, forceAxisIndex); this.ScalingUpperArmLength(proxyBoneMap, targetBoneMap, isLeft: true, autoDetectAxis, forceAxisIndex);
ScalingUpperArmLength(proxyBoneMap, targetBoneMap, isLeft: false, autoDetectAxis, forceAxisIndex); this.ScalingUpperArmLength(proxyBoneMap, targetBoneMap, isLeft: false, autoDetectAxis, forceAxisIndex);
if (proxyBakedBodyMeshes != null) if (proxyBakedBodyMeshes != null)
{ {
foreach (BakedBodyMesh proxyBakedBodyMesh in proxyBakedBodyMeshes) foreach (BakedBodyMesh proxyBakedBodyMesh in proxyBakedBodyMeshes)
@@ -292,22 +290,22 @@ public class BodyPoseMatch_Arm
proxyBakedBodyMesh.ReBakeMesh(); proxyBakedBodyMesh.ReBakeMesh();
} }
} }
ScalingLowerArmLength_BodyMatch(proxyBakedBodyMeshes, proxyBoneMap, targetBakedBodyMeshes, targetBoneMap, autoDetectAxis, forceAxisIndex); this.ScalingLowerArmLength_BodyMatch(proxyBakedBodyMeshes, proxyBoneMap, targetBakedBodyMeshes, targetBoneMap, autoDetectAxis, 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) 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 (TryGetForearmExtremeX(proxyBakedBodyMeshes, proxyBoneMap, HumanBodyBones.LeftHand, isLeft: true, out var extremeX) && TryGetForearmExtremeX(targetBakedBodyMeshes, targetBoneMap, HumanBodyBones.LeftHand, 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))
{ {
ScalingLowerArmLength(proxyBoneMap, targetBoneMap, isLeft: true, autoDetectAxis, forceAxisIndex, extremeX, extremeX2); this.ScalingLowerArmLength(proxyBoneMap, targetBoneMap, isLeft: true, autoDetectAxis, forceAxisIndex, extremeX, extremeX2);
} }
else else
{ {
Debug.LogWarning("[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 (TryGetForearmExtremeX(proxyBakedBodyMeshes, proxyBoneMap, HumanBodyBones.RightHand, isLeft: false, out var extremeX3) && TryGetForearmExtremeX(targetBakedBodyMeshes, targetBoneMap, HumanBodyBones.RightHand, 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))
{ {
ScalingLowerArmLength(proxyBoneMap, targetBoneMap, isLeft: false, autoDetectAxis, forceAxisIndex, extremeX3, extremeX4); this.ScalingLowerArmLength(proxyBoneMap, targetBoneMap, isLeft: false, autoDetectAxis, forceAxisIndex, extremeX3, extremeX4);
} }
else else
{ {
@@ -325,9 +323,9 @@ public class BodyPoseMatch_Arm
{ {
throw new AutoMorpherException("Profile Data is Missing", "[BodyPoseMatch_Arm] ScalingSingArmLenght\n - profileData is null"); throw new AutoMorpherException("Profile Data is Missing", "[BodyPoseMatch_Arm] ScalingSingArmLenght\n - profileData is null");
} }
ScalingUpperArmLength(clothBoneMap, targetBoneMap, isLeft: true, autoDetectAxis, forceAxisIndex); this.ScalingUpperArmLength(clothBoneMap, targetBoneMap, isLeft: true, autoDetectAxis, forceAxisIndex);
ScalingUpperArmLength(clothBoneMap, targetBoneMap, isLeft: false, autoDetectAxis, forceAxisIndex); this.ScalingUpperArmLength(clothBoneMap, targetBoneMap, isLeft: false, autoDetectAxis, forceAxisIndex);
ScalingLowerArmLength_ProfileMatch(targetBakedBodyMeshes, targetBoneMap, clothBoneMap, profileData, comprehensiveScale, autoDetectAxis, forceAxisIndex); this.ScalingLowerArmLength_ProfileMatch(targetBakedBodyMeshes, targetBoneMap, clothBoneMap, profileData, comprehensiveScale, autoDetectAxis, 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) 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)
@@ -337,10 +335,10 @@ public class BodyPoseMatch_Arm
{ {
Debug.LogWarning("[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 (TryGetForearmExtremeX(targetBakedBodyMeshes, targetBoneMap, HumanBodyBones.LeftHand, isLeft: true, out extremeX)) else if (this.TryGetForearmExtremeX(targetBakedBodyMeshes, targetBoneMap, HumanBodyBones.LeftHand, isLeft: true, out extremeX))
{ {
float profileForearmExtremeX = GetProfileForearmExtremeX(clothBoneMap, profileData.LeftLowerArm_HandSpatialData, comprehensiveScale, isLeft: true); float profileForearmExtremeX = this.GetProfileForearmExtremeX(clothBoneMap, profileData.LeftLowerArm_HandSpatialData, comprehensiveScale, isLeft: true);
ScalingLowerArmLength(clothBoneMap, targetBoneMap, isLeft: true, autoDetectAxis, forceAxisIndex, profileForearmExtremeX, extremeX); this.ScalingLowerArmLength(clothBoneMap, targetBoneMap, isLeft: true, autoDetectAxis, forceAxisIndex, profileForearmExtremeX, extremeX);
} }
else else
{ {
@@ -351,10 +349,10 @@ public class BodyPoseMatch_Arm
{ {
Debug.LogWarning("[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 (TryGetForearmExtremeX(targetBakedBodyMeshes, targetBoneMap, HumanBodyBones.RightHand, isLeft: false, out extremeX2)) else if (this.TryGetForearmExtremeX(targetBakedBodyMeshes, targetBoneMap, HumanBodyBones.RightHand, isLeft: false, out extremeX2))
{ {
float profileForearmExtremeX2 = GetProfileForearmExtremeX(clothBoneMap, profileData.RightLowerArm_HandSpatialData, comprehensiveScale, isLeft: false); float profileForearmExtremeX2 = this.GetProfileForearmExtremeX(clothBoneMap, profileData.RightLowerArm_HandSpatialData, comprehensiveScale, isLeft: false);
ScalingLowerArmLength(clothBoneMap, targetBoneMap, isLeft: false, autoDetectAxis, forceAxisIndex, profileForearmExtremeX2, extremeX2); this.ScalingLowerArmLength(clothBoneMap, targetBoneMap, isLeft: false, autoDetectAxis, forceAxisIndex, profileForearmExtremeX2, extremeX2);
} }
else else
{ {
@@ -373,7 +371,7 @@ public class BodyPoseMatch_Arm
{ {
return false; return false;
} }
List<Vector3> list = poseMatchCommonUtil.CollectWeightedVerticesWorld(bakedBodyMeshes, value, weightThreshold, sampleStep); List<Vector3> list = this.poseMatchCommonUtil.CollectWeightedVerticesWorld(bakedBodyMeshes, value, weightThreshold, sampleStep);
if (list == null || list.Count == 0) if (list == null || list.Count == 0)
{ {
return false; return false;
@@ -402,7 +400,7 @@ public class BodyPoseMatch_Arm
{ {
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");
} }
if (poseMatchCommonUtil.GetBoneFromBoneMap(clothBoneMap, spatialData.refBone) == null) if (this.poseMatchCommonUtil.GetBoneFromBoneMap(clothBoneMap, spatialData.refBone) == null)
{ {
throw new AutoMorpherException("Profile Ref Bone Transform is Missing", "[BodyPoseMatch_Arm] GetProfileForearmExtremeX\n - refBone transform is null"); throw new AutoMorpherException("Profile Ref Bone Transform is Missing", "[BodyPoseMatch_Arm] GetProfileForearmExtremeX\n - refBone transform is null");
} }
@@ -442,7 +440,7 @@ public class BodyPoseMatch_Arm
{ {
if (avatarBakedBodyMeshes != null && avatarBoneMap != null) if (avatarBakedBodyMeshes != null && avatarBoneMap != null)
{ {
RegionStats regionStats = 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;
@@ -459,8 +457,8 @@ public class BodyPoseMatch_Arm
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)
{ {
DrawForearmExtremeDebugSingle(proxyObject, proxyBodyMeshes, isLeft, Color.blue, Color.cyan, size, duration); this.DrawForearmExtremeDebugSingle(proxyObject, proxyBodyMeshes, isLeft, Color.blue, Color.cyan, size, duration);
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)
@@ -479,7 +477,7 @@ public class BodyPoseMatch_Arm
Debug.LogWarning($"[BodyPoseMatch_Arm] DrawForearmExtremeDebugSingle: elbow bone missing. isLeft={isLeft}"); Debug.LogWarning($"[BodyPoseMatch_Arm] DrawForearmExtremeDebugSingle: elbow bone missing. isLeft={isLeft}");
return; return;
} }
if (!TryGetForearmExtremePoint(component, bodyMeshes, isLeft, out var extremePos)) if (!this.TryGetForearmExtremePoint(component, bodyMeshes, isLeft, out var extremePos))
{ {
Debug.LogWarning($"[BodyPoseMatch_Arm] DrawForearmExtremeDebugSingle: extreme vertex not found. isLeft={isLeft}"); Debug.LogWarning($"[BodyPoseMatch_Arm] DrawForearmExtremeDebugSingle: extreme vertex not found. isLeft={isLeft}");
return; return;
@@ -520,7 +518,7 @@ public class BodyPoseMatch_Arm
{ {
return false; return false;
} }
List<Vector3> list2 = poseMatchCommonUtil.CollectWeightedVerticesWorld(list, targetBoneSet, 0.1f); List<Vector3> list2 = this.poseMatchCommonUtil.CollectWeightedVerticesWorld(list, targetBoneSet, 0.1f);
if (list2 == null || list2.Count == 0) if (list2 == null || list2.Count == 0)
{ {
return false; return false;

View File

@@ -1,11 +1,9 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts,
// for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies. // for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies.
// EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null // EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.BodyPoseMatch_CommonUtil // Eden.AutoMorpher.BodyPoseMatch_CommonUtil
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Eden.AutoMorpher;
using Eden.AutoMorpher.profile;
using UnityEngine; using UnityEngine;
public class BodyPoseMatch_CommonUtil public class BodyPoseMatch_CommonUtil
@@ -29,12 +27,12 @@ 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 = GetBoneFromBoneMap(clothBoneMap, boneSpatialData.refBone); Transform boneFromBoneMap = this.GetBoneFromBoneMap(clothBoneMap, boneSpatialData.refBone);
if (boneFromBoneMap == 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 (GetBoneFromBoneMap(clothBoneMap, HumanBodyBones.Hips) == 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 + ")");
} }
@@ -45,12 +43,12 @@ public class BodyPoseMatch_CommonUtil
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)
{ {
return GetProfileVolumeWorld(clothBoneMap, spatialData, axis, comprehensiveScale, isMin: true); return this.GetProfileVolumeWorld(clothBoneMap, spatialData, axis, comprehensiveScale, isMin: true);
} }
public Vector3 GetProfileVolumeMaxWorld(Dictionary<HumanBodyBones, HashSet<Transform>> clothBoneMap, BoneSpatialData spatialData, int axis, Vector3 comprehensiveScale) public Vector3 GetProfileVolumeMaxWorld(Dictionary<HumanBodyBones, HashSet<Transform>> clothBoneMap, BoneSpatialData spatialData, int axis, Vector3 comprehensiveScale)
{ {
return GetProfileVolumeWorld(clothBoneMap, spatialData, axis, comprehensiveScale, isMin: false); return this.GetProfileVolumeWorld(clothBoneMap, spatialData, axis, comprehensiveScale, isMin: false);
} }
public Vector3 GetProfileVolumeWorld(Dictionary<HumanBodyBones, HashSet<Transform>> clothBoneMap, BoneSpatialData spatialData, int axisIndex, Vector3 comprehensiveScale, bool isMin) public Vector3 GetProfileVolumeWorld(Dictionary<HumanBodyBones, HashSet<Transform>> clothBoneMap, BoneSpatialData spatialData, int axisIndex, Vector3 comprehensiveScale, bool isMin)
@@ -63,7 +61,7 @@ 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 = GetBoneFromBoneMap(clothBoneMap, spatialData.refBone); Transform boneFromBoneMap = this.GetBoneFromBoneMap(clothBoneMap, spatialData.refBone);
if (boneFromBoneMap == 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})");
@@ -164,7 +162,7 @@ public class BodyPoseMatch_CommonUtil
Debug.Log("[AvatarBodyMatchUtil] CollectBodyPartVerticesWorld: targetBoneSet is empty."); Debug.Log("[AvatarBodyMatchUtil] CollectBodyPartVerticesWorld: targetBoneSet is empty.");
return result; return result;
} }
return CollectWeightedVerticesWorld(bakedBodyMeshes, hashSet, weightThreshold, sampleStep); return this.CollectWeightedVerticesWorld(bakedBodyMeshes, hashSet, weightThreshold, sampleStep);
} }
public void BoneLengthAdjust(Transform proxyParent, Transform proxyChild, Transform targetParent, Transform targetChild, HashSet<Transform> proxyParentSet, bool autoDetectAxis = true, int forceAxisIndex = 1) public void BoneLengthAdjust(Transform proxyParent, Transform proxyChild, Transform targetParent, Transform targetChild, HashSet<Transform> proxyParentSet, bool autoDetectAxis = true, int forceAxisIndex = 1)

View File

@@ -1,10 +1,8 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts,
// for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies. // for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies.
// EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null // EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.BodyPoseMatch_Leg // Eden.AutoMorpher.BodyPoseMatch_Leg
using System.Collections.Generic; using System.Collections.Generic;
using Eden.AutoMorpher;
using Eden.AutoMorpher.profile;
using UnityEngine; using UnityEngine;
public class BodyPoseMatch_Leg public class BodyPoseMatch_Leg
@@ -13,7 +11,7 @@ public class BodyPoseMatch_Leg
public BodyPoseMatch_Leg() public BodyPoseMatch_Leg()
{ {
poseMatchCommonUtil = new BodyPoseMatch_CommonUtil(); this.poseMatchCommonUtil = new BodyPoseMatch_CommonUtil();
} }
public void AlignBothUpperLegs(GameObject proxyObject, IReadOnlyList<BakedBodyMesh> proxyBakedBodyMeshes, Dictionary<HumanBodyBones, HashSet<Transform>> proxyBoneMap, GameObject targetObject, IReadOnlyList<BakedBodyMesh> targetBakedBodyMeshes, Dictionary<HumanBodyBones, HashSet<Transform>> targetBoneMap) public void AlignBothUpperLegs(GameObject proxyObject, IReadOnlyList<BakedBodyMesh> proxyBakedBodyMeshes, Dictionary<HumanBodyBones, HashSet<Transform>> proxyBoneMap, GameObject targetObject, IReadOnlyList<BakedBodyMesh> targetBakedBodyMeshes, Dictionary<HumanBodyBones, HashSet<Transform>> targetBoneMap)
@@ -22,14 +20,14 @@ public class BodyPoseMatch_Leg
{ {
throw new AutoMorpherException("Proxy or Target Object is Missing", "[BodyPoseMatch_Leg] AlignBothUpperLegs\n - proxyObject or targetObject is null"); throw new AutoMorpherException("Proxy or Target Object is Missing", "[BodyPoseMatch_Leg] AlignBothUpperLegs\n - proxyObject or targetObject is null");
} }
AlignUpperLeg_BodyMatch(proxyObject, proxyBakedBodyMeshes, proxyBoneMap, targetObject, targetBakedBodyMeshes, targetBoneMap, isLeft: true); this.AlignUpperLeg_BodyMatch(proxyObject, proxyBakedBodyMeshes, proxyBoneMap, targetObject, targetBakedBodyMeshes, targetBoneMap, isLeft: true);
AlignUpperLeg_BodyMatch(proxyObject, proxyBakedBodyMeshes, proxyBoneMap, targetObject, targetBakedBodyMeshes, targetBoneMap, isLeft: false); this.AlignUpperLeg_BodyMatch(proxyObject, proxyBakedBodyMeshes, proxyBoneMap, targetObject, targetBakedBodyMeshes, targetBoneMap, isLeft: false);
} }
public void AlignBothUpperLegs(Transform targetTransform, IReadOnlyList<BakedBodyMesh> targetBakedBodyMeshes, Dictionary<HumanBodyBones, HashSet<Transform>> targetBoneMap, Transform clothesTransform, Dictionary<HumanBodyBones, HashSet<Transform>> clothBoneMap, ProfileData profileData, Vector3 comprehensiveScale) public void AlignBothUpperLegs(Transform targetTransform, IReadOnlyList<BakedBodyMesh> targetBakedBodyMeshes, Dictionary<HumanBodyBones, HashSet<Transform>> targetBoneMap, Transform clothesTransform, Dictionary<HumanBodyBones, HashSet<Transform>> clothBoneMap, ProfileData profileData, Vector3 comprehensiveScale)
{ {
AlignUpperLeg_Profile(targetTransform, targetBakedBodyMeshes, targetBoneMap, clothesTransform, clothBoneMap, profileData, comprehensiveScale, isLeft: true); this.AlignUpperLeg_Profile(targetTransform, targetBakedBodyMeshes, targetBoneMap, clothesTransform, clothBoneMap, profileData, comprehensiveScale, isLeft: true);
AlignUpperLeg_Profile(targetTransform, targetBakedBodyMeshes, targetBoneMap, clothesTransform, clothBoneMap, profileData, comprehensiveScale, isLeft: false); this.AlignUpperLeg_Profile(targetTransform, targetBakedBodyMeshes, targetBoneMap, clothesTransform, clothBoneMap, profileData, comprehensiveScale, isLeft: false);
} }
public void AlignUpperLeg_BodyMatch(GameObject proxyObject, IReadOnlyList<BakedBodyMesh> proxyBakedBodyMeshes, Dictionary<HumanBodyBones, HashSet<Transform>> proxyBoneMap, GameObject targetObject, IReadOnlyList<BakedBodyMesh> targetBakedBodyMeshes, Dictionary<HumanBodyBones, HashSet<Transform>> targetBoneMap, bool isLeft) public void AlignUpperLeg_BodyMatch(GameObject proxyObject, IReadOnlyList<BakedBodyMesh> proxyBakedBodyMeshes, Dictionary<HumanBodyBones, HashSet<Transform>> proxyBoneMap, GameObject targetObject, IReadOnlyList<BakedBodyMesh> targetBakedBodyMeshes, Dictionary<HumanBodyBones, HashSet<Transform>> targetBoneMap, bool isLeft)
@@ -38,8 +36,8 @@ public class BodyPoseMatch_Leg
{ {
throw new AutoMorpherException("Proxy or Target Object is Missing", "[BodyPoseMatch_Leg] AlignUpperLeg_BodyMatch\n - proxyObject or targetObject is null"); throw new AutoMorpherException("Proxy or Target Object is Missing", "[BodyPoseMatch_Leg] AlignUpperLeg_BodyMatch\n - proxyObject or targetObject is null");
} }
RegionStats regionStats = ComputeLegRegionStats(proxyObject.transform, proxyBakedBodyMeshes, proxyBoneMap, isLeft); RegionStats regionStats = this.ComputeLegRegionStats(proxyObject.transform, proxyBakedBodyMeshes, proxyBoneMap, isLeft);
RegionStats regionStats2 = ComputeLegRegionStats(targetObject.transform, targetBakedBodyMeshes, targetBoneMap, isLeft); RegionStats regionStats2 = this.ComputeLegRegionStats(targetObject.transform, targetBakedBodyMeshes, targetBoneMap, isLeft);
if (regionStats.length < 0.0001f || regionStats2.length < 0.0001f) if (regionStats.length < 0.0001f || regionStats2.length < 0.0001f)
{ {
Debug.LogWarning("[BodyPoseMatch_Leg] AlignUpperLeg_BodyMatch: leg PCA 통계가 비정상입니다."); Debug.LogWarning("[BodyPoseMatch_Leg] AlignUpperLeg_BodyMatch: leg PCA 통계가 비정상입니다.");
@@ -52,7 +50,7 @@ public class BodyPoseMatch_Leg
} }
else else
{ {
AlignUpperLegCore(value, regionStats.center, regionStats2.center); this.AlignUpperLegCore(value, regionStats.center, regionStats2.center);
} }
} }
@@ -69,8 +67,8 @@ public class BodyPoseMatch_Leg
Debug.LogWarning("[BodyPoseMatch_Leg] AlignUpperLeg: " + (isLeft ? "Left" : "Right") + " spatial data missing."); Debug.LogWarning("[BodyPoseMatch_Leg] AlignUpperLeg: " + (isLeft ? "Left" : "Right") + " spatial data missing.");
return; return;
} }
Vector3 profilePcaCenterWorld = poseMatchCommonUtil.GetProfilePcaCenterWorld(clothBoneMap, boneSpatialData, comprehensiveScale); Vector3 profilePcaCenterWorld = this.poseMatchCommonUtil.GetProfilePcaCenterWorld(clothBoneMap, boneSpatialData, comprehensiveScale);
RegionStats regionStats = ComputeLegRegionStats(targetTransform, targetBakedBodyMeshes, targetBoneMap, isLeft); RegionStats regionStats = this.ComputeLegRegionStats(targetTransform, targetBakedBodyMeshes, targetBoneMap, isLeft);
HashSet<Transform> value; HashSet<Transform> value;
if (regionStats.length < 0.0001f) if (regionStats.length < 0.0001f)
{ {
@@ -82,7 +80,7 @@ public class BodyPoseMatch_Leg
} }
else else
{ {
AlignUpperLegCore(value, profilePcaCenterWorld, regionStats.center); this.AlignUpperLegCore(value, profilePcaCenterWorld, regionStats.center);
} }
} }
@@ -114,15 +112,15 @@ public class BodyPoseMatch_Leg
HumanBodyBones.LeftUpperLeg, HumanBodyBones.LeftUpperLeg,
HumanBodyBones.LeftLowerLeg HumanBodyBones.LeftLowerLeg
}); });
List<Vector3> list = poseMatchCommonUtil.CollectHumanoidVerticesWorld(targetHumanBones, avatarBakedBodyMeshes, avatarBoneMap); List<Vector3> list = this.poseMatchCommonUtil.CollectHumanoidVerticesWorld(targetHumanBones, avatarBakedBodyMeshes, avatarBoneMap);
if (list == null || list.Count == 0) if (list == null || list.Count == 0)
{ {
Debug.LogWarning($"[BodyPoseMatch_Leg] ComputeLegRegionStats: leg vertices 0개. avatar={avatarTransform?.name}, isLeft={isLeft}"); Debug.LogWarning($"[BodyPoseMatch_Leg] ComputeLegRegionStats: leg vertices 0개. avatar={avatarTransform?.name}, isLeft={isLeft}");
return default(RegionStats); return default(RegionStats);
} }
RegionStats result = new PcaUtil().ComputeRegionStats(list); RegionStats result = new PcaUtil().ComputeRegionStats(list);
Transform boneFromBoneMap = poseMatchCommonUtil.GetBoneFromBoneMap(avatarBoneMap, isLeft ? HumanBodyBones.LeftUpperLeg : HumanBodyBones.RightUpperLeg); Transform boneFromBoneMap = this.poseMatchCommonUtil.GetBoneFromBoneMap(avatarBoneMap, isLeft ? HumanBodyBones.LeftUpperLeg : HumanBodyBones.RightUpperLeg);
Transform boneFromBoneMap2 = poseMatchCommonUtil.GetBoneFromBoneMap(avatarBoneMap, isLeft ? HumanBodyBones.LeftLowerLeg : HumanBodyBones.RightLowerLeg); Transform boneFromBoneMap2 = this.poseMatchCommonUtil.GetBoneFromBoneMap(avatarBoneMap, isLeft ? HumanBodyBones.LeftLowerLeg : HumanBodyBones.RightLowerLeg);
if (boneFromBoneMap != null && boneFromBoneMap2 != null) if (boneFromBoneMap != null && boneFromBoneMap2 != null)
{ {
Vector3 normalized = (boneFromBoneMap2.position - boneFromBoneMap.position).normalized; Vector3 normalized = (boneFromBoneMap2.position - boneFromBoneMap.position).normalized;
@@ -138,8 +136,8 @@ public class BodyPoseMatch_Leg
public void ScalingBothLegsAndFoots(GameObject proxyObject, IReadOnlyList<BakedBodyMesh> proxyBakedBodyMeshes, Dictionary<HumanBodyBones, HashSet<Transform>> proxyBoneMap, GameObject targetObject, IReadOnlyList<BakedBodyMesh> targetBakedBodyMeshes, Dictionary<HumanBodyBones, HashSet<Transform>> targetBoneMap, bool autoDetectAxis = true, int forceAxisIndex = 1) public void ScalingBothLegsAndFoots(GameObject proxyObject, IReadOnlyList<BakedBodyMesh> proxyBakedBodyMeshes, Dictionary<HumanBodyBones, HashSet<Transform>> proxyBoneMap, GameObject targetObject, IReadOnlyList<BakedBodyMesh> targetBakedBodyMeshes, Dictionary<HumanBodyBones, HashSet<Transform>> targetBoneMap, bool autoDetectAxis = true, int forceAxisIndex = 1)
{ {
ScalingLeg(proxyBoneMap, targetBoneMap, isLeft: true, autoDetectAxis, forceAxisIndex); this.ScalingLeg(proxyBoneMap, targetBoneMap, isLeft: true, autoDetectAxis, forceAxisIndex);
ScalingLeg(proxyBoneMap, targetBoneMap, isLeft: false, autoDetectAxis, forceAxisIndex); this.ScalingLeg(proxyBoneMap, targetBoneMap, isLeft: false, autoDetectAxis, forceAxisIndex);
if (proxyBakedBodyMeshes != null) if (proxyBakedBodyMeshes != null)
{ {
foreach (BakedBodyMesh proxyBakedBodyMesh in proxyBakedBodyMeshes) foreach (BakedBodyMesh proxyBakedBodyMesh in proxyBakedBodyMeshes)
@@ -147,26 +145,26 @@ public class BodyPoseMatch_Leg
proxyBakedBodyMesh?.ReBakeMesh(); proxyBakedBodyMesh?.ReBakeMesh();
} }
} }
ScalingFoot(proxyObject, proxyBakedBodyMeshes, proxyBoneMap, targetObject, targetBakedBodyMeshes, targetBoneMap, isLeft: true); this.ScalingFoot(proxyObject, proxyBakedBodyMeshes, proxyBoneMap, targetObject, targetBakedBodyMeshes, targetBoneMap, isLeft: true);
ScalingFoot(proxyObject, proxyBakedBodyMeshes, proxyBoneMap, targetObject, targetBakedBodyMeshes, targetBoneMap, isLeft: false); this.ScalingFoot(proxyObject, proxyBakedBodyMeshes, proxyBoneMap, targetObject, targetBakedBodyMeshes, targetBoneMap, isLeft: false);
} }
public void ScalingBothLegsAndFoots(Transform targetTransform, IReadOnlyList<BakedBodyMesh> targetBakedBodyMeshes, Dictionary<HumanBodyBones, HashSet<Transform>> targetBoneMap, Transform clothTransform, Dictionary<HumanBodyBones, HashSet<Transform>> clothBoneMap, ProfileData profileData, Vector3 comprehensiveScale, bool autoDetectAxis = true, int forceAxisIndex = 1) public void ScalingBothLegsAndFoots(Transform targetTransform, IReadOnlyList<BakedBodyMesh> targetBakedBodyMeshes, Dictionary<HumanBodyBones, HashSet<Transform>> targetBoneMap, Transform clothTransform, Dictionary<HumanBodyBones, HashSet<Transform>> clothBoneMap, ProfileData profileData, Vector3 comprehensiveScale, bool autoDetectAxis = true, int forceAxisIndex = 1)
{ {
ScalingLeg(clothBoneMap, targetBoneMap, isLeft: true, autoDetectAxis, forceAxisIndex); this.ScalingLeg(clothBoneMap, targetBoneMap, isLeft: true, autoDetectAxis, forceAxisIndex);
ScalingLeg(clothBoneMap, targetBoneMap, isLeft: false, autoDetectAxis, forceAxisIndex); this.ScalingLeg(clothBoneMap, targetBoneMap, isLeft: false, autoDetectAxis, forceAxisIndex);
ScalingFoot(profileData, comprehensiveScale, clothBoneMap, targetTransform, targetBakedBodyMeshes, targetBoneMap, isLeft: true); this.ScalingFoot(profileData, comprehensiveScale, clothBoneMap, targetTransform, targetBakedBodyMeshes, targetBoneMap, isLeft: true);
ScalingFoot(profileData, comprehensiveScale, clothBoneMap, targetTransform, targetBakedBodyMeshes, targetBoneMap, isLeft: false); this.ScalingFoot(profileData, comprehensiveScale, clothBoneMap, targetTransform, targetBakedBodyMeshes, targetBoneMap, isLeft: false);
} }
public void ScalingLeg(Dictionary<HumanBodyBones, HashSet<Transform>> proxyBoneMap, Dictionary<HumanBodyBones, HashSet<Transform>> targetBoneMap, bool isLeft, bool autoDetectAxis = true, int forceAxisIndex = 1) public void ScalingLeg(Dictionary<HumanBodyBones, HashSet<Transform>> proxyBoneMap, Dictionary<HumanBodyBones, HashSet<Transform>> targetBoneMap, bool isLeft, bool autoDetectAxis = true, int forceAxisIndex = 1)
{ {
HumanBodyBones humanBodyBones = (isLeft ? HumanBodyBones.LeftUpperLeg : HumanBodyBones.RightUpperLeg); HumanBodyBones humanBodyBones = (isLeft ? HumanBodyBones.LeftUpperLeg : HumanBodyBones.RightUpperLeg);
HumanBodyBones bone = (isLeft ? HumanBodyBones.LeftLowerLeg : HumanBodyBones.RightLowerLeg); HumanBodyBones bone = (isLeft ? HumanBodyBones.LeftLowerLeg : HumanBodyBones.RightLowerLeg);
Transform boneFromBoneMap = poseMatchCommonUtil.GetBoneFromBoneMap(proxyBoneMap, humanBodyBones); Transform boneFromBoneMap = this.poseMatchCommonUtil.GetBoneFromBoneMap(proxyBoneMap, humanBodyBones);
Transform boneFromBoneMap2 = poseMatchCommonUtil.GetBoneFromBoneMap(proxyBoneMap, bone); Transform boneFromBoneMap2 = this.poseMatchCommonUtil.GetBoneFromBoneMap(proxyBoneMap, bone);
Transform boneFromBoneMap3 = poseMatchCommonUtil.GetBoneFromBoneMap(targetBoneMap, humanBodyBones); Transform boneFromBoneMap3 = this.poseMatchCommonUtil.GetBoneFromBoneMap(targetBoneMap, humanBodyBones);
Transform boneFromBoneMap4 = poseMatchCommonUtil.GetBoneFromBoneMap(targetBoneMap, bone); Transform boneFromBoneMap4 = this.poseMatchCommonUtil.GetBoneFromBoneMap(targetBoneMap, bone);
if (boneFromBoneMap == null || boneFromBoneMap2 == null || boneFromBoneMap3 == null || boneFromBoneMap4 == null) if (boneFromBoneMap == null || boneFromBoneMap2 == null || boneFromBoneMap3 == null || boneFromBoneMap4 == null)
{ {
Debug.LogWarning("[AvatarBodyMatchUtil] ScalingLeg: some leg bones are null"); Debug.LogWarning("[AvatarBodyMatchUtil] ScalingLeg: some leg bones are null");
@@ -177,10 +175,10 @@ public class BodyPoseMatch_Leg
Debug.LogWarning("[AvatarBodyMatchUtil] ScalingLeg: proxy upperLeg bone set missing"); Debug.LogWarning("[AvatarBodyMatchUtil] ScalingLeg: proxy upperLeg bone set missing");
return; return;
} }
poseMatchCommonUtil.BoneLengthAdjust(boneFromBoneMap, boneFromBoneMap2, boneFromBoneMap3, boneFromBoneMap4, value, autoDetectAxis, forceAxisIndex); this.poseMatchCommonUtil.BoneLengthAdjust(boneFromBoneMap, boneFromBoneMap2, boneFromBoneMap3, boneFromBoneMap4, value, autoDetectAxis, forceAxisIndex);
HumanBodyBones humanBodyBones2 = (isLeft ? HumanBodyBones.LeftFoot : HumanBodyBones.RightFoot); HumanBodyBones humanBodyBones2 = (isLeft ? HumanBodyBones.LeftFoot : HumanBodyBones.RightFoot);
Transform boneFromBoneMap5 = poseMatchCommonUtil.GetBoneFromBoneMap(proxyBoneMap, humanBodyBones2); Transform boneFromBoneMap5 = this.poseMatchCommonUtil.GetBoneFromBoneMap(proxyBoneMap, humanBodyBones2);
Transform boneFromBoneMap6 = poseMatchCommonUtil.GetBoneFromBoneMap(targetBoneMap, humanBodyBones2); Transform boneFromBoneMap6 = this.poseMatchCommonUtil.GetBoneFromBoneMap(targetBoneMap, humanBodyBones2);
if (boneFromBoneMap5 == null || boneFromBoneMap6 == null) if (boneFromBoneMap5 == null || boneFromBoneMap6 == null)
{ {
Debug.LogWarning("[AvatarBodyMatchUtil] ScalingFoot: proxyFoot or targetFoot is null"); Debug.LogWarning("[AvatarBodyMatchUtil] ScalingFoot: proxyFoot or targetFoot is null");
@@ -244,12 +242,12 @@ public class BodyPoseMatch_Leg
if (!(transform == null)) if (!(transform == null))
{ {
TempBoneMarker tempBoneMarker; TempBoneMarker tempBoneMarker;
Transform transform2 = poseMatchCommonUtil.CreateTempMarker("scaleSupportBone", key, value2, transform.position, Quaternion.identity, transform.localScale, out tempBoneMarker); Transform transform2 = this.poseMatchCommonUtil.CreateTempMarker("scaleSupportBone", key, value2, transform.position, Quaternion.identity, transform.localScale, out tempBoneMarker);
if (!(transform2 == null)) if (!(transform2 == null))
{ {
ScaleAndAlignAlongAxis(proxyHip, proxyHip.forward, proxyHip.up, transform2, proxyToeF, proxyHeelF, targetFoot, targetToeF, targetHeelF); this.ScaleAndAlignAlongAxis(proxyHip, proxyHip.forward, proxyHip.up, transform2, proxyToeF, proxyHeelF, targetFoot, targetToeF, targetHeelF);
ScaleAndAlignAlongAxis(proxyHip, proxyHip.right, proxyHip.up, transform2, isLeft ? proxySideMin : proxySideMax, isLeft ? proxySideMax : proxySideMin, targetFoot, isLeft ? targetSideMin : targetSideMax, isLeft ? targetSideMax : targetSideMin); this.ScaleAndAlignAlongAxis(proxyHip, proxyHip.right, proxyHip.up, transform2, isLeft ? proxySideMin : proxySideMax, isLeft ? proxySideMax : proxySideMin, targetFoot, isLeft ? targetSideMin : targetSideMax, isLeft ? targetSideMax : targetSideMin);
ScaleAndAlignAlongAxis(proxyHip, proxyHip.up, proxyHip.forward, transform2, 0f, proxySoleY, targetFoot, 0f, targetSoleY); this.ScaleAndAlignAlongAxis(proxyHip, proxyHip.up, proxyHip.forward, transform2, 0f, proxySoleY, targetFoot, 0f, targetSoleY);
} }
} }
} }
@@ -262,19 +260,19 @@ public class BodyPoseMatch_Leg
throw new AutoMorpherException("Proxy or Target Object is Missing", "[BodyPoseMatch_Leg] ScalingFoot\n - proxyObject or targetObject is null"); throw new AutoMorpherException("Proxy or Target Object is Missing", "[BodyPoseMatch_Leg] ScalingFoot\n - proxyObject or targetObject is null");
} }
HumanBodyBones humanBodyBones = (isLeft ? HumanBodyBones.LeftFoot : HumanBodyBones.RightFoot); HumanBodyBones humanBodyBones = (isLeft ? HumanBodyBones.LeftFoot : HumanBodyBones.RightFoot);
Transform boneFromBoneMap = poseMatchCommonUtil.GetBoneFromBoneMap(proxyBoneMap, humanBodyBones); Transform boneFromBoneMap = this.poseMatchCommonUtil.GetBoneFromBoneMap(proxyBoneMap, humanBodyBones);
Transform boneFromBoneMap2 = poseMatchCommonUtil.GetBoneFromBoneMap(targetBoneMap, humanBodyBones); Transform boneFromBoneMap2 = this.poseMatchCommonUtil.GetBoneFromBoneMap(targetBoneMap, humanBodyBones);
if (boneFromBoneMap == null || boneFromBoneMap2 == null) if (boneFromBoneMap == null || boneFromBoneMap2 == null)
{ {
Debug.LogWarning("[AvatarBodyMatchUtil] ScalingFoot: proxyFoot or targetFoot is null"); Debug.LogWarning("[AvatarBodyMatchUtil] ScalingFoot: proxyFoot or targetFoot is null");
return; return;
} }
if (!TryGetFootSpatialData(proxyObject.transform, proxyBakedBodyMeshes, proxyBoneMap, isLeft, out var _, out var footMinUp, out var heelF, out var toeF, out var sideMin, out var sideMax) || !TryGetFootSpatialData(targetObject.transform, targetBakedBodyMeshes, targetBoneMap, isLeft, out var _, out var footMinUp2, out var heelF2, out var toeF2, out var sideMin2, out var sideMax2)) if (!this.TryGetFootSpatialData(proxyObject.transform, proxyBakedBodyMeshes, proxyBoneMap, isLeft, out var _, out var footMinUp, out var heelF, out var toeF, out var sideMin, out var sideMax) || !this.TryGetFootSpatialData(targetObject.transform, targetBakedBodyMeshes, targetBoneMap, isLeft, out var _, out var footMinUp2, out var heelF2, out var toeF2, out var sideMin2, out var sideMax2))
{ {
Debug.LogWarning("[AvatarBodyMatchUtil] ScalingFoot: foot spatial data 계산 실패"); Debug.LogWarning("[AvatarBodyMatchUtil] ScalingFoot: foot spatial data 계산 실패");
return; return;
} }
Transform boneFromBoneMap3 = poseMatchCommonUtil.GetBoneFromBoneMap(proxyBoneMap, HumanBodyBones.Hips); Transform boneFromBoneMap3 = this.poseMatchCommonUtil.GetBoneFromBoneMap(proxyBoneMap, HumanBodyBones.Hips);
HashSet<Transform> value; HashSet<Transform> value;
if (boneFromBoneMap3 == null) if (boneFromBoneMap3 == null)
{ {
@@ -286,7 +284,7 @@ public class BodyPoseMatch_Leg
} }
else else
{ {
ScalingFootCore(boneFromBoneMap3, boneFromBoneMap2, isLeft, value, toeF, heelF, sideMin, sideMax, footMinUp, toeF2, heelF2, sideMin2, sideMax2, footMinUp2); this.ScalingFootCore(boneFromBoneMap3, boneFromBoneMap2, isLeft, value, toeF, heelF, sideMin, sideMax, footMinUp, toeF2, heelF2, sideMin2, sideMax2, footMinUp2);
} }
} }
@@ -297,26 +295,26 @@ public class BodyPoseMatch_Leg
throw new AutoMorpherException("Target Transform is Missing", "[BodyPoseMatch_Leg] ScalingFoot\n - targetTransform is null"); throw new AutoMorpherException("Target Transform is Missing", "[BodyPoseMatch_Leg] ScalingFoot\n - targetTransform is null");
} }
HumanBodyBones humanBodyBones = (isLeft ? HumanBodyBones.LeftFoot : HumanBodyBones.RightFoot); HumanBodyBones humanBodyBones = (isLeft ? HumanBodyBones.LeftFoot : HumanBodyBones.RightFoot);
Transform boneFromBoneMap = poseMatchCommonUtil.GetBoneFromBoneMap(clothBoneMap, humanBodyBones); Transform boneFromBoneMap = this.poseMatchCommonUtil.GetBoneFromBoneMap(clothBoneMap, humanBodyBones);
Transform boneFromBoneMap2 = poseMatchCommonUtil.GetBoneFromBoneMap(targetBoneMap, humanBodyBones); Transform boneFromBoneMap2 = this.poseMatchCommonUtil.GetBoneFromBoneMap(targetBoneMap, humanBodyBones);
if (boneFromBoneMap == null || boneFromBoneMap2 == null) if (boneFromBoneMap == null || boneFromBoneMap2 == null)
{ {
Debug.LogWarning("[AvatarBodyMatchUtil] ScalingFoot: proxyFoot or targetFoot is null"); Debug.LogWarning("[AvatarBodyMatchUtil] ScalingFoot: proxyFoot or targetFoot is null");
return; return;
} }
if (!TryGetFootSpatialData(targetTransform.transform, targetBakedBodyMeshes, targetBoneMap, isLeft, out var _, out var footMinUp, out var heelF, out var toeF, out var sideMin, out var sideMax)) if (!this.TryGetFootSpatialData(targetTransform.transform, targetBakedBodyMeshes, targetBoneMap, isLeft, out var _, out var footMinUp, out var heelF, out var toeF, out var sideMin, out var sideMax))
{ {
Debug.LogWarning("[AvatarBodyMatchUtil] ScalingFoot: foot spatial data 계산 실패"); Debug.LogWarning("[AvatarBodyMatchUtil] ScalingFoot: foot spatial data 계산 실패");
return; return;
} }
Transform boneFromBoneMap3 = poseMatchCommonUtil.GetBoneFromBoneMap(clothBoneMap, HumanBodyBones.Hips); Transform boneFromBoneMap3 = this.poseMatchCommonUtil.GetBoneFromBoneMap(clothBoneMap, HumanBodyBones.Hips);
BoneSpatialData boneSpatialData = (isLeft ? profileData.LeftFootSpatialData : profileData.RightFootSpatialData); BoneSpatialData boneSpatialData = (isLeft ? profileData.LeftFootSpatialData : profileData.RightFootSpatialData);
if (boneSpatialData == null) if (boneSpatialData == null)
{ {
Debug.LogWarning("[AvatarBodyMatchUtil] AlignNeckCenterByPcaWithHipZ: Profile FootSpatialData Data is Not exist."); Debug.LogWarning("[AvatarBodyMatchUtil] AlignNeckCenterByPcaWithHipZ: Profile FootSpatialData Data is Not exist.");
return; return;
} }
Transform boneFromBoneMap4 = poseMatchCommonUtil.GetBoneFromBoneMap(clothBoneMap, boneSpatialData.refBone); Transform boneFromBoneMap4 = this.poseMatchCommonUtil.GetBoneFromBoneMap(clothBoneMap, boneSpatialData.refBone);
if (boneFromBoneMap4 == null) if (boneFromBoneMap4 == null)
{ {
Debug.LogWarning("[BodyPoseMatch_Leg] ScalingFoot: clothRefBone is null"); Debug.LogWarning("[BodyPoseMatch_Leg] ScalingFoot: clothRefBone is null");
@@ -334,7 +332,7 @@ public class BodyPoseMatch_Leg
} }
else else
{ {
ScalingFootCore(boneFromBoneMap3, boneFromBoneMap2, isLeft, value, proxyToeF, proxyHeelF, proxySideMin, proxySideMax, proxySoleY, toeF, heelF, sideMin, sideMax, footMinUp); this.ScalingFootCore(boneFromBoneMap3, boneFromBoneMap2, isLeft, value, proxyToeF, proxyHeelF, proxySideMin, proxySideMax, proxySoleY, toeF, heelF, sideMin, sideMax, footMinUp);
} }
} }
@@ -433,7 +431,7 @@ public class BodyPoseMatch_Leg
{ {
return false; return false;
} }
List<Vector3> list = poseMatchCommonUtil.CollectWeightedVerticesWorld(avatarBakedBodyMeshes, hashSet, weightThreshold, sampleStep); List<Vector3> list = this.poseMatchCommonUtil.CollectWeightedVerticesWorld(avatarBakedBodyMeshes, hashSet, weightThreshold, sampleStep);
if (list == null || list.Count == 0) if (list == null || list.Count == 0)
{ {
return false; return false;
@@ -476,7 +474,7 @@ public class BodyPoseMatch_Leg
{ {
if (!(avatarObject == null)) if (!(avatarObject == null))
{ {
RegionStats regionStats = ComputeLegRegionStats(avatarObject.transform, avatarBakedBodyMeshes, avatarBoneMap, isLeft); RegionStats regionStats = this.ComputeLegRegionStats(avatarObject.transform, avatarBakedBodyMeshes, avatarBoneMap, isLeft);
if (regionStats.length < 0.0001f) if (regionStats.length < 0.0001f)
{ {
Debug.LogWarning($"[AvatarBodyMatchUtil] DrawLegPcaDebug: PCA length too small (avatar={avatarObject.name}, isLeft={isLeft})"); Debug.LogWarning($"[AvatarBodyMatchUtil] DrawLegPcaDebug: PCA length too small (avatar={avatarObject.name}, isLeft={isLeft})");
@@ -502,7 +500,7 @@ public class BodyPoseMatch_Leg
{ {
return; return;
} }
if (!TryGetFootSpatialData(avatarObject.transform, avatarBakedBodyMeshes, avatarBoneMap, isLeft, out var footMaxUp, out var footMinUp, out var heelF, out var toeF, out var sideMin, out var sideMax, weightThreshold, sampleStep)) if (!this.TryGetFootSpatialData(avatarObject.transform, avatarBakedBodyMeshes, avatarBoneMap, isLeft, out var footMaxUp, out var footMinUp, out var heelF, out var toeF, out var sideMin, out var sideMax, weightThreshold, sampleStep))
{ {
Debug.LogWarning("[BodyPoseMatch_Leg] DrawFootSpatialDebug" + $"\n - Failed to compute Foot Spatial Data (avatar={avatarObject.name}, isLeft={isLeft})"); Debug.LogWarning("[BodyPoseMatch_Leg] DrawFootSpatialDebug" + $"\n - Failed to compute Foot Spatial Data (avatar={avatarObject.name}, isLeft={isLeft})");
} }
@@ -531,7 +529,7 @@ public class BodyPoseMatch_Leg
return; return;
} }
Vector3 position = transform.position; Vector3 position = transform.position;
Transform boneFromBoneMap = poseMatchCommonUtil.GetBoneFromBoneMap(avatarBoneMap, HumanBodyBones.Hips); Transform boneFromBoneMap = this.poseMatchCommonUtil.GetBoneFromBoneMap(avatarBoneMap, HumanBodyBones.Hips);
Vector3 vector = ((boneFromBoneMap != null) ? boneFromBoneMap.forward : avatarObject.transform.forward); Vector3 vector = ((boneFromBoneMap != null) ? boneFromBoneMap.forward : avatarObject.transform.forward);
vector.y = 0f; vector.y = 0f;
if (vector.sqrMagnitude < 1E-06f) if (vector.sqrMagnitude < 1E-06f)

View File

@@ -1,11 +1,9 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts,
// for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies. // for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies.
// EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null // EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.BodyPoseMatch_Torso // Eden.AutoMorpher.BodyPoseMatch_Torso
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Eden.AutoMorpher;
using Eden.AutoMorpher.profile;
using UnityEngine; using UnityEngine;
public class BodyPoseMatch_Torso public class BodyPoseMatch_Torso
@@ -14,7 +12,7 @@ public class BodyPoseMatch_Torso
public BodyPoseMatch_Torso() public BodyPoseMatch_Torso()
{ {
poseMatchCommonUtil = new BodyPoseMatch_CommonUtil(); this.poseMatchCommonUtil = new BodyPoseMatch_CommonUtil();
} }
public void AlignTorsoByNeck(IReadOnlyCollection<Transform> sourceHipSet, Vector3 sourceNeckCenterWorld, Vector3 targetNeckCenterWorld) public void AlignTorsoByNeck(IReadOnlyCollection<Transform> sourceHipSet, Vector3 sourceNeckCenterWorld, Vector3 targetNeckCenterWorld)
@@ -47,8 +45,8 @@ public class BodyPoseMatch_Torso
{ {
throw new AutoMorpherException("Proxy/Target Object is Missing", "[BodyPoseMatch_Torso] AlignTorsoByNeck\n - proxyObject or targetObject is null"); throw new AutoMorpherException("Proxy/Target Object is Missing", "[BodyPoseMatch_Torso] AlignTorsoByNeck\n - proxyObject or targetObject is null");
} }
RegionStats regionStats = ComputeNeckRegionStats(proxyObject.transform, proxyBakedBodyMeshes, proxyBoneMap); RegionStats regionStats = this.ComputeNeckRegionStats(proxyObject.transform, proxyBakedBodyMeshes, proxyBoneMap);
RegionStats regionStats2 = ComputeNeckRegionStats(targetObject.transform, targetBakedBodyMeshes, targetBoneMap); RegionStats regionStats2 = this.ComputeNeckRegionStats(targetObject.transform, targetBakedBodyMeshes, targetBoneMap);
if (regionStats.length < 0.0001f || regionStats2.length < 0.0001f) if (regionStats.length < 0.0001f || regionStats2.length < 0.0001f)
{ {
Debug.LogWarning("[BodyPoseMatch_Torso] AlignTorsoByNeck: Neck PCA 통계가 비정상입니다."); Debug.LogWarning("[BodyPoseMatch_Torso] AlignTorsoByNeck: Neck PCA 통계가 비정상입니다.");
@@ -58,7 +56,7 @@ public class BodyPoseMatch_Torso
{ {
throw new AutoMorpherException("Proxy Hip Set is Missing", "[BodyPoseMatch_Torso] AlignTorsoByNeck\n - proxyBoneMap has no Hips bone set"); throw new AutoMorpherException("Proxy Hip Set is Missing", "[BodyPoseMatch_Torso] AlignTorsoByNeck\n - proxyBoneMap has no Hips bone set");
} }
AlignTorsoByNeck(value, regionStats.center, regionStats2.center); this.AlignTorsoByNeck(value, regionStats.center, regionStats2.center);
} }
public void AlignTorsoByNeck(Transform targetTransform, IReadOnlyList<BakedBodyMesh> targetBakedBodyMeshes, Dictionary<HumanBodyBones, HashSet<Transform>> targetBoneMap, Dictionary<HumanBodyBones, HashSet<Transform>> clothBoneMap, Transform clothesTransform, ProfileData profileData, Vector3 comprehensiveScale) public void AlignTorsoByNeck(Transform targetTransform, IReadOnlyList<BakedBodyMesh> targetBakedBodyMeshes, Dictionary<HumanBodyBones, HashSet<Transform>> targetBoneMap, Dictionary<HumanBodyBones, HashSet<Transform>> clothBoneMap, Transform clothesTransform, ProfileData profileData, Vector3 comprehensiveScale)
@@ -71,7 +69,7 @@ public class BodyPoseMatch_Torso
{ {
throw new AutoMorpherException("Profile Neck Data is Missing", "[BodyPoseMatch_Torso] AlignTorsoByNeck\n - profileData or profileData.NeckSpatialData is null"); throw new AutoMorpherException("Profile Neck Data is Missing", "[BodyPoseMatch_Torso] AlignTorsoByNeck\n - profileData or profileData.NeckSpatialData is null");
} }
RegionStats regionStats = ComputeNeckRegionStats(targetTransform, targetBakedBodyMeshes, targetBoneMap); RegionStats regionStats = this.ComputeNeckRegionStats(targetTransform, targetBakedBodyMeshes, targetBoneMap);
if (regionStats.length < 0.0001f) if (regionStats.length < 0.0001f)
{ {
Debug.LogWarning("[BodyPoseMatch_Torso] AlignTorsoByNeck: Neck PCA 통계가 비정상입니다."); Debug.LogWarning("[BodyPoseMatch_Torso] AlignTorsoByNeck: Neck PCA 통계가 비정상입니다.");
@@ -81,14 +79,14 @@ public class BodyPoseMatch_Torso
{ {
throw new AutoMorpherException("Cloth Hip Set is Missing", "[BodyPoseMatch_Torso] AlignTorsoByNeck\n - clothBoneMap has no Hips bone set"); throw new AutoMorpherException("Cloth Hip Set is Missing", "[BodyPoseMatch_Torso] AlignTorsoByNeck\n - clothBoneMap has no Hips bone set");
} }
Vector3 profilePcaCenterWorld = poseMatchCommonUtil.GetProfilePcaCenterWorld(clothBoneMap, profileData.NeckSpatialData, comprehensiveScale); Vector3 profilePcaCenterWorld = this.poseMatchCommonUtil.GetProfilePcaCenterWorld(clothBoneMap, profileData.NeckSpatialData, comprehensiveScale);
AlignTorsoByNeck(value, profilePcaCenterWorld, regionStats.center); this.AlignTorsoByNeck(value, profilePcaCenterWorld, regionStats.center);
} }
public RegionStats ComputeNeckRegionStats(Transform avatarTransform, IReadOnlyList<BakedBodyMesh> avatarBakedBodyMeshes, Dictionary<HumanBodyBones, HashSet<Transform>> avatarBoneMap) public RegionStats ComputeNeckRegionStats(Transform avatarTransform, IReadOnlyList<BakedBodyMesh> avatarBakedBodyMeshes, Dictionary<HumanBodyBones, HashSet<Transform>> avatarBoneMap)
{ {
HumanBodyBones[] targetHumanBones = new HumanBodyBones[1] { HumanBodyBones.Neck }; HumanBodyBones[] targetHumanBones = new HumanBodyBones[1] { HumanBodyBones.Neck };
List<Vector3> list = poseMatchCommonUtil.CollectHumanoidVerticesWorld(targetHumanBones, avatarBakedBodyMeshes, avatarBoneMap); List<Vector3> list = this.poseMatchCommonUtil.CollectHumanoidVerticesWorld(targetHumanBones, avatarBakedBodyMeshes, avatarBoneMap);
if (list == null || list.Count == 0) if (list == null || list.Count == 0)
{ {
Debug.LogWarning("[AvatarBodyMatchUtil] ComputeNeckRegionStats: neck vertices 0개. avatar=" + avatarTransform?.name); Debug.LogWarning("[AvatarBodyMatchUtil] ComputeNeckRegionStats: neck vertices 0개. avatar=" + avatarTransform?.name);
@@ -96,10 +94,10 @@ public class BodyPoseMatch_Torso
} }
RegionStats result = new PcaUtil().ComputeRegionStats(list); RegionStats result = new PcaUtil().ComputeRegionStats(list);
Vector3 vector = avatarTransform.up; Vector3 vector = avatarTransform.up;
Transform boneFromBoneMap = poseMatchCommonUtil.GetBoneFromBoneMap(avatarBoneMap, HumanBodyBones.Head); Transform boneFromBoneMap = this.poseMatchCommonUtil.GetBoneFromBoneMap(avatarBoneMap, HumanBodyBones.Head);
Transform boneFromBoneMap2 = poseMatchCommonUtil.GetBoneFromBoneMap(avatarBoneMap, HumanBodyBones.UpperChest); Transform boneFromBoneMap2 = this.poseMatchCommonUtil.GetBoneFromBoneMap(avatarBoneMap, HumanBodyBones.UpperChest);
Transform boneFromBoneMap3 = poseMatchCommonUtil.GetBoneFromBoneMap(avatarBoneMap, HumanBodyBones.Chest); Transform boneFromBoneMap3 = this.poseMatchCommonUtil.GetBoneFromBoneMap(avatarBoneMap, HumanBodyBones.Chest);
Transform boneFromBoneMap4 = poseMatchCommonUtil.GetBoneFromBoneMap(avatarBoneMap, HumanBodyBones.Hips); Transform boneFromBoneMap4 = this.poseMatchCommonUtil.GetBoneFromBoneMap(avatarBoneMap, HumanBodyBones.Hips);
Transform transform = ((boneFromBoneMap2 != null) ? boneFromBoneMap2 : boneFromBoneMap3); Transform transform = ((boneFromBoneMap2 != null) ? boneFromBoneMap2 : boneFromBoneMap3);
if (boneFromBoneMap != null && transform != null) if (boneFromBoneMap != null && transform != null)
{ {
@@ -125,7 +123,7 @@ public class BodyPoseMatch_Torso
{ {
if (!(avatarObject == null)) if (!(avatarObject == null))
{ {
RegionStats regionStats = ComputeNeckRegionStats(avatarObject.transform, avatarBakedBodyMeshes, avatarBoneMap); RegionStats regionStats = this.ComputeNeckRegionStats(avatarObject.transform, avatarBakedBodyMeshes, avatarBoneMap);
if (regionStats.length < 0.0001f) if (regionStats.length < 0.0001f)
{ {
Debug.LogWarning($"[AvatarBodyMatchUtil] DrawNeckPcaDebug: neck.length가 너무 작음. avatar={avatarObject.name}, length={regionStats.length}"); Debug.LogWarning($"[AvatarBodyMatchUtil] DrawNeckPcaDebug: neck.length가 너무 작음. avatar={avatarObject.name}, length={regionStats.length}");

View File

@@ -1,10 +1,9 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts,
// for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies. // for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies.
// EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null // EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.BodyPoseToClothApplier // Eden.AutoMorpher.BodyPoseToClothApplier
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Eden.AutoMorpher;
using UnityEngine; using UnityEngine;
public class BodyPoseToClothApplier public class BodyPoseToClothApplier
@@ -45,7 +44,7 @@ public class BodyPoseToClothApplier
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.transform; Transform transform = component.transform;
Dictionary<Transform, int> dictionary = BuildDepthMap(transform); Dictionary<Transform, int> dictionary = this.BuildDepthMap(transform);
Dictionary<Transform, Transform> dictionary2 = new Dictionary<Transform, Transform>(); Dictionary<Transform, Transform> dictionary2 = new Dictionary<Transform, Transform>();
List<BoneMapping> list = new List<BoneMapping>(); List<BoneMapping> list = new List<BoneMapping>();
HashSet<Transform> hashSet = new HashSet<Transform>(); HashSet<Transform> hashSet = new HashSet<Transform>();
@@ -83,7 +82,7 @@ public class BodyPoseToClothApplier
dictionary2.Add(value2, key); dictionary2.Add(value2, key);
} }
} }
MirrorBoneMarkers(transform, dictionary2, dictionary, list); this.MirrorBoneMarkers(transform, dictionary2, dictionary, list);
foreach (BoneMapping item2 in (from m in list foreach (BoneMapping item2 in (from m in list
where m != null && m.proxyBone != null && m.clothBone != null where m != null && m.proxyBone != null && m.clothBone != null
orderby m.depth orderby m.depth
@@ -119,7 +118,7 @@ public class BodyPoseToClothApplier
{ {
if (!(transform == null)) if (!(transform == null))
{ {
dictionary[transform] = GetDepthFromRoot(transform, root); dictionary[transform] = this.GetDepthFromRoot(transform, root);
} }
} }
return dictionary; return dictionary;
@@ -172,8 +171,8 @@ public class BodyPoseToClothApplier
{ {
continue; continue;
} }
List<Transform> list = CollectDirectChilds(value); List<Transform> list = this.CollectDirectChilds(value);
Transform transform2 = FindMarkerInChild(value); Transform transform2 = this.FindMarkerInChild(value);
TempBoneMarker tempBoneMarker = null; TempBoneMarker tempBoneMarker = null;
if (transform2 == null) if (transform2 == null)
{ {

View File

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

View File

@@ -1,4 +1,4 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts,
// for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies. // for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies.
// EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null // EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.BoneCorrespondenceUtil // Eden.AutoMorpher.BoneCorrespondenceUtil
@@ -35,10 +35,10 @@ public class BoneCorrespondenceUtil
public float ComputeNameScore(string bodyName, string bodyPath, string clothesName, string clothesPath) public float ComputeNameScore(string bodyName, string bodyPath, string clothesName, string clothesPath)
{ {
string text = StripDigits(NormalizeName(bodyName)); string text = this.StripDigits(this.NormalizeName(bodyName));
string text2 = StripDigits(NormalizeName(clothesName)); string text2 = this.StripDigits(this.NormalizeName(clothesName));
string text3 = StripDigits(NormalizePath(bodyPath)); string text3 = this.StripDigits(this.NormalizePath(bodyPath));
string text4 = StripDigits(NormalizePath(clothesPath)); string text4 = this.StripDigits(this.NormalizePath(clothesPath));
if (!string.IsNullOrEmpty(text3) && text3 == text4) if (!string.IsNullOrEmpty(text3) && text3 == text4)
{ {
return 80f; return 80f;
@@ -51,18 +51,18 @@ public class BoneCorrespondenceUtil
{ {
return 40f; return 40f;
} }
return SubsequenceCoverage(bodyName, clothesName) * 10f; return this.SubsequenceCoverage(bodyName, clothesName) * 10f;
} }
private float SubsequenceCoverage(string bodyRaw, string clothesRaw) private float SubsequenceCoverage(string bodyRaw, string clothesRaw)
{ {
string text = StripDigits(NormalizeName(bodyRaw)); string text = this.StripDigits(this.NormalizeName(bodyRaw));
string text2 = StripDigits(NormalizeName(clothesRaw)); string text2 = this.StripDigits(this.NormalizeName(clothesRaw));
if (string.IsNullOrEmpty(text) || string.IsNullOrEmpty(text2)) if (string.IsNullOrEmpty(text) || string.IsNullOrEmpty(text2))
{ {
return 0f; return 0f;
} }
return (float)SubNameMatchBest(text, text2) / (float)text.Length; return (float)this.SubNameMatchBest(text, text2) / (float)text.Length;
} }
private int SubNameMatchBest(string a, string b, int minMatchCount = 3) private int SubNameMatchBest(string a, string b, int minMatchCount = 3)
@@ -78,7 +78,7 @@ public class BoneCorrespondenceUtil
int num = 0; int num = 0;
for (int i = 0; i <= a.Length - minMatchCount; i++) for (int i = 0; i <= a.Length - minMatchCount; i++)
{ {
int num2 = SubNameMatch(a, i, b, minMatchCount); int num2 = this.SubNameMatch(a, i, b, minMatchCount);
if (num2 > num) if (num2 > num)
{ {
num = num2; num = num2;
@@ -156,12 +156,12 @@ public class BoneCorrespondenceUtil
} }
s = s.ToLowerInvariant(); s = s.ToLowerInvariant();
s = s.Replace("left", "l").Replace("right", "r"); s = s.Replace("left", "l").Replace("right", "r");
char[] array = nameDelims; char[] array = this.nameDelims;
foreach (char c in array) foreach (char c in array)
{ {
s = s.Replace(c.ToString(), ""); s = s.Replace(c.ToString(), "");
} }
s = StripDigits(s); s = this.StripDigits(s);
return s; return s;
} }
@@ -173,7 +173,7 @@ public class BoneCorrespondenceUtil
} }
return string.Join("/", (from x in p.Split('/') return string.Join("/", (from x in p.Split('/')
where !string.IsNullOrEmpty(x) where !string.IsNullOrEmpty(x)
select x).Select(NormalizeName)); select x).Select(this.NormalizeName));
} }
public string StripDigits(string s) public string StripDigits(string s)

View File

@@ -1,12 +1,10 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts,
// for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies. // for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies.
// EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null // EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.BoneMatchUtil // Eden.AutoMorpher.BoneMatchUtil
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Eden.AutoMorpher;
using Eden.AutoMorpher.profile;
using UnityEngine; using UnityEngine;
public class BoneMatchUtil public class BoneMatchUtil
@@ -110,7 +108,7 @@ public class BoneMatchUtil
{ {
throw new AutoMorpherException("Body Animator is Missing", "[BoneMatchUtil] GetBodyRootLocalBones\n - animator is null"); throw new AutoMorpherException("Body Animator is Missing", "[BoneMatchUtil] GetBodyRootLocalBones\n - animator is null");
} }
Dictionary<Transform, HumanBodyBones> humanoidBoneList = GetHumanoidBoneList(bodyAnimator); Dictionary<Transform, HumanBodyBones> humanoidBoneList = this.GetHumanoidBoneList(bodyAnimator);
if (humanoidBoneList == null || humanoidBoneList.Count == 0) if (humanoidBoneList == null || humanoidBoneList.Count == 0)
{ {
throw new AutoMorpherException("Humanoid Bone Map is Missing", "[BoneMatchUtil] GetBodyRootLocalBones\n - Can't find Humanoid Bone List"); throw new AutoMorpherException("Humanoid Bone Map is Missing", "[BoneMatchUtil] GetBodyRootLocalBones\n - Can't find Humanoid Bone List");
@@ -119,7 +117,7 @@ public class BoneMatchUtil
{ {
throw new AutoMorpherException("Body Meshes are Missing", "[BoneMatchUtil] GetBodyRootLocalBones\n - bodyMeshes is null or empty"); throw new AutoMorpherException("Body Meshes are Missing", "[BoneMatchUtil] GetBodyRootLocalBones\n - bodyMeshes is null or empty");
} }
HashSet<Transform> meshBones = GetMeshBones(bodyMeshes); HashSet<Transform> meshBones = this.GetMeshBones(bodyMeshes);
Dictionary<HumanBodyBones, HashSet<Transform>> dictionary = new MeshClassifier().MeshHumanoidBoneMatcher(bodyAnimator, bodyMeshes); Dictionary<HumanBodyBones, HashSet<Transform>> dictionary = new MeshClassifier().MeshHumanoidBoneMatcher(bodyAnimator, bodyMeshes);
HashSet<Transform> hashSet = new HashSet<Transform>(); HashSet<Transform> hashSet = new HashSet<Transform>();
HashSet<Transform> hashSet2 = new HashSet<Transform>(); HashSet<Transform> hashSet2 = new HashSet<Transform>();
@@ -172,7 +170,7 @@ public class BoneMatchUtil
hashSet.Add(item4); hashSet.Add(item4);
} }
} }
List<BoneRootLocalData> rootLocalBones = GetRootLocalBones(bodyTransform, hashSet); List<BoneRootLocalData> rootLocalBones = this.GetRootLocalBones(bodyTransform, hashSet);
foreach (BoneRootLocalData item5 in rootLocalBones) foreach (BoneRootLocalData item5 in rootLocalBones)
{ {
if (item5 != null && !(item5.t == null)) if (item5 != null && !(item5.t == null))
@@ -247,7 +245,7 @@ public class BoneMatchUtil
{ {
float num9 = Quaternion.Angle(bodyBone.rootLocalRot, clothesBone.rootLocalRot); float num9 = Quaternion.Angle(bodyBone.rootLocalRot, clothesBone.rootLocalRot);
float num10 = boneCorrespondenceUtil.ComputeRotationScore(num9, 30f) * 1f; float num10 = boneCorrespondenceUtil.ComputeRotationScore(num9, 30f) * 1f;
if (IsBetterCandidate(num7, num, num10, num2, num8, num3, num6, num4, num9, num5)) if (this.IsBetterCandidate(num7, num, num10, num2, num8, num3, num6, num4, num9, num5))
{ {
boneRootLocalData = bodyBone; boneRootLocalData = bodyBone;
num = num7; num = num7;
@@ -280,7 +278,7 @@ public class BoneMatchUtil
for (int num11 = 1; num11 < list2.Count; num11++) for (int num11 = 1; num11 < list2.Count; num11++)
{ {
(BoneRootLocalData, BoneRootLocalData, float, float, float, float, float) tuple2 = list2[num11]; (BoneRootLocalData, BoneRootLocalData, float, float, float, float, float) tuple2 = list2[num11];
if (IsBetterCandidate(tuple2.Item3, tuple.Item3, tuple2.Item4, tuple.Item4, tuple2.Item5, tuple.Item5, tuple2.Item6, tuple.Item6, tuple2.Item7, tuple.Item7)) if (this.IsBetterCandidate(tuple2.Item3, tuple.Item3, tuple2.Item4, tuple.Item4, tuple2.Item5, tuple.Item5, tuple2.Item6, tuple.Item6, tuple2.Item7, tuple.Item7))
{ {
tuple = tuple2; tuple = tuple2;
} }
@@ -512,13 +510,13 @@ 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 = GetMeshBones(targetClothRoot.GetComponentsInChildren<SkinnedMeshRenderer>(includeInactive: 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)");
} }
List<BoneRootLocalData> rootLocalBones = GetRootLocalBones(sourceClothRoot, hashSet); List<BoneRootLocalData> rootLocalBones = this.GetRootLocalBones(sourceClothRoot, hashSet);
List<BoneRootLocalData> rootLocalBones2 = GetRootLocalBones(targetClothRoot, meshBones); List<BoneRootLocalData> rootLocalBones2 = this.GetRootLocalBones(targetClothRoot, meshBones);
if (rootLocalBones == null || rootLocalBones.Count == 0) if (rootLocalBones == null || rootLocalBones.Count == 0)
{ {
throw new AutoMorpherException("Source RootLocal Bones are Missing", "[BoneMatchUtil] RemapClothMatchResultToTargetCloth\n - sourceRootLocalBones is null or empty"); throw new AutoMorpherException("Source RootLocal Bones are Missing", "[BoneMatchUtil] RemapClothMatchResultToTargetCloth\n - sourceRootLocalBones is null or empty");
@@ -527,7 +525,7 @@ public class BoneMatchUtil
{ {
throw new AutoMorpherException("Target RootLocal Bones are Missing", "[BoneMatchUtil] RemapClothMatchResultToTargetCloth\n - targetRootLocalBones is null or empty"); throw new AutoMorpherException("Target RootLocal Bones are Missing", "[BoneMatchUtil] RemapClothMatchResultToTargetCloth\n - targetRootLocalBones is null or empty");
} }
Dictionary<Transform, Transform> dictionary = BuildTransformMatchMap(rootLocalBones, rootLocalBones2); Dictionary<Transform, Transform> dictionary = this.BuildTransformMatchMap(rootLocalBones, rootLocalBones2);
foreach (KeyValuePair<Transform, ClothBoneType> item3 in sourceClothBoneTypeMap) foreach (KeyValuePair<Transform, ClothBoneType> item3 in sourceClothBoneTypeMap)
{ {
Transform key = item3.Key; Transform key = item3.Key;
@@ -584,18 +582,18 @@ public class BoneMatchUtil
} }
Transform transform = sourceAvatar.transform; Transform transform = sourceAvatar.transform;
Transform transform2 = proxyAvatar.transform; Transform transform2 = proxyAvatar.transform;
HashSet<Transform> meshBones = GetMeshBones(transform2.GetComponentsInChildren<SkinnedMeshRenderer>(includeInactive: 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 = GetMeshBones(transform.GetComponentsInChildren<SkinnedMeshRenderer>(includeInactive: 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)");
} }
List<BoneRootLocalData> rootLocalBones = GetRootLocalBones(transform2, meshBones); List<BoneRootLocalData> rootLocalBones = this.GetRootLocalBones(transform2, meshBones);
List<BoneRootLocalData> rootLocalBones2 = GetRootLocalBones(transform, meshBones2); List<BoneRootLocalData> rootLocalBones2 = this.GetRootLocalBones(transform, meshBones2);
if (rootLocalBones == null || rootLocalBones.Count == 0) if (rootLocalBones == null || rootLocalBones.Count == 0)
{ {
throw new AutoMorpherException("Proxy RootLocal Bones are Missing", "[AvatarBodyMatchUtil] BuildSourceToProxyBoneMap\n - proxyRootLocalBones is null or empty"); throw new AutoMorpherException("Proxy RootLocal Bones are Missing", "[AvatarBodyMatchUtil] BuildSourceToProxyBoneMap\n - proxyRootLocalBones is null or empty");
@@ -604,7 +602,7 @@ public class BoneMatchUtil
{ {
throw new AutoMorpherException("Source RootLocal Bones are Missing", "[AvatarBodyMatchUtil] BuildSourceToProxyBoneMap\n - sourceRootLocalBones is null or empty"); throw new AutoMorpherException("Source RootLocal Bones are Missing", "[AvatarBodyMatchUtil] BuildSourceToProxyBoneMap\n - sourceRootLocalBones is null or empty");
} }
sourceToProxy = BuildTransformMatchMap(rootLocalBones, rootLocalBones2, resultReverse: true); sourceToProxy = this.BuildTransformMatchMap(rootLocalBones, rootLocalBones2, resultReverse: true);
if (sourceToProxy == null) if (sourceToProxy == null)
{ {
throw new AutoMorpherException("Source To Proxy Map Build Failed", "[AvatarBodyMatchUtil] BuildSourceToProxyBoneMap\n - BuildTransformMatchMap returned null"); throw new AutoMorpherException("Source To Proxy Map Build Failed", "[AvatarBodyMatchUtil] BuildSourceToProxyBoneMap\n - BuildTransformMatchMap returned null");

View File

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

View File

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

View File

@@ -1,9 +1,8 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts,
// for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies. // for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies.
// EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null // EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.BvhTriangleMesh // Eden.AutoMorpher.BvhTriangleMesh
using System.Collections.Generic; using System.Collections.Generic;
using Eden.AutoMorpher;
using UnityEngine; using UnityEngine;
public class BvhTriangleMesh public class BvhTriangleMesh
@@ -71,14 +70,14 @@ public class BvhTriangleMesh
public BvhTriangleMesh() public BvhTriangleMesh()
{ {
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)
{ {
Mesh sharedMesh = smr.sharedMesh; Mesh sharedMesh = smr.sharedMesh;
BoneWeight[] boneWeights = sharedMesh.boneWeights; BoneWeight[] boneWeights = sharedMesh.boneWeights;
int[] boneToBodyIndex = BuildBoneToBodyIndexMap(smr, animator, bodyBones); int[] boneToBodyIndex = this.BuildBoneToBodyIndexMap(smr, animator, bodyBones);
HumanBodyBones[] array = 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++)
{ {
@@ -139,7 +138,7 @@ public class BvhTriangleMesh
Vector3[] vertices = mesh.vertices; 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 = BuildBoneToBodyIndexMap(renderer2, animator, humanBones); int[] boneToBodyIndex = this.BuildBoneToBodyIndexMap(renderer2, animator, this.humanBones);
int num3 = array.Length / 3; int num3 = array.Length / 3;
Transform transform = renderer2.transform; Transform transform = renderer2.transform;
Vector3 lossyScale = transform.lossyScale; Vector3 lossyScale = transform.lossyScale;
@@ -163,8 +162,8 @@ public class BvhTriangleMesh
{ {
normal = Vector3.up; normal = Vector3.up;
} }
int num7 = ComputeTriangleMainHumanBoneIndex(num4, num5, num6, boneWeights, boneToBodyIndex, humanBones.Length); int num7 = this.ComputeTriangleMainHumanBoneIndex(num4, num5, num6, boneWeights, boneToBodyIndex, this.humanBones.Length);
HumanBodyBones mainHumanBone = ((num7 >= 0) ? humanBones[num7] : HumanBodyBones.LastBone); HumanBodyBones mainHumanBone = ((num7 >= 0) ? this.humanBones[num7] : HumanBodyBones.LastBone);
bvhTriangleMesh.triangles[num2++] = new BvhTriangle bvhTriangleMesh.triangles[num2++] = new BvhTriangle
{ {
a = vector2, a = vector2,
@@ -184,7 +183,7 @@ public class BvhTriangleMesh
} }
bvhTriangleMesh.triIndices = array2; bvhTriangleMesh.triIndices = array2;
List<BvhNode> list = new List<BvhNode>(); List<BvhNode> list = new List<BvhNode>();
BuildRecursive(bvhTriangleMesh.triangles, array2, 0, num8, list); this.BuildRecursive(bvhTriangleMesh.triangles, array2, 0, num8, list);
bvhTriangleMesh.nodes = list.ToArray(); bvhTriangleMesh.nodes = list.ToArray();
return bvhTriangleMesh; return bvhTriangleMesh;
} }
@@ -360,7 +359,7 @@ public class BvhTriangleMesh
} }
bvhTriangleMesh.triIndices = array2; bvhTriangleMesh.triIndices = array2;
List<BvhNode> list = new List<BvhNode>(); List<BvhNode> list = new List<BvhNode>();
BuildRecursive(bvhTriangleMesh.triangles, array2, 0, num7, list); this.BuildRecursive(bvhTriangleMesh.triangles, array2, 0, num7, list);
bvhTriangleMesh.nodes = list.ToArray(); bvhTriangleMesh.nodes = list.ToArray();
return bvhTriangleMesh; return bvhTriangleMesh;
} }
@@ -405,7 +404,7 @@ public class BvhTriangleMesh
} }
bvhTriangleMesh.triIndices = array2; bvhTriangleMesh.triIndices = array2;
List<BvhNode> list = new List<BvhNode>(); List<BvhNode> list = new List<BvhNode>();
BuildRecursive(bvhTriangleMesh.triangles, array2, 0, num, list); this.BuildRecursive(bvhTriangleMesh.triangles, array2, 0, num, list);
bvhTriangleMesh.nodes = list.ToArray(); bvhTriangleMesh.nodes = list.ToArray();
return bvhTriangleMesh; return bvhTriangleMesh;
} }
@@ -461,7 +460,7 @@ public class BvhTriangleMesh
num2 += ((bvhTriangle2.a + bvhTriangle2.b + bvhTriangle2.c) / 3f)[num]; num2 += ((bvhTriangle2.a + bvhTriangle2.b + bvhTriangle2.c) / 3f)[num];
} }
num2 /= (float)count; num2 /= (float)count;
int num3 = Partition(tris, triIndices, start, count, num, num2); int num3 = this.Partition(tris, triIndices, start, count, num, num2);
if (num3 == start || num3 == start + count) if (num3 == start || num3 == start + count)
{ {
num3 = start + count / 2; num3 = start + count / 2;
@@ -470,8 +469,8 @@ public class BvhTriangleMesh
bvhNode.start = -1; bvhNode.start = -1;
bvhNode.count = 0; bvhNode.count = 0;
outNodes.Add(bvhNode); outNodes.Add(bvhNode);
int leftChild = BuildRecursive(tris, triIndices, start, num3 - start, outNodes); int leftChild = this.BuildRecursive(tris, triIndices, start, num3 - start, outNodes);
int rightChild = BuildRecursive(tris, triIndices, num3, start + count - num3, outNodes); int rightChild = this.BuildRecursive(tris, triIndices, num3, start + count - num3, outNodes);
bvhNode.leftChild = leftChild; bvhNode.leftChild = leftChild;
bvhNode.rightChild = rightChild; bvhNode.rightChild = rightChild;
outNodes[count2] = bvhNode; outNodes[count2] = bvhNode;
@@ -508,11 +507,11 @@ public class BvhTriangleMesh
triangleIndex = -1, triangleIndex = -1,
sqrDistance = float.MaxValue sqrDistance = float.MaxValue
}; };
if (nodes == null || nodes.Length == 0) if (this.nodes == null || this.nodes.Length == 0)
{ {
return best; return best;
} }
QueryClosestRecursive(0, point, ref best); this.QueryClosestRecursive(0, point, ref best);
return best; return best;
} }
@@ -523,25 +522,25 @@ public class BvhTriangleMesh
triangleIndex = -1, triangleIndex = -1,
sqrDistance = float.MaxValue sqrDistance = float.MaxValue
}; };
if (nodes == null || nodes.Length == 0) if (this.nodes == null || this.nodes.Length == 0)
{ {
return best; return best;
} }
if (allowedBones == null || allowedBones.Count == 0) if (allowedBones == null || allowedBones.Count == 0)
{ {
QueryClosestRecursive(0, point, ref best); this.QueryClosestRecursive(0, point, ref best);
} }
else else
{ {
QueryClosestRecursiveFiltered(0, point, ref best, allowedBones); this.QueryClosestRecursiveFiltered(0, point, ref best, allowedBones);
} }
return best; return best;
} }
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)
{ {
BvhNode bvhNode = nodes[nodeIndex]; BvhNode bvhNode = this.nodes[nodeIndex];
if (DistanceSqPointAABB(p, bvhNode.bounds) > best.sqrDistance) if (this.DistanceSqPointAABB(p, bvhNode.bounds) > best.sqrDistance)
{ {
return; return;
} }
@@ -550,11 +549,11 @@ public class BvhTriangleMesh
int num = bvhNode.start + bvhNode.count; int num = bvhNode.start + bvhNode.count;
for (int i = bvhNode.start; i < num; i++) for (int i = bvhNode.start; i < num; i++)
{ {
int num2 = triIndices[i]; int num2 = this.triIndices[i];
BvhTriangle bvhTriangle = triangles[num2]; BvhTriangle bvhTriangle = this.triangles[num2];
if (allowedBones.Contains(bvhTriangle.mainHumanBone)) if (allowedBones.Contains(bvhTriangle.mainHumanBone))
{ {
Vector3 vector = triangleUtil.ClosestPointOnTriangle(p, bvhTriangle.a, bvhTriangle.b, bvhTriangle.c); Vector3 vector = this.triangleUtil.ClosestPointOnTriangle(p, bvhTriangle.a, bvhTriangle.b, bvhTriangle.c);
float sqrMagnitude = (p - vector).sqrMagnitude; float sqrMagnitude = (p - vector).sqrMagnitude;
if (sqrMagnitude < best.sqrDistance) if (sqrMagnitude < best.sqrDistance)
{ {
@@ -571,25 +570,25 @@ public class BvhTriangleMesh
{ {
int leftChild = bvhNode.leftChild; int leftChild = bvhNode.leftChild;
int rightChild = bvhNode.rightChild; int rightChild = bvhNode.rightChild;
float num3 = DistanceSqPointAABB(p, nodes[leftChild].bounds); float num3 = this.DistanceSqPointAABB(p, this.nodes[leftChild].bounds);
float num4 = DistanceSqPointAABB(p, nodes[rightChild].bounds); float num4 = this.DistanceSqPointAABB(p, this.nodes[rightChild].bounds);
if (num3 < num4) if (num3 < num4)
{ {
QueryClosestRecursiveFiltered(leftChild, p, ref best, allowedBones); this.QueryClosestRecursiveFiltered(leftChild, p, ref best, allowedBones);
QueryClosestRecursiveFiltered(rightChild, p, ref best, allowedBones); this.QueryClosestRecursiveFiltered(rightChild, p, ref best, allowedBones);
} }
else else
{ {
QueryClosestRecursiveFiltered(rightChild, p, ref best, allowedBones); this.QueryClosestRecursiveFiltered(rightChild, p, ref best, allowedBones);
QueryClosestRecursiveFiltered(leftChild, p, ref best, allowedBones); this.QueryClosestRecursiveFiltered(leftChild, p, ref best, allowedBones);
} }
} }
} }
private void QueryClosestRecursive(int nodeIndex, Vector3 p, ref ClosestHit best) private void QueryClosestRecursive(int nodeIndex, Vector3 p, ref ClosestHit best)
{ {
BvhNode bvhNode = nodes[nodeIndex]; BvhNode bvhNode = this.nodes[nodeIndex];
if (DistanceSqPointAABB(p, bvhNode.bounds) > best.sqrDistance) if (this.DistanceSqPointAABB(p, bvhNode.bounds) > best.sqrDistance)
{ {
return; return;
} }
@@ -598,9 +597,9 @@ public class BvhTriangleMesh
int num = bvhNode.start + bvhNode.count; int num = bvhNode.start + bvhNode.count;
for (int i = bvhNode.start; i < num; i++) for (int i = bvhNode.start; i < num; i++)
{ {
int num2 = triIndices[i]; int num2 = this.triIndices[i];
BvhTriangle bvhTriangle = triangles[num2]; BvhTriangle bvhTriangle = this.triangles[num2];
Vector3 vector = triangleUtil.ClosestPointOnTriangle(p, bvhTriangle.a, bvhTriangle.b, bvhTriangle.c); Vector3 vector = this.triangleUtil.ClosestPointOnTriangle(p, bvhTriangle.a, bvhTriangle.b, bvhTriangle.c);
float sqrMagnitude = (p - vector).sqrMagnitude; float sqrMagnitude = (p - vector).sqrMagnitude;
if (sqrMagnitude < best.sqrDistance) if (sqrMagnitude < best.sqrDistance)
{ {
@@ -616,17 +615,17 @@ public class BvhTriangleMesh
{ {
int leftChild = bvhNode.leftChild; int leftChild = bvhNode.leftChild;
int rightChild = bvhNode.rightChild; int rightChild = bvhNode.rightChild;
float num3 = DistanceSqPointAABB(p, nodes[leftChild].bounds); float num3 = this.DistanceSqPointAABB(p, this.nodes[leftChild].bounds);
float num4 = DistanceSqPointAABB(p, nodes[rightChild].bounds); float num4 = this.DistanceSqPointAABB(p, this.nodes[rightChild].bounds);
if (num3 < num4) if (num3 < num4)
{ {
QueryClosestRecursive(leftChild, p, ref best); this.QueryClosestRecursive(leftChild, p, ref best);
QueryClosestRecursive(rightChild, p, ref best); this.QueryClosestRecursive(rightChild, p, ref best);
} }
else else
{ {
QueryClosestRecursive(rightChild, p, ref best); this.QueryClosestRecursive(rightChild, p, ref best);
QueryClosestRecursive(leftChild, p, ref best); this.QueryClosestRecursive(leftChild, p, ref best);
} }
} }
} }
@@ -642,20 +641,20 @@ public class BvhTriangleMesh
public int QueryClosestN(Vector3 point, int maxCount, float maxDistance, List<ClosestHit> results) public int QueryClosestN(Vector3 point, int maxCount, float maxDistance, List<ClosestHit> results)
{ {
results.Clear(); results.Clear();
if (nodes == null || nodes.Length == 0 || maxCount <= 0) if (this.nodes == null || this.nodes.Length == 0 || maxCount <= 0)
{ {
return 0; return 0;
} }
float num = maxDistance * maxDistance; float num = maxDistance * maxDistance;
float currentMaxSq = num; float currentMaxSq = num;
QueryClosestNRecursive(0, point, maxCount, num, results, ref currentMaxSq); this.QueryClosestNRecursive(0, point, maxCount, num, results, ref currentMaxSq);
return results.Count; return results.Count;
} }
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)
{ {
BvhNode bvhNode = nodes[nodeIndex]; BvhNode bvhNode = this.nodes[nodeIndex];
if (DistanceSqPointAABB(p, bvhNode.bounds) > currentMaxSq) if (this.DistanceSqPointAABB(p, bvhNode.bounds) > currentMaxSq)
{ {
return; return;
} }
@@ -664,9 +663,9 @@ public class BvhTriangleMesh
int num = bvhNode.start + bvhNode.count; int num = bvhNode.start + bvhNode.count;
for (int i = bvhNode.start; i < num; i++) for (int i = bvhNode.start; i < num; i++)
{ {
int num2 = triIndices[i]; int num2 = this.triIndices[i];
BvhTriangle bvhTriangle = triangles[num2]; BvhTriangle bvhTriangle = this.triangles[num2];
Vector3 vector = triangleUtil.ClosestPointOnTriangle(p, bvhTriangle.a, bvhTriangle.b, bvhTriangle.c); Vector3 vector = this.triangleUtil.ClosestPointOnTriangle(p, bvhTriangle.a, bvhTriangle.b, bvhTriangle.c);
float sqrMagnitude = (p - vector).sqrMagnitude; float sqrMagnitude = (p - vector).sqrMagnitude;
if (sqrMagnitude > maxDistanceSq) if (sqrMagnitude > maxDistanceSq)
{ {
@@ -684,7 +683,7 @@ public class BvhTriangleMesh
}); });
if (bestHits.Count == maxCount) if (bestHits.Count == maxCount)
{ {
currentMaxSq = GetMaxSqrDistance(bestHits, maxDistanceSq); currentMaxSq = this.GetMaxSqrDistance(bestHits, maxDistanceSq);
} }
} }
else else
@@ -710,7 +709,7 @@ public class BvhTriangleMesh
normal = bvhTriangle.normal, normal = bvhTriangle.normal,
sqrDistance = sqrMagnitude sqrDistance = sqrMagnitude
}; };
currentMaxSq = GetMaxSqrDistance(bestHits, maxDistanceSq); currentMaxSq = this.GetMaxSqrDistance(bestHits, maxDistanceSq);
} }
} }
} }
@@ -718,17 +717,17 @@ public class BvhTriangleMesh
{ {
int leftChild = bvhNode.leftChild; int leftChild = bvhNode.leftChild;
int rightChild = bvhNode.rightChild; int rightChild = bvhNode.rightChild;
float num3 = DistanceSqPointAABB(p, nodes[leftChild].bounds); float num3 = this.DistanceSqPointAABB(p, this.nodes[leftChild].bounds);
float num4 = DistanceSqPointAABB(p, nodes[rightChild].bounds); float num4 = this.DistanceSqPointAABB(p, this.nodes[rightChild].bounds);
if (num3 < num4) if (num3 < num4)
{ {
QueryClosestNRecursive(leftChild, p, maxCount, maxDistanceSq, bestHits, ref currentMaxSq); this.QueryClosestNRecursive(leftChild, p, maxCount, maxDistanceSq, bestHits, ref currentMaxSq);
QueryClosestNRecursive(rightChild, p, maxCount, maxDistanceSq, bestHits, ref currentMaxSq); this.QueryClosestNRecursive(rightChild, p, maxCount, maxDistanceSq, bestHits, ref currentMaxSq);
} }
else else
{ {
QueryClosestNRecursive(rightChild, p, maxCount, maxDistanceSq, bestHits, ref currentMaxSq); this.QueryClosestNRecursive(rightChild, p, maxCount, maxDistanceSq, bestHits, ref currentMaxSq);
QueryClosestNRecursive(leftChild, p, maxCount, maxDistanceSq, bestHits, ref currentMaxSq); this.QueryClosestNRecursive(leftChild, p, maxCount, maxDistanceSq, bestHits, ref currentMaxSq);
} }
} }
} }
@@ -752,7 +751,7 @@ public class BvhTriangleMesh
public Vector3 ComputeMoveVectorToSurface(Vector3 p, float targetGap = 0f) public Vector3 ComputeMoveVectorToSurface(Vector3 p, float targetGap = 0f)
{ {
ClosestHit closestHit = QueryClosest(p); ClosestHit closestHit = this.QueryClosest(p);
if (closestHit.triangleIndex < 0) if (closestHit.triangleIndex < 0)
{ {
return Vector3.zero; return Vector3.zero;

View File

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

View File

@@ -1,9 +1,8 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts,
// for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies. // for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies.
// EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null // EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.ClothHumanoidMaskUtil // Eden.AutoMorpher.ClothHumanoidMaskUtil
using System.Collections.Generic; using System.Collections.Generic;
using Eden.AutoMorpher;
using UnityEngine; using UnityEngine;
public class ClothHumanoidMaskUtil public class ClothHumanoidMaskUtil
@@ -133,7 +132,7 @@ public class ClothHumanoidMaskUtil
} }
} }
clothInstance.excludedVertices = array; clothInstance.excludedVertices = array;
BuildLegVertexMasks(clothInstance); this.BuildLegVertexMasks(clothInstance);
void AddHierarchy(Transform root, bool includeRoot) void AddHierarchy(Transform root, bool includeRoot)
{ {
if (!(root == null)) if (!(root == null))

View File

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

View File

@@ -1,9 +1,8 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts,
// for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies. // for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies.
// EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null // EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.ClothInstanceTotal // Eden.AutoMorpher.ClothInstanceTotal
using System.Collections.Generic; using System.Collections.Generic;
using Eden.AutoMorpher;
using UnityEngine; using UnityEngine;
public class ClothInstanceTotal public class ClothInstanceTotal
@@ -35,33 +34,33 @@ public class ClothInstanceTotal
throw new AutoMorpherException("Distance Build Radius is Invalid", "[ClothInstanceTotal] ClothInstanceTotal\n - distanceBuildRadius must be > 0"); throw new AutoMorpherException("Distance Build Radius is Invalid", "[ClothInstanceTotal] ClothInstanceTotal\n - distanceBuildRadius must be > 0");
} }
this.clothInstances = clothInstances; this.clothInstances = clothInstances;
BuildTopologyCache(); this.BuildTopologyCache();
BuildDistanceAdjacencyCandidates(distanceBuildRadius, maxNeighborsPerVertex); this.BuildDistanceAdjacencyCandidates(distanceBuildRadius, maxNeighborsPerVertex);
BuildMergedAdjacency(); this.BuildMergedAdjacency();
} }
public void SetGlobalDeltas(Vector3[] globalDeltas) public void SetGlobalDeltas(Vector3[] globalDeltas)
{ {
if (globalDeltas == null || globalDeltas.Length != TotalVertexCount) if (globalDeltas == null || globalDeltas.Length != this.TotalVertexCount)
{ {
throw new AutoMorpherException("Global Deltas are Invalid", "[ClothInstanceTotal] SetGlobalDeltas\n - globalDeltas is null or length mismatch"); throw new AutoMorpherException("Global Deltas are Invalid", "[ClothInstanceTotal] SetGlobalDeltas\n - globalDeltas is null or length mismatch");
} }
GlobalDeltas = globalDeltas; this.GlobalDeltas = globalDeltas;
} }
public void UpdateGlobalBuffersFromClothInstances() public void UpdateGlobalBuffersFromClothInstances()
{ {
ValidateGlobalBufferReady("[ClothInstanceTotal] UpdateGlobalBuffersFromClothInstances"); this.ValidateGlobalBufferReady("[ClothInstanceTotal] UpdateGlobalBuffersFromClothInstances");
for (int i = 0; i < clothInstances.Count; i++) for (int i = 0; i < this.clothInstances.Count; i++)
{ {
ClothInstance clothInstance = clothInstances[i]; ClothInstance clothInstance = this.clothInstances[i];
if (clothInstance != null) if (clothInstance != null)
{ {
if (clothInstance.worldVertices == null || clothInstance.deltasLocal == null) if (clothInstance.worldVertices == null || clothInstance.deltasLocal == null)
{ {
throw new AutoMorpherException("Cloth Instance Data is Missing", "[ClothInstanceTotal] UpdateGlobalBuffersFromClothInstances\n - worldVertices or deltasLocal is null"); throw new AutoMorpherException("Cloth Instance Data is Missing", "[ClothInstanceTotal] UpdateGlobalBuffersFromClothInstances\n - worldVertices or deltasLocal is null");
} }
int num = VertexOffsets[i]; int num = this.VertexOffsets[i];
int num2 = clothInstance.worldVertices.Length; int num2 = clothInstance.worldVertices.Length;
if (num2 != clothInstance.deltasLocal.Length) if (num2 != clothInstance.deltasLocal.Length)
{ {
@@ -69,8 +68,8 @@ public class ClothInstanceTotal
} }
for (int j = 0; j < num2; j++) for (int j = 0; j < num2; j++)
{ {
GlobalPositions[num + j] = clothInstance.worldVertices[j]; this.GlobalPositions[num + j] = clothInstance.worldVertices[j];
GlobalDeltas[num + j] = clothInstance.deltasLocal[j]; this.GlobalDeltas[num + j] = clothInstance.deltasLocal[j];
} }
} }
} }
@@ -78,21 +77,21 @@ public class ClothInstanceTotal
public void ApplyGlobalDeltasToClothInstances() public void ApplyGlobalDeltasToClothInstances()
{ {
ValidateGlobalBufferReady("[ClothInstanceTotal] ApplyGlobalDeltasToClothInstances"); this.ValidateGlobalBufferReady("[ClothInstanceTotal] ApplyGlobalDeltasToClothInstances");
for (int i = 0; i < clothInstances.Count; i++) for (int i = 0; i < this.clothInstances.Count; i++)
{ {
ClothInstance clothInstance = clothInstances[i]; ClothInstance clothInstance = this.clothInstances[i];
if (clothInstance != null) if (clothInstance != null)
{ {
if (clothInstance.deltasLocal == null) if (clothInstance.deltasLocal == null)
{ {
throw new AutoMorpherException("Cloth Deltas are Missing", "[ClothInstanceTotal] ApplyGlobalDeltasToClothInstances\n - deltasLocal is null"); throw new AutoMorpherException("Cloth Deltas are Missing", "[ClothInstanceTotal] ApplyGlobalDeltasToClothInstances\n - deltasLocal is null");
} }
int num = VertexOffsets[i]; int num = this.VertexOffsets[i];
int num2 = clothInstance.deltasLocal.Length; int num2 = clothInstance.deltasLocal.Length;
for (int j = 0; j < num2; j++) for (int j = 0; j < num2; j++)
{ {
clothInstance.deltasLocal[j] = GlobalDeltas[num + j]; clothInstance.deltasLocal[j] = this.GlobalDeltas[num + j];
} }
} }
} }
@@ -100,11 +99,11 @@ public class ClothInstanceTotal
private void ValidateGlobalBufferReady(string functionContext) private void ValidateGlobalBufferReady(string functionContext)
{ {
if (clothInstances == null || clothInstances.Count == 0) if (this.clothInstances == null || this.clothInstances.Count == 0)
{ {
throw new AutoMorpherException("Cloth Instances are Missing", functionContext + "\n - clothInstances is null or empty"); throw new AutoMorpherException("Cloth Instances are Missing", functionContext + "\n - clothInstances is null or empty");
} }
if (TotalVertexCount <= 0 || GlobalPositions == null || GlobalDeltas == null || VertexOffsets == null || GlobalAdjacencyMerged == null) if (this.TotalVertexCount <= 0 || this.GlobalPositions == null || this.GlobalDeltas == null || this.VertexOffsets == null || this.GlobalAdjacencyMerged == null)
{ {
throw new AutoMorpherException("Cloth Instance Total Cache is Not Ready", functionContext + "\n - total/global buffers/merged adjacency are not initialized"); throw new AutoMorpherException("Cloth Instance Total Cache is Not Ready", functionContext + "\n - total/global buffers/merged adjacency are not initialized");
} }
@@ -112,20 +111,20 @@ public class ClothInstanceTotal
private void BuildTopologyCache() private void BuildTopologyCache()
{ {
TotalVertexCount = CalculateTotalVertexCount(clothInstances); this.TotalVertexCount = this.CalculateTotalVertexCount(this.clothInstances);
if (TotalVertexCount <= 0) if (this.TotalVertexCount <= 0)
{ {
throw new AutoMorpherException("Total Vertex Count is Zero", "[ClothInstanceTotal] BuildTopologyCache\n - TotalVertexCount <= 0"); throw new AutoMorpherException("Total Vertex Count is Zero", "[ClothInstanceTotal] BuildTopologyCache\n - TotalVertexCount <= 0");
} }
GlobalPositions = new Vector3[TotalVertexCount]; this.GlobalPositions = new Vector3[this.TotalVertexCount];
GlobalDeltas = new Vector3[TotalVertexCount]; this.GlobalDeltas = new Vector3[this.TotalVertexCount];
GlobalAdjacencyTopology = new List<int>[TotalVertexCount]; this.GlobalAdjacencyTopology = new List<int>[this.TotalVertexCount];
VertexOffsets = new int[clothInstances.Count]; this.VertexOffsets = new int[this.clothInstances.Count];
int num = 0; int num = 0;
for (int i = 0; i < clothInstances.Count; i++) for (int i = 0; i < this.clothInstances.Count; i++)
{ {
ClothInstance clothInstance = clothInstances[i]; ClothInstance clothInstance = this.clothInstances[i];
VertexOffsets[i] = num; this.VertexOffsets[i] = num;
if (clothInstance == null) if (clothInstance == null)
{ {
continue; continue;
@@ -141,10 +140,10 @@ public class ClothInstanceTotal
} }
for (int j = 0; j < num2; j++) for (int j = 0; j < num2; j++)
{ {
GlobalPositions[num + j] = clothInstance.worldVertices[j]; this.GlobalPositions[num + j] = clothInstance.worldVertices[j];
GlobalDeltas[num + j] = clothInstance.deltasLocal[j]; this.GlobalDeltas[num + j] = clothInstance.deltasLocal[j];
int capacity = clothInstance.vertexAdjacency[j]?.Count ?? 0; int capacity = clothInstance.vertexAdjacency[j]?.Count ?? 0;
GlobalAdjacencyTopology[num + j] = new List<int>(capacity); this.GlobalAdjacencyTopology[num + j] = new List<int>(capacity);
} }
for (int k = 0; k < num2; k++) for (int k = 0; k < num2; k++)
{ {
@@ -154,7 +153,7 @@ public class ClothInstanceTotal
continue; continue;
} }
int num3 = num + k; int num3 = num + k;
List<int> list2 = GlobalAdjacencyTopology[num3]; List<int> list2 = this.GlobalAdjacencyTopology[num3];
for (int l = 0; l < list.Count; l++) for (int l = 0; l < list.Count; l++)
{ {
int num4 = list[l]; int num4 = list[l];
@@ -171,30 +170,30 @@ public class ClothInstanceTotal
private void BuildDistanceAdjacencyCandidates(float radius, int maxNeighborsPerVertex) private void BuildDistanceAdjacencyCandidates(float radius, int maxNeighborsPerVertex)
{ {
if (GlobalPositions == null || GlobalPositions.Length == 0) if (this.GlobalPositions == null || this.GlobalPositions.Length == 0)
{ {
throw new AutoMorpherException("Reference Positions are Missing", "[ClothInstanceTotal] BuildDistanceAdjacencyCandidates\n - GlobalPositions is null or empty"); throw new AutoMorpherException("Reference Positions are Missing", "[ClothInstanceTotal] BuildDistanceAdjacencyCandidates\n - GlobalPositions is null or empty");
} }
GlobalAdjacencyDistance = BuildDistanceAdjacencyCandidatesInternal(GlobalPositions, radius, maxNeighborsPerVertex); this.GlobalAdjacencyDistance = this.BuildDistanceAdjacencyCandidatesInternal(this.GlobalPositions, radius, maxNeighborsPerVertex);
} }
private void BuildMergedAdjacency() private void BuildMergedAdjacency()
{ {
if (GlobalAdjacencyTopology == null || GlobalAdjacencyDistance == null) if (this.GlobalAdjacencyTopology == null || this.GlobalAdjacencyDistance == null)
{ {
throw new AutoMorpherException("Adjacency Inputs are Missing", "[ClothInstanceTotal] BuildMergedAdjacency\n - GlobalAdjacencyTopology or GlobalAdjacencyDistance is null"); throw new AutoMorpherException("Adjacency Inputs are Missing", "[ClothInstanceTotal] BuildMergedAdjacency\n - GlobalAdjacencyTopology or GlobalAdjacencyDistance is null");
} }
if (GlobalAdjacencyTopology.Length != GlobalAdjacencyDistance.Length) if (this.GlobalAdjacencyTopology.Length != this.GlobalAdjacencyDistance.Length)
{ {
throw new AutoMorpherException("Adjacency Length Mismatch", "[ClothInstanceTotal] BuildMergedAdjacency\n - topology and distance adjacency length differ"); throw new AutoMorpherException("Adjacency Length Mismatch", "[ClothInstanceTotal] BuildMergedAdjacency\n - topology and distance adjacency length differ");
} }
int num = GlobalAdjacencyTopology.Length; int num = this.GlobalAdjacencyTopology.Length;
GlobalAdjacencyMerged = new List<int>[num]; this.GlobalAdjacencyMerged = new List<int>[num];
for (int i = 0; i < num; i++) for (int i = 0; i < num; i++)
{ {
List<int> list = new List<int>((GlobalAdjacencyTopology[i]?.Count ?? 0) + (GlobalAdjacencyDistance[i]?.Count ?? 0)); List<int> list = new List<int>((this.GlobalAdjacencyTopology[i]?.Count ?? 0) + (this.GlobalAdjacencyDistance[i]?.Count ?? 0));
HashSet<int> hashSet = new HashSet<int>(); HashSet<int> hashSet = new HashSet<int>();
List<int> list2 = GlobalAdjacencyTopology[i]; List<int> list2 = this.GlobalAdjacencyTopology[i];
if (list2 != null) if (list2 != null)
{ {
for (int j = 0; j < list2.Count; j++) for (int j = 0; j < list2.Count; j++)
@@ -206,7 +205,7 @@ public class ClothInstanceTotal
} }
} }
} }
List<int> list3 = GlobalAdjacencyDistance[i]; List<int> list3 = this.GlobalAdjacencyDistance[i];
if (list3 != null) if (list3 != null)
{ {
for (int k = 0; k < list3.Count; k++) for (int k = 0; k < list3.Count; k++)
@@ -218,7 +217,7 @@ public class ClothInstanceTotal
} }
} }
} }
GlobalAdjacencyMerged[i] = list; this.GlobalAdjacencyMerged[i] = list;
} }
} }

View File

@@ -1,11 +1,10 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts,
// for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies. // for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies.
// EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null // EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.EdenAutoMorpher // Eden.AutoMorpher.EdenAutoMorpher
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using Eden.AutoMorpher;
using UnityEngine; using UnityEngine;
public class EdenAutoMorpher : MonoBehaviour public class EdenAutoMorpher : MonoBehaviour
@@ -101,28 +100,28 @@ public class EdenAutoMorpher : MonoBehaviour
public ProcessInfo GetProcessInfo() public ProcessInfo GetProcessInfo()
{ {
return processInfo; return this.processInfo;
} }
public void ChangeMode(MorpherMode newMode) public void ChangeMode(MorpherMode newMode)
{ {
morpherMode = newMode; this.morpherMode = newMode;
morpherState = MorpherState.Idle; this.morpherState = MorpherState.Idle;
} }
public void StopProcess() public void StopProcess()
{ {
doProcess = false; this.doProcess = false;
switch (morpherState) switch (this.morpherState)
{ {
case MorpherState.Fitting_Doing: case MorpherState.Fitting_Doing:
morpherState = MorpherState.Idle; this.morpherState = MorpherState.Idle;
break; break;
case MorpherState.Weighting_Doing: case MorpherState.Weighting_Doing:
morpherState = MorpherState.Fitting_End; this.morpherState = MorpherState.Fitting_End;
break; break;
default: default:
morpherState = MorpherState.Idle; this.morpherState = MorpherState.Idle;
break; break;
} }
} }
@@ -134,16 +133,16 @@ public class EdenAutoMorpher : MonoBehaviour
{ {
case MorpherMode.AutoMorpher: case MorpherMode.AutoMorpher:
case MorpherMode.ManualMorpher: case MorpherMode.ManualMorpher:
result.sourceAvatarObject = sourceAvatarObject; result.sourceAvatarObject = this.sourceAvatarObject;
result.sourceClothesObject = sourceClothesObject; result.sourceClothesObject = this.sourceClothesObject;
result.sourceBodyMeshes = sourceBodyMeshesReadOnly; result.sourceBodyMeshes = this.sourceBodyMeshesReadOnly;
result.profileName = string.Empty; result.profileName = string.Empty;
break; break;
case MorpherMode.ProfileMorpher: case MorpherMode.ProfileMorpher:
result.sourceAvatarObject = null; result.sourceAvatarObject = null;
result.sourceClothesObject = sourceClothesObject; result.sourceClothesObject = this.sourceClothesObject;
result.sourceBodyMeshes = null; result.sourceBodyMeshes = null;
result.profileName = profileName; result.profileName = this.profileName;
break; break;
default: default:
result.sourceAvatarObject = null; result.sourceAvatarObject = null;
@@ -152,84 +151,84 @@ public class EdenAutoMorpher : MonoBehaviour
result.profileName = string.Empty; result.profileName = string.Empty;
break; break;
} }
result.targetAvatarObject = targetAvatarObject; result.targetAvatarObject = this.targetAvatarObject;
result.targetClothesObject = targetClothesObject; result.targetClothesObject = this.targetClothesObject;
result.targetBodyMeshes = targetBodyMeshesReadOnly; result.targetBodyMeshes = this.targetBodyMeshesReadOnly;
result.minMargin = minMargin; result.minMargin = this.minMargin;
result.worldRadius = worldRadius; result.worldRadius = this.worldRadius;
result.sigma = sigma; result.sigma = this.sigma;
result.smoothingIteration = smoothingIteration; result.smoothingIteration = this.smoothingIteration;
result.fittingExpandIteration = fittingExpandIteration; result.fittingExpandIteration = this.fittingExpandIteration;
result.fittingShrinkIteration = fittingShrinkIteration; result.fittingShrinkIteration = this.fittingShrinkIteration;
result.isBodyAutoSetup = isBodyAutoSetup; result.isBodyAutoSetup = this.isBodyAutoSetup;
result.isReparentAccessoryBonesToTargetAvatar = isReparentAccessoryBonesToTargetAvatar; result.isReparentAccessoryBonesToTargetAvatar = this.isReparentAccessoryBonesToTargetAvatar;
result.skipFootFitting = skipFootFitting; result.skipFootFitting = this.skipFootFitting;
result.clothesHumanoidMatchedBones = clothesHumanoidMatchedBones; result.clothesHumanoidMatchedBones = this.clothesHumanoidMatchedBones;
result.clothBoneTypeMap = clothBoneTypeMap; result.clothBoneTypeMap = this.clothBoneTypeMap;
result.tagEdenMorpehrCloth = tagEdenMorpehrCloth; result.tagEdenMorpehrCloth = this.tagEdenMorpehrCloth;
result.transferWeightToAvatar = transferWeightToAvatar; result.transferWeightToAvatar = this.transferWeightToAvatar;
result.addAnchorBone = addAnchorBone; result.addAnchorBone = this.addAnchorBone;
result.armatureBoneScaleCopy = armatureBoneScaleCopy; result.armatureBoneScaleCopy = this.armatureBoneScaleCopy;
result.isRemoveAutoMorphedClothes = isRemoveAutoMorphedClothes; result.isRemoveAutoMorphedClothes = this.isRemoveAutoMorphedClothes;
return result; return result;
} }
public void AutoPoseSetup(MorpherMode morpherMode) public void AutoPoseSetup(MorpherMode morpherMode)
{ {
TransformInfo transformInfo = new TransformInfo(sourceAvatarObject.transform); TransformInfo transformInfo = new TransformInfo(this.sourceAvatarObject.transform);
TransformInfo transformInfo2 = new TransformInfo(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();
sourceBodyMeshesReadOnly = edenAutoMorpher_SetUpUtil.SetupBodyMeshes(sourceAvatarObject, isBodyAutoSetup, sourceBodyMeshes, "Source ").AsReadOnly(); this.sourceBodyMeshesReadOnly = edenAutoMorpher_SetUpUtil.SetupBodyMeshes(this.sourceAvatarObject, this.isBodyAutoSetup, this.sourceBodyMeshes, "Source ").AsReadOnly();
targetBodyMeshesReadOnly = edenAutoMorpher_SetUpUtil.SetupBodyMeshes(targetAvatarObject, isBodyAutoSetup, targetBodyMeshes, "Target ").AsReadOnly(); this.targetBodyMeshesReadOnly = edenAutoMorpher_SetUpUtil.SetupBodyMeshes(this.targetAvatarObject, this.isBodyAutoSetup, this.targetBodyMeshes, "Target ").AsReadOnly();
targetAvatarObject.transform.SetParent(null, worldPositionStays: true); this.targetAvatarObject.transform.SetParent(null, worldPositionStays: true);
targetAvatarObject.transform.localRotation = Quaternion.identity; this.targetAvatarObject.transform.localRotation = Quaternion.identity;
sourceAvatarObject.transform.SetParent(null, worldPositionStays: true); this.sourceAvatarObject.transform.SetParent(null, worldPositionStays: true);
sourceAvatarObject.transform.localRotation = Quaternion.identity; this.sourceAvatarObject.transform.localRotation = Quaternion.identity;
EdenAutoMorpherConfig config = SetupConfigData(morpherMode); EdenAutoMorpherConfig config = this.SetupConfigData(morpherMode);
new EdenAutoMorpher_SetUpUtil().AutoSetup(ref config, out clothesHumanoidMatchedBones, out clothBoneTypeMap); new EdenAutoMorpher_SetUpUtil().AutoSetup(ref config, out this.clothesHumanoidMatchedBones, out this.clothBoneTypeMap);
targetClothesObject = config.targetClothesObject; this.targetClothesObject = config.targetClothesObject;
targetClothesObjectOriginal = targetClothesObject; this.targetClothesObjectOriginal = this.targetClothesObject;
} }
finally finally
{ {
transformInfo.ApplyToTransform(sourceAvatarObject.transform, applyParent: true, applyPosition: false, applyRotation: true, applyScale: true); transformInfo.ApplyToTransform(this.sourceAvatarObject.transform, applyParent: true, applyPosition: false, applyRotation: true, applyScale: true);
transformInfo2.ApplyToTransform(targetAvatarObject.transform, applyParent: true, applyPosition: false, applyRotation: true, applyScale: true); transformInfo2.ApplyToTransform(this.targetAvatarObject.transform, applyParent: true, applyPosition: false, applyRotation: true, applyScale: true);
} }
} }
public void ProfileSetup(MorpherMode morpherMode) public void ProfileSetup(MorpherMode morpherMode)
{ {
TransformInfo transformInfo = new TransformInfo(sourceClothesObject.transform); TransformInfo transformInfo = new TransformInfo(this.sourceClothesObject.transform);
TransformInfo transformInfo2 = new TransformInfo(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();
targetBodyMeshesReadOnly = edenAutoMorpher_SetUpUtil.SetupBodyMeshes(targetAvatarObject, isBodyAutoSetup, targetBodyMeshes, "Target ").AsReadOnly(); this.targetBodyMeshesReadOnly = edenAutoMorpher_SetUpUtil.SetupBodyMeshes(this.targetAvatarObject, this.isBodyAutoSetup, this.targetBodyMeshes, "Target ").AsReadOnly();
targetAvatarObject.transform.SetParent(null, worldPositionStays: true); this.targetAvatarObject.transform.SetParent(null, worldPositionStays: true);
targetAvatarObject.transform.localRotation = Quaternion.identity; this.targetAvatarObject.transform.localRotation = Quaternion.identity;
sourceClothesObject.transform.SetParent(null, worldPositionStays: true); this.sourceClothesObject.transform.SetParent(null, worldPositionStays: true);
sourceClothesObject.transform.localScale = Vector3.one; this.sourceClothesObject.transform.localScale = Vector3.one;
sourceClothesObject.transform.localRotation = Quaternion.identity; this.sourceClothesObject.transform.localRotation = Quaternion.identity;
EdenAutoMorpherConfig config = SetupConfigData(morpherMode); EdenAutoMorpherConfig config = this.SetupConfigData(morpherMode);
new EdenAutoMorpher_SetUpUtil().ProfileAutoSetup(ref config, out clothesHumanoidMatchedBones, out clothBoneTypeMap); new EdenAutoMorpher_SetUpUtil().ProfileAutoSetup(ref config, out this.clothesHumanoidMatchedBones, out this.clothBoneTypeMap);
targetClothesObject = config.targetClothesObject; this.targetClothesObject = config.targetClothesObject;
targetClothesObjectOriginal = targetClothesObject; this.targetClothesObjectOriginal = this.targetClothesObject;
} }
finally finally
{ {
transformInfo.ApplyToTransform(sourceClothesObject.transform, applyParent: true, applyPosition: false, applyRotation: true, applyScale: true); transformInfo.ApplyToTransform(this.sourceClothesObject.transform, applyParent: true, applyPosition: false, applyRotation: true, applyScale: true);
transformInfo2.ApplyToTransform(targetAvatarObject.transform, applyParent: true, applyPosition: false, applyRotation: true, applyScale: true); transformInfo2.ApplyToTransform(this.targetAvatarObject.transform, applyParent: true, applyPosition: false, applyRotation: true, applyScale: true);
} }
} }
public IEnumerator AutoMorphingEnumerator(MorpherMode morpherMode) public IEnumerator AutoMorphingEnumerator(MorpherMode morpherMode)
{ {
doProcess = true; this.doProcess = true;
yield return null; yield return null;
ProcessInfoDebug(morpherMode, "Run ALL"); this.ProcessInfoDebug(morpherMode, "Run ALL");
morpherState = MorpherState.Fitting_Doing; this.morpherState = MorpherState.Fitting_Doing;
IEnumerator fitEnum = null; IEnumerator fitEnum = null;
this.morpherMode = morpherMode; this.morpherMode = morpherMode;
yield return null; yield return null;
@@ -237,151 +236,151 @@ public class EdenAutoMorpher : MonoBehaviour
switch (morpherMode) switch (morpherMode)
{ {
case MorpherMode.AutoMorpher: case MorpherMode.AutoMorpher:
fitEnum = AutoFitting(morpherMode); fitEnum = this.AutoFitting(morpherMode);
break; break;
case MorpherMode.ManualMorpher: case MorpherMode.ManualMorpher:
fitEnum = ManualFitting(morpherMode); fitEnum = this.ManualFitting(morpherMode);
break; break;
case MorpherMode.ProfileMorpher: case MorpherMode.ProfileMorpher:
fitEnum = ProfileFitting(morpherMode); fitEnum = this.ProfileFitting(morpherMode);
break; break;
default: default:
Debug.LogError("Unknown Mode Index"); Debug.LogError("Unknown Mode Index");
break; break;
} }
while (fitEnum != null && fitEnum.MoveNext() && doProcess) while (fitEnum != null && fitEnum.MoveNext() && this.doProcess)
{ {
yield return fitEnum.Current; yield return fitEnum.Current;
} }
morpherState = MorpherState.Fitting_End; this.morpherState = MorpherState.Fitting_End;
yield return null; yield return null;
morpherState = MorpherState.Weighting_Doing; this.morpherState = MorpherState.Weighting_Doing;
yield return null; yield return null;
Debug.Log("[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 = SetupConfigData(morpherMode); EdenAutoMorpherConfig config = this.SetupConfigData(morpherMode);
IEnumerator eamFitting = eamManager.WeightingEnumerator(config); IEnumerator eamFitting = eamManager.WeightingEnumerator(config);
while (eamFitting.MoveNext() && doProcess) while (eamFitting.MoveNext() && this.doProcess)
{ {
ref string title = ref processInfo.title; ref string title = ref this.processInfo.title;
ref string text = ref processInfo.text; ref string text = ref this.processInfo.text;
ref float progress = ref processInfo.progress; ref float progress = ref this.processInfo.progress;
(title, text, progress) = eamManager.GetProgressInfo(); (title, text, progress) = eamManager.GetProgressInfo();
yield return eamFitting.Current; yield return eamFitting.Current;
} }
} }
yield return null; yield return null;
doProcess = false; this.doProcess = false;
morpherState = MorpherState.Idle; this.morpherState = MorpherState.Idle;
Debug.Log("[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)
{ {
doProcess = true; this.doProcess = true;
ref string title = ref processInfo.title; ref string title = ref this.processInfo.title;
ref string text = ref processInfo.text; ref string text = ref this.processInfo.text;
ref float progress = ref processInfo.progress; ref float progress = ref this.processInfo.progress;
title = "Setup Avatar Pose"; title = "Setup Avatar Pose";
text = "Calculating avatar shape and skeletal data."; text = "Calculating avatar shape and skeletal data.";
progress = 0f; progress = 0f;
yield return null; yield return null;
ProcessInfoDebug(morpherMode, "Fitting"); this.ProcessInfoDebug(morpherMode, "Fitting");
yield return null; yield return null;
morpherState = MorpherState.Fitting_Doing; this.morpherState = MorpherState.Fitting_Doing;
IEnumerator fitEnum = null; IEnumerator fitEnum = null;
this.morpherMode = morpherMode; this.morpherMode = morpherMode;
yield return null; yield return null;
switch (morpherMode) switch (morpherMode)
{ {
case MorpherMode.AutoMorpher: case MorpherMode.AutoMorpher:
fitEnum = AutoFitting(morpherMode); fitEnum = this.AutoFitting(morpherMode);
break; break;
case MorpherMode.ManualMorpher: case MorpherMode.ManualMorpher:
fitEnum = ManualFitting(morpherMode); fitEnum = this.ManualFitting(morpherMode);
break; break;
case MorpherMode.ProfileMorpher: case MorpherMode.ProfileMorpher:
fitEnum = ProfileFitting(morpherMode); fitEnum = this.ProfileFitting(morpherMode);
break; break;
default: default:
Debug.LogError("Unknown Mode Index"); Debug.LogError("Unknown Mode Index");
break; break;
} }
while (fitEnum != null && fitEnum.MoveNext() && doProcess) while (fitEnum != null && fitEnum.MoveNext() && this.doProcess)
{ {
yield return null; yield return null;
} }
morpherState = MorpherState.Fitting_End; this.morpherState = MorpherState.Fitting_End;
yield return null; yield return null;
doProcess = false; this.doProcess = false;
Debug.Log("[Eden Auto Morpher] Ended Fitting"); Debug.Log("[Eden Auto Morpher] Ended Fitting");
yield return null; yield return null;
} }
public IEnumerator WeightingEnumerator() public IEnumerator WeightingEnumerator()
{ {
morpherState = MorpherState.Weighting_Doing; this.morpherState = MorpherState.Weighting_Doing;
doProcess = true; this.doProcess = true;
yield return null; yield return null;
ProcessInfoDebug(morpherMode, "Weighting"); this.ProcessInfoDebug(this.morpherMode, "Weighting");
using (EdenAutoMorpherManager eamManager = new EdenAutoMorpherManager()) using (EdenAutoMorpherManager eamManager = new EdenAutoMorpherManager())
{ {
EdenAutoMorpherConfig config = SetupConfigData(MorpherMode.ETC); EdenAutoMorpherConfig config = this.SetupConfigData(MorpherMode.ETC);
IEnumerator eamFitting = eamManager.WeightingEnumerator(config); IEnumerator eamFitting = eamManager.WeightingEnumerator(config);
while (eamFitting.MoveNext() && doProcess) while (eamFitting.MoveNext() && this.doProcess)
{ {
ref string title = ref processInfo.title; ref string title = ref this.processInfo.title;
ref string text = ref processInfo.text; ref string text = ref this.processInfo.text;
ref float progress = ref processInfo.progress; ref float progress = ref this.processInfo.progress;
(title, text, progress) = eamManager.GetProgressInfo(); (title, text, progress) = eamManager.GetProgressInfo();
yield return eamFitting.Current; yield return eamFitting.Current;
} }
} }
yield return null; yield return null;
doProcess = false; this.doProcess = false;
morpherState = MorpherState.Idle; this.morpherState = MorpherState.Idle;
Debug.Log("[Eden Auto Morpher] Ended Weighting"); Debug.Log("[Eden Auto Morpher] Ended Weighting");
yield return null; yield return null;
} }
public IEnumerator AutoFitting(MorpherMode morpherMode) public IEnumerator AutoFitting(MorpherMode morpherMode)
{ {
TransformInfo sourceAvatarInfo = new TransformInfo(sourceAvatarObject.transform); TransformInfo sourceAvatarInfo = new TransformInfo(this.sourceAvatarObject.transform);
TransformInfo targetAvatarInfo = new TransformInfo(targetAvatarObject.transform); TransformInfo targetAvatarInfo = new TransformInfo(this.targetAvatarObject.transform);
try try
{ {
EdenAutoMorpher_SetUpUtil edenAutoMorpher_SetUpUtil = new EdenAutoMorpher_SetUpUtil(); EdenAutoMorpher_SetUpUtil edenAutoMorpher_SetUpUtil = new EdenAutoMorpher_SetUpUtil();
sourceBodyMeshesReadOnly = edenAutoMorpher_SetUpUtil.SetupBodyMeshes(sourceAvatarObject, isBodyAutoSetup, sourceBodyMeshes, "Source ").AsReadOnly(); this.sourceBodyMeshesReadOnly = edenAutoMorpher_SetUpUtil.SetupBodyMeshes(this.sourceAvatarObject, this.isBodyAutoSetup, this.sourceBodyMeshes, "Source ").AsReadOnly();
targetBodyMeshesReadOnly = edenAutoMorpher_SetUpUtil.SetupBodyMeshes(targetAvatarObject, isBodyAutoSetup, targetBodyMeshes, "Target ").AsReadOnly(); this.targetBodyMeshesReadOnly = edenAutoMorpher_SetUpUtil.SetupBodyMeshes(this.targetAvatarObject, this.isBodyAutoSetup, this.targetBodyMeshes, "Target ").AsReadOnly();
targetAvatarObject.transform.SetParent(null, worldPositionStays: true); this.targetAvatarObject.transform.SetParent(null, worldPositionStays: true);
targetAvatarObject.transform.localRotation = Quaternion.identity; this.targetAvatarObject.transform.localRotation = Quaternion.identity;
sourceAvatarObject.transform.SetParent(null, worldPositionStays: true); this.sourceAvatarObject.transform.SetParent(null, worldPositionStays: true);
sourceAvatarObject.transform.localRotation = Quaternion.identity; this.sourceAvatarObject.transform.localRotation = Quaternion.identity;
EdenAutoMorpherConfig configData = SetupConfigData(morpherMode); EdenAutoMorpherConfig configData = this.SetupConfigData(morpherMode);
new EdenAutoMorpher_SetUpUtil().AutoSetup(ref configData, out clothesHumanoidMatchedBones, out clothBoneTypeMap); new EdenAutoMorpher_SetUpUtil().AutoSetup(ref configData, out this.clothesHumanoidMatchedBones, out this.clothBoneTypeMap);
targetClothesObject = configData.targetClothesObject; this.targetClothesObject = configData.targetClothesObject;
targetClothesObjectOriginal = targetClothesObject; this.targetClothesObjectOriginal = this.targetClothesObject;
yield return null; yield return null;
fittedTargetAvatar = null; this.fittedTargetAvatar = null;
fittedTargetClothes = null; this.fittedTargetClothes = null;
yield return null; yield return null;
configData = SetupConfigData(morpherMode); configData = this.SetupConfigData(morpherMode);
using (EdenAutoMorpherManager eamManager = new EdenAutoMorpherManager()) using (EdenAutoMorpherManager eamManager = new EdenAutoMorpherManager())
{ {
IEnumerator eamFitting = eamManager.FittingIteration(configData, morpherMode); IEnumerator eamFitting = eamManager.FittingIteration(configData, morpherMode);
while (eamFitting.MoveNext() && doProcess) while (eamFitting.MoveNext() && this.doProcess)
{ {
ref string title = ref processInfo.title; ref string title = ref this.processInfo.title;
ref string text = ref processInfo.text; ref string text = ref this.processInfo.text;
ref float progress = ref processInfo.progress; ref float progress = ref this.processInfo.progress;
(title, text, progress) = eamManager.GetProgressInfo(); (title, text, progress) = eamManager.GetProgressInfo();
yield return eamFitting.Current; yield return eamFitting.Current;
} }
} }
fittedTargetAvatar = configData.targetAvatarObject; this.fittedTargetAvatar = configData.targetAvatarObject;
fittedTargetClothes = configData.targetClothesObject; this.fittedTargetClothes = configData.targetClothesObject;
} }
finally finally
{ {
@@ -394,34 +393,34 @@ public class EdenAutoMorpher : MonoBehaviour
public IEnumerator ManualFitting(MorpherMode morpherMode) public IEnumerator ManualFitting(MorpherMode morpherMode)
{ {
TransformInfo sourceAvatarInfo = new TransformInfo(sourceAvatarObject.transform); TransformInfo sourceAvatarInfo = new TransformInfo(this.sourceAvatarObject.transform);
TransformInfo targetAvatarInfo = new TransformInfo(targetAvatarObject.transform); TransformInfo targetAvatarInfo = new TransformInfo(this.targetAvatarObject.transform);
try try
{ {
EdenAutoMorpher_SetUpUtil edenAutoMorpher_SetUpUtil = new EdenAutoMorpher_SetUpUtil(); EdenAutoMorpher_SetUpUtil edenAutoMorpher_SetUpUtil = new EdenAutoMorpher_SetUpUtil();
sourceBodyMeshesReadOnly = edenAutoMorpher_SetUpUtil.SetupBodyMeshes(sourceAvatarObject, isBodyAutoSetup, sourceBodyMeshes, "Source ").AsReadOnly(); this.sourceBodyMeshesReadOnly = edenAutoMorpher_SetUpUtil.SetupBodyMeshes(this.sourceAvatarObject, this.isBodyAutoSetup, this.sourceBodyMeshes, "Source ").AsReadOnly();
targetBodyMeshesReadOnly = edenAutoMorpher_SetUpUtil.SetupBodyMeshes(targetAvatarObject, isBodyAutoSetup, targetBodyMeshes, "Target ").AsReadOnly(); this.targetBodyMeshesReadOnly = edenAutoMorpher_SetUpUtil.SetupBodyMeshes(this.targetAvatarObject, this.isBodyAutoSetup, this.targetBodyMeshes, "Target ").AsReadOnly();
targetClothesObject = targetClothesObjectOriginal; this.targetClothesObject = this.targetClothesObjectOriginal;
EdenAutoMorpherConfig configData = SetupConfigData(morpherMode); EdenAutoMorpherConfig configData = this.SetupConfigData(morpherMode);
new EdenAutoMorpher_SetUpUtil().ManulSetup(ref configData, out clothesHumanoidMatchedBones, out clothBoneTypeMap); new EdenAutoMorpher_SetUpUtil().ManulSetup(ref configData, out this.clothesHumanoidMatchedBones, out this.clothBoneTypeMap);
yield return null; yield return null;
fittedTargetAvatar = null; this.fittedTargetAvatar = null;
fittedTargetClothes = null; this.fittedTargetClothes = null;
configData = SetupConfigData(morpherMode); configData = this.SetupConfigData(morpherMode);
using (EdenAutoMorpherManager eamManager = new EdenAutoMorpherManager()) using (EdenAutoMorpherManager eamManager = new EdenAutoMorpherManager())
{ {
IEnumerator eamFitting = eamManager.FittingIteration(configData, morpherMode); IEnumerator eamFitting = eamManager.FittingIteration(configData, morpherMode);
while (eamFitting.MoveNext() && doProcess) while (eamFitting.MoveNext() && this.doProcess)
{ {
ref string title = ref processInfo.title; ref string title = ref this.processInfo.title;
ref string text = ref processInfo.text; ref string text = ref this.processInfo.text;
ref float progress = ref processInfo.progress; ref float progress = ref this.processInfo.progress;
(title, text, progress) = eamManager.GetProgressInfo(); (title, text, progress) = eamManager.GetProgressInfo();
yield return eamFitting.Current; yield return eamFitting.Current;
} }
} }
fittedTargetAvatar = configData.targetAvatarObject; this.fittedTargetAvatar = configData.targetAvatarObject;
fittedTargetClothes = configData.targetClothesObject; this.fittedTargetClothes = configData.targetClothesObject;
} }
finally finally
{ {
@@ -434,40 +433,40 @@ public class EdenAutoMorpher : MonoBehaviour
public IEnumerator ProfileFitting(MorpherMode morpherMode) public IEnumerator ProfileFitting(MorpherMode morpherMode)
{ {
TransformInfo sourceClothesInfo = new TransformInfo(sourceClothesObject.transform); TransformInfo sourceClothesInfo = new TransformInfo(this.sourceClothesObject.transform);
TransformInfo targetAvatarInfo = new TransformInfo(targetAvatarObject.transform); TransformInfo targetAvatarInfo = new TransformInfo(this.targetAvatarObject.transform);
try try
{ {
EdenAutoMorpher_SetUpUtil edenAutoMorpher_SetUpUtil = new EdenAutoMorpher_SetUpUtil(); EdenAutoMorpher_SetUpUtil edenAutoMorpher_SetUpUtil = new EdenAutoMorpher_SetUpUtil();
targetBodyMeshesReadOnly = edenAutoMorpher_SetUpUtil.SetupBodyMeshes(targetAvatarObject, isBodyAutoSetup, targetBodyMeshes, "Target ").AsReadOnly(); this.targetBodyMeshesReadOnly = edenAutoMorpher_SetUpUtil.SetupBodyMeshes(this.targetAvatarObject, this.isBodyAutoSetup, this.targetBodyMeshes, "Target ").AsReadOnly();
targetAvatarObject.transform.SetParent(null, worldPositionStays: true); this.targetAvatarObject.transform.SetParent(null, worldPositionStays: true);
targetAvatarObject.transform.localRotation = Quaternion.identity; this.targetAvatarObject.transform.localRotation = Quaternion.identity;
sourceClothesObject.transform.SetParent(null, worldPositionStays: true); this.sourceClothesObject.transform.SetParent(null, worldPositionStays: true);
sourceClothesObject.transform.localScale = Vector3.one; this.sourceClothesObject.transform.localScale = Vector3.one;
sourceClothesObject.transform.localRotation = Quaternion.identity; this.sourceClothesObject.transform.localRotation = Quaternion.identity;
EdenAutoMorpherConfig configData = SetupConfigData(morpherMode); EdenAutoMorpherConfig configData = this.SetupConfigData(morpherMode);
new EdenAutoMorpher_SetUpUtil().ProfileAutoSetup(ref configData, out clothesHumanoidMatchedBones, out clothBoneTypeMap); new EdenAutoMorpher_SetUpUtil().ProfileAutoSetup(ref configData, out this.clothesHumanoidMatchedBones, out this.clothBoneTypeMap);
targetClothesObject = configData.targetClothesObject; this.targetClothesObject = configData.targetClothesObject;
targetClothesObjectOriginal = targetClothesObject; this.targetClothesObjectOriginal = this.targetClothesObject;
yield return null; yield return null;
fittedTargetAvatar = null; this.fittedTargetAvatar = null;
fittedTargetClothes = null; this.fittedTargetClothes = null;
yield return null; yield return null;
configData = SetupConfigData(morpherMode); configData = this.SetupConfigData(morpherMode);
using (EdenAutoMorpherManager eamManager = new EdenAutoMorpherManager()) using (EdenAutoMorpherManager eamManager = new EdenAutoMorpherManager())
{ {
IEnumerator eamFitting = eamManager.FittingIteration(configData, morpherMode); IEnumerator eamFitting = eamManager.FittingIteration(configData, morpherMode);
while (eamFitting.MoveNext() && doProcess) while (eamFitting.MoveNext() && this.doProcess)
{ {
ref string title = ref processInfo.title; ref string title = ref this.processInfo.title;
ref string text = ref processInfo.text; ref string text = ref this.processInfo.text;
ref float progress = ref processInfo.progress; ref float progress = ref this.processInfo.progress;
(title, text, progress) = eamManager.GetProgressInfo(); (title, text, progress) = eamManager.GetProgressInfo();
yield return eamFitting.Current; yield return eamFitting.Current;
} }
} }
fittedTargetAvatar = configData.targetAvatarObject; this.fittedTargetAvatar = configData.targetAvatarObject;
fittedTargetClothes = configData.targetClothesObject; this.fittedTargetClothes = configData.targetClothesObject;
yield return null; yield return null;
} }
finally finally
@@ -480,10 +479,10 @@ public class EdenAutoMorpher : MonoBehaviour
public bool IsWeightingReady(bool isAutoMode) public bool IsWeightingReady(bool isAutoMode)
{ {
bool flag = morpherState == MorpherState.Fitting_End && fittedTargetAvatar != null && fittedTargetAvatar == targetAvatarObject; bool flag = this.morpherState == MorpherState.Fitting_End && this.fittedTargetAvatar != null && this.fittedTargetAvatar == this.targetAvatarObject;
if (!isAutoMode) if (!isAutoMode)
{ {
flag = flag && fittedTargetClothes == targetClothesObjectOriginal; flag = flag && this.fittedTargetClothes == this.targetClothesObjectOriginal;
} }
return flag; return flag;
} }
@@ -492,7 +491,7 @@ 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 = SetupConfigData(morpherMode); EdenAutoMorpherConfig edenAutoMorpherConfig = this.SetupConfigData(morpherMode);
string text = ((edenAutoMorpherConfig.sourceAvatarObject != null) ? edenAutoMorpherConfig.sourceAvatarObject.name : "null"); string text = ((edenAutoMorpherConfig.sourceAvatarObject != null) ? edenAutoMorpherConfig.sourceAvatarObject.name : "null");
string text2 = ((edenAutoMorpherConfig.sourceClothesObject != null) ? edenAutoMorpherConfig.sourceClothesObject.name : "null"); string text2 = ((edenAutoMorpherConfig.sourceClothesObject != null) ? edenAutoMorpherConfig.sourceClothesObject.name : "null");
string text3 = ((edenAutoMorpherConfig.targetAvatarObject != null) ? edenAutoMorpherConfig.targetAvatarObject.name : "null"); string text3 = ((edenAutoMorpherConfig.targetAvatarObject != null) ? edenAutoMorpherConfig.targetAvatarObject.name : "null");
@@ -553,26 +552,26 @@ public class EdenAutoMorpher : MonoBehaviour
} }
else else
{ {
stringBuilder.AppendLine($"- sourceBodyMeshes Count: {sourceBodyMeshes.Count}"); stringBuilder.AppendLine($"- sourceBodyMeshes Count: {this.sourceBodyMeshes.Count}");
for (int k = 0; k < sourceBodyMeshes.Count; k++) for (int k = 0; k < this.sourceBodyMeshes.Count; k++)
{ {
SkinnedMeshRenderer skinnedMeshRenderer3 = sourceBodyMeshes[k]; SkinnedMeshRenderer skinnedMeshRenderer3 = this.sourceBodyMeshes[k];
string text11 = ((skinnedMeshRenderer3 != null) ? skinnedMeshRenderer3.name : "null"); string text11 = ((skinnedMeshRenderer3 != null) ? skinnedMeshRenderer3.name : "null");
string text12 = ((skinnedMeshRenderer3 != null && skinnedMeshRenderer3.rootBone != null) ? skinnedMeshRenderer3.rootBone.name : "null"); string text12 = ((skinnedMeshRenderer3 != null && skinnedMeshRenderer3.rootBone != null) ? skinnedMeshRenderer3.rootBone.name : "null");
string text13 = ((skinnedMeshRenderer3 != null && skinnedMeshRenderer3.sharedMesh != null) ? skinnedMeshRenderer3.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}");
} }
} }
if (targetBodyMeshes == null) if (this.targetBodyMeshes == null)
{ {
stringBuilder.AppendLine("- targetBodyMeshes: null"); stringBuilder.AppendLine("- targetBodyMeshes: null");
} }
else else
{ {
stringBuilder.AppendLine($"- targetBodyMeshes Count: {targetBodyMeshes.Count}"); stringBuilder.AppendLine($"- targetBodyMeshes Count: {this.targetBodyMeshes.Count}");
for (int l = 0; l < targetBodyMeshes.Count; l++) for (int l = 0; l < this.targetBodyMeshes.Count; l++)
{ {
SkinnedMeshRenderer skinnedMeshRenderer4 = targetBodyMeshes[l]; SkinnedMeshRenderer skinnedMeshRenderer4 = this.targetBodyMeshes[l];
string text14 = ((skinnedMeshRenderer4 != null) ? skinnedMeshRenderer4.name : "null"); string text14 = ((skinnedMeshRenderer4 != null) ? skinnedMeshRenderer4.name : "null");
string text15 = ((skinnedMeshRenderer4 != null && skinnedMeshRenderer4.rootBone != null) ? skinnedMeshRenderer4.rootBone.name : "null"); string text15 = ((skinnedMeshRenderer4 != null && skinnedMeshRenderer4.rootBone != null) ? skinnedMeshRenderer4.rootBone.name : "null");
string text16 = ((skinnedMeshRenderer4 != null && skinnedMeshRenderer4.sharedMesh != null) ? skinnedMeshRenderer4.sharedMesh.name : "null"); string text16 = ((skinnedMeshRenderer4 != null && skinnedMeshRenderer4.sharedMesh != null) ? skinnedMeshRenderer4.sharedMesh.name : "null");

View File

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

View File

@@ -1,13 +1,12 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts,
// for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies. // for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies.
// EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null // EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.EdenAutoMorpherManager // Eden.AutoMorpher.EdenAutoMorpherManager
using Eden.AutoMorpher;
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using Eden.AutoMorpher;
using Eden.AutoMorpher.profile;
using UnityEditor; using UnityEditor;
using UnityEngine; using UnityEngine;
@@ -23,19 +22,19 @@ public class EdenAutoMorpherManager : IDisposable
public (string, string, float) GetProgressInfo() public (string, string, float) GetProgressInfo()
{ {
return (displayTitle, displayText, displayProgress); return (this.displayTitle, this.displayText, this.displayProgress);
} }
private void SetupProgress(string title, string text, float progress) private void SetupProgress(string title, string text, float progress)
{ {
displayTitle = title; this.displayTitle = title;
displayText = text; this.displayText = text;
displayProgress = progress; this.displayProgress = progress;
} }
private IEnumerator SetupClothInstances(GameObject targetClothesObject, Dictionary<HumanBodyBones, HashSet<Transform>> clothesHumanoidMatchedBones, bool duplicateMesh = true) private IEnumerator SetupClothInstances(GameObject targetClothesObject, Dictionary<HumanBodyBones, HashSet<Transform>> clothesHumanoidMatchedBones, bool duplicateMesh = true)
{ {
clothInstances = new List<ClothInstance>(); this.clothInstances = new List<ClothInstance>();
SkinnedMeshRenderer[] targetClothesSMRs = targetClothesObject.GetComponentsInChildren<SkinnedMeshRenderer>(includeInactive: false); SkinnedMeshRenderer[] targetClothesSMRs = targetClothesObject.GetComponentsInChildren<SkinnedMeshRenderer>(includeInactive: false);
if (targetClothesSMRs.Length == 0) if (targetClothesSMRs.Length == 0)
{ {
@@ -44,15 +43,15 @@ 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++)
{ {
SetupProgress("Set Up", $"Setup Clothes Info [{rendereri}/{targetClothesSMRs.Length}] - ({targetClothesSMRs[rendereri].name})", Mathf.Lerp(0.05f, 0.1f, 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)
{ {
clothInstances.Add(clothInstance); this.clothInstances.Add(clothInstance);
} }
} }
if (clothInstances.Count == 0) if (this.clothInstances.Count == 0)
{ {
throw new AutoMorpherException(LanguageManager.Get("UI.Exception.title.ClothInstanceAllocateFail"), LanguageManager.Get("UI.Exception.message.ClothInstanceAllocateFail")); throw new AutoMorpherException(LanguageManager.Get("UI.Exception.title.ClothInstanceAllocateFail"), LanguageManager.Get("UI.Exception.message.ClothInstanceAllocateFail"));
} }
@@ -60,7 +59,7 @@ 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)
{ {
clothInstances = new List<ClothInstance>(); this.clothInstances = new List<ClothInstance>();
SkinnedMeshRenderer[] targetClothesSMRs = targetClothesObject.GetComponentsInChildren<SkinnedMeshRenderer>(includeInactive: false); SkinnedMeshRenderer[] targetClothesSMRs = targetClothesObject.GetComponentsInChildren<SkinnedMeshRenderer>(includeInactive: false);
if (targetClothesSMRs.Length == 0) if (targetClothesSMRs.Length == 0)
{ {
@@ -74,15 +73,15 @@ 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++)
{ {
SetupProgress("Set Up", $"Setup Clothes Info [{rendereri}/{targetClothesSMRs.Length}] - ({targetClothesSMRs[rendereri].name})", Mathf.Lerp(0.07f, 0.1f, 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)
{ {
clothInstances.Add(clothInstance); this.clothInstances.Add(clothInstance);
} }
} }
if (clothInstances.Count == 0) if (this.clothInstances.Count == 0)
{ {
throw new AutoMorpherException(LanguageManager.Get("UI.Exception.title.ClothInstanceAllocateFail"), LanguageManager.Get("UI.Exception.message.ClothInstanceAllocateFail")); throw new AutoMorpherException(LanguageManager.Get("UI.Exception.title.ClothInstanceAllocateFail"), LanguageManager.Get("UI.Exception.message.ClothInstanceAllocateFail"));
} }
@@ -90,7 +89,7 @@ public class EdenAutoMorpherManager : IDisposable
public IEnumerator FittingIteration(EdenAutoMorpherConfig config, MorpherMode morpherMode) public IEnumerator FittingIteration(EdenAutoMorpherConfig config, MorpherMode morpherMode)
{ {
SetupProgress("Set Up", "Setup Target Avatar Info", 0.03f); this.SetupProgress("Set Up", "Setup Target Avatar Info", 0.03f);
yield return null; yield return null;
MeshMatcher meshMatcher = new MeshMatcher(); MeshMatcher meshMatcher = new MeshMatcher();
BvhTriangleMesh targetBodyBVH = meshMatcher.BuildBvhMulti(config.targetBodyMeshes, config.targetAvatarObject.GetComponent<Animator>()); BvhTriangleMesh targetBodyBVH = meshMatcher.BuildBvhMulti(config.targetBodyMeshes, config.targetAvatarObject.GetComponent<Animator>());
@@ -99,7 +98,7 @@ public class EdenAutoMorpherManager : IDisposable
throw new AutoMorpherException("targetBodyBVH is Null", "[EdenAutoMorpherManater] FittingIteration\n - targetBodyBVH is null"); throw new AutoMorpherException("targetBodyBVH is Null", "[EdenAutoMorpherManater] FittingIteration\n - targetBodyBVH is null");
} }
yield return null; yield return null;
SetupProgress("Set Up", "Setup Source Avatar Info", 0.05f); this.SetupProgress("Set Up", "Setup Source Avatar Info", 0.05f);
yield return null; yield return null;
BvhTriangleMesh sourceBodyBVH = null; BvhTriangleMesh sourceBodyBVH = null;
switch (morpherMode) switch (morpherMode)
@@ -124,9 +123,9 @@ public class EdenAutoMorpherManager : IDisposable
throw new AutoMorpherException("sourceBodyBVH is Null", "[EdenAutoMorpherManater] FittingIteration\n - sourceBodyBVH is null"); throw new AutoMorpherException("sourceBodyBVH is Null", "[EdenAutoMorpherManater] FittingIteration\n - sourceBodyBVH is null");
} }
meshMatcher.bodyBVH = sourceBodyBVH; meshMatcher.bodyBVH = sourceBodyBVH;
SetupProgress("Set Up", "Setup Clothes Info", 0.07f); this.SetupProgress("Set Up", "Setup Clothes Info", 0.07f);
yield return null; yield return null;
IEnumerator setupClothEnum = SetupClothInstances(config.targetClothesObject, config.clothesHumanoidMatchedBones, config.sourceClothesObject, meshMatcher); IEnumerator setupClothEnum = this.SetupClothInstances(config.targetClothesObject, config.clothesHumanoidMatchedBones, config.sourceClothesObject, meshMatcher);
while (setupClothEnum.MoveNext()) while (setupClothEnum.MoveNext())
{ {
yield return setupClothEnum.Current; yield return setupClothEnum.Current;
@@ -138,11 +137,11 @@ public class EdenAutoMorpherManager : IDisposable
int fittingI; int fittingI;
for (fittingI = 0; fittingI < config.fittingExpandIteration; fittingI++) for (fittingI = 0; fittingI < config.fittingExpandIteration; fittingI++)
{ {
foreach (ClothInstance clothInstance in clothInstances) foreach (ClothInstance clothInstance in this.clothInstances)
{ {
SetupProgress("Fitting", $"Phase 1 Expanding [{fittingI + 1}/{config.fittingExpandIteration}] - {clothInstance.smr.transform.name}", Mathf.Lerp(0.1f, 0.4f, (float)fittingI / (float)config.fittingExpandIteration)); this.SetupProgress("Fitting", $"Phase 1 Expanding [{fittingI + 1}/{config.fittingExpandIteration}] - {clothInstance.smr.transform.name}", Mathf.Lerp(0.1f, 0.4f, (float)fittingI / (float)config.fittingExpandIteration));
yield return null; yield return null;
vertexFittingUtil.ExpandClothes_World(clothInstance, clothInstances, meshMatcher, config, fittingRadius); vertexFittingUtil.ExpandClothes_World(clothInstance, this.clothInstances, meshMatcher, config, fittingRadius);
yield return null; yield return null;
} }
if (fittingI % 2 == 0) if (fittingI % 2 == 0)
@@ -153,13 +152,13 @@ public class EdenAutoMorpherManager : IDisposable
fittingRadius = config.worldRadius; fittingRadius = config.worldRadius;
for (fittingI = 0; fittingI < config.fittingShrinkIteration; fittingI++) for (fittingI = 0; fittingI < config.fittingShrinkIteration; fittingI++)
{ {
foreach (ClothInstance clothInstance in clothInstances) foreach (ClothInstance clothInstance in this.clothInstances)
{ {
SetupProgress("Fitting", $"Phase 2 Fitting [{fittingI + 1}/{config.fittingShrinkIteration}] - {clothInstance.smr.transform.name}", Mathf.Lerp(0.4f, 0.8f, (float)fittingI / (float)config.fittingShrinkIteration)); this.SetupProgress("Fitting", $"Phase 2 Fitting [{fittingI + 1}/{config.fittingShrinkIteration}] - {clothInstance.smr.transform.name}", Mathf.Lerp(0.4f, 0.8f, (float)fittingI / (float)config.fittingShrinkIteration));
yield return null; yield return null;
vertexFittingUtil.ShrinkClothes_World(clothInstance, clothInstances, meshMatcher, config, fittingRadius); vertexFittingUtil.ShrinkClothes_World(clothInstance, this.clothInstances, meshMatcher, config, fittingRadius);
yield return null; yield return null;
vertexFittingUtil.ExpandClothes_World(clothInstance, clothInstances, meshMatcher, config, fittingRadius); vertexFittingUtil.ExpandClothes_World(clothInstance, this.clothInstances, meshMatcher, config, fittingRadius);
yield return null; yield return null;
} }
if (fittingI % 2 == 0) if (fittingI % 2 == 0)
@@ -170,11 +169,11 @@ public class EdenAutoMorpherManager : IDisposable
fittingRadius = config.worldRadius / 2f; fittingRadius = config.worldRadius / 2f;
for (fittingI = 0; fittingI < config.fittingExpandIteration; fittingI++) for (fittingI = 0; fittingI < config.fittingExpandIteration; fittingI++)
{ {
foreach (ClothInstance clothInstance in clothInstances) foreach (ClothInstance clothInstance in this.clothInstances)
{ {
SetupProgress("Fitting", $"Phase 3 Fine-tuning [{fittingI + 1}/{config.fittingExpandIteration}] - {clothInstance.smr.transform.name}", Mathf.Lerp(0.8f, 0.9f, (float)fittingI / (float)config.fittingExpandIteration)); this.SetupProgress("Fitting", $"Phase 3 Fine-tuning [{fittingI + 1}/{config.fittingExpandIteration}] - {clothInstance.smr.transform.name}", Mathf.Lerp(0.8f, 0.9f, (float)fittingI / (float)config.fittingExpandIteration));
yield return null; yield return null;
vertexFittingUtil.ExpandClothes_World(clothInstance, clothInstances, meshMatcher, config, fittingRadius); vertexFittingUtil.ExpandClothes_World(clothInstance, this.clothInstances, meshMatcher, config, fittingRadius);
yield return null; yield return null;
} }
if (fittingI % 2 == 0) if (fittingI % 2 == 0)
@@ -183,7 +182,7 @@ public class EdenAutoMorpherManager : IDisposable
} }
} }
yield return null; yield return null;
SetupProgress("Fitting", "Apply Transform Bone", 0.93f); this.SetupProgress("Fitting", "Apply Transform Bone", 0.93f);
yield return null; yield return null;
BoneAlignmentUtil boneAlignmentUtil = new BoneAlignmentUtil(); BoneAlignmentUtil boneAlignmentUtil = new BoneAlignmentUtil();
boneAlignmentUtil.CleanupTempBones(config.targetClothesObject.transform); boneAlignmentUtil.CleanupTempBones(config.targetClothesObject.transform);
@@ -191,16 +190,16 @@ public class EdenAutoMorpherManager : IDisposable
if (morpherMode2 == MorpherMode.AutoMorpher || morpherMode2 == MorpherMode.ProfileMorpher) if (morpherMode2 == MorpherMode.AutoMorpher || morpherMode2 == MorpherMode.ProfileMorpher)
{ {
config.targetClothesObject.transform.localScale = Vector3.one; config.targetClothesObject.transform.localScale = Vector3.one;
boneAlignmentUtil.AlignClothBonesToAvatar(clothInstances[0], config.targetAvatarObject.GetComponent<Animator>()); boneAlignmentUtil.AlignClothBonesToAvatar(this.clothInstances[0], config.targetAvatarObject.GetComponent<Animator>());
} }
yield return null; yield return null;
SetupProgress("Fitting", "Apply Transform Mesh", 0.99f); this.SetupProgress("Fitting", "Apply Transform Mesh", 0.99f);
yield return null; yield return null;
fittingI = 0; fittingI = 0;
while (fittingI < clothInstances.Count) while (fittingI < this.clothInstances.Count)
{ {
ClothInstance clothInstance = clothInstances[fittingI]; ClothInstance clothInstance = this.clothInstances[fittingI];
SetupProgress("Fitting", $"Apply to Mesh [{fittingI + 1}/{clothInstances.Count}] - {clothInstance.smr.transform.name}", Mathf.Lerp(0.93f, 0.98f, (float)fittingI / (float)clothInstances.Count)); this.SetupProgress("Fitting", $"Apply to Mesh [{fittingI + 1}/{this.clothInstances.Count}] - {clothInstance.smr.transform.name}", Mathf.Lerp(0.93f, 0.98f, (float)fittingI / (float)this.clothInstances.Count));
yield return null; yield return null;
clothInstance.ApplyWorldVerticesToMesh(); clothInstance.ApplyWorldVerticesToMesh();
clothInstance.smr.localBounds = new Bounds(Vector3.zero, Vector3.one * 2f); clothInstance.smr.localBounds = new Bounds(Vector3.zero, Vector3.one * 2f);
@@ -211,22 +210,22 @@ public class EdenAutoMorpherManager : IDisposable
fittingI = num; fittingI = num;
} }
yield return null; yield return null;
SetupProgress("Saving", "Saving Mesh Data", 0.99f); this.SetupProgress("Saving", "Saving Mesh Data", 0.99f);
yield return null; yield return null;
SaveEditedMeshesToAssets(clothInstances, config); this.SaveEditedMeshesToAssets(this.clothInstances, config);
yield return null; yield return null;
SetupProgress("Finishing", "Finishing", 1f); this.SetupProgress("Finishing", "Finishing", 1f);
foreach (ClothInstance clothInstance2 in clothInstances) foreach (ClothInstance clothInstance2 in this.clothInstances)
{ {
clothInstance2.Dispose(); clothInstance2.Dispose();
} }
clothInstances = null; this.clothInstances = null;
yield return null; yield return null;
} }
public IEnumerator WeightingEnumerator(EdenAutoMorpherConfig config) public IEnumerator WeightingEnumerator(EdenAutoMorpherConfig config)
{ {
SetupProgress("Set Up", "Setup Target Avatar Info", 0f); this.SetupProgress("Set Up", "Setup Target Avatar Info", 0f);
yield return null; yield return null;
if (new MeshMatcher().BuildBvhMulti(config.targetBodyMeshes, config.targetAvatarObject.GetComponent<Animator>()) == null) if (new MeshMatcher().BuildBvhMulti(config.targetBodyMeshes, config.targetAvatarObject.GetComponent<Animator>()) == null)
{ {
@@ -236,7 +235,7 @@ 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)
{ {
SetupProgress("Set Up", "Setup Target Avatar BodyMesh Info", Mathf.Lerp(0.02f, 0.05f, 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 mesh = new Mesh(); Mesh mesh = new Mesh();
bodyMesh.BakeMesh(mesh); bodyMesh.BakeMesh(mesh);
@@ -245,7 +244,7 @@ public class EdenAutoMorpherManager : IDisposable
bakedTargetBodyMeshes.Add(mesh); bakedTargetBodyMeshes.Add(mesh);
} }
yield return null; yield return null;
IEnumerator setupClothEnum = SetupClothInstances(config.targetClothesObject, config.clothesHumanoidMatchedBones, duplicateMesh: false); IEnumerator setupClothEnum = this.SetupClothInstances(config.targetClothesObject, config.clothesHumanoidMatchedBones, duplicateMesh: false);
while (setupClothEnum.MoveNext()) while (setupClothEnum.MoveNext())
{ {
yield return setupClothEnum.Current; yield return setupClothEnum.Current;
@@ -271,18 +270,18 @@ public class EdenAutoMorpherManager : IDisposable
}; };
yield return null; yield return null;
int weightingI = 0; int weightingI = 0;
while (weightingI < clothInstances.Count) while (weightingI < this.clothInstances.Count)
{ {
ClothInstance clothInstance = clothInstances[weightingI]; ClothInstance clothInstance = this.clothInstances[weightingI];
float num = 0.1f; float num = 0.1f;
float num2 = (0.95f - num) / (float)Mathf.Max(1, clothInstances.Count); float num2 = (0.95f - num) / (float)Mathf.Max(1, this.clothInstances.Count);
float num3 = num + num2 * (float)weightingI; float num3 = num + num2 * (float)weightingI;
float num4 = 0.8f; float num4 = 0.8f;
float weightingStart = num3; float weightingStart = num3;
float weightingEnd = num3 + num2 * num4; float weightingEnd = num3 + num2 * num4;
float applyStart = num3 + num2 * num4; float applyStart = num3 + num2 * num4;
int step = 1; int step = 1;
SetupProgress("Weighting", $"Weighting | Step {step} [{weightingI + 1}/{clothInstances.Count}] - {clothInstance.smr.transform.name}", weightingStart); this.SetupProgress("Weighting", $"Weighting | Step {step} [{weightingI + 1}/{this.clothInstances.Count}] - {clothInstance.smr.transform.name}", weightingStart);
yield return null; yield return null;
IEnumerator weightingEnum = weightTransferUtil.RetargetAndTransfer(clothInstance, config.targetAvatarObject.GetComponent<Animator>(), config.targetBodyMeshes, bakedTargetBodyMeshes, 0, wtSettings, config.clothBoneTypeMap, clonedBoneMap); IEnumerator weightingEnum = weightTransferUtil.RetargetAndTransfer(clothInstance, config.targetAvatarObject.GetComponent<Animator>(), config.targetBodyMeshes, bakedTargetBodyMeshes, 0, wtSettings, config.clothBoneTypeMap, clonedBoneMap);
while (weightingEnum.MoveNext()) while (weightingEnum.MoveNext())
@@ -291,12 +290,12 @@ public class EdenAutoMorpherManager : IDisposable
step++; step++;
float t = 1f - 1f / ((float)step + 1f); float t = 1f - 1f / ((float)step + 1f);
float progress = Mathf.Lerp(weightingStart, weightingEnd, t); float progress = Mathf.Lerp(weightingStart, weightingEnd, t);
SetupProgress("Weighting", $"Weighting | Step {step} [{weightingI + 1}/{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;
} }
yield return null; yield return null;
step++; step++;
SetupProgress("Weighting", $"Weighting | Step {step} - Apply to Mesh [{weightingI + 1}/{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();
clothInstance.smr.localBounds = new Bounds(Vector3.zero, Vector3.one * 2f); clothInstance.smr.localBounds = new Bounds(Vector3.zero, Vector3.one * 2f);
@@ -306,19 +305,19 @@ public class EdenAutoMorpherManager : IDisposable
int num5 = weightingI + 1; int num5 = weightingI + 1;
weightingI = num5; weightingI = num5;
} }
SetupProgress("Weighting", "Allocate Bones", 0.95f); this.SetupProgress("Weighting", "Allocate Bones", 0.95f);
yield return null; yield return null;
if (config.transferWeightToAvatar && config.isReparentAccessoryBonesToTargetAvatar) if (config.transferWeightToAvatar && config.isReparentAccessoryBonesToTargetAvatar)
{ {
new BoneAlignmentUtil().ReparentAccessoryBonesToAvatar(config); new BoneAlignmentUtil().ReparentAccessoryBonesToAvatar(config);
} }
SetupProgress("Finishing", "Finishing", 1f); this.SetupProgress("Finishing", "Finishing", 1f);
yield return null; yield return null;
foreach (ClothInstance clothInstance2 in clothInstances) foreach (ClothInstance clothInstance2 in this.clothInstances)
{ {
clothInstance2.Dispose(); clothInstance2.Dispose();
} }
clothInstances = null; this.clothInstances = null;
yield return null; yield return null;
} }

View File

@@ -1,14 +1,13 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts,
// for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies. // for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies.
// EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null // EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.EdenAutoMorpher_SetUpUtil // Eden.AutoMorpher.EdenAutoMorpher_SetUpUtil
using Eden.AutoMorpher;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using System.Text; using System.Text;
using Eden.AutoMorpher;
using Eden.AutoMorpher.profile;
using UnityEditor; using UnityEditor;
using UnityEditorInternal; using UnityEditorInternal;
using UnityEngine; using UnityEngine;
@@ -67,7 +66,7 @@ public class EdenAutoMorpher_SetUpUtil
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)
{ {
config.targetClothesObject = InstantiateTargetClothes(config.sourceClothesObject, config.targetAvatarObject, config.tagEdenMorpehrCloth, config.isRemoveAutoMorphedClothes); config.targetClothesObject = this.InstantiateTargetClothes(config.sourceClothesObject, config.targetAvatarObject, config.tagEdenMorpehrCloth, config.isRemoveAutoMorphedClothes);
if (config.targetClothesObject == null) if (config.targetClothesObject == null)
{ {
throw new AutoMorpherException("Target Clothes Object is Null", "[EdenAutoMorpher_SetUpUtil] AutoSetup\n - config.targetClothesObject is null"); throw new AutoMorpherException("Target Clothes Object is Null", "[EdenAutoMorpher_SetUpUtil] AutoSetup\n - config.targetClothesObject is null");
@@ -94,7 +93,7 @@ public class EdenAutoMorpher_SetUpUtil
} }
if (AutoMorpherDev.isDeveloperMode) if (AutoMorpherDev.isDeveloperMode)
{ {
DebugPrintSameNameBonePaths(clothToBodyMatched, sourceToProxy); this.DebugPrintSameNameBonePaths(clothToBodyMatched, sourceToProxy);
} }
new BodyPoseToClothApplier().ApplyBodyPoseToClothes(gameObject.transform, config.targetClothesObject.transform, clothToBodyMatched, sourceToProxy); new BodyPoseToClothApplier().ApplyBodyPoseToClothes(gameObject.transform, config.targetClothesObject.transform, clothToBodyMatched, sourceToProxy);
} }
@@ -214,7 +213,7 @@ public class EdenAutoMorpher_SetUpUtil
public void ProfileAutoSetup(ref EdenAutoMorpherConfig config, out Dictionary<HumanBodyBones, HashSet<Transform>> clothesHumanoidMatchedBones, out Dictionary<Transform, ClothBoneType> clothBoneTypeMap) public void ProfileAutoSetup(ref EdenAutoMorpherConfig config, out Dictionary<HumanBodyBones, HashSet<Transform>> clothesHumanoidMatchedBones, out Dictionary<Transform, ClothBoneType> clothBoneTypeMap)
{ {
config.targetClothesObject = InstantiateTargetClothes(config.sourceClothesObject, config.targetAvatarObject, config.tagEdenMorpehrCloth, config.isRemoveAutoMorphedClothes); config.targetClothesObject = this.InstantiateTargetClothes(config.sourceClothesObject, config.targetAvatarObject, config.tagEdenMorpehrCloth, config.isRemoveAutoMorphedClothes);
if (config.targetClothesObject == null) if (config.targetClothesObject == null)
{ {
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");
@@ -242,7 +241,7 @@ public class EdenAutoMorpher_SetUpUtil
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 = "")
{ {
new EdenAutoMorpherManager(); new EdenAutoMorpherManager();
List<SkinnedMeshRenderer> list = (isBodyAutoSetup ? GetBodyMeshes(bodyObject) : userAllocatedBoeyMeshes); List<SkinnedMeshRenderer> list = (isBodyAutoSetup ? this.GetBodyMeshes(bodyObject) : userAllocatedBoeyMeshes);
if (list == null) if (list == null)
{ {
throw new AutoMorpherException(errorPreFix + "Body Mesh Is Null or Empty", errorPreFix + "Body Mesh list is null or empty"); throw new AutoMorpherException(errorPreFix + "Body Mesh Is Null or Empty", errorPreFix + "Body Mesh list is null or empty");
@@ -302,7 +301,7 @@ public class EdenAutoMorpher_SetUpUtil
{ {
throw new AutoMorpherException("Coupled Skinned Mesh Renderer's Mesh is Null or empty", "[EdenAutoMorpher_SetupUtil] SetupClothInstance\n\n - Coupled Skinned Mesh Renderer's mesh is null or no vertices"); throw new AutoMorpherException("Coupled Skinned Mesh Renderer's Mesh is Null or empty", "[EdenAutoMorpher_SetupUtil] SetupClothInstance\n\n - Coupled Skinned Mesh Renderer's mesh is null or no vertices");
} }
ClothInstance clothInstance = SetupClothInstance(clothSMR, clothesHumanoidMatchedBones, duplicateMesh); ClothInstance clothInstance = this.SetupClothInstance(clothSMR, clothesHumanoidMatchedBones, duplicateMesh);
if (clothInstance == null) if (clothInstance == null)
{ {
return null; return null;
@@ -351,7 +350,7 @@ 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 transform2 = FindArmature(config, config.targetClothesObject.transform); Transform transform2 = this.FindArmature(config, config.targetClothesObject.transform);
if (transform2 == null) if (transform2 == null)
{ {
transform2 = new GameObject("Armature.1").transform; transform2 = new GameObject("Armature.1").transform;
@@ -479,7 +478,7 @@ public class EdenAutoMorpher_SetUpUtil
{ {
transform6.name = item4.name; transform6.name = item4.name;
transform6.position = item4.position; transform6.position = item4.position;
ChildBonePositionPreserve(transform6, item4); this.ChildBonePositionPreserve(transform6, item4);
if (config.armatureBoneScaleCopy) if (config.armatureBoneScaleCopy)
{ {
transform6.localScale = item4.localScale; transform6.localScale = item4.localScale;
@@ -578,7 +577,7 @@ public class EdenAutoMorpher_SetUpUtil
if (!(item == null) && (!(item != clothesRoot) || item.IsChildOf(clothesRoot))) if (!(item == null) && (!(item != clothesRoot) || item.IsChildOf(clothesRoot)))
{ {
flag = true; flag = true;
Transform topChildUnderRoot = GetTopChildUnderRoot(item, clothesRoot); Transform topChildUnderRoot = this.GetTopChildUnderRoot(item, clothesRoot);
if (topChildUnderRoot == null || topChildUnderRoot == clothesRoot) if (topChildUnderRoot == null || topChildUnderRoot == clothesRoot)
{ {
return null; return null;
@@ -641,7 +640,7 @@ public class EdenAutoMorpher_SetUpUtil
Transform child = reusableClothBone.GetChild(i); Transform child = reusableClothBone.GetChild(i);
if (!(child == null)) if (!(child == null))
{ {
CollectDescendants(child, list); this.CollectDescendants(child, list);
} }
} }
for (int j = 0; j < list.Count; j++) for (int j = 0; j < list.Count; j++)
@@ -669,7 +668,7 @@ public class EdenAutoMorpher_SetUpUtil
Transform child = root.GetChild(i); Transform child = root.GetChild(i);
if (!(child == null)) if (!(child == null))
{ {
CollectDescendants(child, resultList); this.CollectDescendants(child, resultList);
} }
} }
} }

View File

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

View File

@@ -1,9 +1,9 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts,
// for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies. // for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies.
// EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null // EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.MeshMatcher // Eden.AutoMorpher.MeshMatcher
using System.Collections.Generic;
using Eden.AutoMorpher; using Eden.AutoMorpher;
using System.Collections.Generic;
using UnityEngine; using UnityEngine;
public class MeshMatcher public class MeshMatcher
@@ -61,7 +61,7 @@ public class MeshMatcher
{ {
Vector3[] worldVertices = clothInstance.worldVertices; Vector3[] worldVertices = clothInstance.worldVertices;
float[] minDistance = clothInstance.minDistance; float[] minDistance = clothInstance.minDistance;
if (bodyBVH == null) if (this.bodyBVH == null)
{ {
throw new AutoMorpherException("Body BVH is Missing", "[ExpandVertexMatch] ExpandVertexMatch\n - bodyBVH is null"); throw new AutoMorpherException("Body BVH is Missing", "[ExpandVertexMatch] ExpandVertexMatch\n - bodyBVH is null");
} }
@@ -97,7 +97,7 @@ public class MeshMatcher
continue; continue;
} }
float num2 = minDistance[i] + defaultMinDist; float num2 = minDistance[i] + defaultMinDist;
BvhTriangleMesh.ClosestHit closestHit = (clothInstance.isLeftLegVertex[i] ? bodyBVH.QueryClosest(worldVertices[i], LeftLegBones) : ((!clothInstance.isRightLegVertex[i]) ? bodyBVH.QueryClosest(worldVertices[i]) : bodyBVH.QueryClosest(worldVertices[i], RightLegBones))); BvhTriangleMesh.ClosestHit closestHit = (clothInstance.isLeftLegVertex[i] ? this.bodyBVH.QueryClosest(worldVertices[i], this.LeftLegBones) : ((!clothInstance.isRightLegVertex[i]) ? this.bodyBVH.QueryClosest(worldVertices[i]) : this.bodyBVH.QueryClosest(worldVertices[i], this.RightLegBones)));
if (skipFootFitting && (closestHit.mainHumanBone == HumanBodyBones.LeftFoot || closestHit.mainHumanBone == HumanBodyBones.RightFoot || closestHit.mainHumanBone == HumanBodyBones.RightToes || closestHit.mainHumanBone == HumanBodyBones.LeftToes)) 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;
@@ -133,7 +133,7 @@ public class MeshMatcher
{ {
Vector3[] worldVertices = clothInstance.worldVertices; Vector3[] worldVertices = clothInstance.worldVertices;
float[] minDistance = clothInstance.minDistance; float[] minDistance = clothInstance.minDistance;
if (bodyBVH == null) if (this.bodyBVH == null)
{ {
throw new AutoMorpherException("Body BVH is Missing", "[ShrinkVertexMatch] ShrinkVertexMatch\n - bodyBVH is null"); throw new AutoMorpherException("Body BVH is Missing", "[ShrinkVertexMatch] ShrinkVertexMatch\n - bodyBVH is null");
} }
@@ -171,7 +171,7 @@ public class MeshMatcher
continue; continue;
} }
float num2 = minDistance[i] + defaultMinDist; float num2 = minDistance[i] + defaultMinDist;
BvhTriangleMesh.ClosestHit closestHit = (clothInstance.isLeftLegVertex[i] ? bodyBVH.QueryClosest(worldVertices[i], LeftLegBones) : ((!clothInstance.isRightLegVertex[i]) ? bodyBVH.QueryClosest(worldVertices[i]) : bodyBVH.QueryClosest(worldVertices[i], RightLegBones))); BvhTriangleMesh.ClosestHit closestHit = (clothInstance.isLeftLegVertex[i] ? this.bodyBVH.QueryClosest(worldVertices[i], this.LeftLegBones) : ((!clothInstance.isRightLegVertex[i]) ? this.bodyBVH.QueryClosest(worldVertices[i]) : this.bodyBVH.QueryClosest(worldVertices[i], this.RightLegBones)));
if (closestHit.sqrDistance > num) if (closestHit.sqrDistance > num)
{ {
array[i] = Vector3.zero; array[i] = Vector3.zero;
@@ -205,7 +205,7 @@ public class MeshMatcher
public Vector3[] GetMinDistanceToBody(Vector3[] clothesVertices) public Vector3[] GetMinDistanceToBody(Vector3[] clothesVertices)
{ {
if (bodyBVH == null) if (this.bodyBVH == null)
{ {
throw new AutoMorpherException("sourceBodyBVH is null", "[MeshMatcher] GetMinDistanceToBodysourceBodyBVH is null"); throw new AutoMorpherException("sourceBodyBVH is null", "[MeshMatcher] GetMinDistanceToBodysourceBodyBVH is null");
} }
@@ -217,7 +217,7 @@ public class MeshMatcher
for (int i = 0; i < clothesVertices.Length; i++) for (int i = 0; i < clothesVertices.Length; i++)
{ {
Vector3 vector = clothesVertices[i]; Vector3 vector = clothesVertices[i];
Vector3 vector2 = bodyBVH.QueryClosest(vector).closestPoint - vector; Vector3 vector2 = this.bodyBVH.QueryClosest(vector).closestPoint - vector;
array[i] = vector2; array[i] = vector2;
} }
return array; return array;
@@ -225,7 +225,7 @@ public class MeshMatcher
public bool[] GetBodyInsideFlags(Vector3[] worldVertices) public bool[] GetBodyInsideFlags(Vector3[] worldVertices)
{ {
if (bodyBVH == null) if (this.bodyBVH == null)
{ {
throw new AutoMorpherException("sourceBodyBVH is null", "[MeshMatcher] GetBodyInsideFlagssourceBodyBVH is null"); throw new AutoMorpherException("sourceBodyBVH is null", "[MeshMatcher] GetBodyInsideFlagssourceBodyBVH is null");
} }
@@ -237,7 +237,7 @@ public class MeshMatcher
bool[] array = new bool[worldVertices.Length]; bool[] array = new bool[worldVertices.Length];
for (int i = 0; i < worldVertices.Length; i++) for (int i = 0; i < worldVertices.Length; i++)
{ {
BvhTriangleMesh.ClosestHit closestHit = bodyBVH.QueryClosest(worldVertices[i]); BvhTriangleMesh.ClosestHit closestHit = this.bodyBVH.QueryClosest(worldVertices[i]);
float num = Vector3.Dot((closestHit.closestPoint - worldVertices[i]).normalized, closestHit.normal.normalized); float num = Vector3.Dot((closestHit.closestPoint - worldVertices[i]).normalized, closestHit.normal.normalized);
array[i] = num > 0f; array[i] = num > 0f;
} }

View File

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

View File

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

View File

@@ -1,9 +1,8 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts,
// for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies. // for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies.
// EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null // EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.PcaUtil // Eden.AutoMorpher.PcaUtil
using System.Collections.Generic; using System.Collections.Generic;
using Eden.AutoMorpher;
using UnityEngine; using UnityEngine;
public class PcaUtil public class PcaUtil
@@ -45,7 +44,7 @@ public class PcaUtil
num4 *= num7; num4 *= num7;
num5 *= num7; num5 *= num7;
num6 *= num7; num6 *= num7;
JacobiEigenDecomposition3x3(num, num2, num3, num4, num5, num6, out var eigenValues, out var eigenVectors); this.JacobiEigenDecomposition3x3(num, num2, num3, num4, num5, num6, out var eigenValues, out var eigenVectors);
int num8 = 0; int num8 = 0;
if (eigenValues[1] > eigenValues[num8]) if (eigenValues[1] > eigenValues[num8])
{ {

View File

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

View File

@@ -1,4 +1,4 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts,
// for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies. // for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies.
// EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null // EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.profile.ProfileLoader // Eden.AutoMorpher.profile.ProfileLoader
@@ -6,8 +6,6 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Text; using System.Text;
using Eden.AutoMorpher;
using Eden.AutoMorpher.profile;
using UnityEngine; using UnityEngine;
public class ProfileLoader public class ProfileLoader
@@ -58,12 +56,12 @@ public class ProfileLoader
throw new AutoMorpherException("Profile File Does Not Exist", "[ProfileLoader] LoadProfileData\n - profile file does not exist\n - path : " + path); throw new AutoMorpherException("Profile File Does Not Exist", "[ProfileLoader] LoadProfileData\n - profile file does not exist\n - path : " + path);
} }
string json = File.ReadAllText(path); string json = File.ReadAllText(path);
loadedProfileData = JsonUtility.FromJson<ProfileData>(json); this.loadedProfileData = JsonUtility.FromJson<ProfileData>(json);
if (loadedProfileData == null) if (this.loadedProfileData == null)
{ {
throw new AutoMorpherException("Failed to Load Profile Data", "[ProfileLoader] LoadProfileData\n - Can't Load Profile Data\n - Please place a valid profile data file at " + path); throw new AutoMorpherException("Failed to Load Profile Data", "[ProfileLoader] LoadProfileData\n - Can't Load Profile Data\n - Please place a valid profile data file at " + path);
} }
return loadedProfileData; return this.loadedProfileData;
} }
public BvhTriangleMesh LoadBvhWithRootTransform(Transform rootTransform, string profileName) public BvhTriangleMesh LoadBvhWithRootTransform(Transform rootTransform, string profileName)
@@ -81,7 +79,7 @@ public class ProfileLoader
throw new AutoMorpherException("Profile BVH Path is Invalid", "[ProfileLoader] LoadBvhWithRootTransform\n - profileBvhPath is null or empty"); throw new AutoMorpherException("Profile BVH Path is Invalid", "[ProfileLoader] LoadBvhWithRootTransform\n - profileBvhPath is null or empty");
} }
int version; int version;
ProfileBVH profileBVH = LoadProfileBVHData(path, out version); ProfileBVH profileBVH = this.LoadProfileBVHData(path, out version);
if (profileBVH == null || profileBVH.vertices == null || profileBVH.datas == null || profileBVH.nodes == null || profileBVH.dataIndices == null) 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"); throw new AutoMorpherException("Profile BVH Data is Invalid", "[ProfileLoader] LoadBvhWithRootTransform\n - profile or one of its internal data fields is null");
@@ -103,7 +101,7 @@ public class ProfileLoader
Vector3 a = localToWorldMatrix.MultiplyPoint3x4(point); Vector3 a = localToWorldMatrix.MultiplyPoint3x4(point);
Vector3 b = localToWorldMatrix.MultiplyPoint3x4(point2); Vector3 b = localToWorldMatrix.MultiplyPoint3x4(point2);
Vector3 c = localToWorldMatrix.MultiplyPoint3x4(point3); Vector3 c = localToWorldMatrix.MultiplyPoint3x4(point3);
Vector3 normal = ComputeTriangleNormal(a, b, c); Vector3 normal = this.ComputeTriangleNormal(a, b, c);
bvhTriangleMesh.triangles[i] = new BvhTriangle bvhTriangleMesh.triangles[i] = new BvhTriangle
{ {
a = a, a = a,
@@ -124,7 +122,7 @@ public class ProfileLoader
rightChild = profileBVHNode2.rightChild, rightChild = profileBVHNode2.rightChild,
start = profileBVHNode2.start, start = profileBVHNode2.start,
count = profileBVHNode2.count, count = profileBVHNode2.count,
bounds = TransformBoundsToWorldAABB(localToWorldMatrix, profileBVHNode2.bounds) bounds = this.TransformBoundsToWorldAABB(localToWorldMatrix, profileBVHNode2.bounds)
}; };
} }
return bvhTriangleMesh; return bvhTriangleMesh;
@@ -147,12 +145,12 @@ public class ProfileLoader
throw new AutoMorpherException("Profile BVH Magic Mismatch", "[ProfileLoader] LoadProfileBVHData\n - magic string mismatch\n - invalid or corrupted BVH file"); throw new AutoMorpherException("Profile BVH Magic Mismatch", "[ProfileLoader] LoadProfileBVHData\n - magic string mismatch\n - invalid or corrupted BVH file");
} }
num2 += profileMagic.Length; num2 += profileMagic.Length;
version = ReadHexIntSafe(text, ref num2); version = this.ReadHexIntSafe(text, ref num2);
num = ReadHexIntSafe(text, ref num2); num = this.ReadHexIntSafe(text, ref num2);
int num3 = ReadHexIntSafe(text, ref num2); int num3 = this.ReadHexIntSafe(text, ref num2);
int num4 = ReadHexIntSafe(text, ref num2); int num4 = this.ReadHexIntSafe(text, ref num2);
int num5 = ReadHexIntSafe(text, ref num2); int num5 = this.ReadHexIntSafe(text, ref num2);
int num6 = ReadHexIntSafe(text, ref num2); int num6 = this.ReadHexIntSafe(text, ref num2);
if (num3 < 0 || num4 < 0 || num5 < 0 || num6 < 0) if (num3 < 0 || num4 < 0 || num5 < 0 || num6 < 0)
{ {
throw new AutoMorpherException("Profile BVH Count Data is Invalid", "[ProfileLoader] LoadProfileBVHData\n - one or more count values are negative"); throw new AutoMorpherException("Profile BVH Count Data is Invalid", "[ProfileLoader] LoadProfileBVHData\n - one or more count values are negative");
@@ -160,7 +158,7 @@ public class ProfileLoader
Vector3[] array = new Vector3[num3]; Vector3[] array = new Vector3[num3];
for (int i = 0; i < num3; i++) for (int i = 0; i < num3; i++)
{ {
array[i] = ReadHexVec3Safe(text, ref num2); array[i] = this.ReadHexVec3Safe(text, ref num2);
} }
int version2; int version2;
int countInFile; int countInFile;
@@ -176,7 +174,7 @@ public class ProfileLoader
Vector3[] array4 = new Vector3[num3]; Vector3[] array4 = new Vector3[num3];
for (int j = 0; j < num3; j++) for (int j = 0; j < num3; j++)
{ {
array4[j] = TransformVec3(array3[j], array2[j % array2.Length]); array4[j] = this.TransformVec3(array3[j], array2[j % array2.Length]);
} }
ProfileBVH profileBVH = new ProfileBVH ProfileBVH profileBVH = new ProfileBVH
{ {
@@ -190,28 +188,28 @@ public class ProfileLoader
{ {
profileBVH.datas[k] = new profileBVHData profileBVH.datas[k] = new profileBVHData
{ {
verA = ReadHexIntSafe(text, ref num2), verA = this.ReadHexIntSafe(text, ref num2),
verB = ReadHexIntSafe(text, ref num2), verB = this.ReadHexIntSafe(text, ref num2),
verC = ReadHexIntSafe(text, ref num2) verC = this.ReadHexIntSafe(text, ref num2)
}; };
} }
for (int l = 0; l < num5; l++) for (int l = 0; l < num5; l++)
{ {
Vector3 center = ReadHexVec3Safe(text, ref num2); Vector3 center = this.ReadHexVec3Safe(text, ref num2);
Vector3 vector = ReadHexVec3Safe(text, ref num2); Vector3 vector = this.ReadHexVec3Safe(text, ref num2);
profileBVH.nodes[l] = new profileBVHNode profileBVH.nodes[l] = new profileBVHNode
{ {
bounds = new Bounds(center, vector * 2f), bounds = new Bounds(center, vector * 2f),
leftChild = ReadHexIntSafe(text, ref num2), leftChild = this.ReadHexIntSafe(text, ref num2),
rightChild = ReadHexIntSafe(text, ref num2), rightChild = this.ReadHexIntSafe(text, ref num2),
start = ReadHexIntSafe(text, ref num2), start = this.ReadHexIntSafe(text, ref num2),
count = ReadHexIntSafe(text, ref num2), count = this.ReadHexIntSafe(text, ref num2),
isLeaf = (num2 < text.Length && text[num2++] == '1') isLeaf = (num2 < text.Length && text[num2++] == '1')
}; };
} }
for (int m = 0; m < num6; m++) for (int m = 0; m < num6; m++)
{ {
profileBVH.dataIndices[m] = ReadHexIntSafe(text, ref num2); profileBVH.dataIndices[m] = this.ReadHexIntSafe(text, ref num2);
} }
return profileBVH; return profileBVH;
} }
@@ -230,7 +228,7 @@ public class ProfileLoader
private Vector3 ReadHexVec3Safe(string s, ref int p) private Vector3 ReadHexVec3Safe(string s, ref int p)
{ {
return new Vector3(ReadHexFloatSafe(s, ref p), ReadHexFloatSafe(s, ref p), ReadHexFloatSafe(s, ref p)); return new Vector3(this.ReadHexFloatSafe(s, ref p), this.ReadHexFloatSafe(s, ref p), this.ReadHexFloatSafe(s, ref p));
} }
private float ReadHexFloatSafe(string s, ref int p) private float ReadHexFloatSafe(string s, ref int p)
@@ -247,7 +245,7 @@ public class ProfileLoader
private Vector3 TransformVec3(Vector3 v, BaseKey3 k) private Vector3 TransformVec3(Vector3 v, BaseKey3 k)
{ {
return new Vector3(TransformFloatBits(v.x, k.x), TransformFloatBits(v.y, k.y), TransformFloatBits(v.z, k.z)); return new Vector3(this.TransformFloatBits(v.x, k.x), this.TransformFloatBits(v.y, k.y), this.TransformFloatBits(v.z, k.z));
} }
private float TransformFloatBits(float a, uint keyBits) private float TransformFloatBits(float a, uint keyBits)
@@ -280,13 +278,13 @@ public class ProfileLoader
Vector3 p7 = l2w.MultiplyPoint3x4(center + new Vector3(extents.x, extents.y, extents.z)); Vector3 p7 = l2w.MultiplyPoint3x4(center + new Vector3(extents.x, extents.y, extents.z));
Vector3 min = vector; Vector3 min = vector;
Vector3 max = vector; Vector3 max = vector;
Encapsulate(ref min, ref max, p); this.Encapsulate(ref min, ref max, p);
Encapsulate(ref min, ref max, p2); this.Encapsulate(ref min, ref max, p2);
Encapsulate(ref min, ref max, p3); this.Encapsulate(ref min, ref max, p3);
Encapsulate(ref min, ref max, p4); this.Encapsulate(ref min, ref max, p4);
Encapsulate(ref min, ref max, p5); this.Encapsulate(ref min, ref max, p5);
Encapsulate(ref min, ref max, p6); this.Encapsulate(ref min, ref max, p6);
Encapsulate(ref min, ref max, p7); this.Encapsulate(ref min, ref max, p7);
return new Bounds((min + max) * 0.5f, max - min); return new Bounds((min + max) * 0.5f, max - min);
} }

View File

@@ -1,10 +1,8 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts,
// for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies. // for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies.
// EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null // EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.profile.ProfilePoseMatchUtil // Eden.AutoMorpher.profile.ProfilePoseMatchUtil
using System.Collections.Generic; using System.Collections.Generic;
using Eden.AutoMorpher;
using Eden.AutoMorpher.profile;
using UnityEngine; using UnityEngine;
public class ProfilePoseMatchUtil public class ProfilePoseMatchUtil
@@ -15,8 +13,8 @@ public class ProfilePoseMatchUtil
public ProfilePoseMatchUtil() public ProfilePoseMatchUtil()
{ {
_worldVertexUtil = new WorldVertexUtil(); this._worldVertexUtil = new WorldVertexUtil();
meshClassifier = new MeshClassifier(); this.meshClassifier = new MeshClassifier();
} }
public void ProfilePoseMatcher(GameObject targetAvatar, IReadOnlyList<SkinnedMeshRenderer> targetBodyMeshes, GameObject targetCloth, ProfileData profileData, Dictionary<HumanBodyBones, HashSet<Transform>> clothHumanBonesMap, Dictionary<Transform, ClothBoneType> clothBoneTypeMap, float neckTargetHeight = 1.5f) public void ProfilePoseMatcher(GameObject targetAvatar, IReadOnlyList<SkinnedMeshRenderer> targetBodyMeshes, GameObject targetCloth, ProfileData profileData, Dictionary<HumanBodyBones, HashSet<Transform>> clothHumanBonesMap, Dictionary<Transform, ClothBoneType> clothBoneTypeMap, float neckTargetHeight = 1.5f)
@@ -52,7 +50,7 @@ public class ProfilePoseMatchUtil
Transform parent2 = transform2.parent; Transform parent2 = transform2.parent;
transform2.SetParent(null, worldPositionStays: true); transform2.SetParent(null, worldPositionStays: true);
transform2.position = transform.position; transform2.position = transform.position;
Dictionary<HumanBodyBones, HashSet<Transform>> dictionary = meshClassifier.MeshHumanoidBoneMatcher(targetAvatar.GetComponent<Animator>(), targetBodyMeshes); Dictionary<HumanBodyBones, HashSet<Transform>> dictionary = this.meshClassifier.MeshHumanoidBoneMatcher(targetAvatar.GetComponent<Animator>(), targetBodyMeshes);
if (dictionary == null || dictionary.Count == 0) if (dictionary == null || dictionary.Count == 0)
{ {
throw new AutoMorpherException("Target Avatar Bone Match Data is Missing", "[ProfilePoseMatchUtil] ProfilePoseMatcher\n - target Avatar Bone Match Data is null or empty"); throw new AutoMorpherException("Target Avatar Bone Match Data is Missing", "[ProfilePoseMatchUtil] ProfilePoseMatcher\n - target Avatar Bone Match Data is null or empty");

View File

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

View File

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

View File

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

View File

@@ -1,4 +1,4 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts,
// for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies. // for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies.
// EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null // EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.TransformInfo // Eden.AutoMorpher.TransformInfo
@@ -22,51 +22,51 @@ public class TransformInfo
public TransformInfo(Transform t) public TransformInfo(Transform t)
{ {
parentTransform = t.parent; this.parentTransform = t.parent;
position = t.position; this.position = t.position;
localPosition = t.localPosition; this.localPosition = t.localPosition;
rotation = t.rotation; this.rotation = t.rotation;
localRotation = t.localRotation; this.localRotation = t.localRotation;
localScale = t.localScale; this.localScale = t.localScale;
name = 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)
{ {
if (applyParent) if (applyParent)
{ {
t.SetParent(parentTransform, worldPositionStays: true); t.SetParent(this.parentTransform, worldPositionStays: true);
if (applyPosition) if (applyPosition)
{ {
t.localPosition = localPosition; t.localPosition = this.localPosition;
} }
if (applyRotation) if (applyRotation)
{ {
t.localRotation = localRotation; t.localRotation = this.localRotation;
} }
if (applyScale) if (applyScale)
{ {
t.localScale = localScale; t.localScale = this.localScale;
} }
} }
else else
{ {
if (applyPosition) if (applyPosition)
{ {
t.position = position; t.position = this.position;
} }
if (applyRotation) if (applyRotation)
{ {
t.rotation = rotation; t.rotation = this.rotation;
} }
if (applyScale) if (applyScale)
{ {
t.localScale = localScale; t.localScale = this.localScale;
} }
} }
if (applyName) if (applyName)
{ {
t.name = name; t.name = this.name;
} }
} }
} }

View File

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

View File

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

View File

@@ -1,8 +1,7 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts,
// for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies. // for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies.
// EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null // EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.VertexMoverUtil // Eden.AutoMorpher.VertexMoverUtil
using Eden.AutoMorpher;
using UnityEngine; using UnityEngine;
public class VertexMoverUtil public class VertexMoverUtil
@@ -16,12 +15,12 @@ public class VertexMoverUtil
Vector3[] worldVertices = cloth.worldVertices; Vector3[] worldVertices = cloth.worldVertices;
int num = worldVertices.Length; int num = worldVertices.Length;
bool[] isInboundVerts; bool[] isInboundVerts;
float[] array = ComputeEuclideanDistances(worldVertices, targetPoint, maxRadius, out isInboundVerts); float[] array = this.ComputeEuclideanDistances(worldVertices, targetPoint, maxRadius, out isInboundVerts);
if (array == null) if (array == null)
{ {
return null; return null;
} }
float[] array2 = ComputeKernelWeights(array, isInboundVerts, maxRadius, WeightKernel.Gaussian, param); float[] array2 = this.ComputeKernelWeights(array, isInboundVerts, maxRadius, WeightKernel.Gaussian, param);
Vector3[] array3 = new Vector3[num]; Vector3[] array3 = new Vector3[num];
bool[] isLeftLegVertex = cloth.isLeftLegVertex; bool[] isLeftLegVertex = cloth.isLeftLegVertex;
bool[] isRightLegVertex = cloth.isRightLegVertex; bool[] isRightLegVertex = cloth.isRightLegVertex;
@@ -32,12 +31,12 @@ public class VertexMoverUtil
array3[i] = Vector3.zero; array3[i] = Vector3.zero;
continue; continue;
} }
if (centerIsLeftLeg && IsRightLegVertex(isRightLegVertex, i)) if (centerIsLeftLeg && this.IsRightLegVertex(isRightLegVertex, i))
{ {
array3[i] = Vector3.zero; array3[i] = Vector3.zero;
continue; continue;
} }
if (centerIsRightLeg && IsLeftLegVertex(isLeftLegVertex, i)) if (centerIsRightLeg && this.IsLeftLegVertex(isLeftLegVertex, i))
{ {
array3[i] = Vector3.zero; array3[i] = Vector3.zero;
continue; continue;
@@ -57,12 +56,12 @@ public class VertexMoverUtil
Vector3[] worldVertices = cloth.worldVertices; Vector3[] worldVertices = cloth.worldVertices;
int num = worldVertices.Length; int num = worldVertices.Length;
bool[] isInboundVerts; bool[] isInboundVerts;
float[] array = ComputeEuclideanDistances(worldVertices, targetVertexIdx, maxRadius, out isInboundVerts); float[] array = this.ComputeEuclideanDistances(worldVertices, targetVertexIdx, maxRadius, out isInboundVerts);
if (array == null) if (array == null)
{ {
return null; return null;
} }
float[] array2 = ComputeKernelWeights(array, isInboundVerts, maxRadius, WeightKernel.Gaussian, param); float[] array2 = this.ComputeKernelWeights(array, isInboundVerts, maxRadius, WeightKernel.Gaussian, param);
Vector3[] array3 = new Vector3[num]; Vector3[] array3 = new Vector3[num];
bool[] isLeftLegVertex = cloth.isLeftLegVertex; bool[] isLeftLegVertex = cloth.isLeftLegVertex;
bool[] isRightLegVertex = cloth.isRightLegVertex; bool[] isRightLegVertex = cloth.isRightLegVertex;
@@ -73,12 +72,12 @@ public class VertexMoverUtil
array3[i] = Vector3.zero; array3[i] = Vector3.zero;
continue; continue;
} }
if (centerIsLeftLeg && IsRightLegVertex(isRightLegVertex, i)) if (centerIsLeftLeg && this.IsRightLegVertex(isRightLegVertex, i))
{ {
array3[i] = Vector3.zero; array3[i] = Vector3.zero;
continue; continue;
} }
if (centerIsRightLeg && IsLeftLegVertex(isLeftLegVertex, i)) if (centerIsRightLeg && this.IsLeftLegVertex(isLeftLegVertex, i))
{ {
array3[i] = Vector3.zero; array3[i] = Vector3.zero;
continue; continue;
@@ -91,7 +90,7 @@ 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)
{ {
return ComputeEuclideanDistances(verts, verts[targetVertIdx], maxRadius, out isInboundVerts); return this.ComputeEuclideanDistances(verts, verts[targetVertIdx], maxRadius, out isInboundVerts);
} }
private float[] ComputeEuclideanDistances(Vector3[] verts, Vector3 targetVert, float maxRadius, out bool[] isInboundVerts) private float[] ComputeEuclideanDistances(Vector3[] verts, Vector3 targetVert, float maxRadius, out bool[] isInboundVerts)
@@ -138,10 +137,10 @@ public class VertexMoverUtil
switch (kernel) switch (kernel)
{ {
case WeightKernel.Gaussian: case WeightKernel.Gaussian:
array[i] = ComputeGaussianWeight(dist[i], num2); array[i] = this.ComputeGaussianWeight(dist[i], num2);
break; break;
case WeightKernel.Laplacian: case WeightKernel.Laplacian:
array[i] = ComputeLaplacianWeight(dist[i], num2); array[i] = this.ComputeLaplacianWeight(dist[i], num2);
break; break;
default: default:
array[i] = 0f; array[i] = 0f;

View File

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

View File

@@ -1,8 +1,7 @@
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts, // Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts,
// for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies. // for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies.
// EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null // EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.WorldVertexUtil // Eden.AutoMorpher.WorldVertexUtil
using Eden.AutoMorpher;
using UnityEngine; using UnityEngine;
public class WorldVertexUtil public class WorldVertexUtil
@@ -10,7 +9,7 @@ public class WorldVertexUtil
public Vector3[] GetWorldVertices(SkinnedMeshRenderer smr) public Vector3[] GetWorldVertices(SkinnedMeshRenderer smr)
{ {
Mesh bakedMesh = new Mesh(); Mesh bakedMesh = new Mesh();
return GetWorldVertices(smr, ref bakedMesh); return this.GetWorldVertices(smr, ref bakedMesh);
} }
public Vector3[] GetWorldVertices(SkinnedMeshRenderer smr, ref Mesh bakedMesh) public Vector3[] GetWorldVertices(SkinnedMeshRenderer smr, ref Mesh bakedMesh)