EdenAutoMorpherScript 추출 코드 정제
This commit is contained in:
@@ -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();
|
||||||
Debug.Log((object)$"[DevTimer] {_label}: {_sw.ElapsedMilliseconds} ms");
|
UnityEngine.Debug.Log((object)$"[DevTimer] {this._label}: {this._sw.ElapsedMilliseconds} ms");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -47,7 +45,7 @@ public static class AutoMorpherDev
|
|||||||
{
|
{
|
||||||
if (isDeveloperMode)
|
if (isDeveloperMode)
|
||||||
{
|
{
|
||||||
Debug.Log((object)message);
|
UnityEngine.Debug.Log((object)message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -14,19 +14,19 @@ public class BakedBodyMesh
|
|||||||
{
|
{
|
||||||
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
|
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_0018: Expected O, but got Unknown
|
//IL_0018: Expected O, but got Unknown
|
||||||
smr = _smr;
|
this.smr = _smr;
|
||||||
bakedMesh = new Mesh();
|
this.bakedMesh = new Mesh();
|
||||||
smr.BakeMesh(bakedMesh);
|
this.smr.BakeMesh(this.bakedMesh);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ReBakeMesh()
|
public void ReBakeMesh()
|
||||||
{
|
{
|
||||||
smr.BakeMesh(bakedMesh);
|
this.smr.BakeMesh(this.bakedMesh);
|
||||||
}
|
}
|
||||||
|
|
||||||
~BakedBodyMesh()
|
~BakedBodyMesh()
|
||||||
{
|
{
|
||||||
smr = null;
|
this.smr = null;
|
||||||
bakedMesh = null;
|
this.bakedMesh = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -231,8 +229,7 @@ public class BodyPoseMatchSetupUtil
|
|||||||
Vector3 rootLocalScale = val2.rootLocalScale;
|
Vector3 rootLocalScale = val2.rootLocalScale;
|
||||||
Vector3 lossyScale = rootT.lossyScale;
|
Vector3 lossyScale = rootT.lossyScale;
|
||||||
Vector3 lossyScale2 = val.lossyScale;
|
Vector3 lossyScale2 = val.lossyScale;
|
||||||
Vector3 val4 = default(Vector3);
|
Vector3 val4 = new Vector3(lossyScale2.x / lossyScale.x, lossyScale2.y / lossyScale.y, lossyScale2.z / lossyScale.z);
|
||||||
((Vector3)(ref val4))._002Ector(lossyScale2.x / lossyScale.x, lossyScale2.y / lossyScale.y, lossyScale2.z / lossyScale.z);
|
|
||||||
return new Vector3(val4.x / rootLocalScale.x, val4.y / rootLocalScale.y, val4.z / rootLocalScale.z);
|
return new Vector3(val4.x / rootLocalScale.x, val4.y / rootLocalScale.y, val4.z / rootLocalScale.z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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)
|
||||||
@@ -51,8 +50,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);
|
||||||
@@ -65,7 +64,7 @@ public class BodyPoseMatchUtil
|
|||||||
val.transform.localPosition = Vector3.zero;
|
val.transform.localPosition = Vector3.zero;
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
Dictionary<HumanBodyBones, HashSet<Transform>> dictionary2 = meshClassifier.MeshHumanoidBoneMatcher(component3, proxyBodyMeshes);
|
Dictionary<HumanBodyBones, HashSet<Transform>> dictionary2 = this.meshClassifier.MeshHumanoidBoneMatcher(component3, proxyBodyMeshes);
|
||||||
if (dictionary2 == null || dictionary2.Count == 0)
|
if (dictionary2 == null || dictionary2.Count == 0)
|
||||||
{
|
{
|
||||||
throw new AutoMorpherException("Proxy Bone Map is Missing", "[BodyPoseMatch_Arm] AlignUpperArmByArmPcaCenters\n - proxyBoneMap is null");
|
throw new AutoMorpherException("Proxy Bone Map is Missing", "[BodyPoseMatch_Arm] AlignUpperArmByArmPcaCenters\n - proxyBoneMap is null");
|
||||||
@@ -84,7 +83,7 @@ public class BodyPoseMatchUtil
|
|||||||
}
|
}
|
||||||
BodyPoseMatch_Torso bodyPoseMatch_Torso = new BodyPoseMatch_Torso();
|
BodyPoseMatch_Torso bodyPoseMatch_Torso = new BodyPoseMatch_Torso();
|
||||||
bodyPoseMatch_Torso.AlignTorsoByNeck(val, list, dictionary2, targetAvatar, list2, dictionary);
|
bodyPoseMatch_Torso.AlignTorsoByNeck(val, list, dictionary2, targetAvatar, list2, dictionary);
|
||||||
if (doDebug)
|
if (this.doDebug)
|
||||||
{
|
{
|
||||||
bodyPoseMatch_Torso.DrawTorsoPcaDebug(val, list, dictionary2, Color.yellow, Color.cyan, 1f, 20f);
|
bodyPoseMatch_Torso.DrawTorsoPcaDebug(val, list, dictionary2, Color.yellow, Color.cyan, 1f, 20f);
|
||||||
bodyPoseMatch_Torso.DrawTorsoPcaDebug(targetAvatar, list2, dictionary, Color.red, Color.green, 1f, 20f);
|
bodyPoseMatch_Torso.DrawTorsoPcaDebug(targetAvatar, list2, dictionary, Color.red, Color.green, 1f, 20f);
|
||||||
@@ -95,7 +94,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(val, list, dictionary2, isLeft: true, Color.yellow, Color.cyan, 1f, 20f);
|
bodyPoseMatch_Arm.DrawArmPcaDebug(val, list, dictionary2, isLeft: true, Color.yellow, Color.cyan, 1f, 20f);
|
||||||
bodyPoseMatch_Arm.DrawArmPcaDebug(targetAvatar, list2, dictionary, isLeft: true, Color.red, Color.green, 1f, 20f);
|
bodyPoseMatch_Arm.DrawArmPcaDebug(targetAvatar, list2, dictionary, isLeft: true, Color.red, Color.green, 1f, 20f);
|
||||||
@@ -116,7 +115,7 @@ public class BodyPoseMatchUtil
|
|||||||
item5.ReBakeMesh();
|
item5.ReBakeMesh();
|
||||||
}
|
}
|
||||||
bodyPoseMatch_Leg.ScalingBothLegsAndFoots(val, list, dictionary2, targetAvatar, list2, dictionary);
|
bodyPoseMatch_Leg.ScalingBothLegsAndFoots(val, list, dictionary2, targetAvatar, list2, dictionary);
|
||||||
if (doDebug)
|
if (this.doDebug)
|
||||||
{
|
{
|
||||||
foreach (BakedBodyMesh item6 in list)
|
foreach (BakedBodyMesh item6 in list)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,12 +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;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using Eden.AutoMorpher;
|
|
||||||
using Eden.AutoMorpher.profile;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
public class BodyPoseMatch_Arm
|
public class BodyPoseMatch_Arm
|
||||||
@@ -15,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)
|
||||||
@@ -47,7 +43,7 @@ public class BodyPoseMatch_Arm
|
|||||||
{
|
{
|
||||||
throw new AutoMorpherException("Source Right UpperArm Set is Missing", "[BodyPoseMatch_Arm] AlignUpperArmByArmCenters\n - sourceRightUpperArmSet is null or empty");
|
throw new AutoMorpherException("Source Right UpperArm Set is Missing", "[BodyPoseMatch_Arm] AlignUpperArmByArmCenters\n - sourceRightUpperArmSet is null or empty");
|
||||||
}
|
}
|
||||||
if ((Object)(object)axisReferenceTransform == (Object)null)
|
if (axisReferenceTransform == null)
|
||||||
{
|
{
|
||||||
throw new AutoMorpherException("Axis Reference Transform is Missing", "[BodyPoseMatch_Arm] AlignUpperArmByArmCenters\n - axisReferenceTransform is null");
|
throw new AutoMorpherException("Axis Reference Transform is Missing", "[BodyPoseMatch_Arm] AlignUpperArmByArmCenters\n - axisReferenceTransform is null");
|
||||||
}
|
}
|
||||||
@@ -60,14 +56,14 @@ public class BodyPoseMatch_Arm
|
|||||||
}
|
}
|
||||||
foreach (Transform item in sourceLeftUpperArmSet)
|
foreach (Transform item in sourceLeftUpperArmSet)
|
||||||
{
|
{
|
||||||
if (!((Object)(object)item == (Object)null))
|
if (!(item == null))
|
||||||
{
|
{
|
||||||
item.position += val;
|
item.position += val;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach (Transform item2 in sourceRightUpperArmSet)
|
foreach (Transform item2 in sourceRightUpperArmSet)
|
||||||
{
|
{
|
||||||
if (!((Object)(object)item2 == (Object)null))
|
if (!(item2 == null))
|
||||||
{
|
{
|
||||||
item2.position += val;
|
item2.position += val;
|
||||||
}
|
}
|
||||||
@@ -90,13 +86,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)0);
|
Transform boneFromBoneMap = this.poseMatchCommonUtil.GetBoneFromBoneMap(proxyBoneMap, (HumanBodyBones)0);
|
||||||
if ((Object)(object)boneFromBoneMap == (Object)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)
|
||||||
@@ -104,9 +100,9 @@ public class BodyPoseMatch_Arm
|
|||||||
Debug.LogWarning((object)"[BodyPoseMatch_Arm] AlignUpperArmByArmPcaCenters: proxy arm PCA failed. Skip.");
|
Debug.LogWarning((object)"[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)
|
||||||
@@ -114,7 +110,7 @@ public class BodyPoseMatch_Arm
|
|||||||
Debug.LogWarning((object)"[BodyPoseMatch_Arm] AlignUpperArmByArmPcaCenters: target arm PCA failed. Skip.");
|
Debug.LogWarning((object)"[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)13, out var value) || value == null || value.Count == 0)
|
if (!proxyBoneMap.TryGetValue((HumanBodyBones)13, 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");
|
||||||
@@ -123,7 +119,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)
|
||||||
@@ -156,8 +152,8 @@ 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)0);
|
Transform boneFromBoneMap = this.poseMatchCommonUtil.GetBoneFromBoneMap(clothBoneMap, (HumanBodyBones)0);
|
||||||
if ((Object)(object)boneFromBoneMap == (Object)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");
|
||||||
}
|
}
|
||||||
@@ -171,16 +167,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)
|
||||||
@@ -188,7 +184,7 @@ public class BodyPoseMatch_Arm
|
|||||||
Debug.LogWarning((object)"[BodyPoseMatch_Arm] AlignUpperArmByArmPcaCenters: target arm PCA failed. Skip.");
|
Debug.LogWarning((object)"[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)13, out var value) || value == null || value.Count == 0)
|
if (!clothBoneMap.TryGetValue((HumanBodyBones)13, 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");
|
||||||
@@ -197,7 +193,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)
|
||||||
@@ -237,44 +233,41 @@ public class BodyPoseMatch_Arm
|
|||||||
//IL_012e: Unknown result type (might be due to invalid IL or missing references)
|
//IL_012e: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_0133: Unknown result type (might be due to invalid IL or missing references)
|
//IL_0133: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_0138: Unknown result type (might be due to invalid IL or missing references)
|
//IL_0138: Unknown result type (might be due to invalid IL or missing references)
|
||||||
HumanBodyBones[] array;
|
HumanBodyBones[] targetHumanBones;
|
||||||
if (!isLeft)
|
if (!isLeft)
|
||||||
{
|
{
|
||||||
array = new HumanBodyBones[3];
|
targetHumanBones = new HumanBodyBones[] { (HumanBodyBones)14, (HumanBodyBones)16, (HumanBodyBones)18 };
|
||||||
RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
array = new HumanBodyBones[3];
|
targetHumanBones = new HumanBodyBones[] { (HumanBodyBones)13, (HumanBodyBones)15, (HumanBodyBones)17 };
|
||||||
RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
|
|
||||||
}
|
}
|
||||||
HumanBodyBones[] targetHumanBones = (HumanBodyBones[])(object)array;
|
List<Vector3> list = this.poseMatchCommonUtil.CollectHumanoidVerticesWorld(targetHumanBones, avatarBakedBodyMeshes, avatarBoneMap);
|
||||||
List<Vector3> list = poseMatchCommonUtil.CollectHumanoidVerticesWorld(targetHumanBones, avatarBakedBodyMeshes, avatarBoneMap);
|
|
||||||
if (list == null || list.Count == 0)
|
if (list == null || list.Count == 0)
|
||||||
{
|
{
|
||||||
Debug.LogWarning((object)$"[BodyPoseMatch_Arm] ComputeArmRegionStats: arm vertices 0. isLeft={isLeft}");
|
Debug.LogWarning((object)$"[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, (HumanBodyBones)(isLeft ? 13 : 14));
|
Transform boneFromBoneMap = this.poseMatchCommonUtil.GetBoneFromBoneMap(avatarBoneMap, (HumanBodyBones)(isLeft ? 13 : 14));
|
||||||
Transform boneFromBoneMap2 = poseMatchCommonUtil.GetBoneFromBoneMap(avatarBoneMap, (HumanBodyBones)(isLeft ? 15 : 16));
|
Transform boneFromBoneMap2 = this.poseMatchCommonUtil.GetBoneFromBoneMap(avatarBoneMap, (HumanBodyBones)(isLeft ? 15 : 16));
|
||||||
Transform boneFromBoneMap3 = poseMatchCommonUtil.GetBoneFromBoneMap(avatarBoneMap, (HumanBodyBones)(isLeft ? 17 : 18));
|
Transform boneFromBoneMap3 = this.poseMatchCommonUtil.GetBoneFromBoneMap(avatarBoneMap, (HumanBodyBones)(isLeft ? 17 : 18));
|
||||||
Vector3 principalAxis = Vector3.zero;
|
Vector3 principalAxis = Vector3.zero;
|
||||||
if ((Object)(object)boneFromBoneMap != (Object)null && (Object)(object)boneFromBoneMap3 != (Object)null)
|
if (boneFromBoneMap != null && boneFromBoneMap3 != null)
|
||||||
{
|
{
|
||||||
principalAxis = boneFromBoneMap3.position - boneFromBoneMap.position;
|
principalAxis = boneFromBoneMap3.position - boneFromBoneMap.position;
|
||||||
}
|
}
|
||||||
else if ((Object)(object)boneFromBoneMap != (Object)null && (Object)(object)boneFromBoneMap2 != (Object)null)
|
else if (boneFromBoneMap != null && boneFromBoneMap2 != null)
|
||||||
{
|
{
|
||||||
principalAxis = boneFromBoneMap2.position - boneFromBoneMap.position;
|
principalAxis = boneFromBoneMap2.position - boneFromBoneMap.position;
|
||||||
}
|
}
|
||||||
else if ((Object)(object)boneFromBoneMap2 != (Object)null && (Object)(object)boneFromBoneMap3 != (Object)null)
|
else if (boneFromBoneMap2 != null && boneFromBoneMap3 != null)
|
||||||
{
|
{
|
||||||
principalAxis = boneFromBoneMap3.position - boneFromBoneMap2.position;
|
principalAxis = boneFromBoneMap3.position - boneFromBoneMap2.position;
|
||||||
}
|
}
|
||||||
if (((Vector3)(ref principalAxis)).sqrMagnitude > 1E-08f)
|
if (principalAxis.sqrMagnitude > 1E-08f)
|
||||||
{
|
{
|
||||||
((Vector3)(ref principalAxis)).Normalize();
|
principalAxis.Normalize();
|
||||||
result.principalAxis = principalAxis;
|
result.principalAxis = principalAxis;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@@ -295,14 +288,14 @@ public class BodyPoseMatch_Arm
|
|||||||
HumanBodyBones val = (HumanBodyBones)(isLeft ? 13 : 14);
|
HumanBodyBones val = (HumanBodyBones)(isLeft ? 13 : 14);
|
||||||
HumanBodyBones bone = (HumanBodyBones)(isLeft ? 15 : 16);
|
HumanBodyBones bone = (HumanBodyBones)(isLeft ? 15 : 16);
|
||||||
HumanBodyBones bone2 = (HumanBodyBones)(isLeft ? 17 : 18);
|
HumanBodyBones bone2 = (HumanBodyBones)(isLeft ? 17 : 18);
|
||||||
Transform boneFromBoneMap = poseMatchCommonUtil.GetBoneFromBoneMap(sourceBoneMap, val);
|
Transform boneFromBoneMap = this.poseMatchCommonUtil.GetBoneFromBoneMap(sourceBoneMap, val);
|
||||||
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, val);
|
Transform boneFromBoneMap4 = this.poseMatchCommonUtil.GetBoneFromBoneMap(targetBoneMap, val);
|
||||||
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 ((Object)(object)boneFromBoneMap == (Object)null || (Object)(object)boneFromBoneMap2 == (Object)null || (Object)(object)boneFromBoneMap3 == (Object)null || (Object)(object)boneFromBoneMap4 == (Object)null || (Object)(object)boneFromBoneMap5 == (Object)null || (Object)(object)boneFromBoneMap6 == (Object)null)
|
if (boneFromBoneMap == null || boneFromBoneMap2 == null || boneFromBoneMap3 == null || boneFromBoneMap4 == null || boneFromBoneMap5 == null || boneFromBoneMap6 == null)
|
||||||
{
|
{
|
||||||
Debug.LogWarning((object)"[BodyPoseMatch_Arm] ScalingSingArmLenght: some arm bones are null. Skip.");
|
Debug.LogWarning((object)"[BodyPoseMatch_Arm] ScalingSingArmLenght: some arm bones are null. Skip.");
|
||||||
}
|
}
|
||||||
@@ -312,7 +305,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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -331,12 +324,12 @@ public class BodyPoseMatch_Arm
|
|||||||
//IL_014b: Unknown result type (might be due to invalid IL or missing references)
|
//IL_014b: Unknown result type (might be due to invalid IL or missing references)
|
||||||
HumanBodyBones val = (HumanBodyBones)(isLeft ? 15 : 16);
|
HumanBodyBones val = (HumanBodyBones)(isLeft ? 15 : 16);
|
||||||
HumanBodyBones bone = (HumanBodyBones)(isLeft ? 17 : 18);
|
HumanBodyBones bone = (HumanBodyBones)(isLeft ? 17 : 18);
|
||||||
Transform boneFromBoneMap = poseMatchCommonUtil.GetBoneFromBoneMap(sourceBoneMap, val);
|
Transform boneFromBoneMap = this.poseMatchCommonUtil.GetBoneFromBoneMap(sourceBoneMap, val);
|
||||||
Transform boneFromBoneMap2 = poseMatchCommonUtil.GetBoneFromBoneMap(sourceBoneMap, bone);
|
Transform boneFromBoneMap2 = this.poseMatchCommonUtil.GetBoneFromBoneMap(sourceBoneMap, bone);
|
||||||
Transform boneFromBoneMap3 = poseMatchCommonUtil.GetBoneFromBoneMap(targetBoneMap, val);
|
Transform boneFromBoneMap3 = this.poseMatchCommonUtil.GetBoneFromBoneMap(targetBoneMap, val);
|
||||||
if ((Object)(object)boneFromBoneMap == (Object)null || (Object)(object)boneFromBoneMap2 == (Object)null || (Object)(object)boneFromBoneMap3 == (Object)null)
|
if (boneFromBoneMap == null || boneFromBoneMap2 == null || boneFromBoneMap3 == null)
|
||||||
{
|
{
|
||||||
Debug.LogWarning((object)"[BodyPoseMatch_Arm] ScalingSingArmLenght: some arm bones are null. Skip.");
|
Debug.LogWarning("[BodyPoseMatch_Arm] ScalingSingArmLenght: some arm bones are null. Skip.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
float x = boneFromBoneMap.position.x;
|
float x = boneFromBoneMap.position.x;
|
||||||
@@ -345,11 +338,11 @@ public class BodyPoseMatch_Arm
|
|||||||
float num2 = Mathf.Abs(targetLowerarmExtremeX - x2);
|
float num2 = Mathf.Abs(targetLowerarmExtremeX - x2);
|
||||||
if (num < 0.0001f || num2 < 0.0001f)
|
if (num < 0.0001f || num2 < 0.0001f)
|
||||||
{
|
{
|
||||||
Debug.LogWarning((object)$"[BodyPoseMatch_Arm] ScalingSingArmLenght: span too small. source={num}, target={num2}");
|
Debug.LogWarning($"[BodyPoseMatch_Arm] ScalingSingArmLenght: span too small. source={num}, target={num2}");
|
||||||
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)
|
||||||
{
|
{
|
||||||
@@ -365,7 +358,7 @@ public class BodyPoseMatch_Arm
|
|||||||
}
|
}
|
||||||
foreach (Transform item in sourceBoneMap[val])
|
foreach (Transform item in sourceBoneMap[val])
|
||||||
{
|
{
|
||||||
if (!((Object)(object)item == (Object)null))
|
if (!(item == null))
|
||||||
{
|
{
|
||||||
item.localScale = localScale;
|
item.localScale = localScale;
|
||||||
}
|
}
|
||||||
@@ -378,8 +371,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)
|
||||||
@@ -387,22 +380,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)17, isLeft: true, out var extremeX) && TryGetForearmExtremeX(targetBakedBodyMeshes, targetBoneMap, (HumanBodyBones)17, isLeft: true, out var extremeX2))
|
if (this.TryGetForearmExtremeX(proxyBakedBodyMeshes, proxyBoneMap, (HumanBodyBones)17, isLeft: true, out var extremeX) && this.TryGetForearmExtremeX(targetBakedBodyMeshes, targetBoneMap, (HumanBodyBones)17, 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((object)"[BodyPoseMatch_Arm] ScalingLowerArmLength_BodyMatch: left extreme calc failed. Skip left lower.");
|
Debug.LogWarning((object)"[BodyPoseMatch_Arm] ScalingLowerArmLength_BodyMatch: left extreme calc failed. Skip left lower.");
|
||||||
}
|
}
|
||||||
if (TryGetForearmExtremeX(proxyBakedBodyMeshes, proxyBoneMap, (HumanBodyBones)18, isLeft: false, out var extremeX3) && TryGetForearmExtremeX(targetBakedBodyMeshes, targetBoneMap, (HumanBodyBones)18, isLeft: false, out var extremeX4))
|
if (this.TryGetForearmExtremeX(proxyBakedBodyMeshes, proxyBoneMap, (HumanBodyBones)18, isLeft: false, out var extremeX3) && this.TryGetForearmExtremeX(targetBakedBodyMeshes, targetBoneMap, (HumanBodyBones)18, 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
|
||||||
{
|
{
|
||||||
@@ -421,9 +414,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)
|
||||||
@@ -435,10 +428,10 @@ public class BodyPoseMatch_Arm
|
|||||||
{
|
{
|
||||||
Debug.LogWarning((object)"[BodyPoseMatch_Arm] ScalingLowerArmLength_ProfileMatch: left spatial data missing. Skip left lower.");
|
Debug.LogWarning((object)"[BodyPoseMatch_Arm] ScalingLowerArmLength_ProfileMatch: left spatial data missing. Skip left lower.");
|
||||||
}
|
}
|
||||||
else if (TryGetForearmExtremeX(targetBakedBodyMeshes, targetBoneMap, (HumanBodyBones)17, isLeft: true, out extremeX))
|
else if (this.TryGetForearmExtremeX(targetBakedBodyMeshes, targetBoneMap, (HumanBodyBones)17, 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
|
||||||
{
|
{
|
||||||
@@ -449,10 +442,10 @@ public class BodyPoseMatch_Arm
|
|||||||
{
|
{
|
||||||
Debug.LogWarning((object)"[BodyPoseMatch_Arm] ScalingLowerArmLength_ProfileMatch: right spatial data missing. Skip right lower.");
|
Debug.LogWarning((object)"[BodyPoseMatch_Arm] ScalingLowerArmLength_ProfileMatch: right spatial data missing. Skip right lower.");
|
||||||
}
|
}
|
||||||
else if (TryGetForearmExtremeX(targetBakedBodyMeshes, targetBoneMap, (HumanBodyBones)18, isLeft: false, out extremeX2))
|
else if (this.TryGetForearmExtremeX(targetBakedBodyMeshes, targetBoneMap, (HumanBodyBones)18, 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
|
||||||
{
|
{
|
||||||
@@ -473,7 +466,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;
|
||||||
@@ -507,7 +500,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 ((Object)(object)poseMatchCommonUtil.GetBoneFromBoneMap(clothBoneMap, spatialData.refBone) == (Object)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");
|
||||||
}
|
}
|
||||||
@@ -596,11 +589,11 @@ public class BodyPoseMatch_Arm
|
|||||||
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
|
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
|
||||||
if (avatarBakedBodyMeshes != null && avatarBoneMap != null)
|
if (avatarBakedBodyMeshes != null && avatarBoneMap != null)
|
||||||
{
|
{
|
||||||
RegionStats regionStats = ComputeArmRegionStats(avatarBakedBodyMeshes, avatarBoneMap, isLeft);
|
RegionStats regionStats = this.ComputeArmRegionStats(avatarBakedBodyMeshes, avatarBoneMap, isLeft);
|
||||||
if (!(regionStats.length < 0.0001f))
|
if (!(regionStats.length < 0.0001f))
|
||||||
{
|
{
|
||||||
Vector3 center = regionStats.center;
|
Vector3 center = regionStats.center;
|
||||||
Vector3 val = ((((Vector3)(ref regionStats.principalAxis)).sqrMagnitude > 1E-08f) ? ((Vector3)(ref regionStats.principalAxis)).normalized : Vector3.up);
|
Vector3 val = (regionStats.principalAxis.sqrMagnitude > 1E-08f) ? regionStats.principalAxis.normalized : Vector3.up;
|
||||||
float num = 0.02f * axisScale;
|
float num = 0.02f * axisScale;
|
||||||
Debug.DrawLine(center + Vector3.up * num, center - Vector3.up * num, centerColor, duration);
|
Debug.DrawLine(center + Vector3.up * num, center - Vector3.up * num, centerColor, duration);
|
||||||
Debug.DrawLine(center + Vector3.right * num, center - Vector3.right * num, centerColor, duration);
|
Debug.DrawLine(center + Vector3.right * num, center - Vector3.right * num, centerColor, duration);
|
||||||
@@ -617,8 +610,8 @@ public class BodyPoseMatch_Arm
|
|||||||
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
|
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
|
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
|
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
|
||||||
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)
|
||||||
@@ -655,23 +648,23 @@ public class BodyPoseMatch_Arm
|
|||||||
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
|
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_0107: Unknown result type (might be due to invalid IL or missing references)
|
//IL_0107: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
|
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
|
||||||
if ((Object)(object)avatarObject == (Object)null || bodyMeshes == null || bodyMeshes.Count == 0)
|
if (avatarObject == null || bodyMeshes == null || bodyMeshes.Count == 0)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Animator component = avatarObject.GetComponent<Animator>();
|
Animator component = avatarObject.GetComponent<Animator>();
|
||||||
if (!((Object)(object)component == (Object)null))
|
if (!(component == null))
|
||||||
{
|
{
|
||||||
HumanBodyBones val = (HumanBodyBones)(isLeft ? 15 : 16);
|
HumanBodyBones val = (HumanBodyBones)(isLeft ? 15 : 16);
|
||||||
Transform boneTransform = component.GetBoneTransform(val);
|
Transform boneTransform = component.GetBoneTransform(val);
|
||||||
if ((Object)(object)boneTransform == (Object)null)
|
if (boneTransform == null)
|
||||||
{
|
{
|
||||||
Debug.LogWarning((object)$"[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((object)$"[BodyPoseMatch_Arm] DrawForearmExtremeDebugSingle: extreme vertex not found. isLeft={isLeft}");
|
Debug.LogWarning($"[BodyPoseMatch_Arm] DrawForearmExtremeDebugSingle: extreme vertex not found. isLeft={isLeft}");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Debug.DrawLine(boneTransform.position, extremePos, lineColor, duration);
|
Debug.DrawLine(boneTransform.position, extremePos, lineColor, duration);
|
||||||
@@ -696,13 +689,13 @@ public class BodyPoseMatch_Arm
|
|||||||
//IL_0116: Unknown result type (might be due to invalid IL or missing references)
|
//IL_0116: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_0118: Unknown result type (might be due to invalid IL or missing references)
|
//IL_0118: Unknown result type (might be due to invalid IL or missing references)
|
||||||
extremePos = default(Vector3);
|
extremePos = default(Vector3);
|
||||||
if ((Object)(object)avatar == (Object)null || bodyMeshes == null || bodyMeshes.Count == 0)
|
if (avatar == null || bodyMeshes == null || bodyMeshes.Count == 0)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
HumanBodyBones val = (HumanBodyBones)(isLeft ? 17 : 18);
|
HumanBodyBones val = (HumanBodyBones)(isLeft ? 17 : 18);
|
||||||
Transform boneTransform = avatar.GetBoneTransform(val);
|
Transform boneTransform = avatar.GetBoneTransform(val);
|
||||||
if ((Object)(object)boneTransform == (Object)null)
|
if (boneTransform == null)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -711,7 +704,7 @@ public class BodyPoseMatch_Arm
|
|||||||
for (int i = 0; i < bodyMeshes.Count; i++)
|
for (int i = 0; i < bodyMeshes.Count; i++)
|
||||||
{
|
{
|
||||||
SkinnedMeshRenderer val2 = bodyMeshes[i];
|
SkinnedMeshRenderer val2 = bodyMeshes[i];
|
||||||
if (!((Object)(object)val2 == (Object)null))
|
if (!(val2 == null))
|
||||||
{
|
{
|
||||||
BakedBodyMesh bakedBodyMesh = new BakedBodyMesh(val2);
|
BakedBodyMesh bakedBodyMesh = new BakedBodyMesh(val2);
|
||||||
bakedBodyMesh.ReBakeMesh();
|
bakedBodyMesh.ReBakeMesh();
|
||||||
@@ -722,7 +715,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;
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -42,18 +40,17 @@ 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 ((Object)(object)boneFromBoneMap == (Object)null)
|
if ((Object)(object)boneFromBoneMap == (Object)null)
|
||||||
{
|
{
|
||||||
throw new AutoMorpherException("Profile Ref Bone Transform is Missing", "[BodyPoseMatch_CommonUtil] GetProfilePcaCenterWorld" + $"\n - refBone transform is null (refBone={boneSpatialData.refBone}, context={errorContext})");
|
throw new AutoMorpherException("Profile Ref Bone Transform is Missing", "[BodyPoseMatch_CommonUtil] GetProfilePcaCenterWorld" + $"\n - refBone transform is null (refBone={boneSpatialData.refBone}, context={errorContext})");
|
||||||
}
|
}
|
||||||
if ((Object)(object)GetBoneFromBoneMap(clothBoneMap, (HumanBodyBones)0) == (Object)null)
|
if ((Object)(object)this.GetBoneFromBoneMap(clothBoneMap, (HumanBodyBones)0) == (Object)null)
|
||||||
{
|
{
|
||||||
throw new AutoMorpherException("Hip Transform is Missing", "[BodyPoseMatch_CommonUtil] GetProfilePcaCenterWorld\n - hip transform is null (context=" + errorContext + ")");
|
throw new AutoMorpherException("Hip Transform is Missing", "[BodyPoseMatch_CommonUtil] GetProfilePcaCenterWorld\n - hip transform is null (context=" + errorContext + ")");
|
||||||
}
|
}
|
||||||
Vector3 pcaCenter = boneSpatialData.pcaData.pcaCenter;
|
Vector3 pcaCenter = boneSpatialData.pcaData.pcaCenter;
|
||||||
Vector3 val = default(Vector3);
|
Vector3 val = new Vector3(pcaCenter.x / comprehensiveScale.x, pcaCenter.y / comprehensiveScale.y, pcaCenter.z / comprehensiveScale.z);
|
||||||
((Vector3)(ref val))._002Ector(pcaCenter.x / comprehensiveScale.x, pcaCenter.y / comprehensiveScale.y, pcaCenter.z / comprehensiveScale.z);
|
|
||||||
return boneFromBoneMap.TransformPoint(val);
|
return boneFromBoneMap.TransformPoint(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -61,14 +58,14 @@ public class BodyPoseMatch_CommonUtil
|
|||||||
{
|
{
|
||||||
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
|
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
|
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
|
||||||
return GetProfileVolumeWorld(clothBoneMap, spatialData, axis, comprehensiveScale, isMin: true);
|
return this.GetProfileVolumeWorld(clothBoneMap, spatialData, axis, comprehensiveScale, isMin: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vector3 GetProfileVolumeMaxWorld(Dictionary<HumanBodyBones, HashSet<Transform>> clothBoneMap, BoneSpatialData spatialData, int axis, Vector3 comprehensiveScale)
|
public Vector3 GetProfileVolumeMaxWorld(Dictionary<HumanBodyBones, HashSet<Transform>> clothBoneMap, BoneSpatialData spatialData, int axis, Vector3 comprehensiveScale)
|
||||||
{
|
{
|
||||||
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
|
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
|
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
|
||||||
return GetProfileVolumeWorld(clothBoneMap, spatialData, axis, comprehensiveScale, isMin: false);
|
return this.GetProfileVolumeWorld(clothBoneMap, spatialData, axis, comprehensiveScale, isMin: false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vector3 GetProfileVolumeWorld(Dictionary<HumanBodyBones, HashSet<Transform>> clothBoneMap, BoneSpatialData spatialData, int axisIndex, Vector3 comprehensiveScale, bool isMin)
|
public Vector3 GetProfileVolumeWorld(Dictionary<HumanBodyBones, HashSet<Transform>> clothBoneMap, BoneSpatialData spatialData, int axisIndex, Vector3 comprehensiveScale, bool isMin)
|
||||||
@@ -100,7 +97,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 ((Object)(object)boneFromBoneMap == (Object)null)
|
if ((Object)(object)boneFromBoneMap == (Object)null)
|
||||||
{
|
{
|
||||||
throw new AutoMorpherException("Profile Ref Bone Transform is Missing", "[BodyPoseMatch_CommonUtil] GetProfileVolumeWorld" + $"\n - refBone transform is null (refBone={spatialData.refBone})");
|
throw new AutoMorpherException("Profile Ref Bone Transform is Missing", "[BodyPoseMatch_CommonUtil] GetProfileVolumeWorld" + $"\n - refBone transform is null (refBone={spatialData.refBone})");
|
||||||
@@ -120,8 +117,7 @@ public class BodyPoseMatch_CommonUtil
|
|||||||
default:
|
default:
|
||||||
throw new AutoMorpherException("Unsupported Volume Axis Index", "[BodyPoseMatch_CommonUtil] GetProfileVolumeWorld" + $"\n - axisIndex must be 0(Forward), 1(Right), 2(Up) (axisIndex={axisIndex})");
|
throw new AutoMorpherException("Unsupported Volume Axis Index", "[BodyPoseMatch_CommonUtil] GetProfileVolumeWorld" + $"\n - axisIndex must be 0(Forward), 1(Right), 2(Up) (axisIndex={axisIndex})");
|
||||||
}
|
}
|
||||||
Vector3 val2 = default(Vector3);
|
Vector3 val2 = new Vector3(val.x / comprehensiveScale.x, val.y / comprehensiveScale.y, val.z / comprehensiveScale.z);
|
||||||
((Vector3)(ref val2))._002Ector(val.x / comprehensiveScale.x, val.y / comprehensiveScale.y, val.z / comprehensiveScale.z);
|
|
||||||
return boneFromBoneMap.TransformPoint(val2);
|
return boneFromBoneMap.TransformPoint(val2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -162,10 +158,10 @@ public class BodyPoseMatch_CommonUtil
|
|||||||
{
|
{
|
||||||
BoneWeight val = boneWeights[i];
|
BoneWeight val = boneWeights[i];
|
||||||
float wSum = 0f;
|
float wSum = 0f;
|
||||||
Acc(((BoneWeight)(ref val)).boneIndex0, ((BoneWeight)(ref val)).weight0);
|
Acc(val.boneIndex0, val.weight0);
|
||||||
Acc(((BoneWeight)(ref val)).boneIndex1, ((BoneWeight)(ref val)).weight1);
|
Acc(val.boneIndex1, val.weight1);
|
||||||
Acc(((BoneWeight)(ref val)).boneIndex2, ((BoneWeight)(ref val)).weight2);
|
Acc(val.boneIndex2, val.weight2);
|
||||||
Acc(((BoneWeight)(ref val)).boneIndex3, ((BoneWeight)(ref val)).weight3);
|
Acc(val.boneIndex3, val.weight3);
|
||||||
if (!(wSum < weightThreshold))
|
if (!(wSum < weightThreshold))
|
||||||
{
|
{
|
||||||
list.Add(worldVerticesWithBakedMesh[i]);
|
list.Add(worldVerticesWithBakedMesh[i]);
|
||||||
@@ -216,7 +212,7 @@ public class BodyPoseMatch_CommonUtil
|
|||||||
Debug.Log((object)"[AvatarBodyMatchUtil] CollectBodyPartVerticesWorld: targetBoneSet is empty.");
|
Debug.Log((object)"[AvatarBodyMatchUtil] CollectBodyPartVerticesWorld: targetBoneSet is empty.");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return CollectWeightedVerticesWorld(bakedBodyMeshes, hashSet, weightThreshold, sampleStep);
|
return this.CollectWeightedVerticesWorld(bakedBodyMeshes, hashSet, weightThreshold, sampleStep);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void BoneLengthAdjust(Transform proxyParent, Transform proxyChild, Transform targetParent, Transform targetChild, HashSet<Transform> proxyParentSet, bool autoDetectAxis = true, int forceAxisIndex = 1)
|
public void BoneLengthAdjust(Transform proxyParent, Transform proxyChild, Transform targetParent, Transform targetChild, HashSet<Transform> proxyParentSet, bool autoDetectAxis = true, int forceAxisIndex = 1)
|
||||||
|
|||||||
@@ -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,16 +20,16 @@ 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)
|
||||||
{
|
{
|
||||||
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
|
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
|
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
|
||||||
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)
|
||||||
@@ -44,8 +42,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((object)"[BodyPoseMatch_Leg] AlignUpperLeg_BodyMatch: leg PCA 통계가 비정상입니다.");
|
Debug.LogWarning((object)"[BodyPoseMatch_Leg] AlignUpperLeg_BodyMatch: leg PCA 통계가 비정상입니다.");
|
||||||
@@ -58,7 +56,7 @@ public class BodyPoseMatch_Leg
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AlignUpperLegCore(value, regionStats.center, regionStats2.center);
|
this.AlignUpperLegCore(value, regionStats.center, regionStats2.center);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,8 +80,8 @@ public class BodyPoseMatch_Leg
|
|||||||
Debug.LogWarning((object)("[BodyPoseMatch_Leg] AlignUpperLeg: " + (isLeft ? "Left" : "Right") + " spatial data missing."));
|
Debug.LogWarning((object)("[BodyPoseMatch_Leg] AlignUpperLeg: " + (isLeft ? "Left" : "Right") + " spatial data missing."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Vector3 profilePcaCenterWorld = poseMatchCommonUtil.GetProfilePcaCenterWorld(clothBoneMap, val, comprehensiveScale);
|
Vector3 profilePcaCenterWorld = this.poseMatchCommonUtil.GetProfilePcaCenterWorld(clothBoneMap, val, 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)
|
||||||
{
|
{
|
||||||
@@ -95,7 +93,7 @@ public class BodyPoseMatch_Leg
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AlignUpperLegCore(value, profilePcaCenterWorld, regionStats.center);
|
this.AlignUpperLegCore(value, profilePcaCenterWorld, regionStats.center);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -149,20 +147,20 @@ public class BodyPoseMatch_Leg
|
|||||||
(HumanBodyBones)1,
|
(HumanBodyBones)1,
|
||||||
(HumanBodyBones)3
|
(HumanBodyBones)3
|
||||||
});
|
});
|
||||||
List<Vector3> list = poseMatchCommonUtil.CollectHumanoidVerticesWorld(targetHumanBones, avatarBakedBodyMeshes, avatarBoneMap);
|
List<Vector3> list = this.poseMatchCommonUtil.CollectHumanoidVerticesWorld(targetHumanBones, avatarBakedBodyMeshes, avatarBoneMap);
|
||||||
if (list == null || list.Count == 0)
|
if (list == null || list.Count == 0)
|
||||||
{
|
{
|
||||||
Debug.LogWarning((object)$"[BodyPoseMatch_Leg] ComputeLegRegionStats: leg vertices 0개. avatar={((avatarTransform != null) ? ((Object)avatarTransform).name : null)}, isLeft={isLeft}");
|
Debug.LogWarning((object)$"[BodyPoseMatch_Leg] ComputeLegRegionStats: leg vertices 0개. avatar={((avatarTransform != null) ? ((Object)avatarTransform).name : null)}, 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, (HumanBodyBones)(isLeft ? 1 : 2));
|
Transform boneFromBoneMap = this.poseMatchCommonUtil.GetBoneFromBoneMap(avatarBoneMap, (HumanBodyBones)(isLeft ? 1 : 2));
|
||||||
Transform boneFromBoneMap2 = poseMatchCommonUtil.GetBoneFromBoneMap(avatarBoneMap, (HumanBodyBones)(isLeft ? 3 : 4));
|
Transform boneFromBoneMap2 = this.poseMatchCommonUtil.GetBoneFromBoneMap(avatarBoneMap, (HumanBodyBones)(isLeft ? 3 : 4));
|
||||||
if ((Object)(object)boneFromBoneMap != (Object)null && (Object)(object)boneFromBoneMap2 != (Object)null)
|
if ((Object)(object)boneFromBoneMap != (Object)null && (Object)(object)boneFromBoneMap2 != (Object)null)
|
||||||
{
|
{
|
||||||
Vector3 val = boneFromBoneMap2.position - boneFromBoneMap.position;
|
Vector3 val = boneFromBoneMap2.position - boneFromBoneMap.position;
|
||||||
Vector3 normalized = ((Vector3)(ref val)).normalized;
|
Vector3 normalized = val.normalized;
|
||||||
Vector3 val2 = ((Vector3)(ref result.principalAxis)).normalized;
|
Vector3 val2 = result.principalAxis.normalized;
|
||||||
if (Vector3.Dot(val2, normalized) < 0f)
|
if (Vector3.Dot(val2, normalized) < 0f)
|
||||||
{
|
{
|
||||||
val2 = -val2;
|
val2 = -val2;
|
||||||
@@ -174,8 +172,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)
|
||||||
@@ -183,18 +181,18 @@ 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)
|
||||||
{
|
{
|
||||||
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
|
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
|
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
|
||||||
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)
|
||||||
@@ -217,10 +215,10 @@ public class BodyPoseMatch_Leg
|
|||||||
//IL_0185: Unknown result type (might be due to invalid IL or missing references)
|
//IL_0185: Unknown result type (might be due to invalid IL or missing references)
|
||||||
HumanBodyBones val = (HumanBodyBones)(isLeft ? 1 : 2);
|
HumanBodyBones val = (HumanBodyBones)(isLeft ? 1 : 2);
|
||||||
HumanBodyBones bone = (HumanBodyBones)(isLeft ? 3 : 4);
|
HumanBodyBones bone = (HumanBodyBones)(isLeft ? 3 : 4);
|
||||||
Transform boneFromBoneMap = poseMatchCommonUtil.GetBoneFromBoneMap(proxyBoneMap, val);
|
Transform boneFromBoneMap = this.poseMatchCommonUtil.GetBoneFromBoneMap(proxyBoneMap, val);
|
||||||
Transform boneFromBoneMap2 = poseMatchCommonUtil.GetBoneFromBoneMap(proxyBoneMap, bone);
|
Transform boneFromBoneMap2 = this.poseMatchCommonUtil.GetBoneFromBoneMap(proxyBoneMap, bone);
|
||||||
Transform boneFromBoneMap3 = poseMatchCommonUtil.GetBoneFromBoneMap(targetBoneMap, val);
|
Transform boneFromBoneMap3 = this.poseMatchCommonUtil.GetBoneFromBoneMap(targetBoneMap, val);
|
||||||
Transform boneFromBoneMap4 = poseMatchCommonUtil.GetBoneFromBoneMap(targetBoneMap, bone);
|
Transform boneFromBoneMap4 = this.poseMatchCommonUtil.GetBoneFromBoneMap(targetBoneMap, bone);
|
||||||
if ((Object)(object)boneFromBoneMap == (Object)null || (Object)(object)boneFromBoneMap2 == (Object)null || (Object)(object)boneFromBoneMap3 == (Object)null || (Object)(object)boneFromBoneMap4 == (Object)null)
|
if ((Object)(object)boneFromBoneMap == (Object)null || (Object)(object)boneFromBoneMap2 == (Object)null || (Object)(object)boneFromBoneMap3 == (Object)null || (Object)(object)boneFromBoneMap4 == (Object)null)
|
||||||
{
|
{
|
||||||
Debug.LogWarning((object)"[AvatarBodyMatchUtil] ScalingLeg: some leg bones are null");
|
Debug.LogWarning((object)"[AvatarBodyMatchUtil] ScalingLeg: some leg bones are null");
|
||||||
@@ -231,10 +229,10 @@ public class BodyPoseMatch_Leg
|
|||||||
Debug.LogWarning((object)"[AvatarBodyMatchUtil] ScalingLeg: proxy upperLeg bone set missing");
|
Debug.LogWarning((object)"[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 val2 = (HumanBodyBones)(isLeft ? 5 : 6);
|
HumanBodyBones val2 = (HumanBodyBones)(isLeft ? 5 : 6);
|
||||||
Transform boneFromBoneMap5 = poseMatchCommonUtil.GetBoneFromBoneMap(proxyBoneMap, val2);
|
Transform boneFromBoneMap5 = this.poseMatchCommonUtil.GetBoneFromBoneMap(proxyBoneMap, val2);
|
||||||
Transform boneFromBoneMap6 = poseMatchCommonUtil.GetBoneFromBoneMap(targetBoneMap, val2);
|
Transform boneFromBoneMap6 = this.poseMatchCommonUtil.GetBoneFromBoneMap(targetBoneMap, val2);
|
||||||
if ((Object)(object)boneFromBoneMap5 == (Object)null || (Object)(object)boneFromBoneMap6 == (Object)null)
|
if ((Object)(object)boneFromBoneMap5 == (Object)null || (Object)(object)boneFromBoneMap6 == (Object)null)
|
||||||
{
|
{
|
||||||
Debug.LogWarning((object)"[AvatarBodyMatchUtil] ScalingFoot: proxyFoot or targetFoot is null");
|
Debug.LogWarning((object)"[AvatarBodyMatchUtil] ScalingFoot: proxyFoot or targetFoot is null");
|
||||||
@@ -246,8 +244,7 @@ public class BodyPoseMatch_Leg
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Vector3 val3 = default(Vector3);
|
Vector3 val3 = new Vector3(0f, num, 0f);
|
||||||
((Vector3)(ref val3))._002Ector(0f, num, 0f);
|
|
||||||
if (proxyBoneMap == null || !proxyBoneMap.TryGetValue(val2, out var value2) || value2 == null || value2.Count <= 0)
|
if (proxyBoneMap == null || !proxyBoneMap.TryGetValue(val2, out var value2) || value2 == null || value2.Count <= 0)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@@ -308,12 +305,12 @@ public class BodyPoseMatch_Leg
|
|||||||
if (!((Object)(object)val == (Object)null))
|
if (!((Object)(object)val == (Object)null))
|
||||||
{
|
{
|
||||||
TempBoneMarker tempBoneMarker;
|
TempBoneMarker tempBoneMarker;
|
||||||
Transform val2 = poseMatchCommonUtil.CreateTempMarker("scaleSupportBone", key, value2, val.position, Quaternion.identity, val.localScale, out tempBoneMarker);
|
Transform val2 = this.poseMatchCommonUtil.CreateTempMarker("scaleSupportBone", key, value2, val.position, Quaternion.identity, val.localScale, out tempBoneMarker);
|
||||||
if (!((Object)(object)val2 == (Object)null))
|
if (!((Object)(object)val2 == (Object)null))
|
||||||
{
|
{
|
||||||
ScaleAndAlignAlongAxis(proxyHip, proxyHip.forward, proxyHip.up, val2, proxyToeF, proxyHeelF, targetFoot, targetToeF, targetHeelF);
|
this.ScaleAndAlignAlongAxis(proxyHip, proxyHip.forward, proxyHip.up, val2, proxyToeF, proxyHeelF, targetFoot, targetToeF, targetHeelF);
|
||||||
ScaleAndAlignAlongAxis(proxyHip, proxyHip.right, proxyHip.up, val2, isLeft ? proxySideMin : proxySideMax, isLeft ? proxySideMax : proxySideMin, targetFoot, isLeft ? targetSideMin : targetSideMax, isLeft ? targetSideMax : targetSideMin);
|
this.ScaleAndAlignAlongAxis(proxyHip, proxyHip.right, proxyHip.up, val2, isLeft ? proxySideMin : proxySideMax, isLeft ? proxySideMax : proxySideMin, targetFoot, isLeft ? targetSideMin : targetSideMax, isLeft ? targetSideMax : targetSideMin);
|
||||||
ScaleAndAlignAlongAxis(proxyHip, proxyHip.up, proxyHip.forward, val2, 0f, proxySoleY, targetFoot, 0f, targetSoleY);
|
this.ScaleAndAlignAlongAxis(proxyHip, proxyHip.up, proxyHip.forward, val2, 0f, proxySoleY, targetFoot, 0f, targetSoleY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -330,19 +327,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 val = (HumanBodyBones)(isLeft ? 5 : 6);
|
HumanBodyBones val = (HumanBodyBones)(isLeft ? 5 : 6);
|
||||||
Transform boneFromBoneMap = poseMatchCommonUtil.GetBoneFromBoneMap(proxyBoneMap, val);
|
Transform boneFromBoneMap = this.poseMatchCommonUtil.GetBoneFromBoneMap(proxyBoneMap, val);
|
||||||
Transform boneFromBoneMap2 = poseMatchCommonUtil.GetBoneFromBoneMap(targetBoneMap, val);
|
Transform boneFromBoneMap2 = this.poseMatchCommonUtil.GetBoneFromBoneMap(targetBoneMap, val);
|
||||||
if ((Object)(object)boneFromBoneMap == (Object)null || (Object)(object)boneFromBoneMap2 == (Object)null)
|
if ((Object)(object)boneFromBoneMap == (Object)null || (Object)(object)boneFromBoneMap2 == (Object)null)
|
||||||
{
|
{
|
||||||
Debug.LogWarning((object)"[AvatarBodyMatchUtil] ScalingFoot: proxyFoot or targetFoot is null");
|
Debug.LogWarning((object)"[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((object)"[AvatarBodyMatchUtil] ScalingFoot: foot spatial data 계산 실패");
|
Debug.LogWarning((object)"[AvatarBodyMatchUtil] ScalingFoot: foot spatial data 계산 실패");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Transform boneFromBoneMap3 = poseMatchCommonUtil.GetBoneFromBoneMap(proxyBoneMap, (HumanBodyBones)0);
|
Transform boneFromBoneMap3 = this.poseMatchCommonUtil.GetBoneFromBoneMap(proxyBoneMap, (HumanBodyBones)0);
|
||||||
HashSet<Transform> value;
|
HashSet<Transform> value;
|
||||||
if ((Object)(object)boneFromBoneMap3 == (Object)null)
|
if ((Object)(object)boneFromBoneMap3 == (Object)null)
|
||||||
{
|
{
|
||||||
@@ -354,7 +351,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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -385,26 +382,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 val = (HumanBodyBones)(isLeft ? 5 : 6);
|
HumanBodyBones val = (HumanBodyBones)(isLeft ? 5 : 6);
|
||||||
Transform boneFromBoneMap = poseMatchCommonUtil.GetBoneFromBoneMap(clothBoneMap, val);
|
Transform boneFromBoneMap = this.poseMatchCommonUtil.GetBoneFromBoneMap(clothBoneMap, val);
|
||||||
Transform boneFromBoneMap2 = poseMatchCommonUtil.GetBoneFromBoneMap(targetBoneMap, val);
|
Transform boneFromBoneMap2 = this.poseMatchCommonUtil.GetBoneFromBoneMap(targetBoneMap, val);
|
||||||
if ((Object)(object)boneFromBoneMap == (Object)null || (Object)(object)boneFromBoneMap2 == (Object)null)
|
if ((Object)(object)boneFromBoneMap == (Object)null || (Object)(object)boneFromBoneMap2 == (Object)null)
|
||||||
{
|
{
|
||||||
Debug.LogWarning((object)"[AvatarBodyMatchUtil] ScalingFoot: proxyFoot or targetFoot is null");
|
Debug.LogWarning((object)"[AvatarBodyMatchUtil] ScalingFoot: proxyFoot or targetFoot is null");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!TryGetFootSpatialData(((Component)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(((Component)targetTransform).transform, targetBakedBodyMeshes, targetBoneMap, isLeft, out var _, out var footMinUp, out var heelF, out var toeF, out var sideMin, out var sideMax))
|
||||||
{
|
{
|
||||||
Debug.LogWarning((object)"[AvatarBodyMatchUtil] ScalingFoot: foot spatial data 계산 실패");
|
Debug.LogWarning((object)"[AvatarBodyMatchUtil] ScalingFoot: foot spatial data 계산 실패");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Transform boneFromBoneMap3 = poseMatchCommonUtil.GetBoneFromBoneMap(clothBoneMap, (HumanBodyBones)0);
|
Transform boneFromBoneMap3 = this.poseMatchCommonUtil.GetBoneFromBoneMap(clothBoneMap, (HumanBodyBones)0);
|
||||||
BoneSpatialData val2 = (isLeft ? profileData.LeftFootSpatialData : profileData.RightFootSpatialData);
|
BoneSpatialData val2 = (isLeft ? profileData.LeftFootSpatialData : profileData.RightFootSpatialData);
|
||||||
if (val2 == null)
|
if (val2 == null)
|
||||||
{
|
{
|
||||||
Debug.LogWarning((object)"[AvatarBodyMatchUtil] AlignNeckCenterByPcaWithHipZ: Profile FootSpatialData Data is Not exist.");
|
Debug.LogWarning((object)"[AvatarBodyMatchUtil] AlignNeckCenterByPcaWithHipZ: Profile FootSpatialData Data is Not exist.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Transform boneFromBoneMap4 = poseMatchCommonUtil.GetBoneFromBoneMap(clothBoneMap, val2.refBone);
|
Transform boneFromBoneMap4 = this.poseMatchCommonUtil.GetBoneFromBoneMap(clothBoneMap, val2.refBone);
|
||||||
if ((Object)(object)boneFromBoneMap4 == (Object)null)
|
if ((Object)(object)boneFromBoneMap4 == (Object)null)
|
||||||
{
|
{
|
||||||
Debug.LogWarning((object)"[BodyPoseMatch_Leg] ScalingFoot: clothRefBone is null");
|
Debug.LogWarning((object)"[BodyPoseMatch_Leg] ScalingFoot: clothRefBone is null");
|
||||||
@@ -422,7 +419,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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -578,7 +575,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;
|
||||||
@@ -665,14 +662,14 @@ public class BodyPoseMatch_Leg
|
|||||||
//IL_014a: Unknown result type (might be due to invalid IL or missing references)
|
//IL_014a: Unknown result type (might be due to invalid IL or missing references)
|
||||||
if (!((Object)(object)avatarObject == (Object)null))
|
if (!((Object)(object)avatarObject == (Object)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((object)$"[AvatarBodyMatchUtil] DrawLegPcaDebug: PCA length too small (avatar={((Object)avatarObject).name}, isLeft={isLeft})");
|
Debug.LogWarning((object)$"[AvatarBodyMatchUtil] DrawLegPcaDebug: PCA length too small (avatar={((Object)avatarObject).name}, isLeft={isLeft})");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Vector3 center = regionStats.center;
|
Vector3 center = regionStats.center;
|
||||||
Vector3 normalized = ((Vector3)(ref regionStats.principalAxis)).normalized;
|
Vector3 normalized = regionStats.principalAxis.normalized;
|
||||||
float num = 0.03f * axisScale;
|
float num = 0.03f * axisScale;
|
||||||
Debug.DrawLine(center + Vector3.up * num, center - Vector3.up * num, centerColor, duration);
|
Debug.DrawLine(center + Vector3.up * num, center - Vector3.up * num, centerColor, duration);
|
||||||
Debug.DrawLine(center + Vector3.right * num, center - Vector3.right * num, centerColor, duration);
|
Debug.DrawLine(center + Vector3.right * num, center - Vector3.right * num, centerColor, duration);
|
||||||
@@ -748,7 +745,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((object)("[BodyPoseMatch_Leg] DrawFootSpatialDebug" + $"\n - Failed to compute Foot Spatial Data (avatar={((Object)avatarObject).name}, isLeft={isLeft})"));
|
Debug.LogWarning((object)("[BodyPoseMatch_Leg] DrawFootSpatialDebug" + $"\n - Failed to compute Foot Spatial Data (avatar={((Object)avatarObject).name}, isLeft={isLeft})"));
|
||||||
}
|
}
|
||||||
@@ -777,26 +774,26 @@ public class BodyPoseMatch_Leg
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Vector3 position = val2.position;
|
Vector3 position = val2.position;
|
||||||
Transform boneFromBoneMap = poseMatchCommonUtil.GetBoneFromBoneMap(avatarBoneMap, (HumanBodyBones)0);
|
Transform boneFromBoneMap = this.poseMatchCommonUtil.GetBoneFromBoneMap(avatarBoneMap, (HumanBodyBones)0);
|
||||||
Vector3 val3 = (((Object)(object)boneFromBoneMap != (Object)null) ? boneFromBoneMap.forward : avatarObject.transform.forward);
|
Vector3 val3 = (boneFromBoneMap != null) ? boneFromBoneMap.forward : avatarObject.transform.forward;
|
||||||
val3.y = 0f;
|
val3.y = 0f;
|
||||||
if (((Vector3)(ref val3)).sqrMagnitude < 1E-06f)
|
if (val3.sqrMagnitude < 1E-06f)
|
||||||
{
|
{
|
||||||
val3 = Vector3.forward;
|
val3 = Vector3.forward;
|
||||||
}
|
}
|
||||||
((Vector3)(ref val3)).Normalize();
|
val3.Normalize();
|
||||||
Vector3 val4 = Vector3.Cross(Vector3.up, val3);
|
Vector3 val4 = Vector3.Cross(Vector3.up, val3);
|
||||||
if (((Vector3)(ref val4)).sqrMagnitude < 1E-06f)
|
if (val4.sqrMagnitude < 1E-06f)
|
||||||
{
|
{
|
||||||
val4 = Vector3.right;
|
val4 = Vector3.right;
|
||||||
}
|
}
|
||||||
((Vector3)(ref val4)).Normalize();
|
val4.Normalize();
|
||||||
Vector3 val5 = (((Object)(object)boneFromBoneMap != (Object)null) ? boneFromBoneMap.up : avatarObject.transform.up);
|
Vector3 val5 = (boneFromBoneMap != null) ? boneFromBoneMap.up : avatarObject.transform.up;
|
||||||
if (((Vector3)(ref val5)).sqrMagnitude < 1E-06f)
|
if (val5.sqrMagnitude < 1E-06f)
|
||||||
{
|
{
|
||||||
val5 = Vector3.up;
|
val5 = Vector3.up;
|
||||||
}
|
}
|
||||||
((Vector3)(ref val5)).Normalize();
|
val5.Normalize();
|
||||||
float num = Mathf.Max(0.0001f, axisScale * 0.5f);
|
float num = Mathf.Max(0.0001f, axisScale * 0.5f);
|
||||||
DrawCross(position, val5, val4, centerColor, num, duration);
|
DrawCross(position, val5, val4, centerColor, num, duration);
|
||||||
DrawCross(position, val5, val3, centerColor, num, duration);
|
DrawCross(position, val5, val3, centerColor, num, duration);
|
||||||
@@ -835,9 +832,9 @@ public class BodyPoseMatch_Leg
|
|||||||
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
|
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
|
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
|
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
|
||||||
if (!(((Vector3)(ref dir)).sqrMagnitude < 1E-10f))
|
if (!(dir.sqrMagnitude < 1E-10f))
|
||||||
{
|
{
|
||||||
((Vector3)(ref dir)).Normalize();
|
dir.Normalize();
|
||||||
Debug.DrawLine(start, start + dir * num6, color, d);
|
Debug.DrawLine(start, start + dir * num6, color, d);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -916,16 +913,16 @@ public class BodyPoseMatch_Leg
|
|||||||
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
|
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
|
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
|
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
|
||||||
if (((Vector3)(ref axisA)).sqrMagnitude < 1E-10f)
|
if (axisA.sqrMagnitude < 1E-10f)
|
||||||
{
|
{
|
||||||
axisA = Vector3.up;
|
axisA = Vector3.up;
|
||||||
}
|
}
|
||||||
if (((Vector3)(ref axisB)).sqrMagnitude < 1E-10f)
|
if (axisB.sqrMagnitude < 1E-10f)
|
||||||
{
|
{
|
||||||
axisB = Vector3.right;
|
axisB = Vector3.right;
|
||||||
}
|
}
|
||||||
((Vector3)(ref axisA)).Normalize();
|
axisA.Normalize();
|
||||||
((Vector3)(ref axisB)).Normalize();
|
axisB.Normalize();
|
||||||
Debug.DrawLine(pos - axisA * num6, pos + axisA * num6, color, d);
|
Debug.DrawLine(pos - axisA * num6, pos + axisA * num6, color, d);
|
||||||
Debug.DrawLine(pos - axisB * num6, pos + axisB * num6, color, d);
|
Debug.DrawLine(pos - axisB * num6, pos + axisB * num6, color, d);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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)
|
||||||
@@ -61,8 +59,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((object)"[BodyPoseMatch_Torso] AlignTorsoByNeck: Neck PCA 통계가 비정상입니다.");
|
Debug.LogWarning((object)"[BodyPoseMatch_Torso] AlignTorsoByNeck: Neck PCA 통계가 비정상입니다.");
|
||||||
@@ -72,7 +70,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)
|
||||||
@@ -90,7 +88,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((object)"[BodyPoseMatch_Torso] AlignTorsoByNeck: Neck PCA 통계가 비정상입니다.");
|
Debug.LogWarning((object)"[BodyPoseMatch_Torso] AlignTorsoByNeck: Neck PCA 통계가 비정상입니다.");
|
||||||
@@ -100,8 +98,8 @@ 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)
|
||||||
@@ -124,7 +122,7 @@ public class BodyPoseMatch_Torso
|
|||||||
//IL_0135: Unknown result type (might be due to invalid IL or missing references)
|
//IL_0135: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_013a: Unknown result type (might be due to invalid IL or missing references)
|
//IL_013a: Unknown result type (might be due to invalid IL or missing references)
|
||||||
HumanBodyBones[] targetHumanBones = (HumanBodyBones[])(object)new HumanBodyBones[1] { (HumanBodyBones)9 };
|
HumanBodyBones[] targetHumanBones = (HumanBodyBones[])(object)new HumanBodyBones[1] { (HumanBodyBones)9 };
|
||||||
List<Vector3> list = poseMatchCommonUtil.CollectHumanoidVerticesWorld(targetHumanBones, avatarBakedBodyMeshes, avatarBoneMap);
|
List<Vector3> list = this.poseMatchCommonUtil.CollectHumanoidVerticesWorld(targetHumanBones, avatarBakedBodyMeshes, avatarBoneMap);
|
||||||
if (list == null || list.Count == 0)
|
if (list == null || list.Count == 0)
|
||||||
{
|
{
|
||||||
Debug.LogWarning((object)("[AvatarBodyMatchUtil] ComputeNeckRegionStats: neck vertices 0개. avatar=" + ((avatarTransform != null) ? ((Object)avatarTransform).name : null)));
|
Debug.LogWarning((object)("[AvatarBodyMatchUtil] ComputeNeckRegionStats: neck vertices 0개. avatar=" + ((avatarTransform != null) ? ((Object)avatarTransform).name : null)));
|
||||||
@@ -132,10 +130,10 @@ public class BodyPoseMatch_Torso
|
|||||||
}
|
}
|
||||||
RegionStats result = new PcaUtil().ComputeRegionStats(list);
|
RegionStats result = new PcaUtil().ComputeRegionStats(list);
|
||||||
Vector3 val = avatarTransform.up;
|
Vector3 val = avatarTransform.up;
|
||||||
Transform boneFromBoneMap = poseMatchCommonUtil.GetBoneFromBoneMap(avatarBoneMap, (HumanBodyBones)10);
|
Transform boneFromBoneMap = this.poseMatchCommonUtil.GetBoneFromBoneMap(avatarBoneMap, (HumanBodyBones)10);
|
||||||
Transform boneFromBoneMap2 = poseMatchCommonUtil.GetBoneFromBoneMap(avatarBoneMap, (HumanBodyBones)54);
|
Transform boneFromBoneMap2 = this.poseMatchCommonUtil.GetBoneFromBoneMap(avatarBoneMap, (HumanBodyBones)54);
|
||||||
Transform boneFromBoneMap3 = poseMatchCommonUtil.GetBoneFromBoneMap(avatarBoneMap, (HumanBodyBones)8);
|
Transform boneFromBoneMap3 = this.poseMatchCommonUtil.GetBoneFromBoneMap(avatarBoneMap, (HumanBodyBones)8);
|
||||||
Transform boneFromBoneMap4 = poseMatchCommonUtil.GetBoneFromBoneMap(avatarBoneMap, (HumanBodyBones)0);
|
Transform boneFromBoneMap4 = this.poseMatchCommonUtil.GetBoneFromBoneMap(avatarBoneMap, (HumanBodyBones)0);
|
||||||
Transform val2 = (((Object)(object)boneFromBoneMap2 != (Object)null) ? boneFromBoneMap2 : boneFromBoneMap3);
|
Transform val2 = (((Object)(object)boneFromBoneMap2 != (Object)null) ? boneFromBoneMap2 : boneFromBoneMap3);
|
||||||
if ((Object)(object)boneFromBoneMap != (Object)null && (Object)(object)val2 != (Object)null)
|
if ((Object)(object)boneFromBoneMap != (Object)null && (Object)(object)val2 != (Object)null)
|
||||||
{
|
{
|
||||||
@@ -145,9 +143,9 @@ public class BodyPoseMatch_Torso
|
|||||||
{
|
{
|
||||||
val = boneFromBoneMap.position - boneFromBoneMap4.position;
|
val = boneFromBoneMap.position - boneFromBoneMap4.position;
|
||||||
}
|
}
|
||||||
if (((Vector3)(ref val)).sqrMagnitude > 1E-08f)
|
if (val.sqrMagnitude > 1E-08f)
|
||||||
{
|
{
|
||||||
((Vector3)(ref val)).Normalize();
|
val.Normalize();
|
||||||
}
|
}
|
||||||
if (Vector3.Dot(val, ((Component)avatarTransform).transform.up) < 0f)
|
if (Vector3.Dot(val, ((Component)avatarTransform).transform.up) < 0f)
|
||||||
{
|
{
|
||||||
@@ -193,14 +191,14 @@ public class BodyPoseMatch_Torso
|
|||||||
//IL_0106: Unknown result type (might be due to invalid IL or missing references)
|
//IL_0106: Unknown result type (might be due to invalid IL or missing references)
|
||||||
if (!((Object)(object)avatarObject == (Object)null))
|
if (!((Object)(object)avatarObject == (Object)null))
|
||||||
{
|
{
|
||||||
RegionStats regionStats = ComputeNeckRegionStats(avatarObject.transform, avatarBakedBodyMeshes, avatarBoneMap);
|
RegionStats regionStats = this.ComputeNeckRegionStats(avatarObject.transform, avatarBakedBodyMeshes, avatarBoneMap);
|
||||||
if (regionStats.length < 0.0001f)
|
if (regionStats.length < 0.0001f)
|
||||||
{
|
{
|
||||||
Debug.LogWarning((object)$"[AvatarBodyMatchUtil] DrawNeckPcaDebug: neck.length가 너무 작음. avatar={((Object)avatarObject).name}, length={regionStats.length}");
|
Debug.LogWarning((object)$"[AvatarBodyMatchUtil] DrawNeckPcaDebug: neck.length가 너무 작음. avatar={((Object)avatarObject).name}, length={regionStats.length}");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Vector3 center = regionStats.center;
|
Vector3 center = regionStats.center;
|
||||||
Vector3 normalized = ((Vector3)(ref regionStats.principalAxis)).normalized;
|
Vector3 normalized = regionStats.principalAxis.normalized;
|
||||||
float num = 0.02f * axisScale;
|
float num = 0.02f * axisScale;
|
||||||
Debug.DrawLine(center + Vector3.up * num, center - Vector3.up * num, centerColor, duration);
|
Debug.DrawLine(center + Vector3.up * num, center - Vector3.up * num, centerColor, duration);
|
||||||
Debug.DrawLine(center + Vector3.right * num, center - Vector3.right * num, centerColor, duration);
|
Debug.DrawLine(center + Vector3.right * num, center - Vector3.right * num, centerColor, duration);
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -54,7 +53,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)component).transform;
|
Transform transform = ((Component)component).transform;
|
||||||
Dictionary<Transform, int> dictionary = BuildDepthMap(transform);
|
Dictionary<Transform, int> dictionary = this.BuildDepthMap(transform);
|
||||||
Dictionary<Transform, Transform> dictionary2 = new Dictionary<Transform, Transform>();
|
Dictionary<Transform, Transform> dictionary2 = new Dictionary<Transform, Transform>();
|
||||||
List<BoneMapping> list = new List<BoneMapping>();
|
List<BoneMapping> list = new List<BoneMapping>();
|
||||||
HashSet<Transform> hashSet = new HashSet<Transform>();
|
HashSet<Transform> hashSet = new HashSet<Transform>();
|
||||||
@@ -92,7 +91,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 && (Object)(object)m.proxyBone != (Object)null && (Object)(object)m.clothBone != (Object)null
|
where m != null && (Object)(object)m.proxyBone != (Object)null && (Object)(object)m.clothBone != (Object)null
|
||||||
orderby m.depth
|
orderby m.depth
|
||||||
@@ -128,7 +127,7 @@ public class BodyPoseToClothApplier
|
|||||||
{
|
{
|
||||||
if (!((Object)(object)val == (Object)null))
|
if (!((Object)(object)val == (Object)null))
|
||||||
{
|
{
|
||||||
dictionary[val] = GetDepthFromRoot(val, root);
|
dictionary[val] = this.GetDepthFromRoot(val, root);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return dictionary;
|
return dictionary;
|
||||||
@@ -186,8 +185,8 @@ public class BodyPoseToClothApplier
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
List<Transform> list = CollectDirectChilds(value);
|
List<Transform> list = this.CollectDirectChilds(value);
|
||||||
Transform val = FindMarkerInChild(value);
|
Transform val = this.FindMarkerInChild(value);
|
||||||
TempBoneMarker tempBoneMarker = null;
|
TempBoneMarker tempBoneMarker = null;
|
||||||
if ((Object)(object)val == (Object)null)
|
if ((Object)(object)val == (Object)null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -75,14 +73,14 @@ public class BoneMatchUtil
|
|||||||
{
|
{
|
||||||
foreach (SkinnedMeshRenderer meshRenderer in meshRenderers)
|
foreach (SkinnedMeshRenderer meshRenderer in meshRenderers)
|
||||||
{
|
{
|
||||||
if ((Object)(object)meshRenderer == (Object)null || meshRenderer.bones == null)
|
if (meshRenderer == null || meshRenderer.bones == null)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Transform[] bones = meshRenderer.bones;
|
Transform[] bones = meshRenderer.bones;
|
||||||
foreach (Transform val in bones)
|
foreach (Transform val in bones)
|
||||||
{
|
{
|
||||||
if ((Object)(object)val != (Object)null)
|
if (val != null)
|
||||||
{
|
{
|
||||||
hashSet.Add(val);
|
hashSet.Add(val);
|
||||||
}
|
}
|
||||||
@@ -95,11 +93,11 @@ public class BoneMatchUtil
|
|||||||
public List<BoneRootLocalData> GetRootLocalBones(Transform rootT, HashSet<Transform> boneList)
|
public List<BoneRootLocalData> GetRootLocalBones(Transform rootT, HashSet<Transform> boneList)
|
||||||
{
|
{
|
||||||
BoneCorrespondenceUtil correspondenceUtil = new BoneCorrespondenceUtil();
|
BoneCorrespondenceUtil correspondenceUtil = new BoneCorrespondenceUtil();
|
||||||
return (from t in boneList.Where((Transform t) => (Object)(object)t != (Object)null).Distinct()
|
return (from t in boneList.Where((Transform t) => t != null).Distinct()
|
||||||
select new BoneRootLocalData
|
select new BoneRootLocalData
|
||||||
{
|
{
|
||||||
t = t,
|
t = t,
|
||||||
name = ((Object)t).name,
|
name = t.name,
|
||||||
path = correspondenceUtil.GetHierarchyPath(rootT, t),
|
path = correspondenceUtil.GetHierarchyPath(rootT, t),
|
||||||
rootLocalPos = rootT.InverseTransformPoint(t.position),
|
rootLocalPos = rootT.InverseTransformPoint(t.position),
|
||||||
rootLocalRot = Quaternion.Inverse(rootT.rotation) * t.rotation
|
rootLocalRot = Quaternion.Inverse(rootT.rotation) * t.rotation
|
||||||
@@ -120,15 +118,15 @@ public class BoneMatchUtil
|
|||||||
//IL_0290: Unknown result type (might be due to invalid IL or missing references)
|
//IL_0290: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_0283: Unknown result type (might be due to invalid IL or missing references)
|
//IL_0283: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_0285: Unknown result type (might be due to invalid IL or missing references)
|
//IL_0285: Unknown result type (might be due to invalid IL or missing references)
|
||||||
if ((Object)(object)bodyTransform == (Object)null)
|
if (bodyTransform == null)
|
||||||
{
|
{
|
||||||
throw new AutoMorpherException("Body Transform is Missing", "[BoneMatchUtil] GetBodyRootLocalBones\n - bodyTransform is null");
|
throw new AutoMorpherException("Body Transform is Missing", "[BoneMatchUtil] GetBodyRootLocalBones\n - bodyTransform is null");
|
||||||
}
|
}
|
||||||
if ((Object)(object)bodyAnimator == (Object)null)
|
if (bodyAnimator == null)
|
||||||
{
|
{
|
||||||
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");
|
||||||
@@ -137,13 +135,13 @@ 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>();
|
||||||
foreach (KeyValuePair<Transform, HumanBodyBones> item in humanoidBoneList)
|
foreach (KeyValuePair<Transform, HumanBodyBones> item in humanoidBoneList)
|
||||||
{
|
{
|
||||||
if ((int)item.Value != 55 && !((Object)(object)item.Key == (Object)null))
|
if ((int)item.Value != 55 && !(item.Key == null))
|
||||||
{
|
{
|
||||||
if (!dictionary.TryGetValue(item.Value, out var value) || value == null)
|
if (!dictionary.TryGetValue(item.Value, out var value) || value == null)
|
||||||
{
|
{
|
||||||
@@ -166,18 +164,18 @@ public class BoneMatchUtil
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Transform val = bodyAnimator.GetBoneTransform(key);
|
Transform val = bodyAnimator.GetBoneTransform(key);
|
||||||
if ((Object)(object)val == (Object)null)
|
if (val == null)
|
||||||
{
|
{
|
||||||
val = value2.First();
|
val = value2.First();
|
||||||
}
|
}
|
||||||
if ((Object)(object)val == (Object)null)
|
if (val == null)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
hashSet.Add(val);
|
hashSet.Add(val);
|
||||||
foreach (Transform item3 in value2)
|
foreach (Transform item3 in value2)
|
||||||
{
|
{
|
||||||
if (!((Object)(object)item3 == (Object)(object)val) && !((Object)(object)item3 == (Object)null))
|
if (!(item3 == val) && !(item3 == null))
|
||||||
{
|
{
|
||||||
hashSet2.Add(item3);
|
hashSet2.Add(item3);
|
||||||
}
|
}
|
||||||
@@ -185,15 +183,15 @@ public class BoneMatchUtil
|
|||||||
}
|
}
|
||||||
foreach (Transform item4 in meshBones)
|
foreach (Transform item4 in meshBones)
|
||||||
{
|
{
|
||||||
if (!((Object)(object)item4 == (Object)null) && !hashSet2.Contains(item4))
|
if (!(item4 == null) && !hashSet2.Contains(item4))
|
||||||
{
|
{
|
||||||
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 && !((Object)(object)item5.t == (Object)null))
|
if (item5 != null && !(item5.t == null))
|
||||||
{
|
{
|
||||||
if (humanoidBoneList.TryGetValue(item5.t, out var value3))
|
if (humanoidBoneList.TryGetValue(item5.t, out var value3))
|
||||||
{
|
{
|
||||||
@@ -217,7 +215,7 @@ public class BoneMatchUtil
|
|||||||
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
|
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
|
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
|
||||||
Dictionary<Transform, HumanBodyBones> dictionary = new Dictionary<Transform, HumanBodyBones>();
|
Dictionary<Transform, HumanBodyBones> dictionary = new Dictionary<Transform, HumanBodyBones>();
|
||||||
if ((Object)(object)bodyAnimator == (Object)null || (Object)(object)bodyAnimator.avatar == (Object)null || !bodyAnimator.avatar.isHuman)
|
if (bodyAnimator == null || bodyAnimator.avatar == null || !bodyAnimator.avatar.isHuman)
|
||||||
{
|
{
|
||||||
return dictionary;
|
return dictionary;
|
||||||
}
|
}
|
||||||
@@ -226,7 +224,7 @@ public class BoneMatchUtil
|
|||||||
if ((int)value != 55)
|
if ((int)value != 55)
|
||||||
{
|
{
|
||||||
Transform boneTransform = bodyAnimator.GetBoneTransform(value);
|
Transform boneTransform = bodyAnimator.GetBoneTransform(value);
|
||||||
if (!((Object)(object)boneTransform == (Object)null))
|
if (!(boneTransform == null))
|
||||||
{
|
{
|
||||||
dictionary.TryAdd(boneTransform, value);
|
dictionary.TryAdd(boneTransform, value);
|
||||||
}
|
}
|
||||||
@@ -281,7 +279,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;
|
||||||
@@ -298,8 +296,7 @@ public class BoneMatchUtil
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Dictionary<Transform, BoneRootLocalData> dictionary = new Dictionary<Transform, BoneRootLocalData>();
|
Dictionary<Transform, BoneRootLocalData> dictionary = new Dictionary<Transform, BoneRootLocalData>();
|
||||||
foreach (IGrouping<BoneRootLocalData, (BoneRootLocalData, BoneRootLocalData, float, float, float, float, float)> item in from x in list
|
foreach (IGrouping<BoneRootLocalData, (BoneRootLocalData, BoneRootLocalData, float, float, float, float, float)> item in from x in list group x by x.Item2)
|
||||||
group x by x.body)
|
|
||||||
{
|
{
|
||||||
if (item.Key == null)
|
if (item.Key == null)
|
||||||
{
|
{
|
||||||
@@ -314,19 +311,19 @@ 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (tuple.Item1 != null && (Object)(object)tuple.Item1.t != (Object)null && tuple.Item2 != null)
|
if (tuple.Item1 != null && tuple.Item1.t != null && tuple.Item2 != null)
|
||||||
{
|
{
|
||||||
dictionary[tuple.Item1.t] = tuple.Item2;
|
dictionary[tuple.Item1.t] = tuple.Item2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach (BoneRootLocalData clothesBone2 in clothesBones)
|
foreach (BoneRootLocalData clothesBone2 in clothesBones)
|
||||||
{
|
{
|
||||||
if ((Object)(object)clothesBone2?.t == (Object)null)
|
if (clothesBone2?.t == null)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -423,7 +420,7 @@ public class BoneMatchUtil
|
|||||||
Dictionary<string, List<BoneRootLocalData>> dictionary4 = new Dictionary<string, List<BoneRootLocalData>>();
|
Dictionary<string, List<BoneRootLocalData>> dictionary4 = new Dictionary<string, List<BoneRootLocalData>>();
|
||||||
foreach (BoneRootLocalData destBone in destBones)
|
foreach (BoneRootLocalData destBone in destBones)
|
||||||
{
|
{
|
||||||
if (destBone == null || (Object)(object)destBone.t == (Object)null)
|
if (destBone == null || destBone.t == null)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -440,7 +437,7 @@ public class BoneMatchUtil
|
|||||||
dictionary3.Add(text2, destBone);
|
dictionary3.Add(text2, destBone);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
string text3 = destBone.name ?? ((Object)destBone.t).name;
|
string text3 = destBone.name ?? destBone.t.name;
|
||||||
if (!string.IsNullOrEmpty(text3))
|
if (!string.IsNullOrEmpty(text3))
|
||||||
{
|
{
|
||||||
if (!dictionary4.TryGetValue(text3, out var value))
|
if (!dictionary4.TryGetValue(text3, out var value))
|
||||||
@@ -453,27 +450,27 @@ public class BoneMatchUtil
|
|||||||
HashSet<Transform> hashSet = new HashSet<Transform>();
|
HashSet<Transform> hashSet = new HashSet<Transform>();
|
||||||
foreach (BoneRootLocalData sourceBone in sourceBones)
|
foreach (BoneRootLocalData sourceBone in sourceBones)
|
||||||
{
|
{
|
||||||
if (sourceBone == null || (Object)(object)sourceBone.t == (Object)null)
|
if (sourceBone == null || sourceBone.t == null)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Transform val = null;
|
Transform val = null;
|
||||||
string text4 = sourceBone.path ?? "";
|
string text4 = sourceBone.path ?? "";
|
||||||
if (text4.Length > 0 && dictionary2.TryGetValue(text4, out var value2) && value2 != null && (Object)(object)value2.t != (Object)null && !hashSet.Contains(value2.t))
|
if (text4.Length > 0 && dictionary2.TryGetValue(text4, out var value2) && value2 != null && value2.t != null && !hashSet.Contains(value2.t))
|
||||||
{
|
{
|
||||||
val = value2.t;
|
val = value2.t;
|
||||||
}
|
}
|
||||||
if ((Object)(object)val == (Object)null && text4.Length > 0)
|
if (val == null && text4.Length > 0)
|
||||||
{
|
{
|
||||||
string text5 = boneCorrespondenceUtil.NormalizePath(text4);
|
string text5 = boneCorrespondenceUtil.NormalizePath(text4);
|
||||||
if (text5.Length > 0 && dictionary3.TryGetValue(text5, out var value3) && value3 != null && (Object)(object)value3.t != (Object)null && !hashSet.Contains(value3.t))
|
if (text5.Length > 0 && dictionary3.TryGetValue(text5, out var value3) && value3 != null && value3.t != null && !hashSet.Contains(value3.t))
|
||||||
{
|
{
|
||||||
val = value3.t;
|
val = value3.t;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((Object)(object)val == (Object)null)
|
if (val == null)
|
||||||
{
|
{
|
||||||
string text6 = sourceBone.name ?? ((Object)sourceBone.t).name;
|
string text6 = sourceBone.name ?? sourceBone.t.name;
|
||||||
if (!string.IsNullOrEmpty(text6) && dictionary4.TryGetValue(text6, out var value4))
|
if (!string.IsNullOrEmpty(text6) && dictionary4.TryGetValue(text6, out var value4))
|
||||||
{
|
{
|
||||||
float num = float.PositiveInfinity;
|
float num = float.PositiveInfinity;
|
||||||
@@ -481,7 +478,7 @@ public class BoneMatchUtil
|
|||||||
for (int i = 0; i < value4.Count; i++)
|
for (int i = 0; i < value4.Count; i++)
|
||||||
{
|
{
|
||||||
BoneRootLocalData boneRootLocalData = value4[i];
|
BoneRootLocalData boneRootLocalData = value4[i];
|
||||||
if (boneRootLocalData != null && !((Object)(object)boneRootLocalData.t == (Object)null) && !hashSet.Contains(boneRootLocalData.t))
|
if (boneRootLocalData != null && !(boneRootLocalData.t == null) && !hashSet.Contains(boneRootLocalData.t))
|
||||||
{
|
{
|
||||||
float num2 = Vector3.SqrMagnitude(boneRootLocalData.rootLocalPos - sourceBone.rootLocalPos);
|
float num2 = Vector3.SqrMagnitude(boneRootLocalData.rootLocalPos - sourceBone.rootLocalPos);
|
||||||
if (num2 < num)
|
if (num2 < num)
|
||||||
@@ -494,7 +491,7 @@ public class BoneMatchUtil
|
|||||||
val = val2;
|
val = val2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((Object)(object)val != (Object)null)
|
if (val != null)
|
||||||
{
|
{
|
||||||
if (resultReverse)
|
if (resultReverse)
|
||||||
{
|
{
|
||||||
@@ -518,7 +515,7 @@ public class BoneMatchUtil
|
|||||||
//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
|
//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
|
||||||
targetClothHumanBones = new Dictionary<HumanBodyBones, HashSet<Transform>>();
|
targetClothHumanBones = new Dictionary<HumanBodyBones, HashSet<Transform>>();
|
||||||
targetClothBoneTypeMap = new Dictionary<Transform, ClothBoneType>();
|
targetClothBoneTypeMap = new Dictionary<Transform, ClothBoneType>();
|
||||||
if ((Object)(object)sourceClothRoot == (Object)null || (Object)(object)targetClothRoot == (Object)null)
|
if (sourceClothRoot == null || targetClothRoot == null)
|
||||||
{
|
{
|
||||||
throw new AutoMorpherException("Cloth Root is Missing", "[BoneMatchUtil] RemapClothMatchResultToTargetCloth\n - sourceClothRoot or targetClothRoot is null");
|
throw new AutoMorpherException("Cloth Root is Missing", "[BoneMatchUtil] RemapClothMatchResultToTargetCloth\n - sourceClothRoot or targetClothRoot is null");
|
||||||
}
|
}
|
||||||
@@ -529,7 +526,7 @@ public class BoneMatchUtil
|
|||||||
HashSet<Transform> hashSet = new HashSet<Transform>();
|
HashSet<Transform> hashSet = new HashSet<Transform>();
|
||||||
foreach (KeyValuePair<Transform, ClothBoneType> item in sourceClothBoneTypeMap)
|
foreach (KeyValuePair<Transform, ClothBoneType> item in sourceClothBoneTypeMap)
|
||||||
{
|
{
|
||||||
if ((Object)(object)item.Key != (Object)null)
|
if (item.Key != null)
|
||||||
{
|
{
|
||||||
hashSet.Add(item.Key);
|
hashSet.Add(item.Key);
|
||||||
}
|
}
|
||||||
@@ -543,7 +540,7 @@ public class BoneMatchUtil
|
|||||||
}
|
}
|
||||||
foreach (Transform item2 in value)
|
foreach (Transform item2 in value)
|
||||||
{
|
{
|
||||||
if ((Object)(object)item2 != (Object)null)
|
if (item2 != null)
|
||||||
{
|
{
|
||||||
hashSet.Add(item2);
|
hashSet.Add(item2);
|
||||||
}
|
}
|
||||||
@@ -553,13 +550,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(((Component)targetClothRoot).GetComponentsInChildren<SkinnedMeshRenderer>(true).ToList());
|
HashSet<Transform> meshBones = this.GetMeshBones(((Component)targetClothRoot).GetComponentsInChildren<SkinnedMeshRenderer>(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");
|
||||||
@@ -568,12 +565,12 @@ 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;
|
||||||
ClothBoneType value2 = item3.Value;
|
ClothBoneType value2 = item3.Value;
|
||||||
if ((Object)(object)key == (Object)null || !dictionary.TryGetValue(key, out var value3) || (Object)(object)value3 == (Object)null)
|
if (key == null || !dictionary.TryGetValue(key, out var value3) || value3 == null)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -599,7 +596,7 @@ public class BoneMatchUtil
|
|||||||
}
|
}
|
||||||
foreach (Transform item4 in value5)
|
foreach (Transform item4 in value5)
|
||||||
{
|
{
|
||||||
if (!((Object)(object)item4 == (Object)null) && dictionary.TryGetValue(item4, out var value6) && !((Object)(object)value6 == (Object)null))
|
if (!(item4 == null) && dictionary.TryGetValue(item4, out var value6) && !(value6 == null))
|
||||||
{
|
{
|
||||||
if (!targetClothHumanBones.TryGetValue(key2, out var value7))
|
if (!targetClothHumanBones.TryGetValue(key2, out var value7))
|
||||||
{
|
{
|
||||||
@@ -615,28 +612,28 @@ public class BoneMatchUtil
|
|||||||
public void BuildSourceToProxyBoneMap(Animator sourceAvatar, Animator proxyAvatar, out Dictionary<Transform, Transform> sourceToProxy)
|
public void BuildSourceToProxyBoneMap(Animator sourceAvatar, Animator proxyAvatar, out Dictionary<Transform, Transform> sourceToProxy)
|
||||||
{
|
{
|
||||||
sourceToProxy = new Dictionary<Transform, Transform>();
|
sourceToProxy = new Dictionary<Transform, Transform>();
|
||||||
if ((Object)(object)sourceAvatar == (Object)null)
|
if (sourceAvatar == null)
|
||||||
{
|
{
|
||||||
throw new AutoMorpherException("Source Avatar is Missing", "[AvatarBodyMatchUtil] BuildSourceToProxyBoneMap\n - sourceAvatar is null");
|
throw new AutoMorpherException("Source Avatar is Missing", "[AvatarBodyMatchUtil] BuildSourceToProxyBoneMap\n - sourceAvatar is null");
|
||||||
}
|
}
|
||||||
if ((Object)(object)proxyAvatar == (Object)null)
|
if (proxyAvatar == null)
|
||||||
{
|
{
|
||||||
throw new AutoMorpherException("Proxy Avatar is Missing", "[AvatarBodyMatchUtil] BuildSourceToProxyBoneMap\n - proxyAvatar is null");
|
throw new AutoMorpherException("Proxy Avatar is Missing", "[AvatarBodyMatchUtil] BuildSourceToProxyBoneMap\n - proxyAvatar is null");
|
||||||
}
|
}
|
||||||
Transform transform = ((Component)sourceAvatar).transform;
|
Transform transform = ((Component)sourceAvatar).transform;
|
||||||
Transform transform2 = ((Component)proxyAvatar).transform;
|
Transform transform2 = ((Component)proxyAvatar).transform;
|
||||||
HashSet<Transform> meshBones = GetMeshBones(((Component)transform2).GetComponentsInChildren<SkinnedMeshRenderer>(true).ToList());
|
HashSet<Transform> meshBones = this.GetMeshBones(((Component)transform2).GetComponentsInChildren<SkinnedMeshRenderer>(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(((Component)transform).GetComponentsInChildren<SkinnedMeshRenderer>(true).ToList());
|
HashSet<Transform> meshBones2 = this.GetMeshBones(((Component)transform).GetComponentsInChildren<SkinnedMeshRenderer>(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");
|
||||||
@@ -645,7 +642,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");
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -1,11 +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;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using Eden.AutoMorpher;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
public class BvhTriangleMesh
|
public class BvhTriangleMesh
|
||||||
@@ -37,11 +34,44 @@ public class BvhTriangleMesh
|
|||||||
|
|
||||||
public BvhTriangleMesh()
|
public BvhTriangleMesh()
|
||||||
{
|
{
|
||||||
HumanBodyBones[] array = new HumanBodyBones[34];
|
this.humanBones = new HumanBodyBones[34]
|
||||||
RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
|
{
|
||||||
humanBones = (HumanBodyBones[])(object)array;
|
HumanBodyBones.Hips,
|
||||||
base._002Ector();
|
HumanBodyBones.LeftUpperLeg,
|
||||||
triangleUtil = new TriangleUtil();
|
HumanBodyBones.RightUpperLeg,
|
||||||
|
HumanBodyBones.LeftLowerLeg,
|
||||||
|
HumanBodyBones.RightLowerLeg,
|
||||||
|
HumanBodyBones.LeftFoot,
|
||||||
|
HumanBodyBones.RightFoot,
|
||||||
|
HumanBodyBones.Spine,
|
||||||
|
HumanBodyBones.Chest,
|
||||||
|
HumanBodyBones.Neck,
|
||||||
|
HumanBodyBones.Head,
|
||||||
|
HumanBodyBones.LeftShoulder,
|
||||||
|
HumanBodyBones.RightShoulder,
|
||||||
|
HumanBodyBones.LeftUpperArm,
|
||||||
|
HumanBodyBones.RightUpperArm,
|
||||||
|
HumanBodyBones.LeftLowerArm,
|
||||||
|
HumanBodyBones.RightLowerArm,
|
||||||
|
HumanBodyBones.LeftHand,
|
||||||
|
HumanBodyBones.RightHand,
|
||||||
|
HumanBodyBones.LeftToes,
|
||||||
|
HumanBodyBones.RightToes,
|
||||||
|
HumanBodyBones.LeftEye,
|
||||||
|
HumanBodyBones.RightEye,
|
||||||
|
HumanBodyBones.Jaw,
|
||||||
|
HumanBodyBones.LeftThumbProximal,
|
||||||
|
HumanBodyBones.LeftIndexProximal,
|
||||||
|
HumanBodyBones.LeftMiddleProximal,
|
||||||
|
HumanBodyBones.LeftRingProximal,
|
||||||
|
HumanBodyBones.RightThumbProximal,
|
||||||
|
HumanBodyBones.RightIndexProximal,
|
||||||
|
HumanBodyBones.RightMiddleProximal,
|
||||||
|
HumanBodyBones.RightRingProximal,
|
||||||
|
HumanBodyBones.LeftLittleProximal,
|
||||||
|
HumanBodyBones.RightLittleProximal
|
||||||
|
};
|
||||||
|
this.triangleUtil = new TriangleUtil();
|
||||||
}
|
}
|
||||||
|
|
||||||
private HumanBodyBones[] BuildVertexMainHumanBone(SkinnedMeshRenderer smr, Animator animator, HumanBodyBones[] bodyBones)
|
private HumanBodyBones[] BuildVertexMainHumanBone(SkinnedMeshRenderer smr, Animator animator, HumanBodyBones[] bodyBones)
|
||||||
@@ -50,17 +80,17 @@ public class BvhTriangleMesh
|
|||||||
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
|
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
|
||||||
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 = (HumanBodyBones[])(object)new HumanBodyBones[sharedMesh.vertexCount];
|
HumanBodyBones[] array = (HumanBodyBones[])(object)new HumanBodyBones[sharedMesh.vertexCount];
|
||||||
for (int i = 0; i < sharedMesh.vertexCount; i++)
|
for (int i = 0; i < sharedMesh.vertexCount; i++)
|
||||||
{
|
{
|
||||||
BoneWeight val = boneWeights[i];
|
BoneWeight val = boneWeights[i];
|
||||||
int bestBodyIdx = -1;
|
int bestBodyIdx = -1;
|
||||||
float bestWeight = 0f;
|
float bestWeight = 0f;
|
||||||
Try(((BoneWeight)(ref val)).boneIndex0, ((BoneWeight)(ref val)).weight0);
|
Try(val.boneIndex0, val.weight0);
|
||||||
Try(((BoneWeight)(ref val)).boneIndex1, ((BoneWeight)(ref val)).weight1);
|
Try(val.boneIndex1, val.weight1);
|
||||||
Try(((BoneWeight)(ref val)).boneIndex2, ((BoneWeight)(ref val)).weight2);
|
Try(val.boneIndex2, val.weight2);
|
||||||
Try(((BoneWeight)(ref val)).boneIndex3, ((BoneWeight)(ref val)).weight3);
|
Try(val.boneIndex3, val.weight3);
|
||||||
array[i] = (HumanBodyBones)((bestBodyIdx >= 0) ? ((int)bodyBones[bestBodyIdx]) : 55);
|
array[i] = (HumanBodyBones)((bestBodyIdx >= 0) ? ((int)bodyBones[bestBodyIdx]) : 55);
|
||||||
void Try(int boneIdx, float w)
|
void Try(int boneIdx, float w)
|
||||||
{
|
{
|
||||||
@@ -133,7 +163,7 @@ public class BvhTriangleMesh
|
|||||||
int num = 0;
|
int num = 0;
|
||||||
foreach (SkinnedMeshRenderer renderer in renderers)
|
foreach (SkinnedMeshRenderer renderer in renderers)
|
||||||
{
|
{
|
||||||
if (!((Object)(object)renderer == (Object)null) && !((Object)(object)renderer.sharedMesh == (Object)null))
|
if (!(renderer == null) && !(renderer.sharedMesh == null))
|
||||||
{
|
{
|
||||||
num += renderer.sharedMesh.triangles.Length / 3;
|
num += renderer.sharedMesh.triangles.Length / 3;
|
||||||
}
|
}
|
||||||
@@ -148,32 +178,32 @@ public class BvhTriangleMesh
|
|||||||
Vector3 val2 = default(Vector3);
|
Vector3 val2 = default(Vector3);
|
||||||
foreach (SkinnedMeshRenderer renderer2 in renderers)
|
foreach (SkinnedMeshRenderer renderer2 in renderers)
|
||||||
{
|
{
|
||||||
if (!((Object)(object)renderer2 == (Object)null) && !((Object)(object)renderer2.sharedMesh == (Object)null))
|
if (!(renderer2 == null) && !(renderer2.sharedMesh == null))
|
||||||
{
|
{
|
||||||
val.Clear();
|
val.Clear();
|
||||||
renderer2.BakeMesh(val);
|
renderer2.BakeMesh(val);
|
||||||
Vector3[] vertices = val.vertices;
|
Vector3[] vertices = val.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 = ((Component)renderer2).transform;
|
Transform transform = ((Component)renderer2).transform;
|
||||||
Vector3 lossyScale = transform.lossyScale;
|
Vector3 lossyScale = transform.lossyScale;
|
||||||
((Vector3)(ref val2))._002Ector(1f / Mathf.Max(lossyScale.x, 1E-08f), 1f / Mathf.Max(lossyScale.y, 1E-08f), 1f / Mathf.Max(lossyScale.z, 1E-08f));
|
val2 = new Vector3(1f / Mathf.Max(lossyScale.x, 1E-08f), 1f / Mathf.Max(lossyScale.y, 1E-08f), 1f / Mathf.Max(lossyScale.z, 1E-08f));
|
||||||
Matrix4x4 val3 = transform.localToWorldMatrix * Matrix4x4.Scale(val2);
|
Matrix4x4 val3 = transform.localToWorldMatrix * Matrix4x4.Scale(val2);
|
||||||
for (int i = 0; i < num3; i++)
|
for (int i = 0; i < num3; i++)
|
||||||
{
|
{
|
||||||
int num4 = array[i * 3];
|
int num4 = array[i * 3];
|
||||||
int num5 = array[i * 3 + 1];
|
int num5 = array[i * 3 + 1];
|
||||||
int num6 = array[i * 3 + 2];
|
int num6 = array[i * 3 + 2];
|
||||||
Vector3 val4 = ((Matrix4x4)(ref val3)).MultiplyPoint3x4(vertices[num4]);
|
Vector3 val4 = val3.MultiplyPoint3x4(vertices[num4]);
|
||||||
Vector3 val5 = ((Matrix4x4)(ref val3)).MultiplyPoint3x4(vertices[num5]);
|
Vector3 val5 = val3.MultiplyPoint3x4(vertices[num5]);
|
||||||
Vector3 val6 = ((Matrix4x4)(ref val3)).MultiplyPoint3x4(vertices[num6]);
|
Vector3 val6 = val3.MultiplyPoint3x4(vertices[num6]);
|
||||||
Vector3 val7 = Vector3.Cross(val5 - val4, val6 - val4);
|
Vector3 val7 = Vector3.Cross(val5 - val4, val6 - val4);
|
||||||
float magnitude = ((Vector3)(ref val7)).magnitude;
|
float magnitude = val7.magnitude;
|
||||||
val7 = ((!(magnitude > 1E-08f)) ? Vector3.up : (val7 / magnitude));
|
val7 = ((!(magnitude > 1E-08f)) ? Vector3.up : (val7 / magnitude));
|
||||||
int num7 = ComputeTriangleMainHumanBoneIndex(num4, num5, num6, boneWeights, boneToBodyIndex, humanBones.Length);
|
int num7 = this.ComputeTriangleMainHumanBoneIndex(num4, num5, num6, boneWeights, boneToBodyIndex, this.humanBones.Length);
|
||||||
HumanBodyBones mainHumanBone = (HumanBodyBones)((num7 >= 0) ? ((int)humanBones[num7]) : 55);
|
HumanBodyBones mainHumanBone = (HumanBodyBones)((num7 >= 0) ? ((int)this.humanBones[num7]) : 55);
|
||||||
bvhTriangleMesh.triangles[num2++] = new BvhTriangle
|
bvhTriangleMesh.triangles[num2++] = new BvhTriangle
|
||||||
{
|
{
|
||||||
a = val4,
|
a = val4,
|
||||||
@@ -194,7 +224,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;
|
||||||
}
|
}
|
||||||
@@ -209,14 +239,14 @@ public class BvhTriangleMesh
|
|||||||
{
|
{
|
||||||
array[i] = -1;
|
array[i] = -1;
|
||||||
}
|
}
|
||||||
if ((Object)(object)animator == (Object)null || bodyBones == null || bones == null)
|
if (animator == null || bodyBones == null || bones == null)
|
||||||
{
|
{
|
||||||
return array;
|
return array;
|
||||||
}
|
}
|
||||||
Dictionary<Transform, int> dictionary = new Dictionary<Transform, int>();
|
Dictionary<Transform, int> dictionary = new Dictionary<Transform, int>();
|
||||||
for (int j = 0; j < bones.Length; j++)
|
for (int j = 0; j < bones.Length; j++)
|
||||||
{
|
{
|
||||||
if (!((Object)(object)bones[j] == (Object)null) && !dictionary.ContainsKey(bones[j]))
|
if (!(bones[j] == null) && !dictionary.ContainsKey(bones[j]))
|
||||||
{
|
{
|
||||||
dictionary.Add(bones[j], j);
|
dictionary.Add(bones[j], j);
|
||||||
}
|
}
|
||||||
@@ -231,7 +261,7 @@ public class BvhTriangleMesh
|
|||||||
}
|
}
|
||||||
foreach (Transform item in value)
|
foreach (Transform item in value)
|
||||||
{
|
{
|
||||||
if (!((Object)(object)item == (Object)null) && dictionary.TryGetValue(item, out var value2))
|
if (!(item == null) && dictionary.TryGetValue(item, out var value2))
|
||||||
{
|
{
|
||||||
array[value2] = k;
|
array[value2] = k;
|
||||||
}
|
}
|
||||||
@@ -244,12 +274,12 @@ public class BvhTriangleMesh
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Transform val = bones[l];
|
Transform val = bones[l];
|
||||||
if ((Object)(object)val == (Object)null)
|
if (val == null)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Transform parent = val.parent;
|
Transform parent = val.parent;
|
||||||
if (!((Object)(object)parent == (Object)null) && dictionary.TryGetValue(parent, out var value3))
|
if (!(parent == null) && dictionary.TryGetValue(parent, out var value3))
|
||||||
{
|
{
|
||||||
int num = array[value3];
|
int num = array[value3];
|
||||||
if (num != -1)
|
if (num != -1)
|
||||||
@@ -289,10 +319,10 @@ public class BvhTriangleMesh
|
|||||||
if (v >= 0 && v < weights.Length)
|
if (v >= 0 && v < weights.Length)
|
||||||
{
|
{
|
||||||
BoneWeight val = weights[v];
|
BoneWeight val = weights[v];
|
||||||
Add(((BoneWeight)(ref val)).boneIndex0, ((BoneWeight)(ref val)).weight0);
|
Add(val.boneIndex0, val.weight0);
|
||||||
Add(((BoneWeight)(ref val)).boneIndex1, ((BoneWeight)(ref val)).weight1);
|
Add(val.boneIndex1, val.weight1);
|
||||||
Add(((BoneWeight)(ref val)).boneIndex2, ((BoneWeight)(ref val)).weight2);
|
Add(val.boneIndex2, val.weight2);
|
||||||
Add(((BoneWeight)(ref val)).boneIndex3, ((BoneWeight)(ref val)).weight3);
|
Add(val.boneIndex3, val.weight3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void Add(int boneIdx, float w)
|
void Add(int boneIdx, float w)
|
||||||
@@ -348,7 +378,7 @@ public class BvhTriangleMesh
|
|||||||
int num = 0;
|
int num = 0;
|
||||||
foreach (SkinnedMeshRenderer renderer in renderers)
|
foreach (SkinnedMeshRenderer renderer in renderers)
|
||||||
{
|
{
|
||||||
if (!((Object)(object)renderer == (Object)null) && !((Object)(object)renderer.sharedMesh == (Object)null))
|
if (!(renderer == null) && !(renderer.sharedMesh == null))
|
||||||
{
|
{
|
||||||
num += renderer.sharedMesh.triangles.Length / 3;
|
num += renderer.sharedMesh.triangles.Length / 3;
|
||||||
}
|
}
|
||||||
@@ -361,7 +391,7 @@ public class BvhTriangleMesh
|
|||||||
int num2 = 0;
|
int num2 = 0;
|
||||||
foreach (SkinnedMeshRenderer renderer2 in renderers)
|
foreach (SkinnedMeshRenderer renderer2 in renderers)
|
||||||
{
|
{
|
||||||
if (!((Object)(object)renderer2 == (Object)null) && !((Object)(object)renderer2.sharedMesh == (Object)null))
|
if (!(renderer2 == null) && !(renderer2.sharedMesh == null))
|
||||||
{
|
{
|
||||||
Mesh sharedMesh = renderer2.sharedMesh;
|
Mesh sharedMesh = renderer2.sharedMesh;
|
||||||
Vector3[] vertices = sharedMesh.vertices;
|
Vector3[] vertices = sharedMesh.vertices;
|
||||||
@@ -376,7 +406,7 @@ public class BvhTriangleMesh
|
|||||||
Vector3 val2 = ((Component)renderer2).transform.TransformPoint(vertices[num5]);
|
Vector3 val2 = ((Component)renderer2).transform.TransformPoint(vertices[num5]);
|
||||||
Vector3 val3 = ((Component)renderer2).transform.TransformPoint(vertices[num6]);
|
Vector3 val3 = ((Component)renderer2).transform.TransformPoint(vertices[num6]);
|
||||||
Vector3 val4 = Vector3.Cross(val2 - val, val3 - val);
|
Vector3 val4 = Vector3.Cross(val2 - val, val3 - val);
|
||||||
float magnitude = ((Vector3)(ref val4)).magnitude;
|
float magnitude = val4.magnitude;
|
||||||
val4 = ((!(magnitude > 1E-08f)) ? Vector3.up : (val4 / magnitude));
|
val4 = ((!(magnitude > 1E-08f)) ? Vector3.up : (val4 / magnitude));
|
||||||
bvhTriangleMesh.triangles[num2++] = new BvhTriangle
|
bvhTriangleMesh.triangles[num2++] = new BvhTriangle
|
||||||
{
|
{
|
||||||
@@ -396,7 +426,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;
|
||||||
}
|
}
|
||||||
@@ -447,7 +477,7 @@ public class BvhTriangleMesh
|
|||||||
Vector3 val2 = transform.TransformPoint(vertices[num3]);
|
Vector3 val2 = transform.TransformPoint(vertices[num3]);
|
||||||
Vector3 val3 = transform.TransformPoint(vertices[num4]);
|
Vector3 val3 = transform.TransformPoint(vertices[num4]);
|
||||||
Vector3 val4 = Vector3.Cross(val2 - val, val3 - val);
|
Vector3 val4 = Vector3.Cross(val2 - val, val3 - val);
|
||||||
float magnitude = ((Vector3)(ref val4)).magnitude;
|
float magnitude = val4.magnitude;
|
||||||
val4 = ((!(magnitude > 1E-08f)) ? Vector3.up : (val4 / magnitude));
|
val4 = ((!(magnitude > 1E-08f)) ? Vector3.up : (val4 / magnitude));
|
||||||
bvhTriangleMesh.triangles[i] = new BvhTriangle
|
bvhTriangleMesh.triangles[i] = new BvhTriangle
|
||||||
{
|
{
|
||||||
@@ -464,7 +494,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;
|
||||||
}
|
}
|
||||||
@@ -507,16 +537,16 @@ public class BvhTriangleMesh
|
|||||||
BvhTriangle bvhTriangle = tris[triIndices[i]];
|
BvhTriangle bvhTriangle = tris[triIndices[i]];
|
||||||
if (flag)
|
if (flag)
|
||||||
{
|
{
|
||||||
((Bounds)(ref bounds))._002Ector(bvhTriangle.a, Vector3.zero);
|
bounds = new Bounds(bvhTriangle.a, Vector3.zero);
|
||||||
((Bounds)(ref bounds)).Encapsulate(bvhTriangle.b);
|
bounds.Encapsulate(bvhTriangle.b);
|
||||||
((Bounds)(ref bounds)).Encapsulate(bvhTriangle.c);
|
bounds.Encapsulate(bvhTriangle.c);
|
||||||
flag = false;
|
flag = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
((Bounds)(ref bounds)).Encapsulate(bvhTriangle.a);
|
bounds.Encapsulate(bvhTriangle.a);
|
||||||
((Bounds)(ref bounds)).Encapsulate(bvhTriangle.b);
|
bounds.Encapsulate(bvhTriangle.b);
|
||||||
((Bounds)(ref bounds)).Encapsulate(bvhTriangle.c);
|
bounds.Encapsulate(bvhTriangle.c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bvhNode.bounds = bounds;
|
bvhNode.bounds = bounds;
|
||||||
@@ -530,7 +560,7 @@ public class BvhTriangleMesh
|
|||||||
outNodes.Add(bvhNode);
|
outNodes.Add(bvhNode);
|
||||||
return count2;
|
return count2;
|
||||||
}
|
}
|
||||||
Vector3 size = ((Bounds)(ref bounds)).size;
|
Vector3 size = bounds.size;
|
||||||
int num = 0;
|
int num = 0;
|
||||||
if (size.y > size.x && size.y > size.z)
|
if (size.y > size.x && size.y > size.z)
|
||||||
{
|
{
|
||||||
@@ -545,10 +575,10 @@ public class BvhTriangleMesh
|
|||||||
{
|
{
|
||||||
BvhTriangle bvhTriangle2 = tris[triIndices[j]];
|
BvhTriangle bvhTriangle2 = tris[triIndices[j]];
|
||||||
Vector3 val = (bvhTriangle2.a + bvhTriangle2.b + bvhTriangle2.c) / 3f;
|
Vector3 val = (bvhTriangle2.a + bvhTriangle2.b + bvhTriangle2.c) / 3f;
|
||||||
num2 += ((Vector3)(ref val))[num];
|
num2 += val[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;
|
||||||
@@ -557,8 +587,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;
|
||||||
@@ -573,8 +603,8 @@ public class BvhTriangleMesh
|
|||||||
{
|
{
|
||||||
BvhTriangle bvhTriangle = tris[triIndices[num]];
|
BvhTriangle bvhTriangle = tris[triIndices[num]];
|
||||||
BvhTriangle bvhTriangle2 = tris[triIndices[num2]];
|
BvhTriangle bvhTriangle2 = tris[triIndices[num2]];
|
||||||
float num3 = (((Vector3)(ref bvhTriangle.a))[axis] + ((Vector3)(ref bvhTriangle.b))[axis] + ((Vector3)(ref bvhTriangle.c))[axis]) / 3f;
|
float num3 = (bvhTriangle.a[axis] + bvhTriangle.b[axis] + bvhTriangle.c[axis]) / 3f;
|
||||||
_ = (((Vector3)(ref bvhTriangle2.a))[axis] + ((Vector3)(ref bvhTriangle2.b))[axis] + ((Vector3)(ref bvhTriangle2.c))[axis]) / 3f;
|
_ = (bvhTriangle2.a[axis] + bvhTriangle2.b[axis] + bvhTriangle2.c[axis]) / 3f;
|
||||||
if (num3 < splitPos)
|
if (num3 < splitPos)
|
||||||
{
|
{
|
||||||
num++;
|
num++;
|
||||||
@@ -596,11 +626,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -613,17 +643,17 @@ 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;
|
||||||
}
|
}
|
||||||
@@ -657,8 +687,8 @@ public class BvhTriangleMesh
|
|||||||
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
|
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
|
//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_00db: Unknown result type (might be due to invalid IL or missing references)
|
//IL_00db: Unknown result type (might be due to invalid IL or missing references)
|
||||||
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;
|
||||||
}
|
}
|
||||||
@@ -667,13 +697,13 @@ 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 val = triangleUtil.ClosestPointOnTriangle(p, bvhTriangle.a, bvhTriangle.b, bvhTriangle.c);
|
Vector3 val = this.triangleUtil.ClosestPointOnTriangle(p, bvhTriangle.a, bvhTriangle.b, bvhTriangle.c);
|
||||||
Vector3 val2 = p - val;
|
Vector3 val2 = p - val;
|
||||||
float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude;
|
float sqrMagnitude = val2.sqrMagnitude;
|
||||||
if (sqrMagnitude < best.sqrDistance)
|
if (sqrMagnitude < best.sqrDistance)
|
||||||
{
|
{
|
||||||
best.sqrDistance = sqrMagnitude;
|
best.sqrDistance = sqrMagnitude;
|
||||||
@@ -689,17 +719,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)
|
||||||
{
|
{
|
||||||
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -732,8 +762,8 @@ public class BvhTriangleMesh
|
|||||||
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
|
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
|
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
|
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
|
||||||
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;
|
||||||
}
|
}
|
||||||
@@ -742,11 +772,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];
|
||||||
Vector3 val = triangleUtil.ClosestPointOnTriangle(p, bvhTriangle.a, bvhTriangle.b, bvhTriangle.c);
|
Vector3 val = this.triangleUtil.ClosestPointOnTriangle(p, bvhTriangle.a, bvhTriangle.b, bvhTriangle.c);
|
||||||
Vector3 val2 = p - val;
|
Vector3 val2 = p - val;
|
||||||
float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude;
|
float sqrMagnitude = val2.sqrMagnitude;
|
||||||
if (sqrMagnitude < best.sqrDistance)
|
if (sqrMagnitude < best.sqrDistance)
|
||||||
{
|
{
|
||||||
best.sqrDistance = sqrMagnitude;
|
best.sqrDistance = sqrMagnitude;
|
||||||
@@ -761,17 +791,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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -792,21 +822,21 @@ public class BvhTriangleMesh
|
|||||||
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
|
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
|
||||||
float num = Mathf.Max(new float[3]
|
float num = Mathf.Max(new float[3]
|
||||||
{
|
{
|
||||||
((Bounds)(ref b)).min.x - p.x,
|
b.min.x - p.x,
|
||||||
0f,
|
0f,
|
||||||
p.x - ((Bounds)(ref b)).max.x
|
p.x - b.max.x
|
||||||
});
|
});
|
||||||
float num2 = Mathf.Max(new float[3]
|
float num2 = Mathf.Max(new float[3]
|
||||||
{
|
{
|
||||||
((Bounds)(ref b)).min.y - p.y,
|
b.min.y - p.y,
|
||||||
0f,
|
0f,
|
||||||
p.y - ((Bounds)(ref b)).max.y
|
p.y - b.max.y
|
||||||
});
|
});
|
||||||
float num3 = Mathf.Max(new float[3]
|
float num3 = Mathf.Max(new float[3]
|
||||||
{
|
{
|
||||||
((Bounds)(ref b)).min.z - p.z,
|
b.min.z - p.z,
|
||||||
0f,
|
0f,
|
||||||
p.z - ((Bounds)(ref b)).max.z
|
p.z - b.max.z
|
||||||
});
|
});
|
||||||
return num * num + num2 * num2 + num3 * num3;
|
return num * num + num2 * num2 + num3 * num3;
|
||||||
}
|
}
|
||||||
@@ -815,13 +845,13 @@ public class BvhTriangleMesh
|
|||||||
{
|
{
|
||||||
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
|
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -857,8 +887,8 @@ public class BvhTriangleMesh
|
|||||||
//IL_017b: Unknown result type (might be due to invalid IL or missing references)
|
//IL_017b: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_0184: Unknown result type (might be due to invalid IL or missing references)
|
//IL_0184: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_0189: Unknown result type (might be due to invalid IL or missing references)
|
//IL_0189: Unknown result type (might be due to invalid IL or missing references)
|
||||||
BvhNode bvhNode = nodes[nodeIndex];
|
BvhNode bvhNode = this.nodes[nodeIndex];
|
||||||
if (DistanceSqPointAABB(p, bvhNode.bounds) > currentMaxSq)
|
if (this.DistanceSqPointAABB(p, bvhNode.bounds) > currentMaxSq)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -867,11 +897,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];
|
||||||
Vector3 val = triangleUtil.ClosestPointOnTriangle(p, bvhTriangle.a, bvhTriangle.b, bvhTriangle.c);
|
Vector3 val = this.triangleUtil.ClosestPointOnTriangle(p, bvhTriangle.a, bvhTriangle.b, bvhTriangle.c);
|
||||||
Vector3 val2 = p - val;
|
Vector3 val2 = p - val;
|
||||||
float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude;
|
float sqrMagnitude = val2.sqrMagnitude;
|
||||||
if (sqrMagnitude > maxDistanceSq)
|
if (sqrMagnitude > maxDistanceSq)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
@@ -888,7 +918,7 @@ public class BvhTriangleMesh
|
|||||||
});
|
});
|
||||||
if (bestHits.Count == maxCount)
|
if (bestHits.Count == maxCount)
|
||||||
{
|
{
|
||||||
currentMaxSq = GetMaxSqrDistance(bestHits, maxDistanceSq);
|
currentMaxSq = this.GetMaxSqrDistance(bestHits, maxDistanceSq);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -914,7 +944,7 @@ public class BvhTriangleMesh
|
|||||||
normal = bvhTriangle.normal,
|
normal = bvhTriangle.normal,
|
||||||
sqrDistance = sqrMagnitude
|
sqrDistance = sqrMagnitude
|
||||||
};
|
};
|
||||||
currentMaxSq = GetMaxSqrDistance(bestHits, maxDistanceSq);
|
currentMaxSq = this.GetMaxSqrDistance(bestHits, maxDistanceSq);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -922,17 +952,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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -968,7 +998,7 @@ public class BvhTriangleMesh
|
|||||||
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
|
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
|
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
|
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
|
||||||
ClosestHit closestHit = QueryClosest(p);
|
ClosestHit closestHit = this.QueryClosest(p);
|
||||||
if (closestHit.triangleIndex < 0)
|
if (closestHit.triangleIndex < 0)
|
||||||
{
|
{
|
||||||
return Vector3.zero;
|
return Vector3.zero;
|
||||||
@@ -976,7 +1006,7 @@ public class BvhTriangleMesh
|
|||||||
Vector3 val = closestHit.closestPoint - p;
|
Vector3 val = closestHit.closestPoint - p;
|
||||||
if (targetGap > 0f)
|
if (targetGap > 0f)
|
||||||
{
|
{
|
||||||
val += ((Vector3)(ref closestHit.normal)).normalized * targetGap;
|
val += closestHit.normal.normalized * targetGap;
|
||||||
}
|
}
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -121,10 +120,10 @@ public class ClothHumanoidMaskUtil
|
|||||||
{
|
{
|
||||||
BoneWeight val3 = boneWeights[j];
|
BoneWeight val3 = boneWeights[j];
|
||||||
float excludedWeightSum = 0f;
|
float excludedWeightSum = 0f;
|
||||||
AddExcludedWeight(((BoneWeight)(ref val3)).weight0, ((BoneWeight)(ref val3)).boneIndex0);
|
AddExcludedWeight(val3.weight0, val3.boneIndex0);
|
||||||
AddExcludedWeight(((BoneWeight)(ref val3)).weight1, ((BoneWeight)(ref val3)).boneIndex1);
|
AddExcludedWeight(val3.weight1, val3.boneIndex1);
|
||||||
AddExcludedWeight(((BoneWeight)(ref val3)).weight2, ((BoneWeight)(ref val3)).boneIndex2);
|
AddExcludedWeight(val3.weight2, val3.boneIndex2);
|
||||||
AddExcludedWeight(((BoneWeight)(ref val3)).weight3, ((BoneWeight)(ref val3)).boneIndex3);
|
AddExcludedWeight(val3.weight3, val3.boneIndex3);
|
||||||
array[j] = excludedWeightSum >= 0.8f;
|
array[j] = excludedWeightSum >= 0.8f;
|
||||||
void AddExcludedWeight(float w, int bi)
|
void AddExcludedWeight(float w, int bi)
|
||||||
{
|
{
|
||||||
@@ -135,7 +134,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 (!((Object)(object)root == (Object)null))
|
if (!((Object)(object)root == (Object)null))
|
||||||
@@ -247,10 +246,10 @@ public class ClothHumanoidMaskUtil
|
|||||||
BoneWeight val3 = boneWeights[j];
|
BoneWeight val3 = boneWeights[j];
|
||||||
float leftWeight = 0f;
|
float leftWeight = 0f;
|
||||||
float rightWeight = 0f;
|
float rightWeight = 0f;
|
||||||
Check(((BoneWeight)(ref val3)).boneIndex0, ((BoneWeight)(ref val3)).weight0);
|
Check(val3.boneIndex0, val3.weight0);
|
||||||
Check(((BoneWeight)(ref val3)).boneIndex1, ((BoneWeight)(ref val3)).weight1);
|
Check(val3.boneIndex1, val3.weight1);
|
||||||
Check(((BoneWeight)(ref val3)).boneIndex2, ((BoneWeight)(ref val3)).weight2);
|
Check(val3.boneIndex2, val3.weight2);
|
||||||
Check(((BoneWeight)(ref val3)).boneIndex3, ((BoneWeight)(ref val3)).weight3);
|
Check(val3.boneIndex3, val3.weight3);
|
||||||
if (leftWeight > 0.8f)
|
if (leftWeight > 0.8f)
|
||||||
{
|
{
|
||||||
array[j] = true;
|
array[j] = true;
|
||||||
|
|||||||
@@ -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.ClothInstance
|
// Eden.AutoMorpher.ClothInstance
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Eden.AutoMorpher;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
[Serializable]
|
[Serializable]
|
||||||
@@ -48,30 +47,30 @@ public class ClothInstance
|
|||||||
|
|
||||||
public ClothInstance(SkinnedMeshRenderer clotheSMR, bool duplicateMesh = true)
|
public ClothInstance(SkinnedMeshRenderer clotheSMR, bool duplicateMesh = true)
|
||||||
{
|
{
|
||||||
smr = clotheSMR;
|
this.smr = clotheSMR;
|
||||||
if (duplicateMesh)
|
if (duplicateMesh)
|
||||||
{
|
{
|
||||||
string name = ((Object)smr.sharedMesh).name;
|
string name = this.smr.sharedMesh.name;
|
||||||
editableMesh = Object.Instantiate<Mesh>(clotheSMR.sharedMesh);
|
this.editableMesh = UnityEngine.Object.Instantiate<Mesh>(clotheSMR.sharedMesh);
|
||||||
((Object)editableMesh).name = name + "_EditableMesh";
|
this.editableMesh.name = name + "_EditableMesh";
|
||||||
smr.sharedMesh = editableMesh;
|
this.smr.sharedMesh = this.editableMesh;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
editableMesh = smr.sharedMesh;
|
this.editableMesh = this.smr.sharedMesh;
|
||||||
}
|
}
|
||||||
UpdateWorldVertices();
|
this.UpdateWorldVertices();
|
||||||
int vertexCount = editableMesh.vertexCount;
|
int vertexCount = this.editableMesh.vertexCount;
|
||||||
minDistanceVector = (Vector3[])(object)new Vector3[vertexCount];
|
this.minDistanceVector = (Vector3[])(object)new Vector3[vertexCount];
|
||||||
deltas = (Vector3[])(object)new Vector3[vertexCount];
|
this.deltas = (Vector3[])(object)new Vector3[vertexCount];
|
||||||
minDistance = new float[vertexCount];
|
this.minDistance = new float[vertexCount];
|
||||||
isInsideVertex = new bool[vertexCount];
|
this.isInsideVertex = new bool[vertexCount];
|
||||||
excludedVertices = new bool[vertexCount];
|
this.excludedVertices = new bool[vertexCount];
|
||||||
isLeftLegVertex = new bool[vertexCount];
|
this.isLeftLegVertex = new bool[vertexCount];
|
||||||
isRightLegVertex = new bool[vertexCount];
|
this.isRightLegVertex = new bool[vertexCount];
|
||||||
humanoidMatchedBones = new Dictionary<HumanBodyBones, HashSet<Transform>>();
|
this.humanoidMatchedBones = new Dictionary<HumanBodyBones, HashSet<Transform>>();
|
||||||
vertexAdjacency = BuildVertexAdjacency(editableMesh);
|
this.vertexAdjacency = this.BuildVertexAdjacency(this.editableMesh);
|
||||||
BuildEquivalentVerticesFromWorld();
|
this.BuildEquivalentVerticesFromWorld();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateWorldVertices()
|
public void UpdateWorldVertices()
|
||||||
@@ -108,49 +107,48 @@ public class ClothInstance
|
|||||||
//IL_0205: Unknown result type (might be due to invalid IL or missing references)
|
//IL_0205: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_021a: Unknown result type (might be due to invalid IL or missing references)
|
//IL_021a: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_021f: Unknown result type (might be due to invalid IL or missing references)
|
//IL_021f: Unknown result type (might be due to invalid IL or missing references)
|
||||||
if ((Object)(object)bakedMesh == (Object)null)
|
if (this.bakedMesh == null)
|
||||||
{
|
{
|
||||||
bakedMesh = new Mesh();
|
this.bakedMesh = new Mesh();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bakedMesh.Clear();
|
this.bakedMesh.Clear();
|
||||||
}
|
}
|
||||||
smr.BakeMesh(bakedMesh);
|
this.smr.BakeMesh(this.bakedMesh);
|
||||||
int vertexCount = editableMesh.vertexCount;
|
int vertexCount = this.editableMesh.vertexCount;
|
||||||
Vector3 lossyScale = ((Component)smr).transform.lossyScale;
|
Vector3 lossyScale = ((Component)this.smr).transform.lossyScale;
|
||||||
Vector3 val = default(Vector3);
|
Vector3 val = new Vector3(1f / Mathf.Max(lossyScale.x, 1E-08f), 1f / Mathf.Max(lossyScale.y, 1E-08f), 1f / Mathf.Max(lossyScale.z, 1E-08f));
|
||||||
((Vector3)(ref val))._002Ector(1f / Mathf.Max(lossyScale.x, 1E-08f), 1f / Mathf.Max(lossyScale.y, 1E-08f), 1f / Mathf.Max(lossyScale.z, 1E-08f));
|
this.worldNoScale = ((Component)this.smr).transform.localToWorldMatrix * Matrix4x4.Scale(val);
|
||||||
worldNoScale = ((Component)smr).transform.localToWorldMatrix * Matrix4x4.Scale(val);
|
this.worldVertices = (Vector3[])(object)new Vector3[vertexCount];
|
||||||
worldVertices = (Vector3[])(object)new Vector3[vertexCount];
|
this.deltasLocal = (Vector3[])(object)new Vector3[vertexCount];
|
||||||
deltasLocal = (Vector3[])(object)new Vector3[vertexCount];
|
|
||||||
for (int i = 0; i < vertexCount; i++)
|
for (int i = 0; i < vertexCount; i++)
|
||||||
{
|
{
|
||||||
worldVertices[i] = ((Matrix4x4)(ref worldNoScale)).MultiplyPoint3x4(bakedMesh.vertices[i]);
|
this.worldVertices[i] = this.worldNoScale.MultiplyPoint3x4(this.bakedMesh.vertices[i]);
|
||||||
deltasLocal[i] = Vector3.zero;
|
this.deltasLocal[i] = Vector3.zero;
|
||||||
}
|
}
|
||||||
Vector3[] normals = bakedMesh.normals;
|
Vector3[] normals = this.bakedMesh.normals;
|
||||||
Vector4[] tangents = bakedMesh.tangents;
|
Vector4[] tangents = this.bakedMesh.tangents;
|
||||||
bakedWorldNormals = (Vector3[])(object)new Vector3[vertexCount];
|
this.bakedWorldNormals = (Vector3[])(object)new Vector3[vertexCount];
|
||||||
if (tangents != null && tangents.Length == vertexCount)
|
if (tangents != null && tangents.Length == vertexCount)
|
||||||
{
|
{
|
||||||
bakedWorldTangents = (Vector4[])(object)new Vector4[vertexCount];
|
this.bakedWorldTangents = (Vector4[])(object)new Vector4[vertexCount];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bakedWorldTangents = null;
|
this.bakedWorldTangents = null;
|
||||||
}
|
}
|
||||||
for (int j = 0; j < vertexCount; j++)
|
for (int j = 0; j < vertexCount; j++)
|
||||||
{
|
{
|
||||||
Vector3[] array = bakedWorldNormals;
|
Vector3[] array = this.bakedWorldNormals;
|
||||||
int num = j;
|
int num = j;
|
||||||
Vector3 val2 = ((Component)smr).transform.TransformDirection(normals[j]);
|
Vector3 val2 = ((Component)this.smr).transform.TransformDirection(normals[j]);
|
||||||
array[num] = ((Vector3)(ref val2)).normalized;
|
array[num] = val2.normalized;
|
||||||
if (bakedWorldTangents != null)
|
if (this.bakedWorldTangents != null)
|
||||||
{
|
{
|
||||||
val2 = ((Component)smr).transform.TransformDirection(new Vector3(tangents[j].x, tangents[j].y, tangents[j].z));
|
val2 = ((Component)this.smr).transform.TransformDirection(new Vector3(tangents[j].x, tangents[j].y, tangents[j].z));
|
||||||
Vector3 normalized = ((Vector3)(ref val2)).normalized;
|
Vector3 normalized = val2.normalized;
|
||||||
bakedWorldTangents[j] = new Vector4(normalized.x, normalized.y, normalized.z, tangents[j].w);
|
this.bakedWorldTangents[j] = new Vector4(normalized.x, normalized.y, normalized.z, tangents[j].w);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -205,7 +203,7 @@ public class ClothInstance
|
|||||||
//IL_04b2: Unknown result type (might be due to invalid IL or missing references)
|
//IL_04b2: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_04b4: Unknown result type (might be due to invalid IL or missing references)
|
//IL_04b4: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_04b9: Unknown result type (might be due to invalid IL or missing references)
|
//IL_04b9: Unknown result type (might be due to invalid IL or missing references)
|
||||||
if ((Object)(object)mesh == (Object)null)
|
if (mesh == null)
|
||||||
{
|
{
|
||||||
throw new AutoMorpherException("Mesh is Missing", "[VertexAdjacencyUtil] BuildVertexAdjacency\n - mesh is null");
|
throw new AutoMorpherException("Mesh is Missing", "[VertexAdjacencyUtil] BuildVertexAdjacency\n - mesh is null");
|
||||||
}
|
}
|
||||||
@@ -240,7 +238,7 @@ public class ClothInstance
|
|||||||
for (int k = 0; k < vertexCount; k++)
|
for (int k = 0; k < vertexCount; k++)
|
||||||
{
|
{
|
||||||
Vector3 val = vertices[k];
|
Vector3 val = vertices[k];
|
||||||
((Vector3Int)(ref key))._002Ector(Mathf.FloorToInt(val.x / num5), Mathf.FloorToInt(val.y / num5), Mathf.FloorToInt(val.z / num5));
|
key = new Vector3Int(Mathf.FloorToInt(val.x / num5), Mathf.FloorToInt(val.y / num5), Mathf.FloorToInt(val.z / num5));
|
||||||
if (!dictionary.TryGetValue(key, out var value))
|
if (!dictionary.TryGetValue(key, out var value))
|
||||||
{
|
{
|
||||||
value = (dictionary[key] = new List<int>());
|
value = (dictionary[key] = new List<int>());
|
||||||
@@ -262,7 +260,7 @@ public class ClothInstance
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
((Vector3Int)(ref val2))._002Ector(((Vector3Int)(ref key2)).x + l, ((Vector3Int)(ref key2)).y + m, ((Vector3Int)(ref key2)).z + n);
|
val2 = new(key2.x + l, key2.y + m, key2.z + n);
|
||||||
if (!dictionary.TryGetValue(val2, out var value3))
|
if (!dictionary.TryGetValue(val2, out var value3))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
@@ -277,7 +275,7 @@ public class ClothInstance
|
|||||||
{
|
{
|
||||||
int num10 = value2[num9];
|
int num10 = value2[num9];
|
||||||
val4 = vertices[num10] - val3;
|
val4 = vertices[num10] - val3;
|
||||||
if (((Vector3)(ref val4)).sqrMagnitude <= num6)
|
if (val4.sqrMagnitude <= num6)
|
||||||
{
|
{
|
||||||
AddNeighbor(array, num8, num10);
|
AddNeighbor(array, num8, num10);
|
||||||
AddNeighbor(array, num10, num8);
|
AddNeighbor(array, num10, num8);
|
||||||
@@ -294,7 +292,7 @@ public class ClothInstance
|
|||||||
{
|
{
|
||||||
int num14 = value3[num13];
|
int num14 = value3[num13];
|
||||||
val4 = vertices[num14] - val5;
|
val4 = vertices[num14] - val5;
|
||||||
if (((Vector3)(ref val4)).sqrMagnitude <= num6)
|
if (val4.sqrMagnitude <= num6)
|
||||||
{
|
{
|
||||||
AddNeighbor(array, num12, num14);
|
AddNeighbor(array, num12, num14);
|
||||||
AddNeighbor(array, num14, num12);
|
AddNeighbor(array, num14, num12);
|
||||||
@@ -315,7 +313,7 @@ public class ClothInstance
|
|||||||
for (int num17 = 0; num17 < vertexCount; num17++)
|
for (int num17 = 0; num17 < vertexCount; num17++)
|
||||||
{
|
{
|
||||||
Vector3 val6 = vertices[num17];
|
Vector3 val6 = vertices[num17];
|
||||||
((Vector3Int)(ref key3))._002Ector(Mathf.FloorToInt(val6.x / num15), Mathf.FloorToInt(val6.y / num15), Mathf.FloorToInt(val6.z / num15));
|
key3 = new Vector3Int(Mathf.FloorToInt(val6.x / num15), Mathf.FloorToInt(val6.y / num15), Mathf.FloorToInt(val6.z / num15));
|
||||||
if (!dictionary2.TryGetValue(key3, out var value4))
|
if (!dictionary2.TryGetValue(key3, out var value4))
|
||||||
{
|
{
|
||||||
value4 = (dictionary2[key3] = new List<int>());
|
value4 = (dictionary2[key3] = new List<int>());
|
||||||
@@ -337,7 +335,7 @@ public class ClothInstance
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
((Vector3Int)(ref val7))._002Ector(((Vector3Int)(ref key4)).x + num18, ((Vector3Int)(ref key4)).y + num19, ((Vector3Int)(ref key4)).z + num20);
|
val7 = new Vector3Int(key4.x + num18, key4.y + num19, key4.z + num20);
|
||||||
if (!dictionary2.TryGetValue(val7, out var value6))
|
if (!dictionary2.TryGetValue(val7, out var value6))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
@@ -352,7 +350,7 @@ public class ClothInstance
|
|||||||
{
|
{
|
||||||
int num24 = value5[num23];
|
int num24 = value5[num23];
|
||||||
val4 = vertices[num24] - val8;
|
val4 = vertices[num24] - val8;
|
||||||
if (((Vector3)(ref val4)).sqrMagnitude <= num16)
|
if (val4.sqrMagnitude <= num16)
|
||||||
{
|
{
|
||||||
AddNeighbor(array, num22, num24);
|
AddNeighbor(array, num22, num24);
|
||||||
AddNeighbor(array, num24, num22);
|
AddNeighbor(array, num24, num22);
|
||||||
@@ -369,7 +367,7 @@ public class ClothInstance
|
|||||||
{
|
{
|
||||||
int num28 = value6[num27];
|
int num28 = value6[num27];
|
||||||
val4 = vertices[num28] - val9;
|
val4 = vertices[num28] - val9;
|
||||||
if (((Vector3)(ref val4)).sqrMagnitude <= num16)
|
if (val4.sqrMagnitude <= num16)
|
||||||
{
|
{
|
||||||
AddNeighbor(array, num26, num28);
|
AddNeighbor(array, num26, num28);
|
||||||
AddNeighbor(array, num28, num26);
|
AddNeighbor(array, num28, num26);
|
||||||
@@ -441,11 +439,11 @@ public class ClothInstance
|
|||||||
//IL_0391: Unknown result type (might be due to invalid IL or missing references)
|
//IL_0391: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_0396: Unknown result type (might be due to invalid IL or missing references)
|
//IL_0396: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_039b: Unknown result type (might be due to invalid IL or missing references)
|
//IL_039b: Unknown result type (might be due to invalid IL or missing references)
|
||||||
if ((Object)(object)editableMesh == (Object)null || (Object)(object)smr == (Object)null || worldVertices == null)
|
if (this.editableMesh == null || this.smr == null || this.worldVertices == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Mesh val = editableMesh;
|
Mesh val = this.editableMesh;
|
||||||
int vertexCount = val.vertexCount;
|
int vertexCount = val.vertexCount;
|
||||||
Vector3[] vertices = val.vertices;
|
Vector3[] vertices = val.vertices;
|
||||||
SkinningUtil skinningUtil = new SkinningUtil();
|
SkinningUtil skinningUtil = new SkinningUtil();
|
||||||
@@ -454,12 +452,12 @@ public class ClothInstance
|
|||||||
if (blendShapeCount > 0)
|
if (blendShapeCount > 0)
|
||||||
{
|
{
|
||||||
array = (Vector3[])(object)new Vector3[vertexCount];
|
array = (Vector3[])(object)new Vector3[vertexCount];
|
||||||
Vector3[] array2 = (Vector3[])(object)new Vector3[vertexCount];
|
Vector3[] array2 = new Vector3[vertexCount];
|
||||||
Vector3[] array3 = (Vector3[])(object)new Vector3[vertexCount];
|
Vector3[] array3 = new Vector3[vertexCount];
|
||||||
Vector3[] array4 = (Vector3[])(object)new Vector3[vertexCount];
|
Vector3[] array4 = new Vector3[vertexCount];
|
||||||
for (int i = 0; i < blendShapeCount; i++)
|
for (int i = 0; i < blendShapeCount; i++)
|
||||||
{
|
{
|
||||||
float blendShapeWeight = smr.GetBlendShapeWeight(i);
|
float blendShapeWeight = this.smr.GetBlendShapeWeight(i);
|
||||||
if (Mathf.Approximately(blendShapeWeight, 0f))
|
if (Mathf.Approximately(blendShapeWeight, 0f))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
@@ -480,7 +478,7 @@ public class ClothInstance
|
|||||||
}
|
}
|
||||||
for (int k = 0; k < vertexCount; k++)
|
for (int k = 0; k < vertexCount; k++)
|
||||||
{
|
{
|
||||||
Vector3 val2 = skinningUtil.WorldPosToBindPos_Full(smr, val, k, worldVertices[k]);
|
Vector3 val2 = skinningUtil.WorldPosToBindPos_Full(this.smr, val, k, this.worldVertices[k]);
|
||||||
if (array != null)
|
if (array != null)
|
||||||
{
|
{
|
||||||
val2 -= array[k];
|
val2 -= array[k];
|
||||||
@@ -499,7 +497,7 @@ public class ClothInstance
|
|||||||
Vector3[] array9 = (Vector3[])(object)new Vector3[vertexCount];
|
Vector3[] array9 = (Vector3[])(object)new Vector3[vertexCount];
|
||||||
for (int l = 0; l < blendShapeCount; l++)
|
for (int l = 0; l < blendShapeCount; l++)
|
||||||
{
|
{
|
||||||
float blendShapeWeight2 = smr.GetBlendShapeWeight(l);
|
float blendShapeWeight2 = this.smr.GetBlendShapeWeight(l);
|
||||||
if (Mathf.Approximately(blendShapeWeight2, 0f))
|
if (Mathf.Approximately(blendShapeWeight2, 0f))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
@@ -520,32 +518,32 @@ public class ClothInstance
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (bakedWorldNormals == null || bakedWorldNormals.Length != vertexCount)
|
if (this.bakedWorldNormals == null || this.bakedWorldNormals.Length != vertexCount)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Vector3[] array10 = (Vector3[])(object)new Vector3[vertexCount];
|
Vector3[] array10 = (Vector3[])(object)new Vector3[vertexCount];
|
||||||
bool flag = bakedWorldTangents != null && bakedWorldTangents.Length == vertexCount;
|
bool flag = this.bakedWorldTangents != null && this.bakedWorldTangents.Length == vertexCount;
|
||||||
Vector4[] array11 = (Vector4[])(object)(flag ? new Vector4[vertexCount] : null);
|
Vector4[] array11 = (Vector4[])(object)(flag ? new Vector4[vertexCount] : null);
|
||||||
Vector3 targetWorldDir = default(Vector3);
|
Vector3 targetWorldDir = default(Vector3);
|
||||||
for (int n = 0; n < vertexCount; n++)
|
for (int n = 0; n < vertexCount; n++)
|
||||||
{
|
{
|
||||||
Vector3 val3 = skinningUtil.WorldDirToBindDir_Full(smr, val, n, bakedWorldNormals[n]);
|
Vector3 val3 = skinningUtil.WorldDirToBindDir_Full(this.smr, val, n, this.bakedWorldNormals[n]);
|
||||||
if (array5 != null)
|
if (array5 != null)
|
||||||
{
|
{
|
||||||
val3 -= array5[n];
|
val3 -= array5[n];
|
||||||
}
|
}
|
||||||
array10[n] = ((Vector3)(ref val3)).normalized;
|
array10[n] = val3.normalized;
|
||||||
if (flag)
|
if (flag)
|
||||||
{
|
{
|
||||||
((Vector3)(ref targetWorldDir))._002Ector(bakedWorldTangents[n].x, bakedWorldTangents[n].y, bakedWorldTangents[n].z);
|
targetWorldDir = new Vector3(this.bakedWorldTangents[n].x, this.bakedWorldTangents[n].y, this.bakedWorldTangents[n].z);
|
||||||
Vector3 val4 = skinningUtil.WorldDirToBindDir_Full(smr, val, n, targetWorldDir);
|
Vector3 val4 = skinningUtil.WorldDirToBindDir_Full(this.smr, val, n, targetWorldDir);
|
||||||
if (array6 != null)
|
if (array6 != null)
|
||||||
{
|
{
|
||||||
val4 -= array6[n];
|
val4 -= array6[n];
|
||||||
}
|
}
|
||||||
val4 = ((Vector3)(ref val4)).normalized;
|
val4 = val4.normalized;
|
||||||
array11[n] = new Vector4(val4.x, val4.y, val4.z, bakedWorldTangents[n].w);
|
array11[n] = new Vector4(val4.x, val4.y, val4.z, this.bakedWorldTangents[n].w);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val.normals = array10;
|
val.normals = array10;
|
||||||
@@ -572,27 +570,27 @@ public class ClothInstance
|
|||||||
//IL_0165: Unknown result type (might be due to invalid IL or missing references)
|
//IL_0165: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_0167: Unknown result type (might be due to invalid IL or missing references)
|
//IL_0167: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_016c: Unknown result type (might be due to invalid IL or missing references)
|
//IL_016c: Unknown result type (might be due to invalid IL or missing references)
|
||||||
if (worldVertices == null || worldVertices.Length == 0)
|
if (this.worldVertices == null || this.worldVertices.Length == 0)
|
||||||
{
|
{
|
||||||
Debug.LogWarning((object)"[ClothInstance] BuildEquivalentVerticesFromWorld: worldVertices is null or empty. Call UpdateWorldVertices() first.");
|
Debug.LogWarning((object)"[ClothInstance] BuildEquivalentVerticesFromWorld: worldVertices is null or empty. Call UpdateWorldVertices() first.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int num = worldVertices.Length;
|
int num = this.worldVertices.Length;
|
||||||
if (equivalentVertices == null)
|
if (this.equivalentVertices == null)
|
||||||
{
|
{
|
||||||
equivalentVertices = new List<List<int>>();
|
this.equivalentVertices = new List<List<int>>();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
equivalentVertices.Clear();
|
this.equivalentVertices.Clear();
|
||||||
}
|
}
|
||||||
float num2 = maxDistance * maxDistance;
|
float num2 = maxDistance * maxDistance;
|
||||||
Dictionary<Vector3Int, List<int>> dictionary = new Dictionary<Vector3Int, List<int>>();
|
Dictionary<Vector3Int, List<int>> dictionary = new Dictionary<Vector3Int, List<int>>();
|
||||||
Vector3Int key = default(Vector3Int);
|
Vector3Int key = default(Vector3Int);
|
||||||
for (int i = 0; i < num; i++)
|
for (int i = 0; i < num; i++)
|
||||||
{
|
{
|
||||||
Vector3 val = worldVertices[i];
|
Vector3 val = this.worldVertices[i];
|
||||||
((Vector3Int)(ref key))._002Ector(Mathf.FloorToInt(val.x / maxDistance), Mathf.FloorToInt(val.y / maxDistance), Mathf.FloorToInt(val.z / maxDistance));
|
key = new Vector3Int(Mathf.FloorToInt(val.x / maxDistance), Mathf.FloorToInt(val.y / maxDistance), Mathf.FloorToInt(val.z / maxDistance));
|
||||||
if (!dictionary.TryGetValue(key, out var value))
|
if (!dictionary.TryGetValue(key, out var value))
|
||||||
{
|
{
|
||||||
value = (dictionary[key] = new List<int>());
|
value = (dictionary[key] = new List<int>());
|
||||||
@@ -615,13 +613,13 @@ public class ClothInstance
|
|||||||
for (int k = 0; k < count; k++)
|
for (int k = 0; k < count; k++)
|
||||||
{
|
{
|
||||||
int num3 = value2[k];
|
int num3 = value2[k];
|
||||||
Vector3 val2 = worldVertices[num3];
|
Vector3 val2 = this.worldVertices[num3];
|
||||||
for (int l = k + 1; l < count; l++)
|
for (int l = k + 1; l < count; l++)
|
||||||
{
|
{
|
||||||
int num4 = value2[l];
|
int num4 = value2[l];
|
||||||
Vector3 val3 = worldVertices[num4];
|
Vector3 val3 = this.worldVertices[num4];
|
||||||
Vector3 val4 = val2 - val3;
|
Vector3 val4 = val2 - val3;
|
||||||
if (((Vector3)(ref val4)).sqrMagnitude <= num2)
|
if (val4.sqrMagnitude <= num2)
|
||||||
{
|
{
|
||||||
Union(k, l);
|
Union(k, l);
|
||||||
}
|
}
|
||||||
@@ -641,7 +639,7 @@ public class ClothInstance
|
|||||||
{
|
{
|
||||||
if (value4.Count >= 2)
|
if (value4.Count >= 2)
|
||||||
{
|
{
|
||||||
equivalentVertices.Add(value4);
|
this.equivalentVertices.Add(value4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int Find(int x)
|
int Find(int x)
|
||||||
@@ -666,37 +664,37 @@ public class ClothInstance
|
|||||||
|
|
||||||
~ClothInstance()
|
~ClothInstance()
|
||||||
{
|
{
|
||||||
Dispose();
|
this.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
if ((Object)(object)bakedMesh != (Object)null)
|
if (this.bakedMesh != null)
|
||||||
{
|
{
|
||||||
Object.DestroyImmediate((Object)(object)bakedMesh);
|
UnityEngine.Object.DestroyImmediate(this.bakedMesh);
|
||||||
bakedMesh = null;
|
this.bakedMesh = null;
|
||||||
}
|
}
|
||||||
worldVertices = null;
|
this.worldVertices = null;
|
||||||
minDistanceVector = null;
|
this.minDistanceVector = null;
|
||||||
minDistance = null;
|
this.minDistance = null;
|
||||||
deltas = null;
|
this.deltas = null;
|
||||||
deltasLocal = null;
|
this.deltasLocal = null;
|
||||||
isInsideVertex = null;
|
this.isInsideVertex = null;
|
||||||
excludedVertices = null;
|
this.excludedVertices = null;
|
||||||
isLeftLegVertex = null;
|
this.isLeftLegVertex = null;
|
||||||
isRightLegVertex = null;
|
this.isRightLegVertex = null;
|
||||||
vertexAdjacency = null;
|
this.vertexAdjacency = null;
|
||||||
if (equivalentVertices != null)
|
if (this.equivalentVertices != null)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < equivalentVertices.Count; i++)
|
for (int i = 0; i < this.equivalentVertices.Count; i++)
|
||||||
{
|
{
|
||||||
equivalentVertices[i]?.Clear();
|
this.equivalentVertices[i]?.Clear();
|
||||||
}
|
}
|
||||||
equivalentVertices.Clear();
|
this.equivalentVertices.Clear();
|
||||||
equivalentVertices = null;
|
this.equivalentVertices = null;
|
||||||
}
|
}
|
||||||
humanoidMatchedBones = null;
|
this.humanoidMatchedBones = null;
|
||||||
smr = null;
|
this.smr = null;
|
||||||
editableMesh = null;
|
this.editableMesh = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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,18 +34,18 @@ 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()
|
||||||
@@ -55,17 +54,17 @@ public class ClothInstanceTotal
|
|||||||
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
|
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
|
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
|
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
|
||||||
ValidateGlobalBufferReady("[ClothInstanceTotal] UpdateGlobalBuffersFromClothInstances");
|
this.ValidateGlobalBufferReady("[ClothInstanceTotal] UpdateGlobalBuffersFromClothInstances");
|
||||||
for (int i = 0; i < clothInstances.Count; i++)
|
for (int i = 0; i < this.clothInstances.Count; i++)
|
||||||
{
|
{
|
||||||
ClothInstance clothInstance = clothInstances[i];
|
ClothInstance clothInstance = this.clothInstances[i];
|
||||||
if (clothInstance != null)
|
if (clothInstance != null)
|
||||||
{
|
{
|
||||||
if (clothInstance.worldVertices == null || clothInstance.deltasLocal == null)
|
if (clothInstance.worldVertices == null || clothInstance.deltasLocal == null)
|
||||||
{
|
{
|
||||||
throw new AutoMorpherException("Cloth Instance Data is Missing", "[ClothInstanceTotal] UpdateGlobalBuffersFromClothInstances\n - worldVertices or deltasLocal is null");
|
throw new AutoMorpherException("Cloth Instance Data is Missing", "[ClothInstanceTotal] UpdateGlobalBuffersFromClothInstances\n - worldVertices or deltasLocal is null");
|
||||||
}
|
}
|
||||||
int num = VertexOffsets[i];
|
int num = this.VertexOffsets[i];
|
||||||
int num2 = clothInstance.worldVertices.Length;
|
int num2 = clothInstance.worldVertices.Length;
|
||||||
if (num2 != clothInstance.deltasLocal.Length)
|
if (num2 != clothInstance.deltasLocal.Length)
|
||||||
{
|
{
|
||||||
@@ -73,8 +72,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];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -84,21 +83,21 @@ public class ClothInstanceTotal
|
|||||||
{
|
{
|
||||||
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
|
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
|
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
|
||||||
ValidateGlobalBufferReady("[ClothInstanceTotal] ApplyGlobalDeltasToClothInstances");
|
this.ValidateGlobalBufferReady("[ClothInstanceTotal] ApplyGlobalDeltasToClothInstances");
|
||||||
for (int i = 0; i < clothInstances.Count; i++)
|
for (int i = 0; i < this.clothInstances.Count; i++)
|
||||||
{
|
{
|
||||||
ClothInstance clothInstance = clothInstances[i];
|
ClothInstance clothInstance = this.clothInstances[i];
|
||||||
if (clothInstance != null)
|
if (clothInstance != null)
|
||||||
{
|
{
|
||||||
if (clothInstance.deltasLocal == null)
|
if (clothInstance.deltasLocal == null)
|
||||||
{
|
{
|
||||||
throw new AutoMorpherException("Cloth Deltas are Missing", "[ClothInstanceTotal] ApplyGlobalDeltasToClothInstances\n - deltasLocal is null");
|
throw new AutoMorpherException("Cloth Deltas are Missing", "[ClothInstanceTotal] ApplyGlobalDeltasToClothInstances\n - deltasLocal is null");
|
||||||
}
|
}
|
||||||
int num = VertexOffsets[i];
|
int num = this.VertexOffsets[i];
|
||||||
int num2 = clothInstance.deltasLocal.Length;
|
int num2 = clothInstance.deltasLocal.Length;
|
||||||
for (int j = 0; j < num2; j++)
|
for (int j = 0; j < num2; j++)
|
||||||
{
|
{
|
||||||
clothInstance.deltasLocal[j] = GlobalDeltas[num + j];
|
clothInstance.deltasLocal[j] = this.GlobalDeltas[num + j];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -106,11 +105,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");
|
||||||
}
|
}
|
||||||
@@ -122,20 +121,20 @@ public class ClothInstanceTotal
|
|||||||
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
|
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_0123: Unknown result type (might be due to invalid IL or missing references)
|
//IL_0123: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_0128: Unknown result type (might be due to invalid IL or missing references)
|
//IL_0128: Unknown result type (might be due to invalid IL or missing references)
|
||||||
TotalVertexCount = CalculateTotalVertexCount(clothInstances);
|
this.TotalVertexCount = this.CalculateTotalVertexCount(this.clothInstances);
|
||||||
if (TotalVertexCount <= 0)
|
if (this.TotalVertexCount <= 0)
|
||||||
{
|
{
|
||||||
throw new AutoMorpherException("Total Vertex Count is Zero", "[ClothInstanceTotal] BuildTopologyCache\n - TotalVertexCount <= 0");
|
throw new AutoMorpherException("Total Vertex Count is Zero", "[ClothInstanceTotal] BuildTopologyCache\n - TotalVertexCount <= 0");
|
||||||
}
|
}
|
||||||
GlobalPositions = (Vector3[])(object)new Vector3[TotalVertexCount];
|
this.GlobalPositions = (Vector3[])(object)new Vector3[this.TotalVertexCount];
|
||||||
GlobalDeltas = (Vector3[])(object)new Vector3[TotalVertexCount];
|
this.GlobalDeltas = (Vector3[])(object)new Vector3[this.TotalVertexCount];
|
||||||
GlobalAdjacencyTopology = new List<int>[TotalVertexCount];
|
this.GlobalAdjacencyTopology = new List<int>[this.TotalVertexCount];
|
||||||
VertexOffsets = new int[clothInstances.Count];
|
this.VertexOffsets = new int[this.clothInstances.Count];
|
||||||
int num = 0;
|
int num = 0;
|
||||||
for (int i = 0; i < clothInstances.Count; i++)
|
for (int i = 0; i < this.clothInstances.Count; i++)
|
||||||
{
|
{
|
||||||
ClothInstance clothInstance = clothInstances[i];
|
ClothInstance clothInstance = this.clothInstances[i];
|
||||||
VertexOffsets[i] = num;
|
this.VertexOffsets[i] = num;
|
||||||
if (clothInstance == null)
|
if (clothInstance == null)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
@@ -151,10 +150,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++)
|
||||||
{
|
{
|
||||||
@@ -164,7 +163,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];
|
||||||
@@ -181,30 +180,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++)
|
||||||
@@ -216,7 +215,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++)
|
||||||
@@ -228,7 +227,7 @@ public class ClothInstanceTotal
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
GlobalAdjacencyMerged[i] = list;
|
this.GlobalAdjacencyMerged[i] = list;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -286,7 +285,7 @@ public class ClothInstanceTotal
|
|||||||
for (int j = 0; j < num; j++)
|
for (int j = 0; j < num; j++)
|
||||||
{
|
{
|
||||||
Vector3 val = referencePositions[j];
|
Vector3 val = referencePositions[j];
|
||||||
((Vector3Int)(ref key))._002Ector(Mathf.FloorToInt(val.x * num2), Mathf.FloorToInt(val.y * num2), Mathf.FloorToInt(val.z * num2));
|
key = new Vector3Int(Mathf.FloorToInt(val.x * num2), Mathf.FloorToInt(val.y * num2), Mathf.FloorToInt(val.z * num2));
|
||||||
if (!dictionary.TryGetValue(key, out var value))
|
if (!dictionary.TryGetValue(key, out var value))
|
||||||
{
|
{
|
||||||
value = new List<int>(16);
|
value = new List<int>(16);
|
||||||
@@ -299,7 +298,7 @@ public class ClothInstanceTotal
|
|||||||
for (int k = 0; k < num; k++)
|
for (int k = 0; k < num; k++)
|
||||||
{
|
{
|
||||||
Vector3 val2 = referencePositions[k];
|
Vector3 val2 = referencePositions[k];
|
||||||
((Vector3Int)(ref val3))._002Ector(Mathf.FloorToInt(val2.x * num2), Mathf.FloorToInt(val2.y * num2), Mathf.FloorToInt(val2.z * num2));
|
val3 = new Vector3Int(Mathf.FloorToInt(val2.x * num2), Mathf.FloorToInt(val2.y * num2), Mathf.FloorToInt(val2.z * num2));
|
||||||
List<int> list = array[k];
|
List<int> list = array[k];
|
||||||
for (int l = -1; l <= 1; l++)
|
for (int l = -1; l <= 1; l++)
|
||||||
{
|
{
|
||||||
@@ -307,7 +306,7 @@ public class ClothInstanceTotal
|
|||||||
{
|
{
|
||||||
for (int n = -1; n <= 1; n++)
|
for (int n = -1; n <= 1; n++)
|
||||||
{
|
{
|
||||||
((Vector3Int)(ref key2))._002Ector(((Vector3Int)(ref val3)).x + l, ((Vector3Int)(ref val3)).y + m, ((Vector3Int)(ref val3)).z + n);
|
key2 = new Vector3Int(val3.x + l, val3.y + m, val3.z + n);
|
||||||
if (!dictionary.TryGetValue(key2, out var value2))
|
if (!dictionary.TryGetValue(key2, out var value2))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
@@ -320,7 +319,7 @@ public class ClothInstanceTotal
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Vector3 val4 = referencePositions[num5] - val2;
|
Vector3 val4 = referencePositions[num5] - val2;
|
||||||
if (!(((Vector3)(ref val4)).sqrMagnitude > num3))
|
if (!(val4.sqrMagnitude > num3))
|
||||||
{
|
{
|
||||||
list.Add(num5);
|
list.Add(num5);
|
||||||
if (maxNeighborsPerVertex > 0 && list.Count >= maxNeighborsPerVertex)
|
if (maxNeighborsPerVertex > 0 && list.Count >= maxNeighborsPerVertex)
|
||||||
|
|||||||
@@ -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,25 +151,25 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -178,26 +177,26 @@ public class EdenAutoMorpher : MonoBehaviour
|
|||||||
{
|
{
|
||||||
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
|
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
|
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
|
||||||
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((Transform)null, true);
|
this.targetAvatarObject.transform.SetParent((Transform)null, true);
|
||||||
targetAvatarObject.transform.localRotation = Quaternion.identity;
|
this.targetAvatarObject.transform.localRotation = Quaternion.identity;
|
||||||
sourceAvatarObject.transform.SetParent((Transform)null, true);
|
this.sourceAvatarObject.transform.SetParent((Transform)null, 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -206,35 +205,35 @@ public class EdenAutoMorpher : MonoBehaviour
|
|||||||
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
|
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
|
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
|
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
|
||||||
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((Transform)null, true);
|
this.targetAvatarObject.transform.SetParent((Transform)null, true);
|
||||||
targetAvatarObject.transform.localRotation = Quaternion.identity;
|
this.targetAvatarObject.transform.localRotation = Quaternion.identity;
|
||||||
sourceClothesObject.transform.SetParent((Transform)null, true);
|
this.sourceClothesObject.transform.SetParent((Transform)null, 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;
|
||||||
@@ -242,151 +241,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((object)"Unknown Mode Index");
|
Debug.LogError((object)"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((object)"[Eden Auto Morpher] Run ALL - Start Weighting");
|
Debug.Log((object)"[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;
|
string title = this.processInfo.title;
|
||||||
ref string text = ref processInfo.text;
|
string text = this.processInfo.text;
|
||||||
ref float progress = ref processInfo.progress;
|
float progress = 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((object)"[Eden Auto Morpher] Ended Run ALL");
|
Debug.Log((object)"[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;
|
string title = this.processInfo.title;
|
||||||
ref string text = ref processInfo.text;
|
string text = this.processInfo.text;
|
||||||
ref float progress = ref processInfo.progress;
|
float progress = 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((object)"Unknown Mode Index");
|
Debug.LogError((object)"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((object)"[Eden Auto Morpher] Ended Fitting");
|
Debug.Log((object)"[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;
|
string title = this.processInfo.title;
|
||||||
ref string text = ref processInfo.text;
|
string text = this.processInfo.text;
|
||||||
ref float progress = ref processInfo.progress;
|
float progress = 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((object)"[Eden Auto Morpher] Ended Weighting");
|
Debug.Log((object)"[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((Transform)null, true);
|
this.targetAvatarObject.transform.SetParent((Transform)null, true);
|
||||||
targetAvatarObject.transform.localRotation = Quaternion.identity;
|
this.targetAvatarObject.transform.localRotation = Quaternion.identity;
|
||||||
sourceAvatarObject.transform.SetParent((Transform)null, true);
|
this.sourceAvatarObject.transform.SetParent((Transform)null, 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;
|
string title = this.processInfo.title;
|
||||||
ref string text = ref processInfo.text;
|
string text = this.processInfo.text;
|
||||||
ref float progress = ref processInfo.progress;
|
float progress = 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
|
||||||
{
|
{
|
||||||
@@ -399,34 +398,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;
|
string title = this.processInfo.title;
|
||||||
ref string text = ref processInfo.text;
|
string text = this.processInfo.text;
|
||||||
ref float progress = ref processInfo.progress;
|
float progress = 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
|
||||||
{
|
{
|
||||||
@@ -439,40 +438,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((Transform)null, true);
|
this.targetAvatarObject.transform.SetParent((Transform)null, true);
|
||||||
targetAvatarObject.transform.localRotation = Quaternion.identity;
|
this.targetAvatarObject.transform.localRotation = Quaternion.identity;
|
||||||
sourceClothesObject.transform.SetParent((Transform)null, true);
|
this.sourceClothesObject.transform.SetParent((Transform)null, 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;
|
string title = this.processInfo.title;
|
||||||
ref string text = ref processInfo.text;
|
string text = this.processInfo.text;
|
||||||
ref float progress = ref processInfo.progress;
|
float progress = 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
|
||||||
@@ -485,10 +484,10 @@ public class EdenAutoMorpher : MonoBehaviour
|
|||||||
|
|
||||||
public bool IsWeightingReady(bool isAutoMode)
|
public bool IsWeightingReady(bool isAutoMode)
|
||||||
{
|
{
|
||||||
bool flag = morpherState == MorpherState.Fitting_End && (Object)(object)fittedTargetAvatar != (Object)null && (Object)(object)fittedTargetAvatar == (Object)(object)targetAvatarObject;
|
bool flag = this.morpherState == MorpherState.Fitting_End && (Object)(object)this.fittedTargetAvatar != (Object)null && (Object)(object)this.fittedTargetAvatar == (Object)(object)this.targetAvatarObject;
|
||||||
if (!isAutoMode)
|
if (!isAutoMode)
|
||||||
{
|
{
|
||||||
flag = flag && (Object)(object)fittedTargetClothes == (Object)(object)targetClothesObjectOriginal;
|
flag = flag && (Object)(object)this.fittedTargetClothes == (Object)(object)this.targetClothesObjectOriginal;
|
||||||
}
|
}
|
||||||
return flag;
|
return flag;
|
||||||
}
|
}
|
||||||
@@ -497,7 +496,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 = (((Object)(object)edenAutoMorpherConfig.sourceAvatarObject != (Object)null) ? ((Object)edenAutoMorpherConfig.sourceAvatarObject).name : "null");
|
string text = (((Object)(object)edenAutoMorpherConfig.sourceAvatarObject != (Object)null) ? ((Object)edenAutoMorpherConfig.sourceAvatarObject).name : "null");
|
||||||
string text2 = (((Object)(object)edenAutoMorpherConfig.sourceClothesObject != (Object)null) ? ((Object)edenAutoMorpherConfig.sourceClothesObject).name : "null");
|
string text2 = (((Object)(object)edenAutoMorpherConfig.sourceClothesObject != (Object)null) ? ((Object)edenAutoMorpherConfig.sourceClothesObject).name : "null");
|
||||||
string text3 = (((Object)(object)edenAutoMorpherConfig.targetAvatarObject != (Object)null) ? ((Object)edenAutoMorpherConfig.targetAvatarObject).name : "null");
|
string text3 = (((Object)(object)edenAutoMorpherConfig.targetAvatarObject != (Object)null) ? ((Object)edenAutoMorpherConfig.targetAvatarObject).name : "null");
|
||||||
@@ -558,26 +557,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 val3 = sourceBodyMeshes[k];
|
SkinnedMeshRenderer val3 = this.sourceBodyMeshes[k];
|
||||||
string text11 = (((Object)(object)val3 != (Object)null) ? ((Object)val3).name : "null");
|
string text11 = (((Object)(object)val3 != (Object)null) ? ((Object)val3).name : "null");
|
||||||
string text12 = (((Object)(object)val3 != (Object)null && (Object)(object)val3.rootBone != (Object)null) ? ((Object)val3.rootBone).name : "null");
|
string text12 = (((Object)(object)val3 != (Object)null && (Object)(object)val3.rootBone != (Object)null) ? ((Object)val3.rootBone).name : "null");
|
||||||
string text13 = (((Object)(object)val3 != (Object)null && (Object)(object)val3.sharedMesh != (Object)null) ? ((Object)val3.sharedMesh).name : "null");
|
string text13 = (((Object)(object)val3 != (Object)null && (Object)(object)val3.sharedMesh != (Object)null) ? ((Object)val3.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 val4 = targetBodyMeshes[l];
|
SkinnedMeshRenderer val4 = this.targetBodyMeshes[l];
|
||||||
string text14 = (((Object)(object)val4 != (Object)null) ? ((Object)val4).name : "null");
|
string text14 = (((Object)(object)val4 != (Object)null) ? ((Object)val4).name : "null");
|
||||||
string text15 = (((Object)(object)val4 != (Object)null && (Object)(object)val4.rootBone != (Object)null) ? ((Object)val4.rootBone).name : "null");
|
string text15 = (((Object)(object)val4 != (Object)null && (Object)(object)val4.rootBone != (Object)null) ? ((Object)val4.rootBone).name : "null");
|
||||||
string text16 = (((Object)(object)val4 != (Object)null && (Object)(object)val4.sharedMesh != (Object)null) ? ((Object)val4.sharedMesh).name : "null");
|
string text16 = (((Object)(object)val4 != (Object)null && (Object)(object)val4.sharedMesh != (Object)null) ? ((Object)val4.sharedMesh).name : "null");
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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>(false);
|
SkinnedMeshRenderer[] targetClothesSMRs = targetClothesObject.GetComponentsInChildren<SkinnedMeshRenderer>(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}] - ({((Object)targetClothesSMRs[rendereri]).name})", Mathf.Lerp(0.05f, 0.1f, (float)(rendereri / targetClothesSMRs.Length)));
|
this.SetupProgress("Set Up", $"Setup Clothes Info [{rendereri}/{targetClothesSMRs.Length}] - ({targetClothesSMRs[rendereri].name})", Mathf.Lerp(0.05f, 0.1f, (float)(rendereri / targetClothesSMRs.Length)));
|
||||||
yield return null;
|
yield return null;
|
||||||
ClothInstance clothInstance = setupUtil.SetupClothInstance(targetClothesSMRs[rendereri], clothesHumanoidMatchedBones, duplicateMesh);
|
ClothInstance clothInstance = setupUtil.SetupClothInstance(targetClothesSMRs[rendereri], clothesHumanoidMatchedBones, duplicateMesh);
|
||||||
if (clothInstance != null)
|
if (clothInstance != null)
|
||||||
{
|
{
|
||||||
clothInstances.Add(clothInstance);
|
this.clothInstances.Add(clothInstance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (clothInstances.Count == 0)
|
if (this.clothInstances.Count == 0)
|
||||||
{
|
{
|
||||||
throw new AutoMorpherException(LanguageManager.Get("UI.Exception.title.ClothInstanceAllocateFail"), LanguageManager.Get("UI.Exception.message.ClothInstanceAllocateFail"));
|
throw new AutoMorpherException(LanguageManager.Get("UI.Exception.title.ClothInstanceAllocateFail"), LanguageManager.Get("UI.Exception.message.ClothInstanceAllocateFail"));
|
||||||
}
|
}
|
||||||
@@ -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>(false);
|
SkinnedMeshRenderer[] targetClothesSMRs = targetClothesObject.GetComponentsInChildren<SkinnedMeshRenderer>(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}] - ({((Object)targetClothesSMRs[rendereri]).name})", Mathf.Lerp(0.07f, 0.1f, (float)(rendereri / targetClothesSMRs.Length)));
|
this.SetupProgress("Set Up", $"Setup Clothes Info [{rendereri}/{targetClothesSMRs.Length}] - ({targetClothesSMRs[rendereri].name})", Mathf.Lerp(0.07f, 0.1f, (float)(rendereri / targetClothesSMRs.Length)));
|
||||||
yield return null;
|
yield return null;
|
||||||
ClothInstance clothInstance = setupUtil.SetupClothInstance(targetClothesSMRs[rendereri], sourceClothesSMRs[rendereri], meshMatcher, clothesHumanoidMatchedBones, duplicateMesh: true);
|
ClothInstance clothInstance = setupUtil.SetupClothInstance(targetClothesSMRs[rendereri], sourceClothesSMRs[rendereri], meshMatcher, clothesHumanoidMatchedBones, duplicateMesh: true);
|
||||||
if (clothInstance != null)
|
if (clothInstance != null)
|
||||||
{
|
{
|
||||||
clothInstances.Add(clothInstance);
|
this.clothInstances.Add(clothInstance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (clothInstances.Count == 0)
|
if (this.clothInstances.Count == 0)
|
||||||
{
|
{
|
||||||
throw new AutoMorpherException(LanguageManager.Get("UI.Exception.title.ClothInstanceAllocateFail"), LanguageManager.Get("UI.Exception.message.ClothInstanceAllocateFail"));
|
throw new AutoMorpherException(LanguageManager.Get("UI.Exception.title.ClothInstanceAllocateFail"), LanguageManager.Get("UI.Exception.message.ClothInstanceAllocateFail"));
|
||||||
}
|
}
|
||||||
@@ -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}] - {((Object)((Component)clothInstance.smr).transform).name}", Mathf.Lerp(0.1f, 0.4f, (float)fittingI / (float)config.fittingExpandIteration));
|
this.SetupProgress("Fitting", $"Phase 1 Expanding [{fittingI + 1}/{config.fittingExpandIteration}] - {clothInstance.smr.transform.name}", Mathf.Lerp(0.1f, 0.4f, (float)fittingI / (float)config.fittingExpandIteration));
|
||||||
yield return null;
|
yield return null;
|
||||||
vertexFittingUtil.ExpandClothes_World(clothInstance, clothInstances, meshMatcher, config, fittingRadius);
|
vertexFittingUtil.ExpandClothes_World(clothInstance, this.clothInstances, meshMatcher, config, fittingRadius);
|
||||||
yield return null;
|
yield return null;
|
||||||
}
|
}
|
||||||
if (fittingI % 2 == 0)
|
if (fittingI % 2 == 0)
|
||||||
@@ -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}] - {((Object)((Component)clothInstance.smr).transform).name}", Mathf.Lerp(0.4f, 0.8f, (float)fittingI / (float)config.fittingShrinkIteration));
|
this.SetupProgress("Fitting", $"Phase 2 Fitting [{fittingI + 1}/{config.fittingShrinkIteration}] - {clothInstance.smr.transform.name}", Mathf.Lerp(0.4f, 0.8f, (float)fittingI / (float)config.fittingShrinkIteration));
|
||||||
yield return null;
|
yield return null;
|
||||||
vertexFittingUtil.ShrinkClothes_World(clothInstance, clothInstances, meshMatcher, config, fittingRadius);
|
vertexFittingUtil.ShrinkClothes_World(clothInstance, this.clothInstances, meshMatcher, config, fittingRadius);
|
||||||
yield return null;
|
yield return null;
|
||||||
vertexFittingUtil.ExpandClothes_World(clothInstance, clothInstances, meshMatcher, config, fittingRadius);
|
vertexFittingUtil.ExpandClothes_World(clothInstance, this.clothInstances, meshMatcher, config, fittingRadius);
|
||||||
yield return null;
|
yield return null;
|
||||||
}
|
}
|
||||||
if (fittingI % 2 == 0)
|
if (fittingI % 2 == 0)
|
||||||
@@ -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}] - {((Object)((Component)clothInstance.smr).transform).name}", Mathf.Lerp(0.8f, 0.9f, (float)fittingI / (float)config.fittingExpandIteration));
|
this.SetupProgress("Fitting", $"Phase 3 Fine-tuning [{fittingI + 1}/{config.fittingExpandIteration}] - {clothInstance.smr.transform.name}", Mathf.Lerp(0.8f, 0.9f, (float)fittingI / (float)config.fittingExpandIteration));
|
||||||
yield return null;
|
yield return null;
|
||||||
vertexFittingUtil.ExpandClothes_World(clothInstance, clothInstances, meshMatcher, config, fittingRadius);
|
vertexFittingUtil.ExpandClothes_World(clothInstance, this.clothInstances, meshMatcher, config, fittingRadius);
|
||||||
yield return null;
|
yield return null;
|
||||||
}
|
}
|
||||||
if (fittingI % 2 == 0)
|
if (fittingI % 2 == 0)
|
||||||
@@ -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,42 +190,42 @@ 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}] - {((Object)((Component)clothInstance.smr).transform).name}", Mathf.Lerp(0.93f, 0.98f, (float)fittingI / (float)clothInstances.Count));
|
this.SetupProgress("Fitting", $"Apply to Mesh [{fittingI + 1}/{this.clothInstances.Count}] - {clothInstance.smr.transform.name}", Mathf.Lerp(0.93f, 0.98f, (float)fittingI / (float)this.clothInstances.Count));
|
||||||
yield return null;
|
yield return null;
|
||||||
clothInstance.ApplyWorldVerticesToMesh();
|
clothInstance.ApplyWorldVerticesToMesh();
|
||||||
((Renderer)clothInstance.smr).localBounds = new Bounds(Vector3.zero, Vector3.one * 2f);
|
clothInstance.smr.localBounds = new Bounds(Vector3.zero, Vector3.one * 2f);
|
||||||
EditorUtility.SetDirty((Object)(object)clothInstance.smr.sharedMesh);
|
EditorUtility.SetDirty(clothInstance.smr.sharedMesh);
|
||||||
EditorUtility.SetDirty((Object)(object)clothInstance.smr);
|
EditorUtility.SetDirty(clothInstance.smr);
|
||||||
yield return null;
|
yield return null;
|
||||||
int num = fittingI + 1;
|
int num = fittingI + 1;
|
||||||
fittingI = num;
|
fittingI = num;
|
||||||
}
|
}
|
||||||
yield return null;
|
yield return null;
|
||||||
SetupProgress("Saving", "Saving Mesh Data", 0.99f);
|
this.SetupProgress("Saving", "Saving Mesh Data", 0.99f);
|
||||||
yield return null;
|
yield return null;
|
||||||
SaveEditedMeshesToAssets(clothInstances, config);
|
this.SaveEditedMeshesToAssets(this.clothInstances, config);
|
||||||
yield return null;
|
yield return null;
|
||||||
SetupProgress("Finishing", "Finishing", 1f);
|
this.SetupProgress("Finishing", "Finishing", 1f);
|
||||||
foreach (ClothInstance clothInstance2 in clothInstances)
|
foreach (ClothInstance clothInstance2 in this.clothInstances)
|
||||||
{
|
{
|
||||||
clothInstance2.Dispose();
|
clothInstance2.Dispose();
|
||||||
}
|
}
|
||||||
clothInstances = null;
|
this.clothInstances = null;
|
||||||
yield return null;
|
yield return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerator WeightingEnumerator(EdenAutoMorpherConfig config)
|
public IEnumerator WeightingEnumerator(EdenAutoMorpherConfig config)
|
||||||
{
|
{
|
||||||
SetupProgress("Set Up", "Setup Target Avatar Info", 0f);
|
this.SetupProgress("Set Up", "Setup Target Avatar Info", 0f);
|
||||||
yield return null;
|
yield return null;
|
||||||
if (new MeshMatcher().BuildBvhMulti(config.targetBodyMeshes, config.targetAvatarObject.GetComponent<Animator>()) == null)
|
if (new MeshMatcher().BuildBvhMulti(config.targetBodyMeshes, config.targetAvatarObject.GetComponent<Animator>()) == null)
|
||||||
{
|
{
|
||||||
@@ -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, (float)(bakedTargetBodyMeshes.Count / config.targetBodyMeshes.Count)));
|
this.SetupProgress("Set Up", "Setup Target Avatar BodyMesh Info", Mathf.Lerp(0.02f, 0.05f, (float)(bakedTargetBodyMeshes.Count / config.targetBodyMeshes.Count)));
|
||||||
yield return null;
|
yield return null;
|
||||||
Mesh val = new Mesh();
|
Mesh val = new Mesh();
|
||||||
bodyMesh.BakeMesh(val);
|
bodyMesh.BakeMesh(val);
|
||||||
@@ -245,7 +244,7 @@ public class EdenAutoMorpherManager : IDisposable
|
|||||||
bakedTargetBodyMeshes.Add(val);
|
bakedTargetBodyMeshes.Add(val);
|
||||||
}
|
}
|
||||||
yield return null;
|
yield return null;
|
||||||
IEnumerator setupClothEnum = SetupClothInstances(config.targetClothesObject, config.clothesHumanoidMatchedBones, duplicateMesh: false);
|
IEnumerator setupClothEnum = this.SetupClothInstances(config.targetClothesObject, config.clothesHumanoidMatchedBones, duplicateMesh: false);
|
||||||
while (setupClothEnum.MoveNext())
|
while (setupClothEnum.MoveNext())
|
||||||
{
|
{
|
||||||
yield return setupClothEnum.Current;
|
yield return setupClothEnum.Current;
|
||||||
@@ -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}] - {((Object)((Component)clothInstance.smr).transform).name}", weightingStart);
|
this.SetupProgress("Weighting", $"Weighting | Step {step} [{weightingI + 1}/{this.clothInstances.Count}] - {clothInstance.smr.transform.name}", weightingStart);
|
||||||
yield return null;
|
yield return null;
|
||||||
IEnumerator weightingEnum = weightTransferUtil.RetargetAndTransfer(clothInstance, config.targetAvatarObject.GetComponent<Animator>(), config.targetBodyMeshes, bakedTargetBodyMeshes, 0, wtSettings, config.clothBoneTypeMap, clonedBoneMap);
|
IEnumerator weightingEnum = weightTransferUtil.RetargetAndTransfer(clothInstance, config.targetAvatarObject.GetComponent<Animator>(), config.targetBodyMeshes, bakedTargetBodyMeshes, 0, wtSettings, config.clothBoneTypeMap, clonedBoneMap);
|
||||||
while (weightingEnum.MoveNext())
|
while (weightingEnum.MoveNext())
|
||||||
@@ -291,34 +290,34 @@ public class EdenAutoMorpherManager : IDisposable
|
|||||||
step++;
|
step++;
|
||||||
float num5 = 1f - 1f / ((float)step + 1f);
|
float num5 = 1f - 1f / ((float)step + 1f);
|
||||||
float progress = Mathf.Lerp(weightingStart, weightingEnd, num5);
|
float progress = Mathf.Lerp(weightingStart, weightingEnd, num5);
|
||||||
SetupProgress("Weighting", $"Weighting | Step {step} [{weightingI + 1}/{clothInstances.Count}] - {((Object)((Component)clothInstance.smr).transform).name}", progress);
|
this.SetupProgress("Weighting", $"Weighting | Step {step} [{weightingI + 1}/{this.clothInstances.Count}] - {clothInstance.smr.transform.name}", progress);
|
||||||
yield return weightingEnum.Current;
|
yield return weightingEnum.Current;
|
||||||
}
|
}
|
||||||
yield return null;
|
yield return null;
|
||||||
step++;
|
step++;
|
||||||
SetupProgress("Weighting", $"Weighting | Step {step} - Apply to Mesh [{weightingI + 1}/{clothInstances.Count}] - {((Object)((Component)clothInstance.smr).transform).name}", applyStart);
|
this.SetupProgress("Weighting", $"Weighting | Step {step} - Apply to Mesh [{weightingI + 1}/{this.clothInstances.Count}] - {clothInstance.smr.transform.name}", applyStart);
|
||||||
yield return null;
|
yield return null;
|
||||||
clothInstance.ApplyWorldVerticesToMesh();
|
clothInstance.ApplyWorldVerticesToMesh();
|
||||||
((Renderer)clothInstance.smr).localBounds = new Bounds(Vector3.zero, Vector3.one * 2f);
|
((Renderer)clothInstance.smr).localBounds = new Bounds(Vector3.zero, Vector3.one * 2f);
|
||||||
EditorUtility.SetDirty((Object)(object)clothInstance.smr.sharedMesh);
|
EditorUtility.SetDirty(clothInstance.smr.sharedMesh);
|
||||||
EditorUtility.SetDirty((Object)(object)clothInstance.smr);
|
EditorUtility.SetDirty(clothInstance.smr);
|
||||||
yield return null;
|
yield return null;
|
||||||
int num6 = weightingI + 1;
|
int num6 = weightingI + 1;
|
||||||
weightingI = num6;
|
weightingI = num6;
|
||||||
}
|
}
|
||||||
SetupProgress("Weighting", "Allocate Bones", 0.95f);
|
this.SetupProgress("Weighting", "Allocate Bones", 0.95f);
|
||||||
yield return null;
|
yield return null;
|
||||||
if (config.transferWeightToAvatar && config.isReparentAccessoryBonesToTargetAvatar)
|
if (config.transferWeightToAvatar && config.isReparentAccessoryBonesToTargetAvatar)
|
||||||
{
|
{
|
||||||
new BoneAlignmentUtil().ReparentAccessoryBonesToAvatar(config);
|
new BoneAlignmentUtil().ReparentAccessoryBonesToAvatar(config);
|
||||||
}
|
}
|
||||||
SetupProgress("Finishing", "Finishing", 1f);
|
this.SetupProgress("Finishing", "Finishing", 1f);
|
||||||
yield return null;
|
yield return null;
|
||||||
foreach (ClothInstance clothInstance2 in clothInstances)
|
foreach (ClothInstance clothInstance2 in this.clothInstances)
|
||||||
{
|
{
|
||||||
clothInstance2.Dispose();
|
clothInstance2.Dispose();
|
||||||
}
|
}
|
||||||
clothInstances = null;
|
this.clothInstances = null;
|
||||||
yield return null;
|
yield return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -332,7 +331,7 @@ public class EdenAutoMorpherManager : IDisposable
|
|||||||
Debug.LogWarning((object)"[EdenAutoMorpher] 저장할 ClothInstance가 없습니다.");
|
Debug.LogWarning((object)"[EdenAutoMorpher] 저장할 ClothInstance가 없습니다.");
|
||||||
throw new AutoMorpherException("Can't Save Mesh", "Therer is no ClothInstance to save mesh");
|
throw new AutoMorpherException("Can't Save Mesh", "Therer is no ClothInstance to save mesh");
|
||||||
}
|
}
|
||||||
if ((Object)(object)config.targetClothesObject == (Object)null || (Object)(object)config.targetAvatarObject == (Object)null)
|
if (config.targetClothesObject == null || config.targetAvatarObject == null)
|
||||||
{
|
{
|
||||||
Debug.LogWarning((object)"[EdenAutoMorpher] targetClothesObject 또는 targetAvatarObject 가 null 입니다. 메쉬 저장 경로를 만들 수 없습니다.");
|
Debug.LogWarning((object)"[EdenAutoMorpher] targetClothesObject 또는 targetAvatarObject 가 null 입니다. 메쉬 저장 경로를 만들 수 없습니다.");
|
||||||
throw new AutoMorpherException("Can't Save Mesh", "Target Clothes Object or Target Avatar Object is null.\nCan't Create Mesh Folder");
|
throw new AutoMorpherException("Can't Save Mesh", "Target Clothes Object or Target Avatar Object is null.\nCan't Create Mesh Folder");
|
||||||
@@ -342,13 +341,13 @@ public class EdenAutoMorpherManager : IDisposable
|
|||||||
{
|
{
|
||||||
AssetDatabase.CreateFolder("Assets", "@Eden_Mesh");
|
AssetDatabase.CreateFolder("Assets", "@Eden_Mesh");
|
||||||
}
|
}
|
||||||
string text2 = SanitizeForAssetName(((Object)config.targetAvatarObject).name);
|
string text2 = SanitizeForAssetName(config.targetAvatarObject.name);
|
||||||
string text3 = text + "/" + text2;
|
string text3 = text + "/" + text2;
|
||||||
if (!AssetDatabase.IsValidFolder(text3))
|
if (!AssetDatabase.IsValidFolder(text3))
|
||||||
{
|
{
|
||||||
AssetDatabase.CreateFolder(text, text2);
|
AssetDatabase.CreateFolder(text, text2);
|
||||||
}
|
}
|
||||||
string text4 = SanitizeForAssetName(((Object)config.targetClothesObject).name);
|
string text4 = SanitizeForAssetName(config.targetClothesObject.name);
|
||||||
string text5 = text3 + "/" + text4;
|
string text5 = text3 + "/" + text4;
|
||||||
if (!AssetDatabase.IsValidFolder(text5))
|
if (!AssetDatabase.IsValidFolder(text5))
|
||||||
{
|
{
|
||||||
@@ -356,25 +355,25 @@ public class EdenAutoMorpherManager : IDisposable
|
|||||||
}
|
}
|
||||||
string text6 = AssetDatabase.GenerateUniqueAssetPath(text5 + "/" + text4 + "_Meshes.asset");
|
string text6 = AssetDatabase.GenerateUniqueAssetPath(text5 + "/" + text4 + "_Meshes.asset");
|
||||||
int num = 0;
|
int num = 0;
|
||||||
AssetDatabase.CreateAsset((Object)new Mesh
|
AssetDatabase.CreateAsset(new Mesh
|
||||||
{
|
{
|
||||||
name = text4 + "_RootMesh"
|
name = text4 + "_RootMesh"
|
||||||
}, text6);
|
}, text6);
|
||||||
foreach (ClothInstance clothInstance in clothInstances)
|
foreach (ClothInstance clothInstance in clothInstances)
|
||||||
{
|
{
|
||||||
if (clothInstance != null && !((Object)(object)clothInstance.smr == (Object)null))
|
if (clothInstance != null && !(clothInstance.smr == null))
|
||||||
{
|
{
|
||||||
Mesh sharedMesh = clothInstance.smr.sharedMesh;
|
Mesh sharedMesh = clothInstance.smr.sharedMesh;
|
||||||
if (!((Object)(object)sharedMesh == (Object)null))
|
if (!(sharedMesh == null))
|
||||||
{
|
{
|
||||||
Mesh val = Object.Instantiate<Mesh>(sharedMesh);
|
Mesh val = UnityEngine.Object.Instantiate<Mesh>(sharedMesh);
|
||||||
((Object)val).name = SanitizeForAssetName(((Object)((Component)clothInstance.smr).gameObject).name + "_EditedMesh");
|
val.name = SanitizeForAssetName(clothInstance.smr.gameObject.name + "_EditedMesh");
|
||||||
AssetDatabase.AddObjectToAsset((Object)(object)val, text6);
|
AssetDatabase.AddObjectToAsset(val, text6);
|
||||||
clothInstance.smr.sharedMesh = val;
|
clothInstance.smr.sharedMesh = val;
|
||||||
clothInstance.editableMesh = clothInstance.smr.sharedMesh;
|
clothInstance.editableMesh = clothInstance.smr.sharedMesh;
|
||||||
EditorUtility.SetDirty((Object)(object)clothInstance.smr);
|
EditorUtility.SetDirty(clothInstance.smr);
|
||||||
EditorUtility.SetDirty((Object)(object)clothInstance.smr.sharedMesh);
|
EditorUtility.SetDirty(clothInstance.smr.sharedMesh);
|
||||||
EditorUtility.SetDirty((Object)(object)((Component)clothInstance.smr).gameObject);
|
EditorUtility.SetDirty(clothInstance.smr.gameObject);
|
||||||
num++;
|
num++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
@@ -27,17 +26,17 @@ public class EdenAutoMorpher_SetUpUtil
|
|||||||
Transform[] componentsInChildren = targetAvatarObject.GetComponentsInChildren<Transform>(true);
|
Transform[] componentsInChildren = targetAvatarObject.GetComponentsInChildren<Transform>(true);
|
||||||
foreach (Transform val in componentsInChildren)
|
foreach (Transform val in componentsInChildren)
|
||||||
{
|
{
|
||||||
if (!((Object)(object)((Component)val).gameObject == (Object)(object)targetAvatarObject) && ((Component)val).CompareTag(tagEdenMorpherCloth))
|
if (!(val.gameObject == targetAvatarObject) && val.CompareTag(tagEdenMorpherCloth))
|
||||||
{
|
{
|
||||||
list.Add(((Component)val).gameObject);
|
list.Add(((Component)val).gameObject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach (GameObject item in list)
|
foreach (GameObject item in list)
|
||||||
{
|
{
|
||||||
Object.DestroyImmediate((Object)(object)item);
|
UnityEngine.Object.DestroyImmediate(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
GameObject obj = Object.Instantiate<GameObject>(sourceClothesObject, targetAvatarObject.transform);
|
GameObject obj = UnityEngine.Object.Instantiate<GameObject>(sourceClothesObject, targetAvatarObject.transform);
|
||||||
obj.SetActive(true);
|
obj.SetActive(true);
|
||||||
obj.transform.localPosition = Vector3.zero;
|
obj.transform.localPosition = Vector3.zero;
|
||||||
obj.transform.localRotation = Quaternion.identity;
|
obj.transform.localRotation = Quaternion.identity;
|
||||||
@@ -72,8 +71,8 @@ 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 ((Object)(object)config.targetClothesObject == (Object)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");
|
||||||
}
|
}
|
||||||
@@ -83,7 +82,7 @@ public class EdenAutoMorpher_SetUpUtil
|
|||||||
boneMatchUtil.MatchClothesToBodyBones(bodyRootLocalBones, rootLocalBones, out clothesHumanoidMatchedBones, out clothBoneTypeMap, out var clothToBodyMatched);
|
boneMatchUtil.MatchClothesToBodyBones(bodyRootLocalBones, rootLocalBones, out clothesHumanoidMatchedBones, out clothBoneTypeMap, out var clothToBodyMatched);
|
||||||
Dictionary<Transform, Transform> sourceToProxy;
|
Dictionary<Transform, Transform> sourceToProxy;
|
||||||
GameObject val = new BodyPoseMatchUtil().AutoAdjustBodyPose(config.sourceAvatarObject, config.sourceBodyMeshes, config.targetAvatarObject, config.targetBodyMeshes, out sourceToProxy);
|
GameObject val = new BodyPoseMatchUtil().AutoAdjustBodyPose(config.sourceAvatarObject, config.sourceBodyMeshes, config.targetAvatarObject, config.targetBodyMeshes, out sourceToProxy);
|
||||||
if ((Object)(object)val == (Object)null)
|
if (val == null)
|
||||||
{
|
{
|
||||||
throw new AutoMorpherException(LanguageManager.Get("UI.Exception.title.BodyProxyNull"), LanguageManager.Get("UI.Exception.message.BodyProxyNull"));
|
throw new AutoMorpherException(LanguageManager.Get("UI.Exception.title.BodyProxyNull"), LanguageManager.Get("UI.Exception.message.BodyProxyNull"));
|
||||||
}
|
}
|
||||||
@@ -99,13 +98,13 @@ public class EdenAutoMorpher_SetUpUtil
|
|||||||
}
|
}
|
||||||
if (AutoMorpherDev.isDeveloperMode)
|
if (AutoMorpherDev.isDeveloperMode)
|
||||||
{
|
{
|
||||||
DebugPrintSameNameBonePaths(clothToBodyMatched, sourceToProxy);
|
this.DebugPrintSameNameBonePaths(clothToBodyMatched, sourceToProxy);
|
||||||
}
|
}
|
||||||
new BodyPoseToClothApplier().ApplyBodyPoseToClothes(val.transform, config.targetClothesObject.transform, clothToBodyMatched, sourceToProxy);
|
new BodyPoseToClothApplier().ApplyBodyPoseToClothes(val.transform, config.targetClothesObject.transform, clothToBodyMatched, sourceToProxy);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
Object.DestroyImmediate((Object)(object)val);
|
UnityEngine.Object.DestroyImmediate(val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,12 +122,12 @@ public class EdenAutoMorpher_SetUpUtil
|
|||||||
foreach (KeyValuePair<Transform, Transform> item in sourceToProxy)
|
foreach (KeyValuePair<Transform, Transform> item in sourceToProxy)
|
||||||
{
|
{
|
||||||
Transform key = item.Key;
|
Transform key = item.Key;
|
||||||
if (!((Object)(object)key == (Object)null))
|
if (!(key == null))
|
||||||
{
|
{
|
||||||
if (!dictionary.TryGetValue(((Object)key).name, out var value))
|
if (!dictionary.TryGetValue(key.name, out var value))
|
||||||
{
|
{
|
||||||
value = new List<Transform>();
|
value = new List<Transform>();
|
||||||
dictionary.Add(((Object)key).name, value);
|
dictionary.Add(key.name, value);
|
||||||
}
|
}
|
||||||
value.Add(key);
|
value.Add(key);
|
||||||
}
|
}
|
||||||
@@ -140,11 +139,11 @@ public class EdenAutoMorpher_SetUpUtil
|
|||||||
{
|
{
|
||||||
_ = item2.Key;
|
_ = item2.Key;
|
||||||
Transform val = GetSourceTransform(item2.Value);
|
Transform val = GetSourceTransform(item2.Value);
|
||||||
if ((Object)(object)val == (Object)null)
|
if (val == null)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
string name = ((Object)val).name;
|
string name = val.name;
|
||||||
if (!dictionary.TryGetValue(name, out var value2))
|
if (!dictionary.TryGetValue(name, out var value2))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
@@ -157,19 +156,19 @@ public class EdenAutoMorpher_SetUpUtil
|
|||||||
}
|
}
|
||||||
stringBuilder.AppendLine("--------------------------------------------------");
|
stringBuilder.AppendLine("--------------------------------------------------");
|
||||||
}
|
}
|
||||||
Debug.Log((object)stringBuilder.ToString());
|
Debug.Log(stringBuilder.ToString());
|
||||||
string GetPath(Transform t)
|
string GetPath(Transform t)
|
||||||
{
|
{
|
||||||
if ((Object)(object)t == (Object)null)
|
if (t == null)
|
||||||
{
|
{
|
||||||
return "(null)";
|
return "(null)";
|
||||||
}
|
}
|
||||||
StringBuilder stringBuilder2 = new StringBuilder();
|
StringBuilder stringBuilder2 = new StringBuilder();
|
||||||
while ((Object)(object)t != (Object)null)
|
while (t != null)
|
||||||
{
|
{
|
||||||
stringBuilder2.Insert(0, ((Object)t).name);
|
stringBuilder2.Insert(0, t.name);
|
||||||
t = t.parent;
|
t = t.parent;
|
||||||
if ((Object)(object)t != (Object)null)
|
if (t != null)
|
||||||
{
|
{
|
||||||
stringBuilder2.Insert(0, "/");
|
stringBuilder2.Insert(0, "/");
|
||||||
}
|
}
|
||||||
@@ -220,8 +219,8 @@ 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 ((Object)(object)config.targetClothesObject == (Object)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");
|
||||||
}
|
}
|
||||||
@@ -248,14 +247,14 @@ 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");
|
||||||
}
|
}
|
||||||
foreach (SkinnedMeshRenderer item in list)
|
foreach (SkinnedMeshRenderer item in list)
|
||||||
{
|
{
|
||||||
if ((Object)(object)item == (Object)null)
|
if (item == null)
|
||||||
{
|
{
|
||||||
throw new AutoMorpherException(errorPreFix + "Body Mesh Is Null", "Null Mesh in " + errorPreFix + " Body Meshes");
|
throw new AutoMorpherException(errorPreFix + "Body Mesh Is Null", "Null Mesh in " + errorPreFix + " Body Meshes");
|
||||||
}
|
}
|
||||||
@@ -268,27 +267,27 @@ public class EdenAutoMorpher_SetUpUtil
|
|||||||
MeshClassifier meshClassifier = new MeshClassifier();
|
MeshClassifier meshClassifier = new MeshClassifier();
|
||||||
List<SkinnedMeshRenderer> list = new List<SkinnedMeshRenderer>();
|
List<SkinnedMeshRenderer> list = new List<SkinnedMeshRenderer>();
|
||||||
Animator component = avatarObject.GetComponent<Animator>();
|
Animator component = avatarObject.GetComponent<Animator>();
|
||||||
if ((Object)(object)component != (Object)null && (Object)(object)component.avatar != (Object)null && component.avatar.isHuman)
|
if (component != null && component.avatar != null && component.avatar.isHuman)
|
||||||
{
|
{
|
||||||
list.Add(meshClassifier.GetBodyMesh(avatarObject.transform, component));
|
list.Add(meshClassifier.GetBodyMesh(avatarObject.transform, component));
|
||||||
{
|
{
|
||||||
foreach (SkinnedMeshRenderer item in list)
|
foreach (SkinnedMeshRenderer item in list)
|
||||||
{
|
{
|
||||||
if ((Object)(object)item == (Object)null)
|
if (item == null)
|
||||||
{
|
{
|
||||||
throw new AutoMorpherException(LanguageManager.Get("UI.Exception.title.BodyMeshNull"), LanguageManager.GetFormat("UI.Exception.message.BodyMeshNull", new object[1] { ((Object)avatarObject).name }));
|
throw new AutoMorpherException(LanguageManager.Get("UI.Exception.title.BodyMeshNull"), LanguageManager.GetFormat("UI.Exception.message.BodyMeshNull", new object[1] { avatarObject.name }));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throw new AutoMorpherException(LanguageManager.Get("UI.Exception.title.BodyMeshNull"), LanguageManager.GetFormat("UI.Exception.message.BodyMeshNull", new object[1] { ((Object)avatarObject).name }));
|
throw new AutoMorpherException(LanguageManager.Get("UI.Exception.title.BodyMeshNull"), LanguageManager.GetFormat("UI.Exception.message.BodyMeshNull", new object[1] { avatarObject.name }));
|
||||||
}
|
}
|
||||||
|
|
||||||
public ClothInstance SetupClothInstance(SkinnedMeshRenderer clothSMR, Dictionary<HumanBodyBones, HashSet<Transform>> clothesHumanoidMatchedBones, bool duplicateMesh)
|
public ClothInstance SetupClothInstance(SkinnedMeshRenderer clothSMR, Dictionary<HumanBodyBones, HashSet<Transform>> clothesHumanoidMatchedBones, bool duplicateMesh)
|
||||||
{
|
{
|
||||||
ClothHumanoidMaskUtil clothHumanoidMaskUtil = new ClothHumanoidMaskUtil();
|
ClothHumanoidMaskUtil clothHumanoidMaskUtil = new ClothHumanoidMaskUtil();
|
||||||
if ((Object)(object)clothSMR == (Object)null || (Object)(object)clothSMR.sharedMesh == (Object)null)
|
if (clothSMR == null || clothSMR.sharedMesh == null)
|
||||||
{
|
{
|
||||||
throw new AutoMorpherException(LanguageManager.Get("UI.Exception.title.TargetRendererNull"), LanguageManager.Get("UI.Exception.message.TargetRendererNull"));
|
throw new AutoMorpherException(LanguageManager.Get("UI.Exception.title.TargetRendererNull"), LanguageManager.Get("UI.Exception.message.TargetRendererNull"));
|
||||||
}
|
}
|
||||||
@@ -300,15 +299,15 @@ public class EdenAutoMorpher_SetUpUtil
|
|||||||
|
|
||||||
public ClothInstance SetupClothInstance(SkinnedMeshRenderer clothSMR, SkinnedMeshRenderer coupledSMR, MeshMatcher meshMatcher, Dictionary<HumanBodyBones, HashSet<Transform>> clothesHumanoidMatchedBones, bool duplicateMesh)
|
public ClothInstance SetupClothInstance(SkinnedMeshRenderer clothSMR, SkinnedMeshRenderer coupledSMR, MeshMatcher meshMatcher, Dictionary<HumanBodyBones, HashSet<Transform>> clothesHumanoidMatchedBones, bool duplicateMesh)
|
||||||
{
|
{
|
||||||
if ((Object)(object)coupledSMR == (Object)null)
|
if (coupledSMR == null)
|
||||||
{
|
{
|
||||||
throw new AutoMorpherException("Coupled Skinned Mesh Renderer is Null", "[EdenAutoMorpher_SetupUtil] SetupClothInstance\n\n - Coupled Skinned Mesh Renderer is null");
|
throw new AutoMorpherException("Coupled Skinned Mesh Renderer is Null", "[EdenAutoMorpher_SetupUtil] SetupClothInstance\n\n - Coupled Skinned Mesh Renderer is null");
|
||||||
}
|
}
|
||||||
if ((Object)(object)coupledSMR.sharedMesh == (Object)null || coupledSMR.sharedMesh.vertexCount == 0)
|
if (coupledSMR.sharedMesh == null || coupledSMR.sharedMesh.vertexCount == 0)
|
||||||
{
|
{
|
||||||
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;
|
||||||
@@ -321,7 +320,7 @@ public class EdenAutoMorpher_SetUpUtil
|
|||||||
}
|
}
|
||||||
if (clothInstance.minDistanceVector != null)
|
if (clothInstance.minDistanceVector != null)
|
||||||
{
|
{
|
||||||
clothInstance.minDistance = clothInstance.minDistanceVector.Select((Vector3 v) => ((Vector3)(ref v)).magnitude).ToArray();
|
clothInstance.minDistance = clothInstance.minDistanceVector.Select((Vector3 v) => v.magnitude).ToArray();
|
||||||
}
|
}
|
||||||
clothInstance.isInsideVertex = meshMatcher.GetBodyInsideFlags(worldVertices);
|
clothInstance.isInsideVertex = meshMatcher.GetBodyInsideFlags(worldVertices);
|
||||||
if (clothInstance.isInsideVertex == null || clothInstance.isInsideVertex.Length == 0)
|
if (clothInstance.isInsideVertex == null || clothInstance.isInsideVertex.Length == 0)
|
||||||
@@ -355,21 +354,21 @@ public class EdenAutoMorpher_SetUpUtil
|
|||||||
//IL_04bf: Unknown result type (might be due to invalid IL or missing references)
|
//IL_04bf: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_04b1: Unknown result type (might be due to invalid IL or missing references)
|
//IL_04b1: Unknown result type (might be due to invalid IL or missing references)
|
||||||
clonedBoneMap = null;
|
clonedBoneMap = null;
|
||||||
if ((Object)(object)config.targetClothesObject == (Object)null)
|
if (config.targetClothesObject == null)
|
||||||
{
|
{
|
||||||
throw new AutoMorpherException("Target Clothes Object is Missing", "[EdenAutoMorpherManager] CreateClothesArmature\n - config.targetClothesObject is null");
|
throw new AutoMorpherException("Target Clothes Object is Missing", "[EdenAutoMorpherManager] CreateClothesArmature\n - config.targetClothesObject is null");
|
||||||
}
|
}
|
||||||
if ((Object)(object)config.targetAvatarObject == (Object)null)
|
if (config.targetAvatarObject == null)
|
||||||
{
|
{
|
||||||
throw new AutoMorpherException("Target Avatar Object is Missing", "[EdenAutoMorpherManager] CreateClothesArmature\n - config.targetAvatarObject is null");
|
throw new AutoMorpherException("Target Avatar Object is Missing", "[EdenAutoMorpherManager] CreateClothesArmature\n - config.targetAvatarObject is null");
|
||||||
}
|
}
|
||||||
Animator component = config.targetAvatarObject.GetComponent<Animator>();
|
Animator component = config.targetAvatarObject.GetComponent<Animator>();
|
||||||
if ((Object)(object)component == (Object)null || !component.isHuman)
|
if (component == null || !component.isHuman)
|
||||||
{
|
{
|
||||||
throw new AutoMorpherException("Target Avatar Animator is Invalid", "[EdenAutoMorpherManager] CreateClothesArmature\n - targetAvatarAnimator is null or not a Humanoid");
|
throw new AutoMorpherException("Target Avatar Animator is Invalid", "[EdenAutoMorpherManager] CreateClothesArmature\n - targetAvatarAnimator is null or not a Humanoid");
|
||||||
}
|
}
|
||||||
Transform boneTransform = component.GetBoneTransform((HumanBodyBones)0);
|
Transform boneTransform = component.GetBoneTransform((HumanBodyBones)0);
|
||||||
if ((Object)(object)boneTransform == (Object)null)
|
if (boneTransform == null)
|
||||||
{
|
{
|
||||||
throw new AutoMorpherException("Humanoid Root Bone is Missing", "[EdenAutoMorpherManager] CreateClothesArmature\n - Animator.GetBoneTransform(HumanBodyBones.Hips) returned null");
|
throw new AutoMorpherException("Humanoid Root Bone is Missing", "[EdenAutoMorpherManager] CreateClothesArmature\n - Animator.GetBoneTransform(HumanBodyBones.Hips) returned null");
|
||||||
}
|
}
|
||||||
@@ -378,8 +377,8 @@ public class EdenAutoMorpher_SetUpUtil
|
|||||||
throw new AutoMorpherException("Target Body Meshes are Missing", "[EdenAutoMorpherManager] CreateClothesArmature\n - config.targetBodyMeshes is null or empty");
|
throw new AutoMorpherException("Target Body Meshes are Missing", "[EdenAutoMorpherManager] CreateClothesArmature\n - config.targetBodyMeshes is null or empty");
|
||||||
}
|
}
|
||||||
Transform transform = config.targetClothesObject.transform;
|
Transform transform = config.targetClothesObject.transform;
|
||||||
Transform val = FindArmature(config, config.targetClothesObject.transform);
|
Transform val = this.FindArmature(config, config.targetClothesObject.transform);
|
||||||
if ((Object)(object)val == (Object)null)
|
if (val == null)
|
||||||
{
|
{
|
||||||
val = new GameObject("Armature.1").transform;
|
val = new GameObject("Armature.1").transform;
|
||||||
val.SetParent(transform, false);
|
val.SetParent(transform, false);
|
||||||
@@ -387,9 +386,9 @@ public class EdenAutoMorpher_SetUpUtil
|
|||||||
val.localRotation = Quaternion.identity;
|
val.localRotation = Quaternion.identity;
|
||||||
val.localScale = Vector3.one;
|
val.localScale = Vector3.one;
|
||||||
}
|
}
|
||||||
if (((Object)val).name == "Armature")
|
if (val.name == "Armature")
|
||||||
{
|
{
|
||||||
((Object)val).name = "Armature.1";
|
val.name = "Armature.1";
|
||||||
}
|
}
|
||||||
Dictionary<Transform, Transform> dictionary = new Dictionary<Transform, Transform>();
|
Dictionary<Transform, Transform> dictionary = new Dictionary<Transform, Transform>();
|
||||||
if (config.clothesHumanoidMatchedBones != null && config.clothesHumanoidMatchedBones.Count > 0)
|
if (config.clothesHumanoidMatchedBones != null && config.clothesHumanoidMatchedBones.Count > 0)
|
||||||
@@ -403,7 +402,7 @@ public class EdenAutoMorpher_SetUpUtil
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Transform boneTransform2 = component.GetBoneTransform(key);
|
Transform boneTransform2 = component.GetBoneTransform(key);
|
||||||
if ((Object)(object)boneTransform2 == (Object)null)
|
if (boneTransform2 == null)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -411,11 +410,11 @@ public class EdenAutoMorpher_SetUpUtil
|
|||||||
int num = int.MaxValue;
|
int num = int.MaxValue;
|
||||||
foreach (Transform item in value)
|
foreach (Transform item in value)
|
||||||
{
|
{
|
||||||
if (!((Object)(object)item == (Object)null))
|
if (!(item == null))
|
||||||
{
|
{
|
||||||
int num2 = 0;
|
int num2 = 0;
|
||||||
Transform val3 = item;
|
Transform val3 = item;
|
||||||
while ((Object)(object)val3 != (Object)null)
|
while (val3 != null)
|
||||||
{
|
{
|
||||||
num2++;
|
num2++;
|
||||||
val3 = val3.parent;
|
val3 = val3.parent;
|
||||||
@@ -425,13 +424,13 @@ public class EdenAutoMorpher_SetUpUtil
|
|||||||
num = num2;
|
num = num2;
|
||||||
val2 = item;
|
val2 = item;
|
||||||
}
|
}
|
||||||
else if (num2 == num && (Object)(object)val2 != (Object)null && string.Compare(((Object)item).name, ((Object)val2).name, StringComparison.Ordinal) < 0)
|
else if (num2 == num && val2 != null && string.Compare(item.name, val2.name, StringComparison.Ordinal) < 0)
|
||||||
{
|
{
|
||||||
val2 = item;
|
val2 = item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!((Object)(object)val2 == (Object)null) && !dictionary.ContainsKey(boneTransform2))
|
if (!(val2 == null) && !dictionary.ContainsKey(boneTransform2))
|
||||||
{
|
{
|
||||||
dictionary.Add(boneTransform2, val2);
|
dictionary.Add(boneTransform2, val2);
|
||||||
}
|
}
|
||||||
@@ -442,7 +441,7 @@ public class EdenAutoMorpher_SetUpUtil
|
|||||||
for (int i = 0; i < config.targetBodyMeshes.Count; i++)
|
for (int i = 0; i < config.targetBodyMeshes.Count; i++)
|
||||||
{
|
{
|
||||||
SkinnedMeshRenderer val4 = config.targetBodyMeshes[i];
|
SkinnedMeshRenderer val4 = config.targetBodyMeshes[i];
|
||||||
if ((Object)(object)val4 == (Object)null)
|
if (val4 == null)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -453,7 +452,7 @@ public class EdenAutoMorpher_SetUpUtil
|
|||||||
}
|
}
|
||||||
foreach (Transform item2 in activeBones)
|
foreach (Transform item2 in activeBones)
|
||||||
{
|
{
|
||||||
if ((Object)(object)item2 != (Object)null)
|
if (item2 != null)
|
||||||
{
|
{
|
||||||
hashSet.Add(item2);
|
hashSet.Add(item2);
|
||||||
}
|
}
|
||||||
@@ -462,15 +461,15 @@ public class EdenAutoMorpher_SetUpUtil
|
|||||||
HashSet<Transform> hashSet2 = new HashSet<Transform>(hashSet);
|
HashSet<Transform> hashSet2 = new HashSet<Transform>(hashSet);
|
||||||
foreach (Transform item3 in hashSet)
|
foreach (Transform item3 in hashSet)
|
||||||
{
|
{
|
||||||
if ((Object)(object)item3 == (Object)null)
|
if (item3 == null)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Transform val5 = item3;
|
Transform val5 = item3;
|
||||||
while ((Object)(object)val5 != (Object)null)
|
while (val5 != null)
|
||||||
{
|
{
|
||||||
hashSet2.Add(val5);
|
hashSet2.Add(val5);
|
||||||
if ((Object)(object)val5 == (Object)(object)boneTransform)
|
if (val5 == (object)boneTransform)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -481,32 +480,32 @@ public class EdenAutoMorpher_SetUpUtil
|
|||||||
Dictionary<Transform, Transform> dictionary3 = new Dictionary<Transform, Transform>(hashSet2.Count);
|
Dictionary<Transform, Transform> dictionary3 = new Dictionary<Transform, Transform>(hashSet2.Count);
|
||||||
foreach (Transform item4 in hashSet2)
|
foreach (Transform item4 in hashSet2)
|
||||||
{
|
{
|
||||||
if ((Object)(object)item4 == (Object)null)
|
if (item4 == null)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Transform val6 = null;
|
Transform val6 = null;
|
||||||
Transform val7 = null;
|
Transform val7 = null;
|
||||||
if (dictionary.TryGetValue(item4, out var value2) && (Object)(object)value2 != (Object)null)
|
if (dictionary.TryGetValue(item4, out var value2) && value2 != null)
|
||||||
{
|
{
|
||||||
val6 = value2;
|
val6 = value2;
|
||||||
if (config.addAnchorBone)
|
if (config.addAnchorBone)
|
||||||
{
|
{
|
||||||
val7 = new GameObject(((Object)item4).name).transform;
|
val7 = new GameObject(item4.name).transform;
|
||||||
val7.SetParent(val, false);
|
val7.SetParent(val, false);
|
||||||
val7.position = item4.position;
|
val7.position = item4.position;
|
||||||
val7.rotation = item4.rotation;
|
val7.rotation = item4.rotation;
|
||||||
val7.localScale = Vector3.one;
|
val7.localScale = Vector3.one;
|
||||||
val6.SetParent(val7, true);
|
val6.SetParent(val7, true);
|
||||||
((Object)val6).name = ((Object)item4).name + "_clothes";
|
val6.name = item4.name + "_clothes";
|
||||||
val6.localPosition = Vector3.zero;
|
val6.localPosition = Vector3.zero;
|
||||||
val6.localScale = Vector3.one;
|
val6.localScale = Vector3.one;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
((Object)val6).name = ((Object)item4).name;
|
val6.name = item4.name;
|
||||||
val6.position = item4.position;
|
val6.position = item4.position;
|
||||||
ChildBonePositionPreserve(val6, item4);
|
this.ChildBonePositionPreserve(val6, item4);
|
||||||
if (config.armatureBoneScaleCopy)
|
if (config.armatureBoneScaleCopy)
|
||||||
{
|
{
|
||||||
val6.localScale = item4.localScale;
|
val6.localScale = item4.localScale;
|
||||||
@@ -519,7 +518,7 @@ public class EdenAutoMorpher_SetUpUtil
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
val6 = new GameObject(((Object)item4).name).transform;
|
val6 = new GameObject(item4.name).transform;
|
||||||
val6.SetParent(val, false);
|
val6.SetParent(val, false);
|
||||||
val6.position = item4.position;
|
val6.position = item4.position;
|
||||||
val6.rotation = item4.rotation;
|
val6.rotation = item4.rotation;
|
||||||
@@ -532,38 +531,38 @@ public class EdenAutoMorpher_SetUpUtil
|
|||||||
val6.localScale = Vector3.one;
|
val6.localScale = Vector3.one;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!((Object)(object)val6 == (Object)null))
|
if (!(val6 == null))
|
||||||
{
|
{
|
||||||
dictionary2[item4] = val6;
|
dictionary2[item4] = val6;
|
||||||
dictionary3[item4] = (((Object)(object)val7 != (Object)null) ? val7 : val6);
|
dictionary3[item4] = ((val7 != null) ? val7 : val6);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach (Transform item5 in hashSet2)
|
foreach (Transform item5 in hashSet2)
|
||||||
{
|
{
|
||||||
if ((Object)(object)item5 == (Object)null)
|
if (item5 == null)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!dictionary2.TryGetValue(item5, out var value3) || (Object)(object)value3 == (Object)null)
|
if (!dictionary2.TryGetValue(item5, out var value3) || value3 == null)
|
||||||
{
|
{
|
||||||
throw new AutoMorpherException("Mapped Clothes Bone is Missing", "[EdenAutoMorpherManager] CreateClothesArmature\n - clonedByOriginal does not contain originalBone or mappedClothesBone is null\n - originalBone: " + ((Object)item5).name);
|
throw new AutoMorpherException("Mapped Clothes Bone is Missing", "[EdenAutoMorpherManager] CreateClothesArmature\n - clonedByOriginal does not contain originalBone or mappedClothesBone is null\n - originalBone: " + item5.name);
|
||||||
}
|
}
|
||||||
if (!dictionary3.TryGetValue(item5, out var value4) || (Object)(object)value4 == (Object)null)
|
if (!dictionary3.TryGetValue(item5, out var value4) || value4 == null)
|
||||||
{
|
{
|
||||||
throw new AutoMorpherException("Mapped Anchor Bone is Missing", "[EdenAutoMorpherManager] CreateClothesArmature\n - parentAnchorByOriginal does not contain originalBone or mappedAnchorBone is null\n - originalBone: " + ((Object)item5).name);
|
throw new AutoMorpherException("Mapped Anchor Bone is Missing", "[EdenAutoMorpherManager] CreateClothesArmature\n - parentAnchorByOriginal does not contain originalBone or mappedAnchorBone is null\n - originalBone: " + item5.name);
|
||||||
}
|
}
|
||||||
if ((Object)(object)item5 == (Object)(object)boneTransform)
|
if (item5 == (object)boneTransform)
|
||||||
{
|
{
|
||||||
value4.SetParent(val, true);
|
value4.SetParent(val, true);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Transform parent = item5.parent;
|
Transform parent = item5.parent;
|
||||||
Transform value5;
|
Transform value5;
|
||||||
if ((Object)(object)parent == (Object)null)
|
if (parent == null)
|
||||||
{
|
{
|
||||||
value4.SetParent(val, true);
|
value4.SetParent(val, true);
|
||||||
}
|
}
|
||||||
else if (dictionary3.TryGetValue(parent, out value5) && (Object)(object)value5 != (Object)null)
|
else if (dictionary3.TryGetValue(parent, out value5) && value5 != null)
|
||||||
{
|
{
|
||||||
value4.SetParent(value5, true);
|
value4.SetParent(value5, true);
|
||||||
}
|
}
|
||||||
@@ -572,7 +571,7 @@ public class EdenAutoMorpher_SetUpUtil
|
|||||||
value4.SetParent(val, true);
|
value4.SetParent(val, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!dictionary3.TryGetValue(boneTransform, out var value6) || (Object)(object)value6 == (Object)null)
|
if (!dictionary3.TryGetValue(boneTransform, out var value6) || value6 == null)
|
||||||
{
|
{
|
||||||
throw new AutoMorpherException("Cloned Humanoid Root Bone is Missing", "[EdenAutoMorpherManager] CreateClothesArmature\n - failed to map clone for HumanBodyBones.Hips");
|
throw new AutoMorpherException("Cloned Humanoid Root Bone is Missing", "[EdenAutoMorpherManager] CreateClothesArmature\n - failed to map clone for HumanBodyBones.Hips");
|
||||||
}
|
}
|
||||||
@@ -583,7 +582,7 @@ public class EdenAutoMorpher_SetUpUtil
|
|||||||
|
|
||||||
private Transform FindArmature(EdenAutoMorpherConfig config, Transform clothesRoot)
|
private Transform FindArmature(EdenAutoMorpherConfig config, Transform clothesRoot)
|
||||||
{
|
{
|
||||||
if ((Object)(object)clothesRoot == (Object)null)
|
if (clothesRoot == null)
|
||||||
{
|
{
|
||||||
throw new AutoMorpherException("Armature Root Resolve Failed", "[EdenAutoMorpherManager] FindSingleArmatureRootFromHumanoidMatchedBones\n - config is null or clothesRoot is null");
|
throw new AutoMorpherException("Armature Root Resolve Failed", "[EdenAutoMorpherManager] FindSingleArmatureRootFromHumanoidMatchedBones\n - config is null or clothesRoot is null");
|
||||||
}
|
}
|
||||||
@@ -602,19 +601,19 @@ public class EdenAutoMorpher_SetUpUtil
|
|||||||
}
|
}
|
||||||
foreach (Transform item in value)
|
foreach (Transform item in value)
|
||||||
{
|
{
|
||||||
if (!((Object)(object)item == (Object)null) && (!((Object)(object)item != (Object)(object)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 ((Object)(object)topChildUnderRoot == (Object)null || (Object)(object)topChildUnderRoot == (Object)(object)clothesRoot)
|
if (topChildUnderRoot == null || topChildUnderRoot == clothesRoot)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if ((Object)(object)val == (Object)null)
|
if (val == null)
|
||||||
{
|
{
|
||||||
val = topChildUnderRoot;
|
val = topChildUnderRoot;
|
||||||
}
|
}
|
||||||
else if ((Object)(object)val != (Object)(object)topChildUnderRoot)
|
else if (val != topChildUnderRoot)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -625,7 +624,7 @@ public class EdenAutoMorpher_SetUpUtil
|
|||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if ((Object)(object)val == (Object)null || (Object)(object)val == (Object)(object)clothesRoot)
|
if (val == null || val == clothesRoot)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -634,20 +633,20 @@ public class EdenAutoMorpher_SetUpUtil
|
|||||||
|
|
||||||
private Transform GetTopChildUnderRoot(Transform bone, Transform clothesRoot)
|
private Transform GetTopChildUnderRoot(Transform bone, Transform clothesRoot)
|
||||||
{
|
{
|
||||||
if ((Object)(object)bone == (Object)null || (Object)(object)clothesRoot == (Object)null)
|
if (bone == null || clothesRoot == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if ((Object)(object)bone == (Object)(object)clothesRoot)
|
if (bone == clothesRoot)
|
||||||
{
|
{
|
||||||
return clothesRoot;
|
return clothesRoot;
|
||||||
}
|
}
|
||||||
Transform val = bone;
|
Transform val = bone;
|
||||||
while ((Object)(object)val.parent != (Object)null && (Object)(object)val.parent != (Object)(object)clothesRoot)
|
while (val.parent != null && val.parent != clothesRoot)
|
||||||
{
|
{
|
||||||
val = val.parent;
|
val = val.parent;
|
||||||
}
|
}
|
||||||
if ((Object)(object)val.parent == (Object)(object)clothesRoot)
|
if (val.parent == clothesRoot)
|
||||||
{
|
{
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
@@ -661,7 +660,7 @@ public class EdenAutoMorpher_SetUpUtil
|
|||||||
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
|
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
|
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
|
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
|
||||||
if ((Object)(object)reusableClothBone == (Object)null || (Object)(object)referenceAvatarBone == (Object)null)
|
if (reusableClothBone == null || referenceAvatarBone == null)
|
||||||
{
|
{
|
||||||
throw new AutoMorpherException("Reusable Bone Sync Failed", "[EdenAutoMorpherManager] SyncReusableBoneRotationPreserveChildrenWorld\n - reusableClothBone or referenceAvatarBone is null");
|
throw new AutoMorpherException("Reusable Bone Sync Failed", "[EdenAutoMorpherManager] SyncReusableBoneRotationPreserveChildrenWorld\n - reusableClothBone or referenceAvatarBone is null");
|
||||||
}
|
}
|
||||||
@@ -671,9 +670,9 @@ public class EdenAutoMorpher_SetUpUtil
|
|||||||
for (int i = 0; i < reusableClothBone.childCount; i++)
|
for (int i = 0; i < reusableClothBone.childCount; i++)
|
||||||
{
|
{
|
||||||
Transform child = reusableClothBone.GetChild(i);
|
Transform child = reusableClothBone.GetChild(i);
|
||||||
if (!((Object)(object)child == (Object)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++)
|
||||||
@@ -691,7 +690,7 @@ public class EdenAutoMorpher_SetUpUtil
|
|||||||
|
|
||||||
private void CollectDescendants(Transform root, List<Transform> resultList)
|
private void CollectDescendants(Transform root, List<Transform> resultList)
|
||||||
{
|
{
|
||||||
if ((Object)(object)root == (Object)null)
|
if (root == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -699,9 +698,9 @@ public class EdenAutoMorpher_SetUpUtil
|
|||||||
for (int i = 0; i < root.childCount; i++)
|
for (int i = 0; i < root.childCount; i++)
|
||||||
{
|
{
|
||||||
Transform child = root.GetChild(i);
|
Transform child = root.GetChild(i);
|
||||||
if (!((Object)(object)child == (Object)null))
|
if (!(child == null))
|
||||||
{
|
{
|
||||||
CollectDescendants(child, resultList);
|
this.CollectDescendants(child, resultList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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.MeshClassifier
|
// Eden.AutoMorpher.MeshClassifier
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using Eden.AutoMorpher;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
public class MeshClassifier
|
public class MeshClassifier
|
||||||
@@ -16,26 +14,26 @@ public class MeshClassifier
|
|||||||
|
|
||||||
public SkinnedMeshRenderer GetBodyMesh(Transform root, Animator animator)
|
public SkinnedMeshRenderer GetBodyMesh(Transform root, Animator animator)
|
||||||
{
|
{
|
||||||
List<Transform> list = HumanBodyBonesTrsnforms(bodyBones, animator);
|
List<Transform> list = this.HumanBodyBonesTrsnforms(this.bodyBones, animator);
|
||||||
if (list.Count != bodyBones.Length)
|
if (list.Count != this.bodyBones.Length)
|
||||||
{
|
{
|
||||||
if (AutoMorpherDev.isDeveloperMode)
|
if (AutoMorpherDev.isDeveloperMode)
|
||||||
{
|
{
|
||||||
Debug.LogWarning((object)"[Body Mesh] Animator Bone is not enough");
|
Debug.LogWarning("[Body Mesh] Animator Bone is not enough");
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return GetBoneMatchedMesh(root, list);
|
return this.GetBoneMatchedMesh(root, list);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SkinnedMeshRenderer GetHeadMesh(Transform root, Animator animator)
|
public SkinnedMeshRenderer GetHeadMesh(Transform root, Animator animator)
|
||||||
{
|
{
|
||||||
List<Transform> list = HumanBodyBonesTrsnforms(headBones, animator);
|
List<Transform> list = this.HumanBodyBonesTrsnforms(this.headBones, animator);
|
||||||
if (list.Count != headBones.Length)
|
if (list.Count != this.headBones.Length)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return GetBoneMatchedMesh(root, list);
|
return this.GetBoneMatchedMesh(root, list);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Transform> HumanBodyBonesTrsnforms(HumanBodyBones[] humanBonesList, Animator animator)
|
private List<Transform> HumanBodyBonesTrsnforms(HumanBodyBones[] humanBonesList, Animator animator)
|
||||||
@@ -48,7 +46,7 @@ public class MeshClassifier
|
|||||||
foreach (HumanBodyBones val in humanBonesList)
|
foreach (HumanBodyBones val in humanBonesList)
|
||||||
{
|
{
|
||||||
Transform boneTransform = animator.GetBoneTransform(val);
|
Transform boneTransform = animator.GetBoneTransform(val);
|
||||||
if ((Object)(object)boneTransform == (Object)null)
|
if (boneTransform == null)
|
||||||
{
|
{
|
||||||
list2.Add(val);
|
list2.Add(val);
|
||||||
}
|
}
|
||||||
@@ -71,19 +69,19 @@ public class MeshClassifier
|
|||||||
foreach (SkinnedMeshRenderer val in componentsInChildren)
|
foreach (SkinnedMeshRenderer val in componentsInChildren)
|
||||||
{
|
{
|
||||||
bool flag = true;
|
bool flag = true;
|
||||||
HashSet<Transform> activeBones = GetActiveBones(val);
|
HashSet<Transform> activeBones = this.GetActiveBones(val);
|
||||||
if (AutoMorpherDev.isDeveloperMode)
|
if (AutoMorpherDev.isDeveloperMode)
|
||||||
{
|
{
|
||||||
Debug.Log((object)$"[Body Mesh] {((Object)((Component)val).gameObject).name} have bone Set {activeBones.Count}");
|
Debug.Log($"[Body Mesh] {val.gameObject.name} have bone Set {activeBones.Count}");
|
||||||
}
|
}
|
||||||
foreach (Transform humanBoneTransform in humanBoneTransforms)
|
foreach (Transform humanBoneTransform in humanBoneTransforms)
|
||||||
{
|
{
|
||||||
if (!activeBones.Contains(humanBoneTransform) && !BoneExistsByPosition(humanBoneTransform, activeBones))
|
if (!activeBones.Contains(humanBoneTransform) && !this.BoneExistsByPosition(humanBoneTransform, activeBones))
|
||||||
{
|
{
|
||||||
flag = false;
|
flag = false;
|
||||||
if (AutoMorpherDev.isDeveloperMode)
|
if (AutoMorpherDev.isDeveloperMode)
|
||||||
{
|
{
|
||||||
Debug.Log((object)("[Body Mesh] " + ((Object)((Component)val).gameObject).name + " Doesn't hav bone " + ((Object)humanBoneTransform).name));
|
Debug.Log(("[Body Mesh] " + val.gameObject.name + " Doesn't hav bone " + humanBoneTransform.name));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -105,7 +103,7 @@ public class MeshClassifier
|
|||||||
foreach (Transform item in smrBoneSet)
|
foreach (Transform item in smrBoneSet)
|
||||||
{
|
{
|
||||||
Vector3 val = item.position - boneToCheck.position;
|
Vector3 val = item.position - boneToCheck.position;
|
||||||
if (((Vector3)(ref val)).sqrMagnitude <= posTolerance * posTolerance)
|
if (val.sqrMagnitude <= posTolerance * posTolerance)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -118,9 +116,9 @@ public class MeshClassifier
|
|||||||
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
|
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
|
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
|
||||||
Mesh sharedMesh = smr.sharedMesh;
|
Mesh sharedMesh = smr.sharedMesh;
|
||||||
if ((Object)(object)sharedMesh == (Object)null)
|
if (sharedMesh == null)
|
||||||
{
|
{
|
||||||
Debug.LogWarning((object)"SkinnedMeshRenderer에 연결된 Mesh가 없습니다.");
|
Debug.LogWarning("SkinnedMeshRenderer에 연결된 Mesh가 없습니다.");
|
||||||
return new HashSet<Transform>();
|
return new HashSet<Transform>();
|
||||||
}
|
}
|
||||||
Transform[] bones = smr.bones;
|
Transform[] bones = smr.bones;
|
||||||
@@ -130,21 +128,21 @@ public class MeshClassifier
|
|||||||
for (int i = 0; i < array.Length; i++)
|
for (int i = 0; i < array.Length; i++)
|
||||||
{
|
{
|
||||||
BoneWeight val = array[i];
|
BoneWeight val = array[i];
|
||||||
if (((BoneWeight)(ref val)).weight0 > weightThreshold)
|
if (val.weight0 > weightThreshold)
|
||||||
{
|
{
|
||||||
hashSet.Add(((BoneWeight)(ref val)).boneIndex0);
|
hashSet.Add(val.boneIndex0);
|
||||||
}
|
}
|
||||||
if (((BoneWeight)(ref val)).weight1 > weightThreshold)
|
if (val.weight1 > weightThreshold)
|
||||||
{
|
{
|
||||||
hashSet.Add(((BoneWeight)(ref val)).boneIndex1);
|
hashSet.Add(val.boneIndex1);
|
||||||
}
|
}
|
||||||
if (((BoneWeight)(ref val)).weight2 > weightThreshold)
|
if (val.weight2 > weightThreshold)
|
||||||
{
|
{
|
||||||
hashSet.Add(((BoneWeight)(ref val)).boneIndex2);
|
hashSet.Add(val.boneIndex2);
|
||||||
}
|
}
|
||||||
if (((BoneWeight)(ref val)).weight3 > weightThreshold)
|
if (val.weight3 > weightThreshold)
|
||||||
{
|
{
|
||||||
hashSet.Add(((BoneWeight)(ref val)).boneIndex3);
|
hashSet.Add(val.boneIndex3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
HashSet<Transform> hashSet2 = new HashSet<Transform>();
|
HashSet<Transform> hashSet2 = new HashSet<Transform>();
|
||||||
@@ -164,7 +162,7 @@ public class MeshClassifier
|
|||||||
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
|
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
|
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
|
||||||
Dictionary<HumanBodyBones, HashSet<Transform>> dictionary = new Dictionary<HumanBodyBones, HashSet<Transform>>();
|
Dictionary<HumanBodyBones, HashSet<Transform>> dictionary = new Dictionary<HumanBodyBones, HashSet<Transform>>();
|
||||||
if ((Object)(object)animator == (Object)null)
|
if (animator == null)
|
||||||
{
|
{
|
||||||
throw new AutoMorpherException("Animator is Missing", "[MeshHumanoidBoneMatcher] MeshHumanoidBoneMatcher\n - animator is null");
|
throw new AutoMorpherException("Animator is Missing", "[MeshHumanoidBoneMatcher] MeshHumanoidBoneMatcher\n - animator is null");
|
||||||
}
|
}
|
||||||
@@ -173,13 +171,13 @@ public class MeshClassifier
|
|||||||
{
|
{
|
||||||
foreach (SkinnedMeshRenderer bodyMesh in bodyMeshes)
|
foreach (SkinnedMeshRenderer bodyMesh in bodyMeshes)
|
||||||
{
|
{
|
||||||
if ((Object)(object)bodyMesh == (Object)null)
|
if (bodyMesh == null)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
foreach (Transform activeBone in GetActiveBones(bodyMesh, weightThreshold))
|
foreach (Transform activeBone in this.GetActiveBones(bodyMesh, weightThreshold))
|
||||||
{
|
{
|
||||||
if ((Object)(object)activeBone != (Object)null)
|
if (activeBone != null)
|
||||||
{
|
{
|
||||||
hashSet.Add(activeBone);
|
hashSet.Add(activeBone);
|
||||||
}
|
}
|
||||||
@@ -190,13 +188,13 @@ public class MeshClassifier
|
|||||||
{
|
{
|
||||||
HumanBodyBones val = (HumanBodyBones)i;
|
HumanBodyBones val = (HumanBodyBones)i;
|
||||||
Transform boneTransform = animator.GetBoneTransform(val);
|
Transform boneTransform = animator.GetBoneTransform(val);
|
||||||
if ((Object)(object)boneTransform == (Object)null)
|
if (boneTransform == null)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
HashSet<Transform> hashSet2 = new HashSet<Transform>();
|
HashSet<Transform> hashSet2 = new HashSet<Transform>();
|
||||||
hashSet2.Add(boneTransform);
|
hashSet2.Add(boneTransform);
|
||||||
foreach (Transform item in FindBonesByPosition(boneTransform, hashSet, posTolerance))
|
foreach (Transform item in this.FindBonesByPosition(boneTransform, hashSet, posTolerance))
|
||||||
{
|
{
|
||||||
hashSet2.Add(item);
|
hashSet2.Add(item);
|
||||||
}
|
}
|
||||||
@@ -214,7 +212,7 @@ public class MeshClassifier
|
|||||||
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
|
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
|
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
|
||||||
List<Transform> list = new List<Transform>();
|
List<Transform> list = new List<Transform>();
|
||||||
if ((Object)(object)boneToCheck == (Object)null)
|
if (boneToCheck == null)
|
||||||
{
|
{
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
@@ -222,10 +220,10 @@ public class MeshClassifier
|
|||||||
Vector3 position = boneToCheck.position;
|
Vector3 position = boneToCheck.position;
|
||||||
foreach (Transform item in smrBoneSet)
|
foreach (Transform item in smrBoneSet)
|
||||||
{
|
{
|
||||||
if (!((Object)(object)item == (Object)null) && !((Object)(object)item == (Object)(object)boneToCheck) && NameMatches(((Object)((Component)item).gameObject).name, ((Object)((Component)boneToCheck).gameObject).name))
|
if (!(item == null) && !(item == boneToCheck) && this.NameMatches((((Component)item).gameObject).name, (((Component)boneToCheck).gameObject).name))
|
||||||
{
|
{
|
||||||
Vector3 val = item.position - position;
|
Vector3 val = item.position - position;
|
||||||
if (((Vector3)(ref val)).sqrMagnitude <= num)
|
if (val.sqrMagnitude <= num)
|
||||||
{
|
{
|
||||||
list.Add(item);
|
list.Add(item);
|
||||||
}
|
}
|
||||||
@@ -247,8 +245,8 @@ public class MeshClassifier
|
|||||||
|
|
||||||
private bool NameMatches(string boneToCheckName, string candidateName)
|
private bool NameMatches(string boneToCheckName, string candidateName)
|
||||||
{
|
{
|
||||||
string[] array = TokenizeBoneName(boneToCheckName);
|
string[] array = this.TokenizeBoneName(boneToCheckName);
|
||||||
string[] array2 = TokenizeBoneName(candidateName);
|
string[] array2 = this.TokenizeBoneName(candidateName);
|
||||||
if (array.Length == 0 || array2.Length == 0)
|
if (array.Length == 0 || array2.Length == 0)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@@ -266,12 +264,43 @@ public class MeshClassifier
|
|||||||
|
|
||||||
public MeshClassifier()
|
public MeshClassifier()
|
||||||
{
|
{
|
||||||
HumanBodyBones[] array = new HumanBodyBones[28];
|
this.bodyBones = new HumanBodyBones[28]
|
||||||
RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
|
{
|
||||||
bodyBones = (HumanBodyBones[])(object)array;
|
HumanBodyBones.Hips,
|
||||||
HumanBodyBones[] array2 = new HumanBodyBones[3];
|
HumanBodyBones.Spine,
|
||||||
RuntimeHelpers.InitializeArray(array2, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
|
HumanBodyBones.Chest,
|
||||||
headBones = (HumanBodyBones[])(object)array2;
|
HumanBodyBones.Neck,
|
||||||
base._002Ector();
|
HumanBodyBones.LeftShoulder,
|
||||||
|
HumanBodyBones.LeftUpperArm,
|
||||||
|
HumanBodyBones.LeftLowerArm,
|
||||||
|
HumanBodyBones.LeftHand,
|
||||||
|
HumanBodyBones.LeftThumbProximal,
|
||||||
|
HumanBodyBones.LeftIndexProximal,
|
||||||
|
HumanBodyBones.LeftMiddleProximal,
|
||||||
|
HumanBodyBones.LeftRingProximal,
|
||||||
|
HumanBodyBones.LeftLittleProximal,
|
||||||
|
HumanBodyBones.RightShoulder,
|
||||||
|
HumanBodyBones.RightUpperArm,
|
||||||
|
HumanBodyBones.RightLowerArm,
|
||||||
|
HumanBodyBones.RightHand,
|
||||||
|
HumanBodyBones.RightThumbProximal,
|
||||||
|
HumanBodyBones.RightIndexProximal,
|
||||||
|
HumanBodyBones.RightMiddleProximal,
|
||||||
|
HumanBodyBones.RightRingProximal,
|
||||||
|
HumanBodyBones.RightLittleProximal,
|
||||||
|
HumanBodyBones.LeftUpperLeg,
|
||||||
|
HumanBodyBones.LeftLowerLeg,
|
||||||
|
HumanBodyBones.LeftFoot,
|
||||||
|
HumanBodyBones.RightUpperLeg,
|
||||||
|
HumanBodyBones.RightLowerLeg,
|
||||||
|
HumanBodyBones.RightFoot
|
||||||
|
};
|
||||||
|
|
||||||
|
this.headBones = new HumanBodyBones[3]
|
||||||
|
{
|
||||||
|
HumanBodyBones.Head,
|
||||||
|
HumanBodyBones.LeftEye,
|
||||||
|
HumanBodyBones.RightEye
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -104,7 +104,7 @@ public class MeshMatcher
|
|||||||
//IL_0226: Unknown result type (might be due to invalid IL or missing references)
|
//IL_0226: Unknown result type (might be due to invalid IL or missing references)
|
||||||
Vector3[] worldVertices = clothInstance.worldVertices;
|
Vector3[] worldVertices = clothInstance.worldVertices;
|
||||||
float[] minDistance = clothInstance.minDistance;
|
float[] minDistance = clothInstance.minDistance;
|
||||||
if (bodyBVH == null)
|
if (this.bodyBVH == null)
|
||||||
{
|
{
|
||||||
throw new AutoMorpherException("Body BVH is Missing", "[ExpandVertexMatch] ExpandVertexMatch\n - bodyBVH is null");
|
throw new AutoMorpherException("Body BVH is Missing", "[ExpandVertexMatch] ExpandVertexMatch\n - bodyBVH is null");
|
||||||
}
|
}
|
||||||
@@ -140,7 +140,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 && ((int)closestHit.mainHumanBone == 5 || (int)closestHit.mainHumanBone == 6 || (int)closestHit.mainHumanBone == 20 || (int)closestHit.mainHumanBone == 19))
|
if (skipFootFitting && ((int)closestHit.mainHumanBone == 5 || (int)closestHit.mainHumanBone == 6 || (int)closestHit.mainHumanBone == 20 || (int)closestHit.mainHumanBone == 19))
|
||||||
{
|
{
|
||||||
array[i] = Vector3.zero;
|
array[i] = Vector3.zero;
|
||||||
@@ -152,8 +152,8 @@ public class MeshMatcher
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Vector3 val = closestHit.closestPoint - worldVertices[i];
|
Vector3 val = closestHit.closestPoint - worldVertices[i];
|
||||||
Vector3 normalized = ((Vector3)(ref val)).normalized;
|
Vector3 normalized = val.normalized;
|
||||||
float num3 = Vector3.Dot(normalized, ((Vector3)(ref closestHit.normal)).normalized);
|
float num3 = Vector3.Dot(normalized, closestHit.normal.normalized);
|
||||||
if (num3 > 0.7f)
|
if (num3 > 0.7f)
|
||||||
{
|
{
|
||||||
array[i] = closestHit.closestPoint + normalized * num2 - worldVertices[i];
|
array[i] = closestHit.closestPoint + normalized * num2 - worldVertices[i];
|
||||||
@@ -220,7 +220,7 @@ public class MeshMatcher
|
|||||||
//IL_022f: Unknown result type (might be due to invalid IL or missing references)
|
//IL_022f: Unknown result type (might be due to invalid IL or missing references)
|
||||||
Vector3[] worldVertices = clothInstance.worldVertices;
|
Vector3[] worldVertices = clothInstance.worldVertices;
|
||||||
float[] minDistance = clothInstance.minDistance;
|
float[] minDistance = clothInstance.minDistance;
|
||||||
if (bodyBVH == null)
|
if (this.bodyBVH == null)
|
||||||
{
|
{
|
||||||
throw new AutoMorpherException("Body BVH is Missing", "[ShrinkVertexMatch] ShrinkVertexMatch\n - bodyBVH is null");
|
throw new AutoMorpherException("Body BVH is Missing", "[ShrinkVertexMatch] ShrinkVertexMatch\n - bodyBVH is null");
|
||||||
}
|
}
|
||||||
@@ -258,7 +258,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;
|
||||||
@@ -270,8 +270,8 @@ public class MeshMatcher
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Vector3 val = closestHit.closestPoint - worldVertices[i];
|
Vector3 val = closestHit.closestPoint - worldVertices[i];
|
||||||
Vector3 normalized = ((Vector3)(ref val)).normalized;
|
Vector3 normalized = val.normalized;
|
||||||
float num3 = Vector3.Dot(normalized, ((Vector3)(ref closestHit.normal)).normalized);
|
float num3 = Vector3.Dot(normalized, closestHit.normal.normalized);
|
||||||
if (num3 < -0.7f)
|
if (num3 < -0.7f)
|
||||||
{
|
{
|
||||||
array[i] = closestHit.closestPoint - normalized * num2 - worldVertices[i];
|
array[i] = closestHit.closestPoint - normalized * num2 - worldVertices[i];
|
||||||
@@ -302,7 +302,7 @@ public class MeshMatcher
|
|||||||
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
|
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
|
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
|
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
|
||||||
if (bodyBVH == null)
|
if (this.bodyBVH == null)
|
||||||
{
|
{
|
||||||
throw new AutoMorpherException("sourceBodyBVH is null", "[MeshMatcher] GetMinDistanceToBodysourceBodyBVH is null");
|
throw new AutoMorpherException("sourceBodyBVH is null", "[MeshMatcher] GetMinDistanceToBodysourceBodyBVH is null");
|
||||||
}
|
}
|
||||||
@@ -314,7 +314,7 @@ public class MeshMatcher
|
|||||||
for (int i = 0; i < clothesVertices.Length; i++)
|
for (int i = 0; i < clothesVertices.Length; i++)
|
||||||
{
|
{
|
||||||
Vector3 val = clothesVertices[i];
|
Vector3 val = clothesVertices[i];
|
||||||
Vector3 val2 = bodyBVH.QueryClosest(val).closestPoint - val;
|
Vector3 val2 = this.bodyBVH.QueryClosest(val).closestPoint - val;
|
||||||
array[i] = val2;
|
array[i] = val2;
|
||||||
}
|
}
|
||||||
return array;
|
return array;
|
||||||
@@ -329,7 +329,7 @@ public class MeshMatcher
|
|||||||
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
|
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
|
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
|
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
|
||||||
if (bodyBVH == null)
|
if (this.bodyBVH == null)
|
||||||
{
|
{
|
||||||
throw new AutoMorpherException("sourceBodyBVH is null", "[MeshMatcher] GetBodyInsideFlagssourceBodyBVH is null");
|
throw new AutoMorpherException("sourceBodyBVH is null", "[MeshMatcher] GetBodyInsideFlagssourceBodyBVH is null");
|
||||||
}
|
}
|
||||||
@@ -341,9 +341,9 @@ 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]);
|
||||||
Vector3 val = closestHit.closestPoint - worldVertices[i];
|
Vector3 val = closestHit.closestPoint - worldVertices[i];
|
||||||
float num = Vector3.Dot(((Vector3)(ref val)).normalized, ((Vector3)(ref closestHit.normal)).normalized);
|
float num = Vector3.Dot(val.normalized, closestHit.normal.normalized);
|
||||||
array[i] = num > 0f;
|
array[i] = num > 0f;
|
||||||
}
|
}
|
||||||
return array;
|
return array;
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -89,7 +88,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])
|
||||||
{
|
{
|
||||||
@@ -99,7 +98,7 @@ public class PcaUtil
|
|||||||
{
|
{
|
||||||
num8 = 2;
|
num8 = 2;
|
||||||
}
|
}
|
||||||
Vector3 normalized = ((Vector3)(ref eigenVectors[num8])).normalized;
|
Vector3 normalized = eigenVectors[num8].normalized;
|
||||||
float num9 = float.PositiveInfinity;
|
float num9 = float.PositiveInfinity;
|
||||||
float num10 = float.NegativeInfinity;
|
float num10 = float.NegativeInfinity;
|
||||||
float num11 = 0f;
|
float num11 = 0f;
|
||||||
@@ -116,7 +115,7 @@ public class PcaUtil
|
|||||||
}
|
}
|
||||||
Vector3 val3 = val + normalized * num12;
|
Vector3 val3 = val + normalized * num12;
|
||||||
Vector3 val4 = points[k] - val3;
|
Vector3 val4 = points[k] - val3;
|
||||||
float magnitude = ((Vector3)(ref val4)).magnitude;
|
float magnitude = val4.magnitude;
|
||||||
num11 += magnitude;
|
num11 += magnitude;
|
||||||
}
|
}
|
||||||
result.center = val;
|
result.center = val;
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -53,7 +53,7 @@ public class SkinningUtil
|
|||||||
//IL_0382: Unknown result type (might be due to invalid IL or missing references)
|
//IL_0382: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_0396: Unknown result type (might be due to invalid IL or missing references)
|
//IL_0396: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_034b: Unknown result type (might be due to invalid IL or missing references)
|
//IL_034b: Unknown result type (might be due to invalid IL or missing references)
|
||||||
if ((Object)(object)smr == (Object)null || (Object)(object)bindMesh == (Object)null)
|
if (smr == null || bindMesh == null)
|
||||||
{
|
{
|
||||||
return Vector3.zero;
|
return Vector3.zero;
|
||||||
}
|
}
|
||||||
@@ -73,14 +73,14 @@ public class SkinningUtil
|
|||||||
return ((Component)smr).transform.InverseTransformPoint(targetWorld);
|
return ((Component)smr).transform.InverseTransformPoint(targetWorld);
|
||||||
}
|
}
|
||||||
BoneWeight val = boneWeights[vertexIndex];
|
BoneWeight val = boneWeights[vertexIndex];
|
||||||
bool flag = ((BoneWeight)(ref val)).boneIndex0 >= 0 && ((BoneWeight)(ref val)).boneIndex0 < bones.Length && (Object)(object)bones[((BoneWeight)(ref val)).boneIndex0] != (Object)null && ((BoneWeight)(ref val)).weight0 > 0f;
|
bool flag = val.boneIndex0 >= 0 && val.boneIndex0 < bones.Length && bones[val.boneIndex0] != null && val.weight0 > 0f;
|
||||||
bool flag2 = ((BoneWeight)(ref val)).boneIndex1 >= 0 && ((BoneWeight)(ref val)).boneIndex1 < bones.Length && (Object)(object)bones[((BoneWeight)(ref val)).boneIndex1] != (Object)null && ((BoneWeight)(ref val)).weight1 > 0f;
|
bool flag2 = val.boneIndex1 >= 0 && val.boneIndex1 < bones.Length && bones[val.boneIndex1] != null && val.weight1 > 0f;
|
||||||
bool flag3 = ((BoneWeight)(ref val)).boneIndex2 >= 0 && ((BoneWeight)(ref val)).boneIndex2 < bones.Length && (Object)(object)bones[((BoneWeight)(ref val)).boneIndex2] != (Object)null && ((BoneWeight)(ref val)).weight2 > 0f;
|
bool flag3 = val.boneIndex2 >= 0 && val.boneIndex2 < bones.Length && bones[val.boneIndex2] != null && val.weight2 > 0f;
|
||||||
bool num = ((BoneWeight)(ref val)).boneIndex3 >= 0 && ((BoneWeight)(ref val)).boneIndex3 < bones.Length && (Object)(object)bones[((BoneWeight)(ref val)).boneIndex3] != (Object)null && ((BoneWeight)(ref val)).weight3 > 0f;
|
bool num = val.boneIndex3 >= 0 && val.boneIndex3 < bones.Length && bones[val.boneIndex3] != null && val.weight3 > 0f;
|
||||||
float num2 = (flag ? ((BoneWeight)(ref val)).weight0 : 0f);
|
float num2 = (flag ? val.weight0 : 0f);
|
||||||
float num3 = (flag2 ? ((BoneWeight)(ref val)).weight1 : 0f);
|
float num3 = (flag2 ? val.weight1 : 0f);
|
||||||
float num4 = (flag3 ? ((BoneWeight)(ref val)).weight2 : 0f);
|
float num4 = (flag3 ? val.weight2 : 0f);
|
||||||
float num5 = (num ? ((BoneWeight)(ref val)).weight3 : 0f);
|
float num5 = (num ? val.weight3 : 0f);
|
||||||
float num6 = num2 + num3 + num4 + num5;
|
float num6 = num2 + num3 + num4 + num5;
|
||||||
if (num6 <= 1E-08f)
|
if (num6 <= 1E-08f)
|
||||||
{
|
{
|
||||||
@@ -95,19 +95,19 @@ public class SkinningUtil
|
|||||||
Matrix4x4 acc = Matrix4x4.zero;
|
Matrix4x4 acc = Matrix4x4.zero;
|
||||||
if (num2 > 0f)
|
if (num2 > 0f)
|
||||||
{
|
{
|
||||||
Acc(ref acc, ((BoneWeight)(ref val)).boneIndex0, num2);
|
Acc(ref acc, val.boneIndex0, num2);
|
||||||
}
|
}
|
||||||
if (num3 > 0f)
|
if (num3 > 0f)
|
||||||
{
|
{
|
||||||
Acc(ref acc, ((BoneWeight)(ref val)).boneIndex1, num3);
|
Acc(ref acc, val.boneIndex1, num3);
|
||||||
}
|
}
|
||||||
if (num4 > 0f)
|
if (num4 > 0f)
|
||||||
{
|
{
|
||||||
Acc(ref acc, ((BoneWeight)(ref val)).boneIndex2, num4);
|
Acc(ref acc, val.boneIndex2, num4);
|
||||||
}
|
}
|
||||||
if (num5 > 0f)
|
if (num5 > 0f)
|
||||||
{
|
{
|
||||||
Acc(ref acc, ((BoneWeight)(ref val)).boneIndex3, num5);
|
Acc(ref acc, val.boneIndex3, num5);
|
||||||
}
|
}
|
||||||
if (Mathf.Abs(acc.m00 * (acc.m11 * acc.m22 - acc.m12 * acc.m21) - acc.m01 * (acc.m10 * acc.m22 - acc.m12 * acc.m20) + acc.m02 * (acc.m10 * acc.m21 - acc.m11 * acc.m20)) < 1E-12f)
|
if (Mathf.Abs(acc.m00 * (acc.m11 * acc.m22 - acc.m12 * acc.m21) - acc.m01 * (acc.m10 * acc.m22 - acc.m12 * acc.m20) + acc.m02 * (acc.m10 * acc.m21 - acc.m11 * acc.m20)) < 1E-12f)
|
||||||
{
|
{
|
||||||
@@ -115,8 +115,8 @@ public class SkinningUtil
|
|||||||
}
|
}
|
||||||
acc.m33 = 1f;
|
acc.m33 = 1f;
|
||||||
Matrix4x4 val3 = Matrix4x4.Inverse(acc);
|
Matrix4x4 val3 = Matrix4x4.Inverse(acc);
|
||||||
Vector3 val4 = ((Matrix4x4)(ref val3)).MultiplyPoint3x4(val2);
|
Vector3 val4 = val3.MultiplyPoint3x4(val2);
|
||||||
Debug.Log((object)$"Diff{((Component)smr).transform.TransformPoint(val4) - targetWorld}");
|
Debug.Log($"Diff{((Component)smr).transform.TransformPoint(val4) - targetWorld}");
|
||||||
return val4;
|
return val4;
|
||||||
void Acc(ref Matrix4x4 reference, int boneIndex, float w)
|
void Acc(ref Matrix4x4 reference, int boneIndex, float w)
|
||||||
{
|
{
|
||||||
@@ -196,7 +196,7 @@ public class SkinningUtil
|
|||||||
//IL_029d: Unknown result type (might be due to invalid IL or missing references)
|
//IL_029d: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
|
//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_028d: Unknown result type (might be due to invalid IL or missing references)
|
//IL_028d: Unknown result type (might be due to invalid IL or missing references)
|
||||||
if ((Object)(object)smr == (Object)null || (Object)(object)bindMesh == (Object)null)
|
if (smr == null || bindMesh == null)
|
||||||
{
|
{
|
||||||
return Vector3.zero;
|
return Vector3.zero;
|
||||||
}
|
}
|
||||||
@@ -218,18 +218,18 @@ public class SkinningUtil
|
|||||||
BoneWeight val = boneWeights[vertexIndex];
|
BoneWeight val = boneWeights[vertexIndex];
|
||||||
float[] array = new float[4];
|
float[] array = new float[4];
|
||||||
int[] array2 = new int[4];
|
int[] array2 = new int[4];
|
||||||
array[0] = ((BoneWeight)(ref val)).weight0;
|
array[0] = val.weight0;
|
||||||
array2[0] = ((BoneWeight)(ref val)).boneIndex0;
|
array2[0] = val.boneIndex0;
|
||||||
array[1] = ((BoneWeight)(ref val)).weight1;
|
array[1] = val.weight1;
|
||||||
array2[1] = ((BoneWeight)(ref val)).boneIndex1;
|
array2[1] = val.boneIndex1;
|
||||||
array[2] = ((BoneWeight)(ref val)).weight2;
|
array[2] = val.weight2;
|
||||||
array2[2] = ((BoneWeight)(ref val)).boneIndex2;
|
array2[2] = val.boneIndex2;
|
||||||
array[3] = ((BoneWeight)(ref val)).weight3;
|
array[3] = val.weight3;
|
||||||
array2[3] = ((BoneWeight)(ref val)).boneIndex3;
|
array2[3] = val.boneIndex3;
|
||||||
float num = 0f;
|
float num = 0f;
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
if (array2[i] >= 0 && array2[i] < bones.Length && (Object)(object)bones[array2[i]] != (Object)null)
|
if (array2[i] >= 0 && array2[i] < bones.Length && bones[array2[i]] != null)
|
||||||
{
|
{
|
||||||
num += array[i];
|
num += array[i];
|
||||||
}
|
}
|
||||||
@@ -242,9 +242,8 @@ public class SkinningUtil
|
|||||||
{
|
{
|
||||||
array[j] /= num;
|
array[j] /= num;
|
||||||
}
|
}
|
||||||
Vector3 val2 = ((Component)smr).transform.InverseTransformPoint(targetWorld);
|
Vector3 val2 = smr.transform.InverseTransformPoint(targetWorld);
|
||||||
Vector4 val3 = default(Vector4);
|
Vector4 val3 = new Vector4(val2.x, val2.y, val2.z, 1f);
|
||||||
((Vector4)(ref val3))._002Ector(val2.x, val2.y, val2.z, 1f);
|
|
||||||
Matrix4x4 objWorldInv = ((Component)smr).transform.worldToLocalMatrix;
|
Matrix4x4 objWorldInv = ((Component)smr).transform.worldToLocalMatrix;
|
||||||
Matrix4x4 acc = Matrix4x4.zero;
|
Matrix4x4 acc = Matrix4x4.zero;
|
||||||
for (int k = 0; k < 4; k++)
|
for (int k = 0; k < 4; k++)
|
||||||
@@ -259,7 +258,7 @@ public class SkinningUtil
|
|||||||
return val2;
|
return val2;
|
||||||
}
|
}
|
||||||
Matrix4x4 val4 = Matrix4x4.Inverse(acc);
|
Matrix4x4 val4 = Matrix4x4.Inverse(acc);
|
||||||
return ((Matrix4x4)(ref val4)).MultiplyPoint3x4(Vector4.op_Implicit(val3));
|
return val4.MultiplyPoint3x4((Vector4)val3);
|
||||||
void Accumulate(ref Matrix4x4 reference, int bi, float w)
|
void Accumulate(ref Matrix4x4 reference, int bi, float w)
|
||||||
{
|
{
|
||||||
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
|
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
|
||||||
@@ -343,7 +342,7 @@ public class SkinningUtil
|
|||||||
//IL_0233: Unknown result type (might be due to invalid IL or missing references)
|
//IL_0233: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_024d: Unknown result type (might be due to invalid IL or missing references)
|
//IL_024d: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_0245: Unknown result type (might be due to invalid IL or missing references)
|
//IL_0245: Unknown result type (might be due to invalid IL or missing references)
|
||||||
if ((Object)(object)smr == (Object)null || (Object)(object)bindMesh == (Object)null)
|
if (smr == null || bindMesh == null)
|
||||||
{
|
{
|
||||||
return Vector3.zero;
|
return Vector3.zero;
|
||||||
}
|
}
|
||||||
@@ -354,33 +353,33 @@ public class SkinningUtil
|
|||||||
if (boneWeights == null || bindposes == null || bones == null)
|
if (boneWeights == null || bindposes == null || bones == null)
|
||||||
{
|
{
|
||||||
val = ((Component)smr).transform.InverseTransformDirection(targetWorldDir);
|
val = ((Component)smr).transform.InverseTransformDirection(targetWorldDir);
|
||||||
return ((Vector3)(ref val)).normalized;
|
return val.normalized;
|
||||||
}
|
}
|
||||||
if (vertexIndex < 0 || vertexIndex >= boneWeights.Length)
|
if (vertexIndex < 0 || vertexIndex >= boneWeights.Length)
|
||||||
{
|
{
|
||||||
val = ((Component)smr).transform.InverseTransformDirection(targetWorldDir);
|
val = ((Component)smr).transform.InverseTransformDirection(targetWorldDir);
|
||||||
return ((Vector3)(ref val)).normalized;
|
return val.normalized;
|
||||||
}
|
}
|
||||||
if (bindposes.Length != bones.Length)
|
if (bindposes.Length != bones.Length)
|
||||||
{
|
{
|
||||||
val = ((Component)smr).transform.InverseTransformDirection(targetWorldDir);
|
val = ((Component)smr).transform.InverseTransformDirection(targetWorldDir);
|
||||||
return ((Vector3)(ref val)).normalized;
|
return val.normalized;
|
||||||
}
|
}
|
||||||
BoneWeight val2 = boneWeights[vertexIndex];
|
BoneWeight val2 = boneWeights[vertexIndex];
|
||||||
float[] array = new float[4];
|
float[] array = new float[4];
|
||||||
int[] array2 = new int[4];
|
int[] array2 = new int[4];
|
||||||
array[0] = ((BoneWeight)(ref val2)).weight0;
|
array[0] = val2.weight0;
|
||||||
array2[0] = ((BoneWeight)(ref val2)).boneIndex0;
|
array2[0] = val2.boneIndex0;
|
||||||
array[1] = ((BoneWeight)(ref val2)).weight1;
|
array[1] = val2.weight1;
|
||||||
array2[1] = ((BoneWeight)(ref val2)).boneIndex1;
|
array2[1] = val2.boneIndex1;
|
||||||
array[2] = ((BoneWeight)(ref val2)).weight2;
|
array[2] = val2.weight2;
|
||||||
array2[2] = ((BoneWeight)(ref val2)).boneIndex2;
|
array2[2] = val2.boneIndex2;
|
||||||
array[3] = ((BoneWeight)(ref val2)).weight3;
|
array[3] = val2.weight3;
|
||||||
array2[3] = ((BoneWeight)(ref val2)).boneIndex3;
|
array2[3] = val2.boneIndex3;
|
||||||
float num = 0f;
|
float num = 0f;
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
if (array2[i] >= 0 && array2[i] < bones.Length && (Object)(object)bones[array2[i]] != (Object)null)
|
if (array2[i] >= 0 && array2[i] < bones.Length && bones[array2[i]] != null)
|
||||||
{
|
{
|
||||||
num += array[i];
|
num += array[i];
|
||||||
}
|
}
|
||||||
@@ -388,14 +387,14 @@ public class SkinningUtil
|
|||||||
if (num < 1E-08f)
|
if (num < 1E-08f)
|
||||||
{
|
{
|
||||||
val = ((Component)smr).transform.InverseTransformDirection(targetWorldDir);
|
val = ((Component)smr).transform.InverseTransformDirection(targetWorldDir);
|
||||||
return ((Vector3)(ref val)).normalized;
|
return val.normalized;
|
||||||
}
|
}
|
||||||
for (int j = 0; j < 4; j++)
|
for (int j = 0; j < 4; j++)
|
||||||
{
|
{
|
||||||
array[j] /= num;
|
array[j] /= num;
|
||||||
}
|
}
|
||||||
Vector3 val3 = ((Component)smr).transform.InverseTransformDirection(targetWorldDir);
|
Vector3 val3 = ((Component)smr).transform.InverseTransformDirection(targetWorldDir);
|
||||||
if (((Vector3)(ref val3)).sqrMagnitude < 1E-12f)
|
if (val3.sqrMagnitude < 1E-12f)
|
||||||
{
|
{
|
||||||
return Vector3.up;
|
return Vector3.up;
|
||||||
}
|
}
|
||||||
@@ -408,13 +407,13 @@ public class SkinningUtil
|
|||||||
Accumulate(ref acc, array2[k], array[k]);
|
Accumulate(ref acc, array2[k], array[k]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Matrix4x4 transpose = ((Matrix4x4)(ref acc)).transpose;
|
Matrix4x4 transpose = acc.transpose;
|
||||||
Vector3 val4 = ((Matrix4x4)(ref transpose)).MultiplyVector(val3);
|
Vector3 val4 = transpose.MultiplyVector(val3);
|
||||||
if (((Vector3)(ref val4)).sqrMagnitude < 1E-12f)
|
if (val4.sqrMagnitude < 1E-12f)
|
||||||
{
|
{
|
||||||
return ((Vector3)(ref val3)).normalized;
|
return val3.normalized;
|
||||||
}
|
}
|
||||||
return ((Vector3)(ref val4)).normalized;
|
return val4.normalized;
|
||||||
void Accumulate(ref Matrix4x4 reference, int bi, float w)
|
void Accumulate(ref Matrix4x4 reference, int bi, float w)
|
||||||
{
|
{
|
||||||
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
|
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -32,13 +32,13 @@ public class TransformInfo
|
|||||||
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
|
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
|
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
|
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
|
||||||
parentTransform = t.parent;
|
this.parentTransform = t.parent;
|
||||||
position = t.position;
|
this.position = t.position;
|
||||||
localPosition = t.localPosition;
|
this.localPosition = t.localPosition;
|
||||||
rotation = t.rotation;
|
this.rotation = t.rotation;
|
||||||
localRotation = t.localRotation;
|
this.localRotation = t.localRotation;
|
||||||
localScale = t.localScale;
|
this.localScale = t.localScale;
|
||||||
name = ((Object)t).name;
|
this.name = ((Object)t).name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ApplyToTransform(Transform t, bool applyParent, bool applyPosition, bool applyRotation, bool applyScale, bool applyName = false)
|
public void ApplyToTransform(Transform t, bool applyParent, bool applyPosition, bool applyRotation, bool applyScale, bool applyName = false)
|
||||||
@@ -51,38 +51,38 @@ public class TransformInfo
|
|||||||
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
|
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
|
||||||
if (applyParent)
|
if (applyParent)
|
||||||
{
|
{
|
||||||
t.SetParent(parentTransform, true);
|
t.SetParent(this.parentTransform, true);
|
||||||
if (applyPosition)
|
if (applyPosition)
|
||||||
{
|
{
|
||||||
t.localPosition = localPosition;
|
t.localPosition = this.localPosition;
|
||||||
}
|
}
|
||||||
if (applyRotation)
|
if (applyRotation)
|
||||||
{
|
{
|
||||||
t.localRotation = localRotation;
|
t.localRotation = this.localRotation;
|
||||||
}
|
}
|
||||||
if (applyScale)
|
if (applyScale)
|
||||||
{
|
{
|
||||||
t.localScale = localScale;
|
t.localScale = this.localScale;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (applyPosition)
|
if (applyPosition)
|
||||||
{
|
{
|
||||||
t.position = position;
|
t.position = this.position;
|
||||||
}
|
}
|
||||||
if (applyRotation)
|
if (applyRotation)
|
||||||
{
|
{
|
||||||
t.rotation = rotation;
|
t.rotation = this.rotation;
|
||||||
}
|
}
|
||||||
if (applyScale)
|
if (applyScale)
|
||||||
{
|
{
|
||||||
t.localScale = localScale;
|
t.localScale = this.localScale;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (applyName)
|
if (applyName)
|
||||||
{
|
{
|
||||||
((Object)t).name = name;
|
((Object)t).name = this.name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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.VertexFittingUtil
|
// Eden.AutoMorpher.VertexFittingUtil
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using Eden.AutoMorpher;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
public class VertexFittingUtil
|
public class VertexFittingUtil
|
||||||
@@ -48,7 +47,7 @@ public class VertexFittingUtil
|
|||||||
}
|
}
|
||||||
Vector3[] deltas = clothInstanceTotal.GlobalDeltas;
|
Vector3[] deltas = clothInstanceTotal.GlobalDeltas;
|
||||||
clothInstanceTotal.UpdateGlobalBuffersFromClothInstances();
|
clothInstanceTotal.UpdateGlobalBuffersFromClothInstances();
|
||||||
SmoothDeltasByDistance(clothInstanceTotal.GlobalPositions, ref deltas, clothInstanceTotal.GlobalAdjacencyMerged, config.worldRadius, 1, config.smoothingIteration, 0.5f, config.sigma);
|
this.SmoothDeltasByDistance(clothInstanceTotal.GlobalPositions, ref deltas, clothInstanceTotal.GlobalAdjacencyMerged, config.worldRadius, 1, config.smoothingIteration, 0.5f, config.sigma);
|
||||||
clothInstanceTotal.SetGlobalDeltas(deltas);
|
clothInstanceTotal.SetGlobalDeltas(deltas);
|
||||||
clothInstanceTotal.ApplyGlobalDeltasToClothInstances();
|
clothInstanceTotal.ApplyGlobalDeltasToClothInstances();
|
||||||
foreach (ClothInstance clothInstance3 in clothInstances)
|
foreach (ClothInstance clothInstance3 in clothInstances)
|
||||||
@@ -110,10 +109,10 @@ public class VertexFittingUtil
|
|||||||
}
|
}
|
||||||
Vector3[] deltas = clothInstanceTotal.GlobalDeltas;
|
Vector3[] deltas = clothInstanceTotal.GlobalDeltas;
|
||||||
clothInstanceTotal.UpdateGlobalBuffersFromClothInstances();
|
clothInstanceTotal.UpdateGlobalBuffersFromClothInstances();
|
||||||
SmoothDeltasByDistance(clothInstanceTotal.GlobalPositions, ref deltas, clothInstanceTotal.GlobalAdjacencyMerged, config.worldRadius, 3, config.smoothingIteration, 0.5f, config.sigma);
|
this.SmoothDeltasByDistance(clothInstanceTotal.GlobalPositions, ref deltas, clothInstanceTotal.GlobalAdjacencyMerged, config.worldRadius, 3, config.smoothingIteration, 0.5f, config.sigma);
|
||||||
clothInstanceTotal.SetGlobalDeltas(deltas);
|
clothInstanceTotal.SetGlobalDeltas(deltas);
|
||||||
clothInstanceTotal.ApplyGlobalDeltasToClothInstances();
|
clothInstanceTotal.ApplyGlobalDeltasToClothInstances();
|
||||||
SmoothAllClothesDeltasByDistance(clothInstances, config.worldRadius, config.smoothingIteration, config.sigma);
|
this.SmoothAllClothesDeltasByDistance(clothInstances, config.worldRadius, config.smoothingIteration, config.sigma);
|
||||||
foreach (ClothInstance clothInstance3 in clothInstances)
|
foreach (ClothInstance clothInstance3 in clothInstances)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < clothInstance3.worldVertices.Length; i++)
|
for (int i = 0; i < clothInstance3.worldVertices.Length; i++)
|
||||||
@@ -179,7 +178,7 @@ public class VertexFittingUtil
|
|||||||
//IL_035f: Unknown result type (might be due to invalid IL or missing references)
|
//IL_035f: Unknown result type (might be due to invalid IL or missing references)
|
||||||
if (AutoMorpherDev.isDeveloperMode)
|
if (AutoMorpherDev.isDeveloperMode)
|
||||||
{
|
{
|
||||||
Debug.Log((object)("[Expand] Start " + ((Object)((Component)clothInstance.smr).gameObject).name + "//==============================================================================================================="));
|
UnityEngine.Debug.Log((object)("[Expand] Start " + ((Object)((Component)clothInstance.smr).gameObject).name + "//==============================================================================================================="));
|
||||||
}
|
}
|
||||||
Stopwatch stopwatch = (AutoMorpherDev.isDeveloperMode ? Stopwatch.StartNew() : null);
|
Stopwatch stopwatch = (AutoMorpherDev.isDeveloperMode ? Stopwatch.StartNew() : null);
|
||||||
Stopwatch.StartNew();
|
Stopwatch.StartNew();
|
||||||
@@ -190,19 +189,19 @@ public class VertexFittingUtil
|
|||||||
List<int> list = null;
|
List<int> list = null;
|
||||||
using (AutoMorpherDev.Profile("[Expand] Select Anchors time"))
|
using (AutoMorpherDev.Profile("[Expand] Select Anchors time"))
|
||||||
{
|
{
|
||||||
list = SelectAnchors(clothInstance, fittingRadius);
|
list = this.SelectAnchors(clothInstance, fittingRadius);
|
||||||
}
|
}
|
||||||
if (AutoMorpherDev.isDeveloperMode)
|
if (AutoMorpherDev.isDeveloperMode)
|
||||||
{
|
{
|
||||||
Debug.Log((object)$"[Expand] Anchor Count {list.Count}");
|
UnityEngine.Debug.Log((object)$"[Expand] Anchor Count {list.Count}");
|
||||||
}
|
}
|
||||||
if (list.Count == 0)
|
if (list.Count == 0)
|
||||||
{
|
{
|
||||||
if (AutoMorpherDev.isDeveloperMode)
|
if (AutoMorpherDev.isDeveloperMode)
|
||||||
{
|
{
|
||||||
stopwatch.Stop();
|
stopwatch.Stop();
|
||||||
Debug.Log((object)$"[Expand] TOTAL ShrinkClothes time: {stopwatch.ElapsedMilliseconds} ms");
|
UnityEngine.Debug.Log((object)$"[Expand] TOTAL ShrinkClothes time: {stopwatch.ElapsedMilliseconds} ms");
|
||||||
Debug.Log((object)("[Expand] End " + ((Object)((Component)clothInstance.smr).gameObject).name + "//==============================================================================================================="));
|
UnityEngine.Debug.Log((object)("[Expand] End " + ((Object)((Component)clothInstance.smr).gameObject).name + "//==============================================================================================================="));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -219,8 +218,8 @@ public class VertexFittingUtil
|
|||||||
Stopwatch stopwatch3 = (AutoMorpherDev.isDeveloperMode ? Stopwatch.StartNew() : null);
|
Stopwatch stopwatch3 = (AutoMorpherDev.isDeveloperMode ? Stopwatch.StartNew() : null);
|
||||||
if (AutoMorpherDev.isDeveloperMode)
|
if (AutoMorpherDev.isDeveloperMode)
|
||||||
{
|
{
|
||||||
Debug.Log((object)$"[Expand] Selected Expand Vertes: {((Object)((Component)clothInstance.smr).gameObject).name} / {item}");
|
UnityEngine.Debug.Log((object)$"[Expand] Selected Expand Vertes: {((Object)((Component)clothInstance.smr).gameObject).name} / {item}");
|
||||||
Debug.Log((object)$"[Expand] SelectedCEnter {item} {clothInstance.deltas[item]} {clothInstance.worldVertices[item]}");
|
UnityEngine.Debug.Log((object)$"[Expand] SelectedCEnter {item} {clothInstance.deltas[item]} {clothInstance.worldVertices[item]}");
|
||||||
}
|
}
|
||||||
Vector3[] array = vertexMoverUtil.MoveVertices(clothInstance, item, clothInstance.isLeftLegVertex[item], clothInstance.isRightLegVertex[item], fittingRadius, config.sigma, clothInstance.deltas[item]);
|
Vector3[] array = vertexMoverUtil.MoveVertices(clothInstance, item, clothInstance.isLeftLegVertex[item], clothInstance.isRightLegVertex[item], fittingRadius, config.sigma, clothInstance.deltas[item]);
|
||||||
if (array == null)
|
if (array == null)
|
||||||
@@ -272,7 +271,7 @@ public class VertexFittingUtil
|
|||||||
num2 += (float)stopwatch4.ElapsedMilliseconds;
|
num2 += (float)stopwatch4.ElapsedMilliseconds;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SmoothAllClothesDeltasByDistance(clothInstances, fittingRadius, config.smoothingIteration, config.sigma);
|
this.SmoothAllClothesDeltasByDistance(clothInstances, fittingRadius, config.smoothingIteration, config.sigma);
|
||||||
foreach (ClothInstance clothInstance3 in clothInstances)
|
foreach (ClothInstance clothInstance3 in clothInstances)
|
||||||
{
|
{
|
||||||
for (int k = 0; k < clothInstance3.worldVertices.Length; k++)
|
for (int k = 0; k < clothInstance3.worldVertices.Length; k++)
|
||||||
@@ -301,12 +300,12 @@ public class VertexFittingUtil
|
|||||||
if (AutoMorpherDev.isDeveloperMode)
|
if (AutoMorpherDev.isDeveloperMode)
|
||||||
{
|
{
|
||||||
stopwatch2.Stop();
|
stopwatch2.Stop();
|
||||||
Debug.Log((object)$"[Expand] Renderer Move Vector Calculate: {((Object)((Component)clothInstance.smr).gameObject).name} : {num}");
|
UnityEngine.Debug.Log((object)$"[Expand] Renderer Move Vector Calculate: {((Object)((Component)clothInstance.smr).gameObject).name} : {num}");
|
||||||
Debug.Log((object)$"[Expand] Other Renderer Move Vector Calculate: {((Object)((Component)clothInstance.smr).gameObject).name} : {num2}");
|
UnityEngine.Debug.Log((object)$"[Expand] Other Renderer Move Vector Calculate: {((Object)((Component)clothInstance.smr).gameObject).name} : {num2}");
|
||||||
Debug.Log((object)$"[Expand] Total Move Vector Calculate: {((Object)((Component)clothInstance.smr).gameObject).name} : {stopwatch2.ElapsedMilliseconds}");
|
UnityEngine.Debug.Log((object)$"[Expand] Total Move Vector Calculate: {((Object)((Component)clothInstance.smr).gameObject).name} : {stopwatch2.ElapsedMilliseconds}");
|
||||||
stopwatch.Stop();
|
stopwatch.Stop();
|
||||||
Debug.Log((object)$"[Expand] TOTAL ShrinkClothes time: {stopwatch.ElapsedMilliseconds} ms");
|
UnityEngine.Debug.Log((object)$"[Expand] TOTAL ShrinkClothes time: {stopwatch.ElapsedMilliseconds} ms");
|
||||||
Debug.Log((object)("[Expand] End " + ((Object)((Component)clothInstance.smr).gameObject).name + "//==============================================================================================================="));
|
UnityEngine.Debug.Log((object)("[Expand] End " + ((Object)((Component)clothInstance.smr).gameObject).name + "//==============================================================================================================="));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -348,7 +347,7 @@ public class VertexFittingUtil
|
|||||||
//IL_0348: Unknown result type (might be due to invalid IL or missing references)
|
//IL_0348: Unknown result type (might be due to invalid IL or missing references)
|
||||||
if (AutoMorpherDev.isDeveloperMode)
|
if (AutoMorpherDev.isDeveloperMode)
|
||||||
{
|
{
|
||||||
Debug.Log((object)("[Shrink] Start " + ((Object)((Component)clothInstance.smr).gameObject).name + "//==============================================================================================================="));
|
UnityEngine.Debug.Log((object)("[Shrink] Start " + ((Object)((Component)clothInstance.smr).gameObject).name + "//==============================================================================================================="));
|
||||||
}
|
}
|
||||||
Stopwatch stopwatch = (AutoMorpherDev.isDeveloperMode ? Stopwatch.StartNew() : null);
|
Stopwatch stopwatch = (AutoMorpherDev.isDeveloperMode ? Stopwatch.StartNew() : null);
|
||||||
using (AutoMorpherDev.Profile("[Shrink] BVH Mesh Matching time"))
|
using (AutoMorpherDev.Profile("[Shrink] BVH Mesh Matching time"))
|
||||||
@@ -358,19 +357,19 @@ public class VertexFittingUtil
|
|||||||
List<int> list = null;
|
List<int> list = null;
|
||||||
using (AutoMorpherDev.Profile("[Shrink] Select Anchors time"))
|
using (AutoMorpherDev.Profile("[Shrink] Select Anchors time"))
|
||||||
{
|
{
|
||||||
list = SelectAnchors(clothInstance, fittingRadius);
|
list = this.SelectAnchors(clothInstance, fittingRadius);
|
||||||
}
|
}
|
||||||
if (AutoMorpherDev.isDeveloperMode)
|
if (AutoMorpherDev.isDeveloperMode)
|
||||||
{
|
{
|
||||||
Debug.Log((object)$"[Shrink] Anchor Count {list.Count}");
|
UnityEngine.Debug.Log((object)$"[Shrink] Anchor Count {list.Count}");
|
||||||
}
|
}
|
||||||
if (list.Count == 0)
|
if (list.Count == 0)
|
||||||
{
|
{
|
||||||
if (AutoMorpherDev.isDeveloperMode)
|
if (AutoMorpherDev.isDeveloperMode)
|
||||||
{
|
{
|
||||||
stopwatch.Stop();
|
stopwatch.Stop();
|
||||||
Debug.Log((object)$"[Shrink] TOTAL ShrinkClothes time: {stopwatch.ElapsedMilliseconds} ms");
|
UnityEngine.Debug.Log((object)$"[Shrink] TOTAL ShrinkClothes time: {stopwatch.ElapsedMilliseconds} ms");
|
||||||
Debug.Log((object)("[Shrink] End " + ((Object)((Component)clothInstance.smr).gameObject).name + "//==============================================================================================================="));
|
UnityEngine.Debug.Log((object)("[Shrink] End " + ((Object)((Component)clothInstance.smr).gameObject).name + "//==============================================================================================================="));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -387,8 +386,8 @@ public class VertexFittingUtil
|
|||||||
Stopwatch stopwatch3 = (AutoMorpherDev.isDeveloperMode ? Stopwatch.StartNew() : null);
|
Stopwatch stopwatch3 = (AutoMorpherDev.isDeveloperMode ? Stopwatch.StartNew() : null);
|
||||||
if (AutoMorpherDev.isDeveloperMode)
|
if (AutoMorpherDev.isDeveloperMode)
|
||||||
{
|
{
|
||||||
Debug.Log((object)$"[Shrink] Selected Expand Vertes: {((Object)((Component)clothInstance.smr).gameObject).name} / {item}");
|
UnityEngine.Debug.Log((object)$"[Shrink] Selected Expand Vertes: {((Object)((Component)clothInstance.smr).gameObject).name} / {item}");
|
||||||
Debug.Log((object)$"[Shrink] SelectedCEnter {item} {clothInstance.deltas[item]} {clothInstance.worldVertices[item]}");
|
UnityEngine.Debug.Log((object)$"[Shrink] SelectedCEnter {item} {clothInstance.deltas[item]} {clothInstance.worldVertices[item]}");
|
||||||
}
|
}
|
||||||
Vector3[] array = vertexMoverUtil.MoveVertices(clothInstance, item, clothInstance.isLeftLegVertex[item], clothInstance.isRightLegVertex[item], fittingRadius, config.sigma, clothInstance.deltas[item]);
|
Vector3[] array = vertexMoverUtil.MoveVertices(clothInstance, item, clothInstance.isLeftLegVertex[item], clothInstance.isRightLegVertex[item], fittingRadius, config.sigma, clothInstance.deltas[item]);
|
||||||
if (array == null)
|
if (array == null)
|
||||||
@@ -437,7 +436,7 @@ public class VertexFittingUtil
|
|||||||
num2 += (float)stopwatch4.ElapsedMilliseconds;
|
num2 += (float)stopwatch4.ElapsedMilliseconds;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SmoothAllClothesDeltasByDistance(clothInstances, fittingRadius, config.smoothingIteration, config.sigma);
|
this.SmoothAllClothesDeltasByDistance(clothInstances, fittingRadius, config.smoothingIteration, config.sigma);
|
||||||
foreach (ClothInstance clothInstance3 in clothInstances)
|
foreach (ClothInstance clothInstance3 in clothInstances)
|
||||||
{
|
{
|
||||||
for (int k = 0; k < clothInstance3.worldVertices.Length; k++)
|
for (int k = 0; k < clothInstance3.worldVertices.Length; k++)
|
||||||
@@ -466,12 +465,12 @@ public class VertexFittingUtil
|
|||||||
if (AutoMorpherDev.isDeveloperMode)
|
if (AutoMorpherDev.isDeveloperMode)
|
||||||
{
|
{
|
||||||
stopwatch2.Stop();
|
stopwatch2.Stop();
|
||||||
Debug.Log((object)$"[Shrink] Renderer Move Vector Calculate: {((Object)((Component)clothInstance.smr).gameObject).name} : {num}");
|
UnityEngine.Debug.Log((object)$"[Shrink] Renderer Move Vector Calculate: {((Object)((Component)clothInstance.smr).gameObject).name} : {num}");
|
||||||
Debug.Log((object)$"[Shrink] Other Renderer Move Vector Calculate: {((Object)((Component)clothInstance.smr).gameObject).name} : {num2}");
|
UnityEngine.Debug.Log((object)$"[Shrink] Other Renderer Move Vector Calculate: {((Object)((Component)clothInstance.smr).gameObject).name} : {num2}");
|
||||||
Debug.Log((object)$"[Shrink] Total Move Vector Calculate: {((Object)((Component)clothInstance.smr).gameObject).name} : {stopwatch2.ElapsedMilliseconds}");
|
UnityEngine.Debug.Log((object)$"[Shrink] Total Move Vector Calculate: {((Object)((Component)clothInstance.smr).gameObject).name} : {stopwatch2.ElapsedMilliseconds}");
|
||||||
stopwatch.Stop();
|
stopwatch.Stop();
|
||||||
Debug.Log((object)$"[Shrink] TOTAL ShrinkClothes time: {stopwatch.ElapsedMilliseconds} ms");
|
UnityEngine.Debug.Log((object)$"[Shrink] TOTAL ShrinkClothes time: {stopwatch.ElapsedMilliseconds} ms");
|
||||||
Debug.Log((object)("[Shrink] End " + ((Object)((Component)clothInstance.smr).gameObject).name + "//==============================================================================================================="));
|
UnityEngine.Debug.Log((object)("[Shrink] End " + ((Object)((Component)clothInstance.smr).gameObject).name + "//==============================================================================================================="));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -494,12 +493,12 @@ public class VertexFittingUtil
|
|||||||
//IL_0114: Unknown result type (might be due to invalid IL or missing references)
|
//IL_0114: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
|
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_012c: Unknown result type (might be due to invalid IL or missing references)
|
//IL_012c: Unknown result type (might be due to invalid IL or missing references)
|
||||||
Debug.Log((object)("[Expand] " + ((Object)((Component)clothInstance.smr).gameObject).name + "//==============================================================================================================="));
|
UnityEngine.Debug.Log((object)("[Expand] " + ((Object)((Component)clothInstance.smr).gameObject).name + "//==============================================================================================================="));
|
||||||
Stopwatch stopwatch = Stopwatch.StartNew();
|
Stopwatch stopwatch = Stopwatch.StartNew();
|
||||||
Stopwatch stopwatch2 = Stopwatch.StartNew();
|
Stopwatch stopwatch2 = Stopwatch.StartNew();
|
||||||
clothInstance.deltas = meshMatcher.ExpandVertexMatch(clothInstance, minMargin);
|
clothInstance.deltas = meshMatcher.ExpandVertexMatch(clothInstance, minMargin);
|
||||||
stopwatch2.Stop();
|
stopwatch2.Stop();
|
||||||
Debug.Log((object)$"[Expand] BVH Mesh Matching time: {stopwatch2.ElapsedMilliseconds} ms");
|
UnityEngine.Debug.Log((object)$"[Expand] BVH Mesh Matching time: {stopwatch2.ElapsedMilliseconds} ms");
|
||||||
for (int i = 0; i < clothInstance.worldVertices.Length; i++)
|
for (int i = 0; i < clothInstance.worldVertices.Length; i++)
|
||||||
{
|
{
|
||||||
ref Vector3 reference = ref clothInstance.worldVertices[i];
|
ref Vector3 reference = ref clothInstance.worldVertices[i];
|
||||||
@@ -520,8 +519,8 @@ public class VertexFittingUtil
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
stopwatch.Stop();
|
stopwatch.Stop();
|
||||||
Debug.Log((object)$"[Expand] TOTAL ShrinkClothes time: {stopwatch.ElapsedMilliseconds} ms");
|
UnityEngine.Debug.Log((object)$"[Expand] TOTAL ShrinkClothes time: {stopwatch.ElapsedMilliseconds} ms");
|
||||||
Debug.Log((object)("[Expand] " + ((Object)((Component)clothInstance.smr).gameObject).name + "//==============================================================================================================="));
|
UnityEngine.Debug.Log((object)("[Expand] " + ((Object)((Component)clothInstance.smr).gameObject).name + "//==============================================================================================================="));
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<int> SelectAnchors(ClothInstance clothInstance, float worldRadius, float minDeltaSq = 1E-05f, float maxDelta = 0.1f)
|
private List<int> SelectAnchors(ClothInstance clothInstance, float worldRadius, float minDeltaSq = 1E-05f, float maxDelta = 0.1f)
|
||||||
@@ -543,7 +542,7 @@ public class VertexFittingUtil
|
|||||||
int num = clothInstance.worldVertices.Length;
|
int num = clothInstance.worldVertices.Length;
|
||||||
for (int i = 0; i < num; i++)
|
for (int i = 0; i < num; i++)
|
||||||
{
|
{
|
||||||
if (!clothInstance.isInsideVertex[i] && ((Vector3)(ref clothInstance.deltas[i])).sqrMagnitude > minDeltaSq)
|
if (!clothInstance.isInsideVertex[i] && clothInstance.deltas[i].sqrMagnitude > minDeltaSq)
|
||||||
{
|
{
|
||||||
list2.Add(i);
|
list2.Add(i);
|
||||||
}
|
}
|
||||||
@@ -552,10 +551,10 @@ public class VertexFittingUtil
|
|||||||
{
|
{
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
list2.Sort(delegate(int a, int b)
|
list2.Sort(delegate (int a, int b)
|
||||||
{
|
{
|
||||||
float sqrMagnitude = ((Vector3)(ref clothInstance.deltas[a])).sqrMagnitude;
|
float sqrMagnitude = clothInstance.deltas[a].sqrMagnitude;
|
||||||
float num9 = ((Vector3)(ref clothInstance.deltas[b])).sqrMagnitude - sqrMagnitude;
|
float num9 = clothInstance.deltas[b].sqrMagnitude - sqrMagnitude;
|
||||||
if (Mathf.Abs(num9) > 1E-06f)
|
if (Mathf.Abs(num9) > 1E-06f)
|
||||||
{
|
{
|
||||||
if (!(num9 > 0f))
|
if (!(num9 > 0f))
|
||||||
@@ -596,7 +595,7 @@ public class VertexFittingUtil
|
|||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
((Vector3Int)(ref key2))._002Ector(((Vector3Int)(ref key)).x + num4, ((Vector3Int)(ref key)).y + num5, ((Vector3Int)(ref key)).z + num6);
|
key2 = new Vector3Int(key.x + num4, key.y + num5, key.z + num6);
|
||||||
if (!dictionary.TryGetValue(key2, out var value))
|
if (!dictionary.TryGetValue(key2, out var value))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
@@ -605,7 +604,7 @@ public class VertexFittingUtil
|
|||||||
{
|
{
|
||||||
int num8 = value[num7];
|
int num8 = value[num7];
|
||||||
Vector3 val = clothInstance.worldVertices[item] - clothInstance.worldVertices[num8];
|
Vector3 val = clothInstance.worldVertices[item] - clothInstance.worldVertices[num8];
|
||||||
if (((Vector3)(ref val)).sqrMagnitude < num3)
|
if (val.sqrMagnitude < num3)
|
||||||
{
|
{
|
||||||
flag = true;
|
flag = true;
|
||||||
break;
|
break;
|
||||||
@@ -723,7 +722,7 @@ public class VertexFittingUtil
|
|||||||
int depth = node.depth;
|
int depth = node.depth;
|
||||||
Vector3 val2 = positions[index];
|
Vector3 val2 = positions[index];
|
||||||
val3 = val2 - val;
|
val3 = val2 - val;
|
||||||
float sqrMagnitude = ((Vector3)(ref val3)).sqrMagnitude;
|
float sqrMagnitude = val3.sqrMagnitude;
|
||||||
if (index != j && sqrMagnitude <= num2)
|
if (index != j && sqrMagnitude <= num2)
|
||||||
{
|
{
|
||||||
list.Add(index);
|
list.Add(index);
|
||||||
@@ -743,7 +742,7 @@ public class VertexFittingUtil
|
|||||||
if (array2[num5] != num4)
|
if (array2[num5] != num4)
|
||||||
{
|
{
|
||||||
val3 = positions[num5] - val2;
|
val3 = positions[num5] - val2;
|
||||||
if (!(((Vector3)(ref val3)).sqrMagnitude > num2))
|
if (!(val3.sqrMagnitude > num2))
|
||||||
{
|
{
|
||||||
array2[num5] = num4;
|
array2[num5] = num4;
|
||||||
queue.Enqueue(new Node
|
queue.Enqueue(new Node
|
||||||
@@ -766,7 +765,7 @@ public class VertexFittingUtil
|
|||||||
{
|
{
|
||||||
int num7 = list[l];
|
int num7 = list[l];
|
||||||
val3 = positions[num7] - val;
|
val3 = positions[num7] - val;
|
||||||
float sqrMagnitude2 = ((Vector3)(ref val3)).sqrMagnitude;
|
float sqrMagnitude2 = val3.sqrMagnitude;
|
||||||
if (!(sqrMagnitude2 > num2))
|
if (!(sqrMagnitude2 > num2))
|
||||||
{
|
{
|
||||||
float num8 = Mathf.Exp((0f - sqrMagnitude2) / num3);
|
float num8 = Mathf.Exp((0f - sqrMagnitude2) / num3);
|
||||||
@@ -856,7 +855,7 @@ public class VertexFittingUtil
|
|||||||
}
|
}
|
||||||
num2 += num3;
|
num2 += num3;
|
||||||
}
|
}
|
||||||
SmoothDeltasByDistance(array, ref deltas, array2, radius, maxDepth, iterations, smoothFactor, gaussianSigma);
|
this.SmoothDeltasByDistance(array, ref deltas, array2, radius, maxDepth, iterations, smoothFactor, gaussianSigma);
|
||||||
for (int n = 0; n < clothesInstances.Count; n++)
|
for (int n = 0; n < clothesInstances.Count; n++)
|
||||||
{
|
{
|
||||||
ClothInstance clothInstance3 = clothesInstances[n];
|
ClothInstance clothInstance3 = clothesInstances[n];
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -26,12 +25,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 = (Vector3[])(object)new Vector3[num];
|
Vector3[] array3 = (Vector3[])(object)new Vector3[num];
|
||||||
bool[] isLeftLegVertex = cloth.isLeftLegVertex;
|
bool[] isLeftLegVertex = cloth.isLeftLegVertex;
|
||||||
bool[] isRightLegVertex = cloth.isRightLegVertex;
|
bool[] isRightLegVertex = cloth.isRightLegVertex;
|
||||||
@@ -42,12 +41,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;
|
||||||
@@ -76,12 +75,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 = (Vector3[])(object)new Vector3[num];
|
Vector3[] array3 = (Vector3[])(object)new Vector3[num];
|
||||||
bool[] isLeftLegVertex = cloth.isLeftLegVertex;
|
bool[] isLeftLegVertex = cloth.isLeftLegVertex;
|
||||||
bool[] isRightLegVertex = cloth.isRightLegVertex;
|
bool[] isRightLegVertex = cloth.isRightLegVertex;
|
||||||
@@ -92,12 +91,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;
|
||||||
@@ -111,7 +110,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)
|
||||||
{
|
{
|
||||||
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
|
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
|
||||||
return ComputeEuclideanDistances(verts, verts[targetVertIdx], maxRadius, out isInboundVerts);
|
return this.ComputeEuclideanDistances(verts, verts[targetVertIdx], maxRadius, out isInboundVerts);
|
||||||
}
|
}
|
||||||
|
|
||||||
private float[] ComputeEuclideanDistances(Vector3[] verts, Vector3 targetVert, float maxRadius, out bool[] isInboundVerts)
|
private float[] ComputeEuclideanDistances(Vector3[] verts, Vector3 targetVert, float maxRadius, out bool[] isInboundVerts)
|
||||||
@@ -160,10 +159,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;
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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.WeightTransferUtil
|
// Eden.AutoMorpher.WeightTransferUtil
|
||||||
@@ -6,7 +6,6 @@ using System;
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Eden.AutoMorpher;
|
|
||||||
using Unity.Collections;
|
using Unity.Collections;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
@@ -53,18 +52,18 @@ public class WeightTransferUtil
|
|||||||
|
|
||||||
private bool IsBreastOrButtBone(Transform t)
|
private bool IsBreastOrButtBone(Transform t)
|
||||||
{
|
{
|
||||||
if ((Object)(object)t == (Object)null)
|
if (t == null)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
string[] patterns = new string[6] { "breast", "boob", "bust", "oppai", "chichi", "mune" };
|
string[] patterns = new string[6] { "breast", "boob", "bust", "oppai", "chichi", "mune" };
|
||||||
string[] patterns2 = new string[6] { "butt", "buttock", "buttox", "glute", "glutes", "gluteus" };
|
string[] patterns2 = new string[6] { "butt", "buttock", "buttox", "glute", "glutes", "gluteus" };
|
||||||
string lowerName = ((Object)t).name.ToLowerInvariant();
|
string lowerName = (t).name.ToLowerInvariant();
|
||||||
if (NameContainsAny(lowerName, patterns))
|
if (this.NameContainsAny(lowerName, patterns))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (NameContainsAny(lowerName, patterns2))
|
if (this.NameContainsAny(lowerName, patterns2))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -73,7 +72,7 @@ public class WeightTransferUtil
|
|||||||
|
|
||||||
public IEnumerator RetargetAndTransfer(ClothInstance cloth, Animator avatarAnimator, IReadOnlyList<SkinnedMeshRenderer> bodyMeshes, IReadOnlyList<Mesh> bodyBakedMeshes, int referenceBodyIndex = 0, Settings settings = null, Dictionary<Transform, ClothBoneType> boneTypeMap = null, Dictionary<Transform, Transform> bodyToClothesMap = null)
|
public IEnumerator RetargetAndTransfer(ClothInstance cloth, Animator avatarAnimator, IReadOnlyList<SkinnedMeshRenderer> bodyMeshes, IReadOnlyList<Mesh> bodyBakedMeshes, int referenceBodyIndex = 0, Settings settings = null, Dictionary<Transform, ClothBoneType> boneTypeMap = null, Dictionary<Transform, Transform> bodyToClothesMap = null)
|
||||||
{
|
{
|
||||||
if (cloth == null || (Object)(object)cloth.smr == (Object)null || (Object)(object)cloth.editableMesh == (Object)null)
|
if (cloth == null || cloth.smr == null || cloth.editableMesh == null)
|
||||||
{
|
{
|
||||||
throw new AutoMorpherException("Cloth Instance is Invalid", "[WeightTransferUtil] RetargetAndTransfer\n - cloth is null or cloth.smr is null or cloth.editableMesh is null");
|
throw new AutoMorpherException("Cloth Instance is Invalid", "[WeightTransferUtil] RetargetAndTransfer\n - cloth is null or cloth.smr is null or cloth.editableMesh is null");
|
||||||
}
|
}
|
||||||
@@ -81,11 +80,11 @@ public class WeightTransferUtil
|
|||||||
{
|
{
|
||||||
throw new AutoMorpherException("Cloth World Vertices are Missing", "[WeightTransferUtil] RetargetAndTransfer\n - cloth.worldVertices is null or empty");
|
throw new AutoMorpherException("Cloth World Vertices are Missing", "[WeightTransferUtil] RetargetAndTransfer\n - cloth.worldVertices is null or empty");
|
||||||
}
|
}
|
||||||
if ((Object)(object)cloth.bakedMesh == (Object)null)
|
if (cloth.bakedMesh == null)
|
||||||
{
|
{
|
||||||
throw new AutoMorpherException("Cloth Baked Mesh is Missing", "[WeightTransferUtil] RetargetAndTransfer\n - cloth.bakedMesh is null");
|
throw new AutoMorpherException("Cloth Baked Mesh is Missing", "[WeightTransferUtil] RetargetAndTransfer\n - cloth.bakedMesh is null");
|
||||||
}
|
}
|
||||||
if ((Object)(object)avatarAnimator == (Object)null || !avatarAnimator.isHuman)
|
if (avatarAnimator == null || !avatarAnimator.isHuman)
|
||||||
{
|
{
|
||||||
throw new AutoMorpherException("Avatar Animator is Invalid", "[WeightTransferUtil] RetargetAndTransfer\n - avatarAnimator is null or not a Humanoid");
|
throw new AutoMorpherException("Avatar Animator is Invalid", "[WeightTransferUtil] RetargetAndTransfer\n - avatarAnimator is null or not a Humanoid");
|
||||||
}
|
}
|
||||||
@@ -98,7 +97,7 @@ public class WeightTransferUtil
|
|||||||
referenceBodyIndex = 0;
|
referenceBodyIndex = 0;
|
||||||
}
|
}
|
||||||
SkinnedMeshRenderer bodyRefSmr = bodyMeshes[referenceBodyIndex];
|
SkinnedMeshRenderer bodyRefSmr = bodyMeshes[referenceBodyIndex];
|
||||||
if ((Object)(object)bodyRefSmr == (Object)null || (Object)(object)bodyRefSmr.sharedMesh == (Object)null)
|
if (bodyRefSmr == null || bodyRefSmr.sharedMesh == null)
|
||||||
{
|
{
|
||||||
throw new AutoMorpherException("Reference Body Mesh is Invalid", "[WeightTransferUtil] RetargetAndTransfer\n - bodyRefSmr is null or bodyRefSmr.sharedMesh is null\n - referenceBodyIndex : " + referenceBodyIndex);
|
throw new AutoMorpherException("Reference Body Mesh is Invalid", "[WeightTransferUtil] RetargetAndTransfer\n - bodyRefSmr is null or bodyRefSmr.sharedMesh is null\n - referenceBodyIndex : " + referenceBodyIndex);
|
||||||
}
|
}
|
||||||
@@ -113,7 +112,7 @@ public class WeightTransferUtil
|
|||||||
Transform[] bones;
|
Transform[] bones;
|
||||||
Dictionary<Transform, int> accIndexByTransform;
|
Dictionary<Transform, int> accIndexByTransform;
|
||||||
float tiny;
|
float tiny;
|
||||||
if (boneTypeMap != null && (Object)(object)cloth.smr != (Object)null && (Object)(object)cloth.editableMesh != (Object)null)
|
if (boneTypeMap != null && cloth.smr != null && cloth.editableMesh != null)
|
||||||
{
|
{
|
||||||
bones = cloth.smr.bones;
|
bones = cloth.smr.bones;
|
||||||
if (bones != null && bones.Length != 0)
|
if (bones != null && bones.Length != 0)
|
||||||
@@ -126,7 +125,7 @@ public class WeightTransferUtil
|
|||||||
HashSet<Transform> hashSet = new HashSet<Transform>();
|
HashSet<Transform> hashSet = new HashSet<Transform>();
|
||||||
foreach (Transform val in bones)
|
foreach (Transform val in bones)
|
||||||
{
|
{
|
||||||
if (!((Object)(object)val == (Object)null) && boneTypeMap.TryGetValue(val, out var value2) && value2 == ClothBoneType.Accessory)
|
if (!(val == null) && boneTypeMap.TryGetValue(val, out var value2) && value2 == ClothBoneType.Accessory)
|
||||||
{
|
{
|
||||||
hashSet.Add(val);
|
hashSet.Add(val);
|
||||||
}
|
}
|
||||||
@@ -135,7 +134,7 @@ public class WeightTransferUtil
|
|||||||
{
|
{
|
||||||
foreach (Transform item in value)
|
foreach (Transform item in value)
|
||||||
{
|
{
|
||||||
if (!((Object)(object)item == (Object)null) && Array.IndexOf(bones, item) >= 0)
|
if (!(item == null) && Array.IndexOf(bones, item) >= 0)
|
||||||
{
|
{
|
||||||
hashSet.Add(item);
|
hashSet.Add(item);
|
||||||
}
|
}
|
||||||
@@ -145,7 +144,7 @@ public class WeightTransferUtil
|
|||||||
accIndexByTransform = new Dictionary<Transform, int>();
|
accIndexByTransform = new Dictionary<Transform, int>();
|
||||||
foreach (Transform val2 in bones)
|
foreach (Transform val2 in bones)
|
||||||
{
|
{
|
||||||
if (!((Object)(object)val2 == (Object)null) && hashSet.Contains(val2) && !IsBreastOrButtBone(val2) && !accIndexByTransform.ContainsKey(val2))
|
if (!(val2 == null) && hashSet.Contains(val2) && !this.IsBreastOrButtBone(val2) && !accIndexByTransform.ContainsKey(val2))
|
||||||
{
|
{
|
||||||
accIndexByTransform[val2] = list.Count;
|
accIndexByTransform[val2] = list.Count;
|
||||||
list.Add(val2);
|
list.Add(val2);
|
||||||
@@ -163,10 +162,10 @@ public class WeightTransferUtil
|
|||||||
for (int k = 0; k < vertexCount; k++)
|
for (int k = 0; k < vertexCount; k++)
|
||||||
{
|
{
|
||||||
BoneWeight val3 = boneWeights[k];
|
BoneWeight val3 = boneWeights[k];
|
||||||
Acc(((BoneWeight)(ref val3)).boneIndex0, ((BoneWeight)(ref val3)).weight0, k);
|
Acc(val3.boneIndex0, val3.weight0, k);
|
||||||
Acc(((BoneWeight)(ref val3)).boneIndex1, ((BoneWeight)(ref val3)).weight1, k);
|
Acc(val3.boneIndex1, val3.weight1, k);
|
||||||
Acc(((BoneWeight)(ref val3)).boneIndex2, ((BoneWeight)(ref val3)).weight2, k);
|
Acc(val3.boneIndex2, val3.weight2, k);
|
||||||
Acc(((BoneWeight)(ref val3)).boneIndex3, ((BoneWeight)(ref val3)).weight3, k);
|
Acc(val3.boneIndex3, val3.weight3, k);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -174,18 +173,18 @@ public class WeightTransferUtil
|
|||||||
}
|
}
|
||||||
int bodyBoneCount = bodyRefSmr.bones.Length;
|
int bodyBoneCount = bodyRefSmr.bones.Length;
|
||||||
yield return null;
|
yield return null;
|
||||||
RetargetClothToAvatarSkeleton(cloth, avatarAnimator, bodyRefSmr, accessoryBones);
|
this.RetargetClothToAvatarSkeleton(cloth, avatarAnimator, bodyRefSmr, accessoryBones);
|
||||||
TransferFromBodyToCloth(avatarAnimator, cloth, bodyMeshes, bodyBakedMeshes, settings, accessoryBones, accessoryWeights, bodyBoneCount, prevBoneWeights);
|
this.TransferFromBodyToCloth(avatarAnimator, cloth, bodyMeshes, bodyBakedMeshes, settings, accessoryBones, accessoryWeights, bodyBoneCount, prevBoneWeights);
|
||||||
if (settings.weightInClothes)
|
if (settings.weightInClothes)
|
||||||
{
|
{
|
||||||
MoveBodyWeightsToClothesBones(cloth.smr, cloth.smr.sharedMesh, bodyToClothesMap, accessoryBones);
|
this.MoveBodyWeightsToClothesBones(cloth.smr, cloth.smr.sharedMesh, bodyToClothesMap, accessoryBones);
|
||||||
}
|
}
|
||||||
void Acc(int boneIndex, float w, int v)
|
void Acc(int boneIndex, float w, int v)
|
||||||
{
|
{
|
||||||
if (!(w <= tiny) && boneIndex >= 0 && boneIndex < bones.Length)
|
if (!(w <= tiny) && boneIndex >= 0 && boneIndex < bones.Length)
|
||||||
{
|
{
|
||||||
Transform val4 = bones[boneIndex];
|
Transform val4 = bones[boneIndex];
|
||||||
if (!((Object)(object)val4 == (Object)null) && accIndexByTransform.TryGetValue(val4, out var value3))
|
if (!(val4 == null) && accIndexByTransform.TryGetValue(val4, out var value3))
|
||||||
{
|
{
|
||||||
accessoryWeights[v, value3] += w;
|
accessoryWeights[v, value3] += w;
|
||||||
}
|
}
|
||||||
@@ -232,7 +231,7 @@ public class WeightTransferUtil
|
|||||||
//IL_04b4: Unknown result type (might be due to invalid IL or missing references)
|
//IL_04b4: Unknown result type (might be due to invalid IL or missing references)
|
||||||
SkinnedMeshRenderer smr = cloth.smr;
|
SkinnedMeshRenderer smr = cloth.smr;
|
||||||
Mesh sharedMesh = cloth.smr.sharedMesh;
|
Mesh sharedMesh = cloth.smr.sharedMesh;
|
||||||
if ((Object)(object)sharedMesh == (Object)null)
|
if (sharedMesh == null)
|
||||||
{
|
{
|
||||||
throw new AutoMorpherException("Cloth Mesh is Missing", "[WeightTransferUtil] RetargetClothToAvatarSkeleton\n - clothMesh is null");
|
throw new AutoMorpherException("Cloth Mesh is Missing", "[WeightTransferUtil] RetargetClothToAvatarSkeleton\n - clothMesh is null");
|
||||||
}
|
}
|
||||||
@@ -256,7 +255,7 @@ public class WeightTransferUtil
|
|||||||
}
|
}
|
||||||
foreach (Transform item in value)
|
foreach (Transform item in value)
|
||||||
{
|
{
|
||||||
if (!((Object)(object)item == (Object)null) && !dictionary.ContainsKey(item))
|
if (!(item == null) && !dictionary.ContainsKey(item))
|
||||||
{
|
{
|
||||||
dictionary.Add(item, key);
|
dictionary.Add(item, key);
|
||||||
}
|
}
|
||||||
@@ -267,7 +266,7 @@ public class WeightTransferUtil
|
|||||||
for (int i = 0; i < bones2.Length; i++)
|
for (int i = 0; i < bones2.Length; i++)
|
||||||
{
|
{
|
||||||
Transform val = bones2[i];
|
Transform val = bones2[i];
|
||||||
if ((Object)(object)val != (Object)null && !dictionary3.ContainsKey(val))
|
if (val != null && !dictionary3.ContainsKey(val))
|
||||||
{
|
{
|
||||||
dictionary3.Add(val, i);
|
dictionary3.Add(val, i);
|
||||||
}
|
}
|
||||||
@@ -277,7 +276,7 @@ public class WeightTransferUtil
|
|||||||
if ((int)value4 != 55)
|
if ((int)value4 != 55)
|
||||||
{
|
{
|
||||||
Transform boneTransform = avatarAnimator.GetBoneTransform(value4);
|
Transform boneTransform = avatarAnimator.GetBoneTransform(value4);
|
||||||
if (!((Object)(object)boneTransform == (Object)null) && dictionary3.TryGetValue(boneTransform, out var value2))
|
if (!(boneTransform == null) && dictionary3.TryGetValue(boneTransform, out var value2))
|
||||||
{
|
{
|
||||||
dictionary2[value4] = value2;
|
dictionary2[value4] = value2;
|
||||||
}
|
}
|
||||||
@@ -286,7 +285,7 @@ public class WeightTransferUtil
|
|||||||
BoneWeight[] boneWeights = sharedMesh.boneWeights;
|
BoneWeight[] boneWeights = sharedMesh.boneWeights;
|
||||||
if (boneWeights == null || boneWeights.Length == 0)
|
if (boneWeights == null || boneWeights.Length == 0)
|
||||||
{
|
{
|
||||||
Debug.LogWarning((object)"[WeightTransferUtil] clothMesh.boneWeights 가 비어 있음. 리타겟할 weight 가 없음.");
|
Debug.LogWarning("[WeightTransferUtil] clothMesh.boneWeights 가 비어 있음. 리타겟할 weight 가 없음.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int vertexCount = sharedMesh.vertexCount;
|
int vertexCount = sharedMesh.vertexCount;
|
||||||
@@ -295,17 +294,17 @@ public class WeightTransferUtil
|
|||||||
for (int j = 0; j < vertexCount; j++)
|
for (int j = 0; j < vertexCount; j++)
|
||||||
{
|
{
|
||||||
BoneWeight val3 = boneWeights[j];
|
BoneWeight val3 = boneWeights[j];
|
||||||
AccumulateRetargetWeight(array, j, ((BoneWeight)(ref val3)).boneIndex0, ((BoneWeight)(ref val3)).weight0, bones, dictionary, dictionary2);
|
this.AccumulateRetargetWeight(array, j, val3.boneIndex0, val3.weight0, bones, dictionary, dictionary2);
|
||||||
AccumulateRetargetWeight(array, j, ((BoneWeight)(ref val3)).boneIndex1, ((BoneWeight)(ref val3)).weight1, bones, dictionary, dictionary2);
|
this.AccumulateRetargetWeight(array, j, val3.boneIndex1, val3.weight1, bones, dictionary, dictionary2);
|
||||||
AccumulateRetargetWeight(array, j, ((BoneWeight)(ref val3)).boneIndex2, ((BoneWeight)(ref val3)).weight2, bones, dictionary, dictionary2);
|
this.AccumulateRetargetWeight(array, j, val3.boneIndex2, val3.weight2, bones, dictionary, dictionary2);
|
||||||
AccumulateRetargetWeight(array, j, ((BoneWeight)(ref val3)).boneIndex3, ((BoneWeight)(ref val3)).weight3, bones, dictionary, dictionary2);
|
this.AccumulateRetargetWeight(array, j, val3.boneIndex3, val3.weight3, bones, dictionary, dictionary2);
|
||||||
}
|
}
|
||||||
BoneWeight[] boneWeights2 = CollapseWeightsToBoneWeights(array, 4, 0.0001f);
|
BoneWeight[] boneWeights2 = this.CollapseWeightsToBoneWeights(array, 4, 0.0001f);
|
||||||
Matrix4x4[] array2 = (Matrix4x4[])(object)new Matrix4x4[bones2.Length];
|
Matrix4x4[] array2 = (Matrix4x4[])new Matrix4x4[bones2.Length];
|
||||||
for (int k = 0; k < bones2.Length; k++)
|
for (int k = 0; k < bones2.Length; k++)
|
||||||
{
|
{
|
||||||
Transform val4 = bones2[k];
|
Transform val4 = bones2[k];
|
||||||
if ((Object)(object)val4 != (Object)null)
|
if (val4 != null)
|
||||||
{
|
{
|
||||||
array2[k] = val4.worldToLocalMatrix * localToWorldMatrix;
|
array2[k] = val4.worldToLocalMatrix * localToWorldMatrix;
|
||||||
}
|
}
|
||||||
@@ -318,8 +317,8 @@ public class WeightTransferUtil
|
|||||||
sharedMesh.bindposes = array2;
|
sharedMesh.bindposes = array2;
|
||||||
smr.rootBone = bodyRefSmr.rootBone;
|
smr.rootBone = bodyRefSmr.rootBone;
|
||||||
smr.bones = bones2;
|
smr.bones = bones2;
|
||||||
EditorUtility.SetDirty((Object)(object)sharedMesh);
|
EditorUtility.SetDirty(sharedMesh);
|
||||||
EditorUtility.SetDirty((Object)(object)smr);
|
EditorUtility.SetDirty(smr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Transform[] bones3 = bodyRefSmr.bones;
|
Transform[] bones3 = bodyRefSmr.bones;
|
||||||
@@ -335,7 +334,7 @@ public class WeightTransferUtil
|
|||||||
for (int l = 0; l < bones4.Length; l++)
|
for (int l = 0; l < bones4.Length; l++)
|
||||||
{
|
{
|
||||||
Transform val5 = bones4[l];
|
Transform val5 = bones4[l];
|
||||||
if (!((Object)(object)val5 == (Object)null) && !dictionary4.ContainsKey(val5))
|
if (!(val5 == null) && !dictionary4.ContainsKey(val5))
|
||||||
{
|
{
|
||||||
dictionary4.Add(val5, l);
|
dictionary4.Add(val5, l);
|
||||||
}
|
}
|
||||||
@@ -343,7 +342,7 @@ public class WeightTransferUtil
|
|||||||
}
|
}
|
||||||
int num2 = bones3.Length;
|
int num2 = bones3.Length;
|
||||||
int num3 = accessoryBones.Length;
|
int num3 = accessoryBones.Length;
|
||||||
Transform[] array3 = (Transform[])(object)new Transform[num2 + num3];
|
Transform[] array3 = (Transform[])new Transform[num2 + num3];
|
||||||
for (int m = 0; m < num2; m++)
|
for (int m = 0; m < num2; m++)
|
||||||
{
|
{
|
||||||
array3[m] = bones3[m];
|
array3[m] = bones3[m];
|
||||||
@@ -352,11 +351,11 @@ public class WeightTransferUtil
|
|||||||
{
|
{
|
||||||
array3[num2 + n] = accessoryBones[n];
|
array3[num2 + n] = accessoryBones[n];
|
||||||
}
|
}
|
||||||
Matrix4x4[] array4 = (Matrix4x4[])(object)new Matrix4x4[array3.Length];
|
Matrix4x4[] array4 = (Matrix4x4[])new Matrix4x4[array3.Length];
|
||||||
for (int num4 = 0; num4 < num2; num4++)
|
for (int num4 = 0; num4 < num2; num4++)
|
||||||
{
|
{
|
||||||
Transform val6 = bones3[num4];
|
Transform val6 = bones3[num4];
|
||||||
if ((Object)(object)val6 != (Object)null)
|
if (val6 != null)
|
||||||
{
|
{
|
||||||
array4[num4] = val6.worldToLocalMatrix * localToWorldMatrix;
|
array4[num4] = val6.worldToLocalMatrix * localToWorldMatrix;
|
||||||
}
|
}
|
||||||
@@ -369,18 +368,18 @@ public class WeightTransferUtil
|
|||||||
{
|
{
|
||||||
Transform val7 = accessoryBones[num5];
|
Transform val7 = accessoryBones[num5];
|
||||||
Matrix4x4 val8 = Matrix4x4.identity;
|
Matrix4x4 val8 = Matrix4x4.identity;
|
||||||
if ((Object)(object)val7 != (Object)null && dictionary4.TryGetValue(val7, out var value3))
|
if (val7 != null && dictionary4.TryGetValue(val7, out var value3))
|
||||||
{
|
{
|
||||||
val8 = ((bindposes == null || value3 < 0 || value3 >= bindposes.Length) ? (val7.worldToLocalMatrix * localToWorldMatrix) : bindposes[value3]);
|
val8 = ((bindposes == null || value3 < 0 || value3 >= bindposes.Length) ? (val7.worldToLocalMatrix * localToWorldMatrix) : bindposes[value3]);
|
||||||
}
|
}
|
||||||
array4[num2 + num5] = val8;
|
array4[num2 + num5] = val8;
|
||||||
}
|
}
|
||||||
sharedMesh.bindposes = array4;
|
sharedMesh.bindposes = array4;
|
||||||
sharedMesh.boneWeights = (BoneWeight[])(object)new BoneWeight[sharedMesh.vertexCount];
|
sharedMesh.boneWeights = (BoneWeight[])new BoneWeight[sharedMesh.vertexCount];
|
||||||
smr.rootBone = bodyRefSmr.rootBone;
|
smr.rootBone = bodyRefSmr.rootBone;
|
||||||
smr.bones = array3;
|
smr.bones = array3;
|
||||||
EditorUtility.SetDirty((Object)(object)sharedMesh);
|
EditorUtility.SetDirty(sharedMesh);
|
||||||
EditorUtility.SetDirty((Object)(object)smr);
|
EditorUtility.SetDirty(smr);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AccumulateRetargetWeight(float[,] W, int vertIndex, int clothBoneIndex, float weight, Transform[] clothBones, Dictionary<Transform, HumanBodyBones> clothBoneToHuman, Dictionary<HumanBodyBones, int> humanToTargetBoneIndex)
|
private void AccumulateRetargetWeight(float[,] W, int vertIndex, int clothBoneIndex, float weight, Transform[] clothBones, Dictionary<Transform, HumanBodyBones> clothBoneToHuman, Dictionary<HumanBodyBones, int> humanToTargetBoneIndex)
|
||||||
@@ -389,7 +388,7 @@ public class WeightTransferUtil
|
|||||||
if (!(weight <= 0f) && clothBoneIndex >= 0 && clothBoneIndex < clothBones.Length)
|
if (!(weight <= 0f) && clothBoneIndex >= 0 && clothBoneIndex < clothBones.Length)
|
||||||
{
|
{
|
||||||
Transform val = clothBones[clothBoneIndex];
|
Transform val = clothBones[clothBoneIndex];
|
||||||
if (!((Object)(object)val == (Object)null) && clothBoneToHuman.TryGetValue(val, out var value) && humanToTargetBoneIndex.TryGetValue(value, out var value2))
|
if (!(val == null) && clothBoneToHuman.TryGetValue(val, out var value) && humanToTargetBoneIndex.TryGetValue(value, out var value2))
|
||||||
{
|
{
|
||||||
W[vertIndex, value2] += weight;
|
W[vertIndex, value2] += weight;
|
||||||
}
|
}
|
||||||
@@ -426,7 +425,7 @@ public class WeightTransferUtil
|
|||||||
throw new AutoMorpherException("Cloth World Vertices are Missing", "[WeightTransferUtil] TransferFromBodyToCloth\n - cloth.worldVertices is null or empty");
|
throw new AutoMorpherException("Cloth World Vertices are Missing", "[WeightTransferUtil] TransferFromBodyToCloth\n - cloth.worldVertices is null or empty");
|
||||||
}
|
}
|
||||||
int[] triangles = cloth.editableMesh.triangles;
|
int[] triangles = cloth.editableMesh.triangles;
|
||||||
Vector3[] clothWorldNormals = GetClothWorldNormals(cloth);
|
Vector3[] clothWorldNormals = this.GetClothWorldNormals(cloth);
|
||||||
if (clothWorldNormals == null || clothWorldNormals.Length != worldVertices.Length)
|
if (clothWorldNormals == null || clothWorldNormals.Length != worldVertices.Length)
|
||||||
{
|
{
|
||||||
throw new AutoMorpherException("Cloth World Normals Calculation Failed", "[WeightTransferUtil] TransferFromBodyToCloth\n - targetNormalsWorld is null or length mismatch\n - targetVertsWorld.Length : " + ((worldVertices == null) ? (-1) : worldVertices.Length) + "\n - targetNormalsWorld.Length : " + ((clothWorldNormals == null) ? (-1) : clothWorldNormals.Length));
|
throw new AutoMorpherException("Cloth World Normals Calculation Failed", "[WeightTransferUtil] TransferFromBodyToCloth\n - targetNormalsWorld is null or length mismatch\n - targetVertsWorld.Length : " + ((worldVertices == null) ? (-1) : worldVertices.Length) + "\n - targetNormalsWorld.Length : " + ((clothWorldNormals == null) ? (-1) : clothWorldNormals.Length));
|
||||||
@@ -437,7 +436,7 @@ public class WeightTransferUtil
|
|||||||
for (int i = 0; i < bones.Length; i++)
|
for (int i = 0; i < bones.Length; i++)
|
||||||
{
|
{
|
||||||
Transform val = bones[i];
|
Transform val = bones[i];
|
||||||
if ((Object)(object)val != (Object)null && !dictionary.ContainsKey(val))
|
if (val != null && !dictionary.ContainsKey(val))
|
||||||
{
|
{
|
||||||
dictionary.Add(val, i);
|
dictionary.Add(val, i);
|
||||||
}
|
}
|
||||||
@@ -446,7 +445,7 @@ public class WeightTransferUtil
|
|||||||
int num3 = 0;
|
int num3 = 0;
|
||||||
foreach (SkinnedMeshRenderer bodyMesh in bodyMeshes)
|
foreach (SkinnedMeshRenderer bodyMesh in bodyMeshes)
|
||||||
{
|
{
|
||||||
if (!((Object)(object)bodyMesh == (Object)null) && !((Object)(object)bodyMesh.sharedMesh == (Object)null))
|
if (!(bodyMesh == null) && !(bodyMesh.sharedMesh == null))
|
||||||
{
|
{
|
||||||
num2 += bodyMesh.sharedMesh.vertexCount;
|
num2 += bodyMesh.sharedMesh.vertexCount;
|
||||||
num3 += bodyMesh.sharedMesh.triangles.Length;
|
num3 += bodyMesh.sharedMesh.triangles.Length;
|
||||||
@@ -456,8 +455,8 @@ public class WeightTransferUtil
|
|||||||
{
|
{
|
||||||
throw new AutoMorpherException("Valid Body Mesh is Missing", "[WeightTransferUtil] TransferFromBodyToCloth\n - bodyMeshes has no valid mesh (totalVerts == 0 or totalTris == 0)");
|
throw new AutoMorpherException("Valid Body Mesh is Missing", "[WeightTransferUtil] TransferFromBodyToCloth\n - bodyMeshes has no valid mesh (totalVerts == 0 or totalTris == 0)");
|
||||||
}
|
}
|
||||||
Vector3[] array = (Vector3[])(object)new Vector3[num2];
|
Vector3[] array = (Vector3[])new Vector3[num2];
|
||||||
Vector3[] array2 = (Vector3[])(object)new Vector3[num2];
|
Vector3[] array2 = (Vector3[])new Vector3[num2];
|
||||||
int[] array3 = new int[num3];
|
int[] array3 = new int[num3];
|
||||||
float[,] W = new float[num2, num];
|
float[,] W = new float[num2, num];
|
||||||
int num4 = 0;
|
int num4 = 0;
|
||||||
@@ -466,7 +465,7 @@ public class WeightTransferUtil
|
|||||||
for (int j = 0; j < bodyMeshes.Count; j++)
|
for (int j = 0; j < bodyMeshes.Count; j++)
|
||||||
{
|
{
|
||||||
SkinnedMeshRenderer val2 = bodyMeshes[j];
|
SkinnedMeshRenderer val2 = bodyMeshes[j];
|
||||||
if ((Object)(object)val2 == (Object)null || (Object)(object)val2.sharedMesh == (Object)null)
|
if (val2 == null || val2.sharedMesh == null)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -477,13 +476,13 @@ public class WeightTransferUtil
|
|||||||
int[] triangles2 = obj.triangles;
|
int[] triangles2 = obj.triangles;
|
||||||
int vertexCount = obj.vertexCount;
|
int vertexCount = obj.vertexCount;
|
||||||
Vector3 lossyScale = ((Component)val2).transform.lossyScale;
|
Vector3 lossyScale = ((Component)val2).transform.lossyScale;
|
||||||
((Vector3)(ref val3))._002Ector(1f / Mathf.Max(lossyScale.x, 1E-08f), 1f / Mathf.Max(lossyScale.y, 1E-08f), 1f / Mathf.Max(lossyScale.z, 1E-08f));
|
val3 = new Vector3(1f / Mathf.Max(lossyScale.x, 1E-08f), 1f / Mathf.Max(lossyScale.y, 1E-08f), 1f / Mathf.Max(lossyScale.z, 1E-08f));
|
||||||
Matrix4x4 val4 = ((Component)val2).transform.localToWorldMatrix * Matrix4x4.Scale(val3);
|
Matrix4x4 val4 = ((Component)val2).transform.localToWorldMatrix * Matrix4x4.Scale(val3);
|
||||||
for (int k = 0; k < vertexCount; k++)
|
for (int k = 0; k < vertexCount; k++)
|
||||||
{
|
{
|
||||||
array[num4 + k] = ((Matrix4x4)(ref val4)).MultiplyPoint3x4(vertices[k]);
|
array[num4 + k] = val4.MultiplyPoint3x4(vertices[k]);
|
||||||
Vector3 val5 = ((Matrix4x4)(ref val4)).MultiplyVector(normals[k]);
|
Vector3 val5 = val4.MultiplyVector(normals[k]);
|
||||||
Vector3 normalized = ((Vector3)(ref val5)).normalized;
|
Vector3 normalized = val5.normalized;
|
||||||
array2[num4 + k] = normalized;
|
array2[num4 + k] = normalized;
|
||||||
}
|
}
|
||||||
for (int l = 0; l < triangles2.Length; l++)
|
for (int l = 0; l < triangles2.Length; l++)
|
||||||
@@ -497,10 +496,10 @@ public class WeightTransferUtil
|
|||||||
for (int m = 0; m < vertexCount; m++)
|
for (int m = 0; m < vertexCount; m++)
|
||||||
{
|
{
|
||||||
BoneWeight val6 = boneWeights[m];
|
BoneWeight val6 = boneWeights[m];
|
||||||
AccumulateBodyWeight(ref W, num4 + m, ((BoneWeight)(ref val6)).boneIndex0, ((BoneWeight)(ref val6)).weight0, bones2, dictionary);
|
this.AccumulateBodyWeight(ref W, num4 + m, val6.boneIndex0, val6.weight0, bones2, dictionary);
|
||||||
AccumulateBodyWeight(ref W, num4 + m, ((BoneWeight)(ref val6)).boneIndex1, ((BoneWeight)(ref val6)).weight1, bones2, dictionary);
|
this.AccumulateBodyWeight(ref W, num4 + m, val6.boneIndex1, val6.weight1, bones2, dictionary);
|
||||||
AccumulateBodyWeight(ref W, num4 + m, ((BoneWeight)(ref val6)).boneIndex2, ((BoneWeight)(ref val6)).weight2, bones2, dictionary);
|
this.AccumulateBodyWeight(ref W, num4 + m, val6.boneIndex2, val6.weight2, bones2, dictionary);
|
||||||
AccumulateBodyWeight(ref W, num4 + m, ((BoneWeight)(ref val6)).boneIndex3, ((BoneWeight)(ref val6)).weight3, bones2, dictionary);
|
this.AccumulateBodyWeight(ref W, num4 + m, val6.boneIndex3, val6.weight3, bones2, dictionary);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
num4 += vertexCount;
|
num4 += vertexCount;
|
||||||
@@ -509,15 +508,15 @@ public class WeightTransferUtil
|
|||||||
List<int>[] array4 = cloth.vertexAdjacency;
|
List<int>[] array4 = cloth.vertexAdjacency;
|
||||||
if (array4 == null || array4.Length != worldVertices.Length)
|
if (array4 == null || array4.Length != worldVertices.Length)
|
||||||
{
|
{
|
||||||
array4 = BuildAdjacencyFromTriangles(worldVertices.Length, triangles);
|
array4 = this.BuildAdjacencyFromTriangles(worldVertices.Length, triangles);
|
||||||
}
|
}
|
||||||
float[,] weights = FindMatchesClosestSurface(array, array3, array2, worldVertices, clothWorldNormals, W, settings.maxDistance * settings.maxDistance, settings.maxNormalAngleDeg, settings.allowFlippedNormal, out var matchedMask);
|
float[,] weights = this.FindMatchesClosestSurface(array, array3, array2, worldVertices, clothWorldNormals, W, settings.maxDistance * settings.maxDistance, settings.maxNormalAngleDeg, settings.allowFlippedNormal, out var matchedMask);
|
||||||
weights = InpaintApprox(worldVertices, triangles, weights, matchedMask, array4, 20, 0.7f);
|
weights = this.InpaintApprox(worldVertices, triangles, weights, matchedMask, array4, 20, 0.7f);
|
||||||
if (settings.enableSmoothing && settings.smoothingIterations > 0 && settings.smoothingAlpha > 0f)
|
if (settings.enableSmoothing && settings.smoothingIterations > 0 && settings.smoothingAlpha > 0f)
|
||||||
{
|
{
|
||||||
weights = SmoothWeightsApprox(worldVertices, weights, matchedMask, array4, settings.smoothingIterations, settings.smoothingAlpha, settings.maxDistance);
|
weights = this.SmoothWeightsApprox(worldVertices, weights, matchedMask, array4, settings.smoothingIterations, settings.smoothingAlpha, settings.maxDistance);
|
||||||
}
|
}
|
||||||
ApplyLegVertexConstraints(avatarAnimator, cloth, weights, bodyBoneCount, settings.tinyWeight);
|
this.ApplyLegVertexConstraints(avatarAnimator, cloth, weights, bodyBoneCount, settings.tinyWeight);
|
||||||
int vertexCount2 = cloth.editableMesh.vertexCount;
|
int vertexCount2 = cloth.editableMesh.vertexCount;
|
||||||
num = cloth.smr.bones.Length;
|
num = cloth.smr.bones.Length;
|
||||||
if (accessoryBones != null && accessoryBones.Length != 0 && accessoryWeights != null && bodyBoneCount > 0)
|
if (accessoryBones != null && accessoryBones.Length != 0 && accessoryWeights != null && bodyBoneCount > 0)
|
||||||
@@ -528,18 +527,18 @@ public class WeightTransferUtil
|
|||||||
cloth.humanoidMatchedBones.TryGetValue((HumanBodyBones)10, out value);
|
cloth.humanoidMatchedBones.TryGetValue((HumanBodyBones)10, out value);
|
||||||
}
|
}
|
||||||
Transform val7 = null;
|
Transform val7 = null;
|
||||||
if ((Object)(object)avatarAnimator != (Object)null)
|
if (avatarAnimator != null)
|
||||||
{
|
{
|
||||||
val7 = avatarAnimator.GetBoneTransform((HumanBodyBones)10);
|
val7 = avatarAnimator.GetBoneTransform((HumanBodyBones)10);
|
||||||
}
|
}
|
||||||
if (value != null && (Object)(object)val7 != (Object)null)
|
if (value != null && val7 != null)
|
||||||
{
|
{
|
||||||
int num6 = Array.IndexOf(cloth.smr.bones, val7);
|
int num6 = Array.IndexOf(cloth.smr.bones, val7);
|
||||||
if (num6 >= 0 && num6 < bodyBoneCount)
|
if (num6 >= 0 && num6 < bodyBoneCount)
|
||||||
{
|
{
|
||||||
foreach (Transform item in value)
|
foreach (Transform item in value)
|
||||||
{
|
{
|
||||||
if ((Object)(object)item == (Object)null)
|
if (item == null)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -564,34 +563,34 @@ public class WeightTransferUtil
|
|||||||
BoneWeight[] array5;
|
BoneWeight[] array5;
|
||||||
if (accessoryBones != null && accessoryBones.Length != 0 && accessoryWeights != null && bodyBoneCount > 0 && bodyBoneCount + accessoryBones.Length == num)
|
if (accessoryBones != null && accessoryBones.Length != 0 && accessoryWeights != null && bodyBoneCount > 0 && bodyBoneCount + accessoryBones.Length == num)
|
||||||
{
|
{
|
||||||
array5 = MergeBodyAndAccessoryWeights(weights, accessoryWeights, bodyBoneCount, settings.tinyWeight, settings.enforceFourBoneLimit);
|
array5 = this.MergeBodyAndAccessoryWeights(weights, accessoryWeights, bodyBoneCount, settings.tinyWeight, settings.enforceFourBoneLimit);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (settings.enforceFourBoneLimit)
|
if (settings.enforceFourBoneLimit)
|
||||||
{
|
{
|
||||||
EnforceMaxBonesPerVertex(weights, 4, settings.tinyWeight);
|
this.EnforceMaxBonesPerVertex(weights, 4, settings.tinyWeight);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ZeroSmallWeights(weights, settings.tinyWeight);
|
this.ZeroSmallWeights(weights, settings.tinyWeight);
|
||||||
}
|
}
|
||||||
NormalizeWeightsPerVertex(weights, settings.tinyWeight);
|
this.NormalizeWeightsPerVertex(weights, settings.tinyWeight);
|
||||||
array5 = CollapseWeightsToBoneWeights(weights, 4, settings.tinyWeight);
|
array5 = this.CollapseWeightsToBoneWeights(weights, 4, settings.tinyWeight);
|
||||||
}
|
}
|
||||||
Mesh sharedMesh2 = cloth.smr.sharedMesh;
|
Mesh sharedMesh2 = cloth.smr.sharedMesh;
|
||||||
if (sharedMesh2.vertexCount != array5.Length)
|
if (sharedMesh2.vertexCount != array5.Length)
|
||||||
{
|
{
|
||||||
throw new AutoMorpherException("Vertex Count and Weight Length Mismatch", "[WeightTransferUtil] TransferFromBodyToCloth\n - mesh.vertexCount : " + sharedMesh2.vertexCount + "\n - finalWeights.Length : " + array5.Length);
|
throw new AutoMorpherException("Vertex Count and Weight Length Mismatch", "[WeightTransferUtil] TransferFromBodyToCloth\n - mesh.vertexCount : " + sharedMesh2.vertexCount + "\n - finalWeights.Length : " + array5.Length);
|
||||||
}
|
}
|
||||||
EnsureNonZeroAndNormalizeFinalWeights(cloth, array5, array4, settings.tinyWeight);
|
this.EnsureNonZeroAndNormalizeFinalWeights(cloth, array5, array4, settings.tinyWeight);
|
||||||
ApplyEquivalentVertexWeights(cloth, array5);
|
this.ApplyEquivalentVertexWeights(cloth, array5);
|
||||||
NormalizeAllBoneWeightsInPlace(array5, settings.tinyWeight);
|
this.NormalizeAllBoneWeightsInPlace(array5, settings.tinyWeight);
|
||||||
sharedMesh2.boneWeights = array5;
|
sharedMesh2.boneWeights = array5;
|
||||||
cloth.smr.sharedMesh = sharedMesh2;
|
cloth.smr.sharedMesh = sharedMesh2;
|
||||||
if (!TryApplyBoneWeightsWithValidation(sharedMesh2, array5, 1E-10f, out var zeroWeightVertexCount))
|
if (!this.TryApplyBoneWeightsWithValidation(sharedMesh2, array5, 1E-10f, out var zeroWeightVertexCount))
|
||||||
{
|
{
|
||||||
Debug.LogWarning((object)$"[WeightValidation] Zero-weight vertices detected: {zeroWeightVertexCount}");
|
Debug.LogWarning($"[WeightValidation] Zero-weight vertices detected: {zeroWeightVertexCount}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -601,11 +600,11 @@ public class WeightTransferUtil
|
|||||||
//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
|
//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
|
//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
|
//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
|
||||||
if ((Object)(object)clothesSmr == (Object)null)
|
if (clothesSmr == null)
|
||||||
{
|
{
|
||||||
throw new AutoMorpherException("Clothes SMR is Missing", "[WeightTransferUtil] MoveBodyWeightsToClothesBones\n - clothesSmr is null");
|
throw new AutoMorpherException("Clothes SMR is Missing", "[WeightTransferUtil] MoveBodyWeightsToClothesBones\n - clothesSmr is null");
|
||||||
}
|
}
|
||||||
if ((Object)(object)clothesMesh == (Object)null)
|
if (clothesMesh == null)
|
||||||
{
|
{
|
||||||
throw new AutoMorpherException("Clothes Mesh is Missing", "[WeightTransferUtil] MoveBodyWeightsToClothesBones\n - clothesMesh is null");
|
throw new AutoMorpherException("Clothes Mesh is Missing", "[WeightTransferUtil] MoveBodyWeightsToClothesBones\n - clothesMesh is null");
|
||||||
}
|
}
|
||||||
@@ -613,7 +612,7 @@ public class WeightTransferUtil
|
|||||||
{
|
{
|
||||||
throw new AutoMorpherException("Body To Clothes Map is Missing", "[WeightTransferUtil] MoveBodyWeightsToClothesBones\n - bodyToClothesMap is null");
|
throw new AutoMorpherException("Body To Clothes Map is Missing", "[WeightTransferUtil] MoveBodyWeightsToClothesBones\n - bodyToClothesMap is null");
|
||||||
}
|
}
|
||||||
Transform clothesFallbackRoot = (((Object)(object)clothesSmr.rootBone != (Object)null) ? clothesSmr.rootBone : ((Component)clothesSmr).transform);
|
Transform clothesFallbackRoot = ((clothesSmr.rootBone != null) ? clothesSmr.rootBone : ((Component)clothesSmr).transform);
|
||||||
HashSet<Transform> hashSet = null;
|
HashSet<Transform> hashSet = null;
|
||||||
if (accessoryBones != null && accessoryBones.Length != 0)
|
if (accessoryBones != null && accessoryBones.Length != 0)
|
||||||
{
|
{
|
||||||
@@ -624,11 +623,11 @@ public class WeightTransferUtil
|
|||||||
{
|
{
|
||||||
throw new AutoMorpherException("Clothes Bones are Missing", "[WeightTransferUtil] MoveBodyWeightsToClothesBones\n - clothesSmr.bones is null or empty");
|
throw new AutoMorpherException("Clothes Bones are Missing", "[WeightTransferUtil] MoveBodyWeightsToClothesBones\n - clothesSmr.bones is null or empty");
|
||||||
}
|
}
|
||||||
Transform[] array = (Transform[])(object)new Transform[bones.Length];
|
Transform[] array = (Transform[])new Transform[bones.Length];
|
||||||
for (int i = 0; i < bones.Length; i++)
|
for (int i = 0; i < bones.Length; i++)
|
||||||
{
|
{
|
||||||
Transform val = bones[i];
|
Transform val = bones[i];
|
||||||
if ((Object)(object)val == (Object)null)
|
if (val == null)
|
||||||
{
|
{
|
||||||
array[i] = clothesFallbackRoot;
|
array[i] = clothesFallbackRoot;
|
||||||
continue;
|
continue;
|
||||||
@@ -639,23 +638,23 @@ public class WeightTransferUtil
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Transform val2 = EnsureClothesBoneExists(val);
|
Transform val2 = EnsureClothesBoneExists(val);
|
||||||
array[i] = (((Object)(object)val2 != (Object)null) ? val2 : clothesFallbackRoot);
|
array[i] = ((val2 != null) ? val2 : clothesFallbackRoot);
|
||||||
}
|
}
|
||||||
clothesSmr.bones = array;
|
clothesSmr.bones = array;
|
||||||
if ((Object)(object)clothesSmr.rootBone != (Object)null && (hashSet == null || !hashSet.Contains(clothesSmr.rootBone)))
|
if (clothesSmr.rootBone != null && (hashSet == null || !hashSet.Contains(clothesSmr.rootBone)))
|
||||||
{
|
{
|
||||||
Transform val3 = EnsureClothesBoneExists(clothesSmr.rootBone);
|
Transform val3 = EnsureClothesBoneExists(clothesSmr.rootBone);
|
||||||
if ((Object)(object)val3 != (Object)null)
|
if (val3 != null)
|
||||||
{
|
{
|
||||||
clothesSmr.rootBone = val3;
|
clothesSmr.rootBone = val3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Transform val4 = (((Object)(object)clothesSmr.rootBone != (Object)null) ? clothesSmr.rootBone : ((Component)clothesSmr).transform);
|
Transform val4 = ((clothesSmr.rootBone != null) ? clothesSmr.rootBone : ((Component)clothesSmr).transform);
|
||||||
Matrix4x4[] array2 = (Matrix4x4[])(object)new Matrix4x4[array.Length];
|
Matrix4x4[] array2 = (Matrix4x4[])new Matrix4x4[array.Length];
|
||||||
for (int j = 0; j < array.Length; j++)
|
for (int j = 0; j < array.Length; j++)
|
||||||
{
|
{
|
||||||
Transform val5 = array[j];
|
Transform val5 = array[j];
|
||||||
if ((Object)(object)val5 == (Object)null)
|
if (val5 == null)
|
||||||
{
|
{
|
||||||
throw new AutoMorpherException("Remapped Bone is Null", "[WeightTransferUtil] MoveBodyWeightsToClothesBones\n - remappedBones contains null bone after fallback");
|
throw new AutoMorpherException("Remapped Bone is Null", "[WeightTransferUtil] MoveBodyWeightsToClothesBones\n - remappedBones contains null bone after fallback");
|
||||||
}
|
}
|
||||||
@@ -668,24 +667,24 @@ public class WeightTransferUtil
|
|||||||
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
|
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
|
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
|
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
|
||||||
if ((Object)(object)bodyBone == (Object)null)
|
if (bodyBone == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (bodyToClothesMap.TryGetValue(bodyBone, out var value) && (Object)(object)value != (Object)null)
|
if (bodyToClothesMap.TryGetValue(bodyBone, out var value) && value != null)
|
||||||
{
|
{
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
Transform val6 = null;
|
Transform val6 = null;
|
||||||
if ((Object)(object)bodyBone.parent != (Object)null)
|
if (bodyBone.parent != null)
|
||||||
{
|
{
|
||||||
val6 = EnsureClothesBoneExists(bodyBone.parent);
|
val6 = EnsureClothesBoneExists(bodyBone.parent);
|
||||||
}
|
}
|
||||||
if ((Object)(object)val6 == (Object)null)
|
if (val6 == null)
|
||||||
{
|
{
|
||||||
val6 = clothesFallbackRoot;
|
val6 = clothesFallbackRoot;
|
||||||
}
|
}
|
||||||
Transform transform = new GameObject(((Object)bodyBone).name).transform;
|
Transform transform = new GameObject((bodyBone).name).transform;
|
||||||
transform.SetParent(val6, false);
|
transform.SetParent(val6, false);
|
||||||
transform.localPosition = bodyBone.localPosition;
|
transform.localPosition = bodyBone.localPosition;
|
||||||
transform.localRotation = bodyBone.localRotation;
|
transform.localRotation = bodyBone.localRotation;
|
||||||
@@ -709,7 +708,7 @@ public class WeightTransferUtil
|
|||||||
zeroWeightVertexCount = 0;
|
zeroWeightVertexCount = 0;
|
||||||
int num = weights.Length;
|
int num = weights.Length;
|
||||||
NativeArray<byte> val = default(NativeArray<byte>);
|
NativeArray<byte> val = default(NativeArray<byte>);
|
||||||
val._002Ector(num, (Allocator)2, (NativeArrayOptions)1);
|
val = new NativeArray<byte>(num, (Allocator)2, (NativeArrayOptions)1);
|
||||||
List<BoneWeight1> list = new List<BoneWeight1>(num * 4);
|
List<BoneWeight1> list = new List<BoneWeight1>(num * 4);
|
||||||
NativeArray<BoneWeight1> val2 = default(NativeArray<BoneWeight1>);
|
NativeArray<BoneWeight1> val2 = default(NativeArray<BoneWeight1>);
|
||||||
try
|
try
|
||||||
@@ -718,10 +717,10 @@ public class WeightTransferUtil
|
|||||||
{
|
{
|
||||||
BoneWeight val3 = weights[i];
|
BoneWeight val3 = weights[i];
|
||||||
int count = 0;
|
int count = 0;
|
||||||
AddIfValid(list, ((BoneWeight)(ref val3)).boneIndex0, ((BoneWeight)(ref val3)).weight0, tiny, ref count);
|
this.AddIfValid(list, val3.boneIndex0, val3.weight0, tiny, ref count);
|
||||||
AddIfValid(list, ((BoneWeight)(ref val3)).boneIndex1, ((BoneWeight)(ref val3)).weight1, tiny, ref count);
|
this.AddIfValid(list, val3.boneIndex1, val3.weight1, tiny, ref count);
|
||||||
AddIfValid(list, ((BoneWeight)(ref val3)).boneIndex2, ((BoneWeight)(ref val3)).weight2, tiny, ref count);
|
this.AddIfValid(list, val3.boneIndex2, val3.weight2, tiny, ref count);
|
||||||
AddIfValid(list, ((BoneWeight)(ref val3)).boneIndex3, ((BoneWeight)(ref val3)).weight3, tiny, ref count);
|
this.AddIfValid(list, val3.boneIndex3, val3.weight3, tiny, ref count);
|
||||||
if (count == 0)
|
if (count == 0)
|
||||||
{
|
{
|
||||||
zeroWeightVertexCount++;
|
zeroWeightVertexCount++;
|
||||||
@@ -741,7 +740,7 @@ public class WeightTransferUtil
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Debug.LogWarning((object)("[SetBoneWeights] Failed: " + ex.Message));
|
Debug.LogWarning(("[SetBoneWeights] Failed: " + ex.Message));
|
||||||
result = false;
|
result = false;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
@@ -765,8 +764,8 @@ public class WeightTransferUtil
|
|||||||
if (boneIndex >= 0 && !(weight <= tiny))
|
if (boneIndex >= 0 && !(weight <= tiny))
|
||||||
{
|
{
|
||||||
BoneWeight1 item = default(BoneWeight1);
|
BoneWeight1 item = default(BoneWeight1);
|
||||||
((BoneWeight1)(ref item)).boneIndex = boneIndex;
|
item.boneIndex = boneIndex;
|
||||||
((BoneWeight1)(ref item)).weight = weight;
|
item.weight = weight;
|
||||||
list.Add(item);
|
list.Add(item);
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
@@ -818,10 +817,10 @@ public class WeightTransferUtil
|
|||||||
foreach (int item2 in list)
|
foreach (int item2 in list)
|
||||||
{
|
{
|
||||||
BoneWeight val = finalWeights[item2];
|
BoneWeight val = finalWeights[item2];
|
||||||
Accumulate(((BoneWeight)(ref val)).boneIndex0, ((BoneWeight)(ref val)).weight0);
|
Accumulate(val.boneIndex0, val.weight0);
|
||||||
Accumulate(((BoneWeight)(ref val)).boneIndex1, ((BoneWeight)(ref val)).weight1);
|
Accumulate(val.boneIndex1, val.weight1);
|
||||||
Accumulate(((BoneWeight)(ref val)).boneIndex2, ((BoneWeight)(ref val)).weight2);
|
Accumulate(val.boneIndex2, val.weight2);
|
||||||
Accumulate(((BoneWeight)(ref val)).boneIndex3, ((BoneWeight)(ref val)).weight3);
|
Accumulate(val.boneIndex3, val.weight3);
|
||||||
}
|
}
|
||||||
if (weightMap.Count == 0)
|
if (weightMap.Count == 0)
|
||||||
{
|
{
|
||||||
@@ -845,20 +844,20 @@ public class WeightTransferUtil
|
|||||||
switch (num5)
|
switch (num5)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
((BoneWeight)(ref val2)).boneIndex0 = key;
|
val2.boneIndex0 = key;
|
||||||
((BoneWeight)(ref val2)).weight0 = num6;
|
val2.weight0 = num6;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
((BoneWeight)(ref val2)).boneIndex1 = key;
|
val2.boneIndex1 = key;
|
||||||
((BoneWeight)(ref val2)).weight1 = num6;
|
val2.weight1 = num6;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
((BoneWeight)(ref val2)).boneIndex2 = key;
|
val2.boneIndex2 = key;
|
||||||
((BoneWeight)(ref val2)).weight2 = num6;
|
val2.weight2 = num6;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
((BoneWeight)(ref val2)).boneIndex3 = key;
|
val2.boneIndex3 = key;
|
||||||
((BoneWeight)(ref val2)).weight3 = num6;
|
val2.weight3 = num6;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -886,7 +885,7 @@ public class WeightTransferUtil
|
|||||||
|
|
||||||
private void ApplyLegVertexConstraints(Animator avatarAnimator, ClothInstance cloth, float[,] weights, int bodyBoneCount, float tinyWeight)
|
private void ApplyLegVertexConstraints(Animator avatarAnimator, ClothInstance cloth, float[,] weights, int bodyBoneCount, float tinyWeight)
|
||||||
{
|
{
|
||||||
if (cloth == null || (Object)(object)cloth.smr == (Object)null)
|
if (cloth == null || cloth.smr == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -911,7 +910,7 @@ public class WeightTransferUtil
|
|||||||
for (int i = 0; i < num; i++)
|
for (int i = 0; i < num; i++)
|
||||||
{
|
{
|
||||||
Transform val = bones[i];
|
Transform val = bones[i];
|
||||||
if (!((Object)(object)val == (Object)null))
|
if (!(val == null))
|
||||||
{
|
{
|
||||||
if (val.IsChildOf(boneTransform))
|
if (val.IsChildOf(boneTransform))
|
||||||
{
|
{
|
||||||
@@ -966,11 +965,11 @@ public class WeightTransferUtil
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
int num = cloth.worldVertices.Length;
|
int num = cloth.worldVertices.Length;
|
||||||
if ((Object)(object)cloth.bakedMesh == (Object)null || cloth.bakedMesh.vertexCount != num)
|
if (cloth.bakedMesh == null || cloth.bakedMesh.vertexCount != num)
|
||||||
{
|
{
|
||||||
throw new AutoMorpherException("Cloth Baked Mesh is Invalid", "[WeightTransferUtil] GetClothWorldNormals\n - bakedMesh is null or vertexCount mismatch\n - bakedMesh.vertexCount : " + (((Object)(object)cloth.bakedMesh == (Object)null) ? (-1) : cloth.bakedMesh.vertexCount) + "\n - worldVertices.Length : " + num);
|
throw new AutoMorpherException("Cloth Baked Mesh is Invalid", "[WeightTransferUtil] GetClothWorldNormals\n - bakedMesh is null or vertexCount mismatch\n - bakedMesh.vertexCount : " + ((cloth.bakedMesh == null) ? (-1) : cloth.bakedMesh.vertexCount) + "\n - worldVertices.Length : " + num);
|
||||||
}
|
}
|
||||||
Vector3[] array = (Vector3[])(object)new Vector3[num];
|
Vector3[] array = (Vector3[])new Vector3[num];
|
||||||
Mesh bakedMesh = cloth.bakedMesh;
|
Mesh bakedMesh = cloth.bakedMesh;
|
||||||
Vector3[] normals = bakedMesh.normals;
|
Vector3[] normals = bakedMesh.normals;
|
||||||
if (normals == null || normals.Length != num)
|
if (normals == null || normals.Length != num)
|
||||||
@@ -980,8 +979,8 @@ public class WeightTransferUtil
|
|||||||
}
|
}
|
||||||
for (int i = 0; i < num; i++)
|
for (int i = 0; i < num; i++)
|
||||||
{
|
{
|
||||||
Vector3 val = ((Matrix4x4)(ref cloth.worldNoScale)).MultiplyVector(normals[i]);
|
Vector3 val = cloth.worldNoScale.MultiplyVector(normals[i]);
|
||||||
Vector3 normalized = ((Vector3)(ref val)).normalized;
|
Vector3 normalized = val.normalized;
|
||||||
array[i] = normalized;
|
array[i] = normalized;
|
||||||
}
|
}
|
||||||
return array;
|
return array;
|
||||||
@@ -992,7 +991,7 @@ public class WeightTransferUtil
|
|||||||
if (!(weight <= 0f) && bodyBones != null && localBoneIndex >= 0 && localBoneIndex < bodyBones.Length)
|
if (!(weight <= 0f) && bodyBones != null && localBoneIndex >= 0 && localBoneIndex < bodyBones.Length)
|
||||||
{
|
{
|
||||||
Transform val = bodyBones[localBoneIndex];
|
Transform val = bodyBones[localBoneIndex];
|
||||||
if (!((Object)(object)val == (Object)null) && targetBoneIndexByTransform.TryGetValue(val, out var value))
|
if (!(val == null) && targetBoneIndexByTransform.TryGetValue(val, out var value))
|
||||||
{
|
{
|
||||||
W[vIndex, value] += weight;
|
W[vIndex, value] += weight;
|
||||||
}
|
}
|
||||||
@@ -1012,9 +1011,9 @@ public class WeightTransferUtil
|
|||||||
int num2 = triangles[j * 3];
|
int num2 = triangles[j * 3];
|
||||||
int num3 = triangles[j * 3 + 1];
|
int num3 = triangles[j * 3 + 1];
|
||||||
int num4 = triangles[j * 3 + 2];
|
int num4 = triangles[j * 3 + 2];
|
||||||
AddEdge(array, num2, num3);
|
this.AddEdge(array, num2, num3);
|
||||||
AddEdge(array, num3, num4);
|
this.AddEdge(array, num3, num4);
|
||||||
AddEdge(array, num4, num2);
|
this.AddEdge(array, num4, num2);
|
||||||
}
|
}
|
||||||
return array;
|
return array;
|
||||||
}
|
}
|
||||||
@@ -1100,9 +1099,9 @@ public class WeightTransferUtil
|
|||||||
Vector3 b = sourceVerts[num7];
|
Vector3 b = sourceVerts[num7];
|
||||||
Vector3 c = sourceVerts[num8];
|
Vector3 c = sourceVerts[num8];
|
||||||
Vector3 bary;
|
Vector3 bary;
|
||||||
Vector3 val3 = ClosestPointOnTriangle(val, a, b, c, out bary);
|
Vector3 val3 = this.ClosestPointOnTriangle(val, a, b, c, out bary);
|
||||||
val4 = val - val3;
|
val4 = val - val3;
|
||||||
float sqrMagnitude = ((Vector3)(ref val4)).sqrMagnitude;
|
float sqrMagnitude = val4.sqrMagnitude;
|
||||||
if (sqrMagnitude < num4)
|
if (sqrMagnitude < num4)
|
||||||
{
|
{
|
||||||
num4 = sqrMagnitude;
|
num4 = sqrMagnitude;
|
||||||
@@ -1123,8 +1122,8 @@ public class WeightTransferUtil
|
|||||||
Vector3 val6 = sourceNormals[num11];
|
Vector3 val6 = sourceNormals[num11];
|
||||||
Vector3 val7 = sourceNormals[num12];
|
Vector3 val7 = sourceNormals[num12];
|
||||||
val4 = val5 * val2.x + val6 * val2.y + val7 * val2.z;
|
val4 = val5 * val2.x + val6 * val2.y + val7 * val2.z;
|
||||||
Vector3 normalized = ((Vector3)(ref val4)).normalized;
|
Vector3 normalized = val4.normalized;
|
||||||
Vector3 normalized2 = ((Vector3)(ref targetNormals[i])).normalized;
|
Vector3 normalized2 = targetNormals[i].normalized;
|
||||||
float num13 = Mathf.Acos(Mathf.Clamp(Vector3.Dot(normalized, normalized2), -1f, 1f));
|
float num13 = Mathf.Acos(Mathf.Clamp(Vector3.Dot(normalized, normalized2), -1f, 1f));
|
||||||
bool flag = num13 <= num3;
|
bool flag = num13 <= num3;
|
||||||
if (flipVertexNormal && MathF.PI - num13 <= num3)
|
if (flipVertexNormal && MathF.PI - num13 <= num3)
|
||||||
@@ -1350,7 +1349,7 @@ public class WeightTransferUtil
|
|||||||
//IL_0193: Unknown result type (might be due to invalid IL or missing references)
|
//IL_0193: Unknown result type (might be due to invalid IL or missing references)
|
||||||
int length = weights.GetLength(0);
|
int length = weights.GetLength(0);
|
||||||
int length2 = weights.GetLength(1);
|
int length2 = weights.GetLength(1);
|
||||||
BoneWeight[] array = (BoneWeight[])(object)new BoneWeight[length];
|
BoneWeight[] array = (BoneWeight[])new BoneWeight[length];
|
||||||
for (int i = 0; i < length; i++)
|
for (int i = 0; i < length; i++)
|
||||||
{
|
{
|
||||||
List<(int, float)> list = new List<(int, float)>();
|
List<(int, float)> list = new List<(int, float)>();
|
||||||
@@ -1387,20 +1386,20 @@ public class WeightTransferUtil
|
|||||||
switch (num6)
|
switch (num6)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
((BoneWeight)(ref val)).boneIndex0 = item;
|
val.boneIndex0 = item;
|
||||||
((BoneWeight)(ref val)).weight0 = num7;
|
val.weight0 = num7;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
((BoneWeight)(ref val)).boneIndex1 = item;
|
val.boneIndex1 = item;
|
||||||
((BoneWeight)(ref val)).weight1 = num7;
|
val.weight1 = num7;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
((BoneWeight)(ref val)).boneIndex2 = item;
|
val.boneIndex2 = item;
|
||||||
((BoneWeight)(ref val)).weight2 = num7;
|
val.weight2 = num7;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
((BoneWeight)(ref val)).boneIndex3 = item;
|
val.boneIndex3 = item;
|
||||||
((BoneWeight)(ref val)).weight3 = num7;
|
val.weight3 = num7;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1465,7 +1464,7 @@ public class WeightTransferUtil
|
|||||||
{
|
{
|
||||||
if (!matched[i])
|
if (!matched[i])
|
||||||
{
|
{
|
||||||
FloodFillWithinDistance(verts, adjacency, i, distanceThreshold, array);
|
this.FloodFillWithinDistance(verts, adjacency, i, distanceThreshold, array);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
float[,] array2 = (float[,])weights.Clone();
|
float[,] array2 = (float[,])weights.Clone();
|
||||||
@@ -1528,7 +1527,7 @@ public class WeightTransferUtil
|
|||||||
if (!visited[item])
|
if (!visited[item])
|
||||||
{
|
{
|
||||||
Vector3 val = verts[startIndex] - verts[item];
|
Vector3 val = verts[startIndex] - verts[item];
|
||||||
if (((Vector3)(ref val)).magnitude < maxDistance)
|
if (val.magnitude < maxDistance)
|
||||||
{
|
{
|
||||||
visited[item] = true;
|
visited[item] = true;
|
||||||
queue.Enqueue(item);
|
queue.Enqueue(item);
|
||||||
@@ -1547,7 +1546,7 @@ public class WeightTransferUtil
|
|||||||
int length = bodyWeights.GetLength(0);
|
int length = bodyWeights.GetLength(0);
|
||||||
bodyWeights.GetLength(1);
|
bodyWeights.GetLength(1);
|
||||||
int length2 = accessoryWeights.GetLength(1);
|
int length2 = accessoryWeights.GetLength(1);
|
||||||
BoneWeight[] array = (BoneWeight[])(object)new BoneWeight[length];
|
BoneWeight[] array = (BoneWeight[])new BoneWeight[length];
|
||||||
for (int i = 0; i < length; i++)
|
for (int i = 0; i < length; i++)
|
||||||
{
|
{
|
||||||
List<(int, float)> list = new List<(int, float)>();
|
List<(int, float)> list = new List<(int, float)>();
|
||||||
@@ -1602,7 +1601,7 @@ public class WeightTransferUtil
|
|||||||
}
|
}
|
||||||
if (enforceFour && list3.Count > 4)
|
if (enforceFour && list3.Count > 4)
|
||||||
{
|
{
|
||||||
list3.Sort(delegate((int bone, float w) a, (int bone, float w) b)
|
list3.Sort(delegate ((int bone, float w) a, (int bone, float w) b)
|
||||||
{
|
{
|
||||||
bool flag = a.bone >= bodyBoneCount;
|
bool flag = a.bone >= bodyBoneCount;
|
||||||
bool flag2 = b.bone >= bodyBoneCount;
|
bool flag2 = b.bone >= bodyBoneCount;
|
||||||
@@ -1628,20 +1627,20 @@ public class WeightTransferUtil
|
|||||||
switch (num9)
|
switch (num9)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
((BoneWeight)(ref val)).boneIndex0 = item2;
|
val.boneIndex0 = item2;
|
||||||
((BoneWeight)(ref val)).weight0 = num10;
|
val.weight0 = num10;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
((BoneWeight)(ref val)).boneIndex1 = item2;
|
val.boneIndex1 = item2;
|
||||||
((BoneWeight)(ref val)).weight1 = num10;
|
val.weight1 = num10;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
((BoneWeight)(ref val)).boneIndex2 = item2;
|
val.boneIndex2 = item2;
|
||||||
((BoneWeight)(ref val)).weight2 = num10;
|
val.weight2 = num10;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
((BoneWeight)(ref val)).boneIndex3 = item2;
|
val.boneIndex3 = item2;
|
||||||
((BoneWeight)(ref val)).weight3 = num10;
|
val.weight3 = num10;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1654,9 +1653,9 @@ public class WeightTransferUtil
|
|||||||
{
|
{
|
||||||
if (cloth != null && weights != null && weights.Length != 0)
|
if (cloth != null && weights != null && weights.Length != 0)
|
||||||
{
|
{
|
||||||
PreNormalizeBoneWeightsInPlace(weights, tiny);
|
this.PreNormalizeBoneWeightsInPlace(weights, tiny);
|
||||||
FillZeroWeightsFromNeighbors(weights, adjacency, tiny);
|
this.FillZeroWeightsFromNeighbors(weights, adjacency, tiny);
|
||||||
NormalizeAllBoneWeightsInPlace(weights, tiny);
|
this.NormalizeAllBoneWeightsInPlace(weights, tiny);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1669,14 +1668,14 @@ public class WeightTransferUtil
|
|||||||
for (int i = 0; i < weights.Length; i++)
|
for (int i = 0; i < weights.Length; i++)
|
||||||
{
|
{
|
||||||
BoneWeight val = weights[i];
|
BoneWeight val = weights[i];
|
||||||
float num = Sum(in weights[i]);
|
float num = this.Sum(in weights[i]);
|
||||||
if (!(num < tiny))
|
if (!(num < tiny))
|
||||||
{
|
{
|
||||||
float num2 = 1f / num;
|
float num2 = 1f / num;
|
||||||
((BoneWeight)(ref val)).weight0 = ((BoneWeight)(ref val)).weight0 * num2;
|
val.weight0 = val.weight0 * num2;
|
||||||
((BoneWeight)(ref val)).weight1 = ((BoneWeight)(ref val)).weight1 * num2;
|
val.weight1 = val.weight1 * num2;
|
||||||
((BoneWeight)(ref val)).weight2 = ((BoneWeight)(ref val)).weight2 * num2;
|
val.weight2 = val.weight2 * num2;
|
||||||
((BoneWeight)(ref val)).weight3 = ((BoneWeight)(ref val)).weight3 * num2;
|
val.weight3 = val.weight3 * num2;
|
||||||
weights[i] = val;
|
weights[i] = val;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1696,10 +1695,10 @@ public class WeightTransferUtil
|
|||||||
int num = weights.Length;
|
int num = weights.Length;
|
||||||
for (int i = 0; i < num; i++)
|
for (int i = 0; i < num; i++)
|
||||||
{
|
{
|
||||||
if (!(Sum(in weights[i]) >= tiny))
|
if (!(this.Sum(in weights[i]) >= tiny))
|
||||||
{
|
{
|
||||||
BoneWeight bw = AverageFromNeighbors(i, weights, adjacency, tiny, 1);
|
BoneWeight bw = this.AverageFromNeighbors(i, weights, adjacency, tiny, 1);
|
||||||
if (Sum(in bw) >= tiny)
|
if (this.Sum(in bw) >= tiny)
|
||||||
{
|
{
|
||||||
weights[i] = bw;
|
weights[i] = bw;
|
||||||
}
|
}
|
||||||
@@ -1707,17 +1706,17 @@ public class WeightTransferUtil
|
|||||||
}
|
}
|
||||||
for (int j = 0; j < num; j++)
|
for (int j = 0; j < num; j++)
|
||||||
{
|
{
|
||||||
if (!(Sum(in weights[j]) >= tiny))
|
if (!(this.Sum(in weights[j]) >= tiny))
|
||||||
{
|
{
|
||||||
int num2 = FindNearestNonZeroVertexBfs(j, weights, adjacency, tiny, 8);
|
int num2 = this.FindNearestNonZeroVertexBfs(j, weights, adjacency, tiny, 8);
|
||||||
if (num2 >= 0)
|
if (num2 >= 0)
|
||||||
{
|
{
|
||||||
weights[j] = weights[num2];
|
weights[j] = weights[num2];
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
BoneWeight val = default(BoneWeight);
|
BoneWeight val = default(BoneWeight);
|
||||||
((BoneWeight)(ref val)).boneIndex0 = 0;
|
val.boneIndex0 = 0;
|
||||||
((BoneWeight)(ref val)).weight0 = 1f;
|
val.weight0 = 1f;
|
||||||
weights[j] = val;
|
weights[j] = val;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1755,17 +1754,17 @@ public class WeightTransferUtil
|
|||||||
dictionary[item] = num2 + 1;
|
dictionary[item] = num2 + 1;
|
||||||
queue.Enqueue(item);
|
queue.Enqueue(item);
|
||||||
BoneWeight bw = weights[item];
|
BoneWeight bw = weights[item];
|
||||||
if (!(Sum(in bw) < tiny))
|
if (!(this.Sum(in bw) < tiny))
|
||||||
{
|
{
|
||||||
Acc(map, ((BoneWeight)(ref bw)).boneIndex0, ((BoneWeight)(ref bw)).weight0, tiny);
|
this.Acc(map, bw.boneIndex0, bw.weight0, tiny);
|
||||||
Acc(map, ((BoneWeight)(ref bw)).boneIndex1, ((BoneWeight)(ref bw)).weight1, tiny);
|
this.Acc(map, bw.boneIndex1, bw.weight1, tiny);
|
||||||
Acc(map, ((BoneWeight)(ref bw)).boneIndex2, ((BoneWeight)(ref bw)).weight2, tiny);
|
this.Acc(map, bw.boneIndex2, bw.weight2, tiny);
|
||||||
Acc(map, ((BoneWeight)(ref bw)).boneIndex3, ((BoneWeight)(ref bw)).weight3, tiny);
|
this.Acc(map, bw.boneIndex3, bw.weight3, tiny);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return BuildTop4Normalized(map, tiny);
|
return this.BuildTop4Normalized(map, tiny);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int FindNearestNonZeroVertexBfs(int start, BoneWeight[] weights, List<int>[] adjacency, float tiny, int maxDepth)
|
private int FindNearestNonZeroVertexBfs(int start, BoneWeight[] weights, List<int>[] adjacency, float tiny, int maxDepth)
|
||||||
@@ -1780,7 +1779,7 @@ public class WeightTransferUtil
|
|||||||
{
|
{
|
||||||
int num = queue.Dequeue();
|
int num = queue.Dequeue();
|
||||||
int num2 = dictionary[num];
|
int num2 = dictionary[num];
|
||||||
if (num2 > 0 && Sum(in weights[num]) >= tiny)
|
if (num2 > 0 && this.Sum(in weights[num]) >= tiny)
|
||||||
{
|
{
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
@@ -1813,15 +1812,15 @@ public class WeightTransferUtil
|
|||||||
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
|
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
|
||||||
for (int i = 0; i < weights.Length; i++)
|
for (int i = 0; i < weights.Length; i++)
|
||||||
{
|
{
|
||||||
float num = Sum(in weights[i]);
|
float num = this.Sum(in weights[i]);
|
||||||
if (!(num < tiny))
|
if (!(num < tiny))
|
||||||
{
|
{
|
||||||
float num2 = 1f / num;
|
float num2 = 1f / num;
|
||||||
BoneWeight val = weights[i];
|
BoneWeight val = weights[i];
|
||||||
((BoneWeight)(ref val)).weight0 = ((BoneWeight)(ref val)).weight0 * num2;
|
val.weight0 = val.weight0 * num2;
|
||||||
((BoneWeight)(ref val)).weight1 = ((BoneWeight)(ref val)).weight1 * num2;
|
val.weight1 = val.weight1 * num2;
|
||||||
((BoneWeight)(ref val)).weight2 = ((BoneWeight)(ref val)).weight2 * num2;
|
val.weight2 = val.weight2 * num2;
|
||||||
((BoneWeight)(ref val)).weight3 = ((BoneWeight)(ref val)).weight3 * num2;
|
val.weight3 = val.weight3 * num2;
|
||||||
weights[i] = val;
|
weights[i] = val;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1838,13 +1837,13 @@ public class WeightTransferUtil
|
|||||||
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
|
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
|
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
|
||||||
BoneWeight val = bw;
|
BoneWeight val = bw;
|
||||||
float weight = ((BoneWeight)(ref val)).weight0;
|
float weight = val.weight0;
|
||||||
val = bw;
|
val = bw;
|
||||||
float num = weight + ((BoneWeight)(ref val)).weight1;
|
float num = weight + val.weight1;
|
||||||
val = bw;
|
val = bw;
|
||||||
float num2 = num + ((BoneWeight)(ref val)).weight2;
|
float num2 = num + val.weight2;
|
||||||
val = bw;
|
val = bw;
|
||||||
return num2 + ((BoneWeight)(ref val)).weight3;
|
return num2 + val.weight3;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Acc(Dictionary<int, float> map, int boneIndex, float w, float tiny)
|
private void Acc(Dictionary<int, float> map, int boneIndex, float w, float tiny)
|
||||||
@@ -1893,20 +1892,20 @@ public class WeightTransferUtil
|
|||||||
switch (num4)
|
switch (num4)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
((BoneWeight)(ref result)).boneIndex0 = key;
|
result.boneIndex0 = key;
|
||||||
((BoneWeight)(ref result)).weight0 = num5;
|
result.weight0 = num5;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
((BoneWeight)(ref result)).boneIndex1 = key;
|
result.boneIndex1 = key;
|
||||||
((BoneWeight)(ref result)).weight1 = num5;
|
result.weight1 = num5;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
((BoneWeight)(ref result)).boneIndex2 = key;
|
result.boneIndex2 = key;
|
||||||
((BoneWeight)(ref result)).weight2 = num5;
|
result.weight2 = num5;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
((BoneWeight)(ref result)).boneIndex3 = key;
|
result.boneIndex3 = key;
|
||||||
((BoneWeight)(ref result)).weight3 = num5;
|
result.weight3 = num5;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -12,7 +11,7 @@ public class WorldVertexUtil
|
|||||||
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
|
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_0006: Expected O, but got Unknown
|
//IL_0006: Expected O, but got Unknown
|
||||||
Mesh bakedMesh = new Mesh();
|
Mesh bakedMesh = new Mesh();
|
||||||
return GetWorldVertices(smr, ref bakedMesh);
|
return this.GetWorldVertices(smr, ref bakedMesh);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vector3[] GetWorldVertices(SkinnedMeshRenderer smr, ref Mesh bakedMesh)
|
public Vector3[] GetWorldVertices(SkinnedMeshRenderer smr, ref Mesh bakedMesh)
|
||||||
@@ -47,15 +46,14 @@ public class WorldVertexUtil
|
|||||||
smr.BakeMesh(bakedMesh);
|
smr.BakeMesh(bakedMesh);
|
||||||
Transform transform = ((Component)smr).transform;
|
Transform transform = ((Component)smr).transform;
|
||||||
Vector3 lossyScale = transform.lossyScale;
|
Vector3 lossyScale = transform.lossyScale;
|
||||||
Vector3 val = default(Vector3);
|
Vector3 val = new Vector3(1f / Mathf.Max(lossyScale.x, 1E-08f), 1f / Mathf.Max(lossyScale.y, 1E-08f), 1f / Mathf.Max(lossyScale.z, 1E-08f));
|
||||||
((Vector3)(ref val))._002Ector(1f / Mathf.Max(lossyScale.x, 1E-08f), 1f / Mathf.Max(lossyScale.y, 1E-08f), 1f / Mathf.Max(lossyScale.z, 1E-08f));
|
|
||||||
Matrix4x4 val2 = transform.localToWorldMatrix * Matrix4x4.Scale(val);
|
Matrix4x4 val2 = transform.localToWorldMatrix * Matrix4x4.Scale(val);
|
||||||
Vector3[] vertices = bakedMesh.vertices;
|
Vector3[] vertices = bakedMesh.vertices;
|
||||||
int num = vertices.Length;
|
int num = vertices.Length;
|
||||||
Vector3[] array = (Vector3[])(object)new Vector3[num];
|
Vector3[] array = (Vector3[])(object)new Vector3[num];
|
||||||
for (int i = 0; i < num; i++)
|
for (int i = 0; i < num; i++)
|
||||||
{
|
{
|
||||||
array[i] = ((Matrix4x4)(ref val2)).MultiplyPoint3x4(vertices[i]);
|
array[i] = val2.MultiplyPoint3x4(vertices[i]);
|
||||||
}
|
}
|
||||||
return array;
|
return array;
|
||||||
}
|
}
|
||||||
@@ -85,15 +83,14 @@ public class WorldVertexUtil
|
|||||||
}
|
}
|
||||||
Transform transform = ((Component)smr).transform;
|
Transform transform = ((Component)smr).transform;
|
||||||
Vector3 lossyScale = transform.lossyScale;
|
Vector3 lossyScale = transform.lossyScale;
|
||||||
Vector3 val = default(Vector3);
|
Vector3 val = new Vector3(1f / Mathf.Max(lossyScale.x, 1E-08f), 1f / Mathf.Max(lossyScale.y, 1E-08f), 1f / Mathf.Max(lossyScale.z, 1E-08f));
|
||||||
((Vector3)(ref val))._002Ector(1f / Mathf.Max(lossyScale.x, 1E-08f), 1f / Mathf.Max(lossyScale.y, 1E-08f), 1f / Mathf.Max(lossyScale.z, 1E-08f));
|
|
||||||
Matrix4x4 val2 = transform.localToWorldMatrix * Matrix4x4.Scale(val);
|
Matrix4x4 val2 = transform.localToWorldMatrix * Matrix4x4.Scale(val);
|
||||||
Vector3[] vertices = bakedMesh.vertices;
|
Vector3[] vertices = bakedMesh.vertices;
|
||||||
int num = vertices.Length;
|
int num = vertices.Length;
|
||||||
Vector3[] array = (Vector3[])(object)new Vector3[num];
|
Vector3[] array = (Vector3[])(object)new Vector3[num];
|
||||||
for (int i = 0; i < num; i++)
|
for (int i = 0; i < num; i++)
|
||||||
{
|
{
|
||||||
array[i] = ((Matrix4x4)(ref val2)).MultiplyPoint3x4(vertices[i]);
|
array[i] = val2.MultiplyPoint3x4(vertices[i]);
|
||||||
}
|
}
|
||||||
return array;
|
return array;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -62,12 +60,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 text = File.ReadAllText(path);
|
string text = File.ReadAllText(path);
|
||||||
loadedProfileData = JsonUtility.FromJson<ProfileData>(text);
|
this.loadedProfileData = JsonUtility.FromJson<ProfileData>(text);
|
||||||
if (loadedProfileData == null)
|
if (this.loadedProfileData == null)
|
||||||
{
|
{
|
||||||
throw new AutoMorpherException("Failed to Load Profile Data", "[ProfileLoader] LoadProfileData\n - Can't Load Profile Data\n - Please place a valid profile data file at " + path);
|
throw new AutoMorpherException("Failed to Load Profile Data", "[ProfileLoader] LoadProfileData\n - Can't Load Profile Data\n - Please place a valid profile data file at " + path);
|
||||||
}
|
}
|
||||||
return loadedProfileData;
|
return this.loadedProfileData;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BvhTriangleMesh LoadBvhWithRootTransform(Transform rootTransform, string profileName)
|
public BvhTriangleMesh LoadBvhWithRootTransform(Transform rootTransform, string profileName)
|
||||||
@@ -113,7 +111,7 @@ public class ProfileLoader
|
|||||||
string path = Path.Combine(Application.dataPath, val.GetProfileBasePath());
|
string path = Path.Combine(Application.dataPath, val.GetProfileBasePath());
|
||||||
path = Path.Combine(path, profileName);
|
path = Path.Combine(path, profileName);
|
||||||
path = Path.Combine(path, profileName + ".eb");
|
path = Path.Combine(path, profileName + ".eb");
|
||||||
if ((Object)(object)rootTransform == (Object)null)
|
if (rootTransform == null)
|
||||||
{
|
{
|
||||||
throw new AutoMorpherException("Root Transform is Null", "[ProfileLoader] LoadBvhWithRootTransform\n - rootTransform is null");
|
throw new AutoMorpherException("Root Transform is Null", "[ProfileLoader] LoadBvhWithRootTransform\n - rootTransform is null");
|
||||||
}
|
}
|
||||||
@@ -122,7 +120,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 val2 = LoadProfileBVHData(path, out version);
|
ProfileBVH val2 = this.LoadProfileBVHData(path, out version);
|
||||||
if (val2 == null || val2.vertices == null || val2.datas == null || val2.nodes == null || val2.dataIndices == null)
|
if (val2 == null || val2.vertices == null || val2.datas == null || val2.nodes == null || val2.dataIndices == null)
|
||||||
{
|
{
|
||||||
throw new AutoMorpherException("Profile BVH Data is Invalid", "[ProfileLoader] LoadBvhWithRootTransform\n - profile or one of its internal data fields is null");
|
throw new AutoMorpherException("Profile BVH Data is Invalid", "[ProfileLoader] LoadBvhWithRootTransform\n - profile or one of its internal data fields is null");
|
||||||
@@ -141,10 +139,10 @@ public class ProfileLoader
|
|||||||
Vector3 val4 = val2.vertices[val3.verA];
|
Vector3 val4 = val2.vertices[val3.verA];
|
||||||
Vector3 val5 = val2.vertices[val3.verB];
|
Vector3 val5 = val2.vertices[val3.verB];
|
||||||
Vector3 val6 = val2.vertices[val3.verC];
|
Vector3 val6 = val2.vertices[val3.verC];
|
||||||
Vector3 a = ((Matrix4x4)(ref localToWorldMatrix)).MultiplyPoint3x4(val4);
|
Vector3 a = localToWorldMatrix.MultiplyPoint3x4(val4);
|
||||||
Vector3 b = ((Matrix4x4)(ref localToWorldMatrix)).MultiplyPoint3x4(val5);
|
Vector3 b = localToWorldMatrix.MultiplyPoint3x4(val5);
|
||||||
Vector3 c = ((Matrix4x4)(ref localToWorldMatrix)).MultiplyPoint3x4(val6);
|
Vector3 c = localToWorldMatrix.MultiplyPoint3x4(val6);
|
||||||
Vector3 normal = ComputeTriangleNormal(a, b, c);
|
Vector3 normal = this.ComputeTriangleNormal(a, b, c);
|
||||||
bvhTriangleMesh.triangles[i] = new BvhTriangle
|
bvhTriangleMesh.triangles[i] = new BvhTriangle
|
||||||
{
|
{
|
||||||
a = a,
|
a = a,
|
||||||
@@ -165,7 +163,7 @@ public class ProfileLoader
|
|||||||
rightChild = val7.rightChild,
|
rightChild = val7.rightChild,
|
||||||
start = val7.start,
|
start = val7.start,
|
||||||
count = val7.count,
|
count = val7.count,
|
||||||
bounds = TransformBoundsToWorldAABB(localToWorldMatrix, val7.bounds)
|
bounds = this.TransformBoundsToWorldAABB(localToWorldMatrix, val7.bounds)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return bvhTriangleMesh;
|
return bvhTriangleMesh;
|
||||||
@@ -227,12 +225,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");
|
||||||
@@ -240,11 +238,11 @@ public class ProfileLoader
|
|||||||
Vector3[] array = (Vector3[])(object)new Vector3[num3];
|
Vector3[] array = (Vector3[])(object)new Vector3[num3];
|
||||||
for (int i = 0; i < num3; i++)
|
for (int i = 0; i < num3; i++)
|
||||||
{
|
{
|
||||||
array[i] = ReadHexVec3Safe(text, ref num2);
|
array[i] = this.ReadHexVec3Safe(text, ref num2);
|
||||||
}
|
}
|
||||||
int num7 = default(int);
|
int num7 = default(int);
|
||||||
int num8 = default(int);
|
int num8 = default(int);
|
||||||
BaseKey3[] array2 = new ProfileUtils_VertexUtil().LoadTable(val.GetBaseDataPath(), ref num7, ref num8);
|
BaseKey3[] array2 = new ProfileUtils_VertexUtil().LoadTable(val.GetBaseDataPath(), out num7, out num8);
|
||||||
if (array2 == null || array2.Length == 0)
|
if (array2 == null || array2.Length == 0)
|
||||||
{
|
{
|
||||||
throw new AutoMorpherException("Profile BVH Base Vertex Table is Invalid", "[ProfileLoader] LoadProfileBVHData\n - base vertex table is null or empty");
|
throw new AutoMorpherException("Profile BVH Base Vertex Table is Invalid", "[ProfileLoader] LoadProfileBVHData\n - base vertex table is null or empty");
|
||||||
@@ -256,7 +254,7 @@ public class ProfileLoader
|
|||||||
Vector3[] array4 = (Vector3[])(object)new Vector3[num3];
|
Vector3[] array4 = (Vector3[])(object)new Vector3[num3];
|
||||||
for (int j = 0; j < num3; j++)
|
for (int j = 0; j < num3; j++)
|
||||||
{
|
{
|
||||||
array4[j] = TransformVec3(array3[j], array2[j % array2.Length]);
|
array4[j] = this.TransformVec3(array3[j], array2[j % array2.Length]);
|
||||||
}
|
}
|
||||||
ProfileBVH val3 = new ProfileBVH
|
ProfileBVH val3 = new ProfileBVH
|
||||||
{
|
{
|
||||||
@@ -270,28 +268,28 @@ public class ProfileLoader
|
|||||||
{
|
{
|
||||||
val3.datas[k] = new profileBVHData
|
val3.datas[k] = new profileBVHData
|
||||||
{
|
{
|
||||||
verA = ReadHexIntSafe(text, ref num2),
|
verA = this.ReadHexIntSafe(text, ref num2),
|
||||||
verB = ReadHexIntSafe(text, ref num2),
|
verB = this.ReadHexIntSafe(text, ref num2),
|
||||||
verC = ReadHexIntSafe(text, ref num2)
|
verC = this.ReadHexIntSafe(text, ref num2)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
for (int l = 0; l < num5; l++)
|
for (int l = 0; l < num5; l++)
|
||||||
{
|
{
|
||||||
Vector3 val4 = ReadHexVec3Safe(text, ref num2);
|
Vector3 val4 = this.ReadHexVec3Safe(text, ref num2);
|
||||||
Vector3 val5 = ReadHexVec3Safe(text, ref num2);
|
Vector3 val5 = this.ReadHexVec3Safe(text, ref num2);
|
||||||
val3.nodes[l] = new profileBVHNode
|
val3.nodes[l] = new profileBVHNode
|
||||||
{
|
{
|
||||||
bounds = new Bounds(val4, val5 * 2f),
|
bounds = new Bounds(val4, val5 * 2f),
|
||||||
leftChild = ReadHexIntSafe(text, ref num2),
|
leftChild = this.ReadHexIntSafe(text, ref num2),
|
||||||
rightChild = ReadHexIntSafe(text, ref num2),
|
rightChild = this.ReadHexIntSafe(text, ref num2),
|
||||||
start = ReadHexIntSafe(text, ref num2),
|
start = this.ReadHexIntSafe(text, ref num2),
|
||||||
count = ReadHexIntSafe(text, ref num2),
|
count = this.ReadHexIntSafe(text, ref num2),
|
||||||
isLeaf = (num2 < text.Length && text[num2++] == '1')
|
isLeaf = (num2 < text.Length && text[num2++] == '1')
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
for (int m = 0; m < num6; m++)
|
for (int m = 0; m < num6; m++)
|
||||||
{
|
{
|
||||||
val3.dataIndices[m] = ReadHexIntSafe(text, ref num2);
|
val3.dataIndices[m] = this.ReadHexIntSafe(text, ref num2);
|
||||||
}
|
}
|
||||||
return val3;
|
return val3;
|
||||||
}
|
}
|
||||||
@@ -311,7 +309,7 @@ public class ProfileLoader
|
|||||||
private Vector3 ReadHexVec3Safe(string s, ref int p)
|
private Vector3 ReadHexVec3Safe(string s, ref int p)
|
||||||
{
|
{
|
||||||
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
|
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
|
||||||
return new Vector3(ReadHexFloatSafe(s, ref p), ReadHexFloatSafe(s, ref p), ReadHexFloatSafe(s, ref p));
|
return new Vector3(this.ReadHexFloatSafe(s, ref p), this.ReadHexFloatSafe(s, ref p), this.ReadHexFloatSafe(s, ref p));
|
||||||
}
|
}
|
||||||
|
|
||||||
private float ReadHexFloatSafe(string s, ref int p)
|
private float ReadHexFloatSafe(string s, ref int p)
|
||||||
@@ -335,7 +333,7 @@ public class ProfileLoader
|
|||||||
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
|
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
|
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
|
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
|
||||||
return new Vector3(TransformFloatBits(v.x, k.x), TransformFloatBits(v.y, k.y), TransformFloatBits(v.z, k.z));
|
return new Vector3(this.TransformFloatBits(v.x, k.x), this.TransformFloatBits(v.y, k.y), this.TransformFloatBits(v.z, k.z));
|
||||||
}
|
}
|
||||||
|
|
||||||
private float TransformFloatBits(float a, uint keyBits)
|
private float TransformFloatBits(float a, uint keyBits)
|
||||||
@@ -357,7 +355,7 @@ public class ProfileLoader
|
|||||||
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
|
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
|
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
|
||||||
Vector3 val = Vector3.Cross(b - a, c - a);
|
Vector3 val = Vector3.Cross(b - a, c - a);
|
||||||
float magnitude = ((Vector3)(ref val)).magnitude;
|
float magnitude = val.magnitude;
|
||||||
if (magnitude > 1E-08f)
|
if (magnitude > 1E-08f)
|
||||||
{
|
{
|
||||||
return val / magnitude;
|
return val / magnitude;
|
||||||
@@ -452,25 +450,25 @@ public class ProfileLoader
|
|||||||
//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
|
//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
|
//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
|
||||||
//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
|
//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
|
||||||
Vector3 center = ((Bounds)(ref localBounds)).center;
|
Vector3 center = localBounds.center;
|
||||||
Vector3 extents = ((Bounds)(ref localBounds)).extents;
|
Vector3 extents = localBounds.extents;
|
||||||
Vector3 val = ((Matrix4x4)(ref l2w)).MultiplyPoint3x4(center + new Vector3(0f - extents.x, 0f - extents.y, 0f - extents.z));
|
Vector3 val = l2w.MultiplyPoint3x4(center + new Vector3(0f - extents.x, 0f - extents.y, 0f - extents.z));
|
||||||
Vector3 p = ((Matrix4x4)(ref l2w)).MultiplyPoint3x4(center + new Vector3(0f - extents.x, 0f - extents.y, extents.z));
|
Vector3 p = l2w.MultiplyPoint3x4(center + new Vector3(0f - extents.x, 0f - extents.y, extents.z));
|
||||||
Vector3 p2 = ((Matrix4x4)(ref l2w)).MultiplyPoint3x4(center + new Vector3(0f - extents.x, extents.y, 0f - extents.z));
|
Vector3 p2 = l2w.MultiplyPoint3x4(center + new Vector3(0f - extents.x, extents.y, 0f - extents.z));
|
||||||
Vector3 p3 = ((Matrix4x4)(ref l2w)).MultiplyPoint3x4(center + new Vector3(0f - extents.x, extents.y, extents.z));
|
Vector3 p3 = l2w.MultiplyPoint3x4(center + new Vector3(0f - extents.x, extents.y, extents.z));
|
||||||
Vector3 p4 = ((Matrix4x4)(ref l2w)).MultiplyPoint3x4(center + new Vector3(extents.x, 0f - extents.y, 0f - extents.z));
|
Vector3 p4 = l2w.MultiplyPoint3x4(center + new Vector3(extents.x, 0f - extents.y, 0f - extents.z));
|
||||||
Vector3 p5 = ((Matrix4x4)(ref l2w)).MultiplyPoint3x4(center + new Vector3(extents.x, 0f - extents.y, extents.z));
|
Vector3 p5 = l2w.MultiplyPoint3x4(center + new Vector3(extents.x, 0f - extents.y, extents.z));
|
||||||
Vector3 p6 = ((Matrix4x4)(ref l2w)).MultiplyPoint3x4(center + new Vector3(extents.x, extents.y, 0f - extents.z));
|
Vector3 p6 = l2w.MultiplyPoint3x4(center + new Vector3(extents.x, extents.y, 0f - extents.z));
|
||||||
Vector3 p7 = ((Matrix4x4)(ref l2w)).MultiplyPoint3x4(center + new Vector3(extents.x, extents.y, extents.z));
|
Vector3 p7 = l2w.MultiplyPoint3x4(center + new Vector3(extents.x, extents.y, extents.z));
|
||||||
Vector3 min = val;
|
Vector3 min = val;
|
||||||
Vector3 max = val;
|
Vector3 max = val;
|
||||||
Encapsulate(ref min, ref max, p);
|
this.Encapsulate(ref min, ref max, p);
|
||||||
Encapsulate(ref min, ref max, p2);
|
this.Encapsulate(ref min, ref max, p2);
|
||||||
Encapsulate(ref min, ref max, p3);
|
this.Encapsulate(ref min, ref max, p3);
|
||||||
Encapsulate(ref min, ref max, p4);
|
this.Encapsulate(ref min, ref max, p4);
|
||||||
Encapsulate(ref min, ref max, p5);
|
this.Encapsulate(ref min, ref max, p5);
|
||||||
Encapsulate(ref min, ref max, p6);
|
this.Encapsulate(ref min, ref max, p6);
|
||||||
Encapsulate(ref min, ref max, p7);
|
this.Encapsulate(ref min, ref max, p7);
|
||||||
return new Bounds((min + max) * 0.5f, max - min);
|
return new Bounds((min + max) * 0.5f, max - min);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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)
|
||||||
@@ -61,7 +59,7 @@ public class ProfilePoseMatchUtil
|
|||||||
Transform parent2 = transform2.parent;
|
Transform parent2 = transform2.parent;
|
||||||
transform2.SetParent((Transform)null, true);
|
transform2.SetParent((Transform)null, true);
|
||||||
transform2.position = transform.position;
|
transform2.position = transform.position;
|
||||||
Dictionary<HumanBodyBones, HashSet<Transform>> dictionary = meshClassifier.MeshHumanoidBoneMatcher(targetAvatar.GetComponent<Animator>(), targetBodyMeshes);
|
Dictionary<HumanBodyBones, HashSet<Transform>> dictionary = this.meshClassifier.MeshHumanoidBoneMatcher(targetAvatar.GetComponent<Animator>(), targetBodyMeshes);
|
||||||
if (dictionary == null || dictionary.Count == 0)
|
if (dictionary == null || dictionary.Count == 0)
|
||||||
{
|
{
|
||||||
throw new AutoMorpherException("Target Avatar Bone Match Data is Missing", "[ProfilePoseMatchUtil] ProfilePoseMatcher\n - target Avatar Bone Match Data is null or empty");
|
throw new AutoMorpherException("Target Avatar Bone Match Data is Missing", "[ProfilePoseMatchUtil] ProfilePoseMatcher\n - target Avatar Bone Match Data is null or empty");
|
||||||
|
|||||||
Reference in New Issue
Block a user