EdenAutoMorpher_ProfileSaver_Script를 ILSpy로 디컴파일한 결과를 수정없이 가져옴
This commit is contained in:
8
Assets/@Eden_Tools/Eden_AutoMorpher/ProfileSaver.meta
Normal file
8
Assets/@Eden_Tools/Eden_AutoMorpher/ProfileSaver.meta
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 3f15b8b51b341c647a98a34a47707efb
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 0a87e8255c6175649ab3d14c5d7390a0
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts,
|
||||||
|
// for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies.
|
||||||
|
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
|
// Eden.AutoMorpher.profile.BaseKey3
|
||||||
|
public struct BaseKey3
|
||||||
|
{
|
||||||
|
public uint x;
|
||||||
|
|
||||||
|
public uint y;
|
||||||
|
|
||||||
|
public uint z;
|
||||||
|
|
||||||
|
public BaseKey3(uint x, uint y, uint z)
|
||||||
|
{
|
||||||
|
this.x = x;
|
||||||
|
this.y = y;
|
||||||
|
this.z = z;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 33819e87e935234448269d35d6e155b5
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts,
|
||||||
|
// for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies.
|
||||||
|
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
|
// Eden.AutoMorpher.profile.BoneData
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
[Serializable]
|
||||||
|
public class BoneData
|
||||||
|
{
|
||||||
|
public int id;
|
||||||
|
|
||||||
|
public string boneName;
|
||||||
|
|
||||||
|
public string parentName;
|
||||||
|
|
||||||
|
public string hierarchyPath;
|
||||||
|
|
||||||
|
public HumanBodyBones hBone;
|
||||||
|
|
||||||
|
public int parentId;
|
||||||
|
|
||||||
|
public List<int> childrenIds;
|
||||||
|
|
||||||
|
public Vector3 rootLocalPosition;
|
||||||
|
|
||||||
|
public Quaternion rootLocalRotation;
|
||||||
|
|
||||||
|
public Vector3 rootLocalScale;
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 8d3573fd768baee41b6e2b78d647bf04
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts,
|
||||||
|
// for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies.
|
||||||
|
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
|
// Eden.AutoMorpher.profile.BoneSpatialData
|
||||||
|
using System;
|
||||||
|
using Eden.AutoMorpher.profile;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
[Serializable]
|
||||||
|
public class BoneSpatialData
|
||||||
|
{
|
||||||
|
public HumanBodyBones refBone;
|
||||||
|
|
||||||
|
public PCAData pcaData;
|
||||||
|
|
||||||
|
public VolumeData volumeData;
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 48d80c2519b3d8b4a97a8d6d5cd7b159
|
||||||
@@ -0,0 +1,315 @@
|
|||||||
|
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts,
|
||||||
|
// for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies.
|
||||||
|
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
|
// Eden.AutoMorpher.profile.EdenAutoMorpher_ProfileSaver
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using Eden.AutoMorpher.profile;
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class EdenAutoMorpher_ProfileSaver : MonoBehaviour
|
||||||
|
{
|
||||||
|
public Transform sourceAvatar;
|
||||||
|
|
||||||
|
public List<SkinnedMeshRenderer> sourceBodyMeshes = new List<SkinnedMeshRenderer>();
|
||||||
|
|
||||||
|
public string profileName;
|
||||||
|
|
||||||
|
private const float adjustHigh = 1.5f;
|
||||||
|
|
||||||
|
[ContextMenu("SaveProfile")]
|
||||||
|
public void SaveProfile()
|
||||||
|
{
|
||||||
|
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0205: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
Vector3 position = sourceAvatar.position;
|
||||||
|
Quaternion rotation = sourceAvatar.rotation;
|
||||||
|
Vector3 localScale = sourceAvatar.localScale;
|
||||||
|
Transform parent = sourceAvatar.parent;
|
||||||
|
sourceAvatar.SetParent((Transform)null);
|
||||||
|
sourceAvatar.position = Vector3.zero;
|
||||||
|
sourceAvatar.rotation = Quaternion.identity;
|
||||||
|
sourceAvatar.localScale = Vector3.one;
|
||||||
|
ProfileData newProfileData = new ProfileData();
|
||||||
|
ProfileUtils profileUtils = new ProfileUtils();
|
||||||
|
newProfileData.version = profileUtils.GetProfileVersion();
|
||||||
|
Animator component = ((Component)sourceAvatar).GetComponent<Animator>();
|
||||||
|
if ((Object)(object)component == (Object)null)
|
||||||
|
{
|
||||||
|
Debug.LogError((object)("[EdenAutoMorpher_ProfileSaver] Source Avatar Has No Animator\nSet Animator to Source Avatar " + ((Object)sourceAvatar).name));
|
||||||
|
}
|
||||||
|
Dictionary<HumanBodyBones, HashSet<Transform>> humanoidMeshBoneMap = profileUtils.GetHumanoidMeshBoneMap(component, sourceBodyMeshes);
|
||||||
|
List<ProfileBakedBodyMesh> list = new List<ProfileBakedBodyMesh>();
|
||||||
|
foreach (SkinnedMeshRenderer sourceBodyMesh in sourceBodyMeshes)
|
||||||
|
{
|
||||||
|
list.Add(new ProfileBakedBodyMesh(sourceBodyMesh));
|
||||||
|
}
|
||||||
|
SaveBoneData(ref newProfileData, sourceAvatar, humanoidMeshBoneMap, list);
|
||||||
|
ProfileUtils_BVHUtil profileUtils_BVHUtil = new ProfileUtils_BVHUtil();
|
||||||
|
ProfileBVH bVHData = profileUtils_BVHUtil.GetBVHData(sourceAvatar, list);
|
||||||
|
profileUtils_BVHUtil.SaveProfileBVH(bVHData, Path.Combine(profileUtils.GetProfileBasePath(), profileName), profileName);
|
||||||
|
newProfileData.neckTargetHeight = 1.5f;
|
||||||
|
AdjustAvatarHigh(sourceAvatar, humanoidMeshBoneMap, 1.5f);
|
||||||
|
foreach (ProfileBakedBodyMesh item in list)
|
||||||
|
{
|
||||||
|
item.ReBakeMesh();
|
||||||
|
}
|
||||||
|
SaveSpatialData(ref newProfileData, humanoidMeshBoneMap, list);
|
||||||
|
SaveProfileToJson(newProfileData, Path.Combine(profileUtils.GetProfileBasePath(), profileName), profileName);
|
||||||
|
sourceAvatar.SetParent(parent);
|
||||||
|
sourceAvatar.position = position;
|
||||||
|
sourceAvatar.rotation = rotation;
|
||||||
|
sourceAvatar.localScale = localScale;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SaveSpatialData(ref ProfileData newProfileData, Dictionary<HumanBodyBones, HashSet<Transform>> sourceBoneMap, List<ProfileBakedBodyMesh> sourceBodyBakedMeshes)
|
||||||
|
{
|
||||||
|
ProfileUtils profileUtils = new ProfileUtils();
|
||||||
|
HumanBodyBones[] influencedBones = (HumanBodyBones[])(object)new HumanBodyBones[1] { (HumanBodyBones)9 };
|
||||||
|
newProfileData.NeckSpatialData = profileUtils.GetBoneSpatialData((HumanBodyBones)9, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
|
||||||
|
HumanBodyBones[] array = new HumanBodyBones[3];
|
||||||
|
RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
|
||||||
|
influencedBones = (HumanBodyBones[])(object)array;
|
||||||
|
newProfileData.LeftUpperArmSpatialData = profileUtils.GetBoneSpatialData((HumanBodyBones)13, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
|
||||||
|
HumanBodyBones[] array2 = new HumanBodyBones[3];
|
||||||
|
RuntimeHelpers.InitializeArray(array2, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
|
||||||
|
influencedBones = (HumanBodyBones[])(object)array2;
|
||||||
|
newProfileData.RightUpperArmSpatialData = profileUtils.GetBoneSpatialData((HumanBodyBones)14, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
|
||||||
|
influencedBones = (HumanBodyBones[])(object)new HumanBodyBones[1] { (HumanBodyBones)15 };
|
||||||
|
newProfileData.LeftLowerArmSpatialData = profileUtils.GetBoneSpatialData((HumanBodyBones)15, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
|
||||||
|
influencedBones = (HumanBodyBones[])(object)new HumanBodyBones[1] { (HumanBodyBones)16 };
|
||||||
|
newProfileData.RightLowerArmSpatialData = profileUtils.GetBoneSpatialData((HumanBodyBones)16, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
|
||||||
|
influencedBones = (HumanBodyBones[])(object)new HumanBodyBones[1] { (HumanBodyBones)17 };
|
||||||
|
newProfileData.LeftLowerArm_HandSpatialData = profileUtils.GetBoneSpatialData((HumanBodyBones)15, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
|
||||||
|
influencedBones = (HumanBodyBones[])(object)new HumanBodyBones[1] { (HumanBodyBones)18 };
|
||||||
|
newProfileData.RightLowerArm_HandSpatialData = profileUtils.GetBoneSpatialData((HumanBodyBones)16, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
|
||||||
|
influencedBones = (HumanBodyBones[])(object)new HumanBodyBones[2]
|
||||||
|
{
|
||||||
|
(HumanBodyBones)1,
|
||||||
|
(HumanBodyBones)3
|
||||||
|
};
|
||||||
|
newProfileData.LeftUpperLegSpatialData = profileUtils.GetBoneSpatialData((HumanBodyBones)1, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
|
||||||
|
influencedBones = (HumanBodyBones[])(object)new HumanBodyBones[2]
|
||||||
|
{
|
||||||
|
(HumanBodyBones)2,
|
||||||
|
(HumanBodyBones)4
|
||||||
|
};
|
||||||
|
newProfileData.RightUpperLegSpatialData = profileUtils.GetBoneSpatialData((HumanBodyBones)2, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
|
||||||
|
influencedBones = (HumanBodyBones[])(object)new HumanBodyBones[1] { (HumanBodyBones)5 };
|
||||||
|
newProfileData.LeftFootSpatialData = profileUtils.GetBoneSpatialData((HumanBodyBones)5, influencedBones, sourceBoneMap, sourceBodyBakedMeshes, addChildBones: true);
|
||||||
|
influencedBones = (HumanBodyBones[])(object)new HumanBodyBones[1] { (HumanBodyBones)6 };
|
||||||
|
newProfileData.RightFootSpatialData = profileUtils.GetBoneSpatialData((HumanBodyBones)6, influencedBones, sourceBoneMap, sourceBodyBakedMeshes, addChildBones: true);
|
||||||
|
influencedBones = (HumanBodyBones[])(object)new HumanBodyBones[1] { (HumanBodyBones)8 };
|
||||||
|
newProfileData.ChestSpatialData = profileUtils.GetBoneSpatialData((HumanBodyBones)8, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
|
||||||
|
influencedBones = (HumanBodyBones[])(object)new HumanBodyBones[1] { (HumanBodyBones)54 };
|
||||||
|
newProfileData.UpperChestSpatialData = profileUtils.GetBoneSpatialData((HumanBodyBones)54, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
|
||||||
|
influencedBones = (HumanBodyBones[])(object)new HumanBodyBones[2]
|
||||||
|
{
|
||||||
|
(HumanBodyBones)8,
|
||||||
|
(HumanBodyBones)54
|
||||||
|
};
|
||||||
|
newProfileData.IntegratedChestSpatialData = profileUtils.GetBoneSpatialData((HumanBodyBones)8, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
|
||||||
|
influencedBones = (HumanBodyBones[])(object)new HumanBodyBones[1] { (HumanBodyBones)7 };
|
||||||
|
newProfileData.SpineSpatialData = profileUtils.GetBoneSpatialData((HumanBodyBones)7, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
|
||||||
|
influencedBones = (HumanBodyBones[])(object)new HumanBodyBones[1] { (HumanBodyBones)17 };
|
||||||
|
newProfileData.LeftHandSpatialData = profileUtils.GetBoneSpatialData((HumanBodyBones)17, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
|
||||||
|
HumanBodyBones[] array3 = new HumanBodyBones[3];
|
||||||
|
RuntimeHelpers.InitializeArray(array3, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
|
||||||
|
influencedBones = (HumanBodyBones[])(object)array3;
|
||||||
|
newProfileData.LeftHandThumbSpatialData = profileUtils.GetBoneSpatialData((HumanBodyBones)24, influencedBones, sourceBoneMap, sourceBodyBakedMeshes, addChildBones: true);
|
||||||
|
influencedBones = (HumanBodyBones[])(object)new HumanBodyBones[1] { (HumanBodyBones)24 };
|
||||||
|
newProfileData.LeftHandThumbProximalSpatialData = profileUtils.GetBoneSpatialData((HumanBodyBones)24, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
|
||||||
|
influencedBones = (HumanBodyBones[])(object)new HumanBodyBones[1] { (HumanBodyBones)25 };
|
||||||
|
newProfileData.LeftHandThumbIntermediateSpatialData = profileUtils.GetBoneSpatialData((HumanBodyBones)25, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
|
||||||
|
influencedBones = (HumanBodyBones[])(object)new HumanBodyBones[1] { (HumanBodyBones)26 };
|
||||||
|
newProfileData.LeftHandThumbDistalSpatialData = profileUtils.GetBoneSpatialData((HumanBodyBones)26, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
|
||||||
|
HumanBodyBones[] array4 = new HumanBodyBones[3];
|
||||||
|
RuntimeHelpers.InitializeArray(array4, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
|
||||||
|
influencedBones = (HumanBodyBones[])(object)array4;
|
||||||
|
newProfileData.LeftHandIndexSpatialData = profileUtils.GetBoneSpatialData((HumanBodyBones)27, influencedBones, sourceBoneMap, sourceBodyBakedMeshes, addChildBones: true);
|
||||||
|
influencedBones = (HumanBodyBones[])(object)new HumanBodyBones[1] { (HumanBodyBones)27 };
|
||||||
|
newProfileData.LeftHandIndexProximalSpatialData = profileUtils.GetBoneSpatialData((HumanBodyBones)27, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
|
||||||
|
influencedBones = (HumanBodyBones[])(object)new HumanBodyBones[1] { (HumanBodyBones)28 };
|
||||||
|
newProfileData.LeftHandIndexIntermediateSpatialData = profileUtils.GetBoneSpatialData((HumanBodyBones)28, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
|
||||||
|
influencedBones = (HumanBodyBones[])(object)new HumanBodyBones[1] { (HumanBodyBones)29 };
|
||||||
|
newProfileData.LeftHandIndexDistalSpatialData = profileUtils.GetBoneSpatialData((HumanBodyBones)29, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
|
||||||
|
HumanBodyBones[] array5 = new HumanBodyBones[3];
|
||||||
|
RuntimeHelpers.InitializeArray(array5, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
|
||||||
|
influencedBones = (HumanBodyBones[])(object)array5;
|
||||||
|
newProfileData.LeftHandMiddleSpatialData = profileUtils.GetBoneSpatialData((HumanBodyBones)30, influencedBones, sourceBoneMap, sourceBodyBakedMeshes, addChildBones: true);
|
||||||
|
influencedBones = (HumanBodyBones[])(object)new HumanBodyBones[1] { (HumanBodyBones)30 };
|
||||||
|
newProfileData.LeftHandMiddleProximalSpatialData = profileUtils.GetBoneSpatialData((HumanBodyBones)30, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
|
||||||
|
influencedBones = (HumanBodyBones[])(object)new HumanBodyBones[1] { (HumanBodyBones)31 };
|
||||||
|
newProfileData.LeftHandMiddleIntermediateSpatialData = profileUtils.GetBoneSpatialData((HumanBodyBones)31, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
|
||||||
|
influencedBones = (HumanBodyBones[])(object)new HumanBodyBones[1] { (HumanBodyBones)32 };
|
||||||
|
newProfileData.LeftHandMiddleDistalSpatialData = profileUtils.GetBoneSpatialData((HumanBodyBones)32, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
|
||||||
|
HumanBodyBones[] array6 = new HumanBodyBones[3];
|
||||||
|
RuntimeHelpers.InitializeArray(array6, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
|
||||||
|
influencedBones = (HumanBodyBones[])(object)array6;
|
||||||
|
newProfileData.LeftHandRingSpatialData = profileUtils.GetBoneSpatialData((HumanBodyBones)33, influencedBones, sourceBoneMap, sourceBodyBakedMeshes, addChildBones: true);
|
||||||
|
influencedBones = (HumanBodyBones[])(object)new HumanBodyBones[1] { (HumanBodyBones)33 };
|
||||||
|
newProfileData.LeftHandRingProximalSpatialData = profileUtils.GetBoneSpatialData((HumanBodyBones)33, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
|
||||||
|
influencedBones = (HumanBodyBones[])(object)new HumanBodyBones[1] { (HumanBodyBones)34 };
|
||||||
|
newProfileData.LeftHandRingIntermediateSpatialData = profileUtils.GetBoneSpatialData((HumanBodyBones)34, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
|
||||||
|
influencedBones = (HumanBodyBones[])(object)new HumanBodyBones[1] { (HumanBodyBones)35 };
|
||||||
|
newProfileData.LeftHandRingDistalSpatialData = profileUtils.GetBoneSpatialData((HumanBodyBones)35, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
|
||||||
|
HumanBodyBones[] array7 = new HumanBodyBones[3];
|
||||||
|
RuntimeHelpers.InitializeArray(array7, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
|
||||||
|
influencedBones = (HumanBodyBones[])(object)array7;
|
||||||
|
newProfileData.LeftHandLittleSpatialData = profileUtils.GetBoneSpatialData((HumanBodyBones)36, influencedBones, sourceBoneMap, sourceBodyBakedMeshes, addChildBones: true);
|
||||||
|
influencedBones = (HumanBodyBones[])(object)new HumanBodyBones[1] { (HumanBodyBones)36 };
|
||||||
|
newProfileData.LeftHandLittleProximalSpatialData = profileUtils.GetBoneSpatialData((HumanBodyBones)36, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
|
||||||
|
influencedBones = (HumanBodyBones[])(object)new HumanBodyBones[1] { (HumanBodyBones)37 };
|
||||||
|
newProfileData.LeftHandLittleIntermediateSpatialData = profileUtils.GetBoneSpatialData((HumanBodyBones)37, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
|
||||||
|
influencedBones = (HumanBodyBones[])(object)new HumanBodyBones[1] { (HumanBodyBones)38 };
|
||||||
|
newProfileData.LeftHandLittleDistalSpatialData = profileUtils.GetBoneSpatialData((HumanBodyBones)38, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
|
||||||
|
influencedBones = (HumanBodyBones[])(object)new HumanBodyBones[1] { (HumanBodyBones)18 };
|
||||||
|
newProfileData.RightHandSpatialData = profileUtils.GetBoneSpatialData((HumanBodyBones)18, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
|
||||||
|
HumanBodyBones[] array8 = new HumanBodyBones[3];
|
||||||
|
RuntimeHelpers.InitializeArray(array8, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
|
||||||
|
influencedBones = (HumanBodyBones[])(object)array8;
|
||||||
|
newProfileData.RightHandThumbSpatialData = profileUtils.GetBoneSpatialData((HumanBodyBones)39, influencedBones, sourceBoneMap, sourceBodyBakedMeshes, addChildBones: true);
|
||||||
|
influencedBones = (HumanBodyBones[])(object)new HumanBodyBones[1] { (HumanBodyBones)39 };
|
||||||
|
newProfileData.RightHandThumbProximalSpatialData = profileUtils.GetBoneSpatialData((HumanBodyBones)39, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
|
||||||
|
influencedBones = (HumanBodyBones[])(object)new HumanBodyBones[1] { (HumanBodyBones)40 };
|
||||||
|
newProfileData.RightHandThumbIntermediateSpatialData = profileUtils.GetBoneSpatialData((HumanBodyBones)40, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
|
||||||
|
influencedBones = (HumanBodyBones[])(object)new HumanBodyBones[1] { (HumanBodyBones)41 };
|
||||||
|
newProfileData.RightHandThumbDistalSpatialData = profileUtils.GetBoneSpatialData((HumanBodyBones)41, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
|
||||||
|
HumanBodyBones[] array9 = new HumanBodyBones[3];
|
||||||
|
RuntimeHelpers.InitializeArray(array9, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
|
||||||
|
influencedBones = (HumanBodyBones[])(object)array9;
|
||||||
|
newProfileData.RightHandIndexSpatialData = profileUtils.GetBoneSpatialData((HumanBodyBones)42, influencedBones, sourceBoneMap, sourceBodyBakedMeshes, addChildBones: true);
|
||||||
|
influencedBones = (HumanBodyBones[])(object)new HumanBodyBones[1] { (HumanBodyBones)42 };
|
||||||
|
newProfileData.RightHandIndexProximalSpatialData = profileUtils.GetBoneSpatialData((HumanBodyBones)42, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
|
||||||
|
influencedBones = (HumanBodyBones[])(object)new HumanBodyBones[1] { (HumanBodyBones)43 };
|
||||||
|
newProfileData.RightHandIndexIntermediateSpatialData = profileUtils.GetBoneSpatialData((HumanBodyBones)43, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
|
||||||
|
influencedBones = (HumanBodyBones[])(object)new HumanBodyBones[1] { (HumanBodyBones)44 };
|
||||||
|
newProfileData.RightHandIndexDistalSpatialData = profileUtils.GetBoneSpatialData((HumanBodyBones)44, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
|
||||||
|
HumanBodyBones[] array10 = new HumanBodyBones[3];
|
||||||
|
RuntimeHelpers.InitializeArray(array10, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
|
||||||
|
influencedBones = (HumanBodyBones[])(object)array10;
|
||||||
|
newProfileData.RightHandMiddleSpatialData = profileUtils.GetBoneSpatialData((HumanBodyBones)45, influencedBones, sourceBoneMap, sourceBodyBakedMeshes, addChildBones: true);
|
||||||
|
influencedBones = (HumanBodyBones[])(object)new HumanBodyBones[1] { (HumanBodyBones)45 };
|
||||||
|
newProfileData.RightHandMiddleProximalSpatialData = profileUtils.GetBoneSpatialData((HumanBodyBones)45, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
|
||||||
|
influencedBones = (HumanBodyBones[])(object)new HumanBodyBones[1] { (HumanBodyBones)46 };
|
||||||
|
newProfileData.RightHandMiddleIntermediateSpatialData = profileUtils.GetBoneSpatialData((HumanBodyBones)46, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
|
||||||
|
influencedBones = (HumanBodyBones[])(object)new HumanBodyBones[1] { (HumanBodyBones)47 };
|
||||||
|
newProfileData.RightHandMiddleDistalSpatialData = profileUtils.GetBoneSpatialData((HumanBodyBones)47, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
|
||||||
|
HumanBodyBones[] array11 = new HumanBodyBones[3];
|
||||||
|
RuntimeHelpers.InitializeArray(array11, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
|
||||||
|
influencedBones = (HumanBodyBones[])(object)array11;
|
||||||
|
newProfileData.RightHandRingSpatialData = profileUtils.GetBoneSpatialData((HumanBodyBones)48, influencedBones, sourceBoneMap, sourceBodyBakedMeshes, addChildBones: true);
|
||||||
|
influencedBones = (HumanBodyBones[])(object)new HumanBodyBones[1] { (HumanBodyBones)48 };
|
||||||
|
newProfileData.RightHandRingProximalSpatialData = profileUtils.GetBoneSpatialData((HumanBodyBones)48, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
|
||||||
|
influencedBones = (HumanBodyBones[])(object)new HumanBodyBones[1] { (HumanBodyBones)49 };
|
||||||
|
newProfileData.RightHandRingIntermediateSpatialData = profileUtils.GetBoneSpatialData((HumanBodyBones)49, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
|
||||||
|
influencedBones = (HumanBodyBones[])(object)new HumanBodyBones[1] { (HumanBodyBones)50 };
|
||||||
|
newProfileData.RightHandRingDistalSpatialData = profileUtils.GetBoneSpatialData((HumanBodyBones)50, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
|
||||||
|
HumanBodyBones[] array12 = new HumanBodyBones[3];
|
||||||
|
RuntimeHelpers.InitializeArray(array12, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
|
||||||
|
influencedBones = (HumanBodyBones[])(object)array12;
|
||||||
|
newProfileData.RightHandLittleSpatialData = profileUtils.GetBoneSpatialData((HumanBodyBones)51, influencedBones, sourceBoneMap, sourceBodyBakedMeshes, addChildBones: true);
|
||||||
|
influencedBones = (HumanBodyBones[])(object)new HumanBodyBones[1] { (HumanBodyBones)51 };
|
||||||
|
newProfileData.RightHandLittleProximalSpatialData = profileUtils.GetBoneSpatialData((HumanBodyBones)51, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
|
||||||
|
influencedBones = (HumanBodyBones[])(object)new HumanBodyBones[1] { (HumanBodyBones)52 };
|
||||||
|
newProfileData.RightHandLittleIntermediateSpatialData = profileUtils.GetBoneSpatialData((HumanBodyBones)52, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
|
||||||
|
influencedBones = (HumanBodyBones[])(object)new HumanBodyBones[1] { (HumanBodyBones)53 };
|
||||||
|
newProfileData.RightHandLittleDistalSpatialData = profileUtils.GetBoneSpatialData((HumanBodyBones)53, influencedBones, sourceBoneMap, sourceBodyBakedMeshes);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SaveBoneData(ref ProfileData newProfileData, Transform sourceAvatar, Dictionary<HumanBodyBones, HashSet<Transform>> sourceBoneMap, List<ProfileBakedBodyMesh> sourceBodyBakedMeshes)
|
||||||
|
{
|
||||||
|
ProfileUtils profileUtils = new ProfileUtils();
|
||||||
|
HashSet<Transform> hashSet = new HashSet<Transform>();
|
||||||
|
foreach (ProfileBakedBodyMesh sourceBodyBakedMesh in sourceBodyBakedMeshes)
|
||||||
|
{
|
||||||
|
foreach (Transform bodyMeshBone in profileUtils.GetBodyMeshBones(sourceBodyBakedMesh.smr))
|
||||||
|
{
|
||||||
|
hashSet.Add(bodyMeshBone);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (hashSet.Count == 0)
|
||||||
|
{
|
||||||
|
Debug.LogWarning((object)"[EdenAutoMorpher_ProfileSaver] SaveBoneData - avatarBones is empty.");
|
||||||
|
newProfileData.boneRootId = -1;
|
||||||
|
newProfileData.bones = new List<BoneData>();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
newProfileData.boneRootId = 0;
|
||||||
|
newProfileData.bones = profileUtils.GetBoneDatas(sourceAvatar, hashSet, sourceBoneMap);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AdjustAvatarHigh(Transform sourceRoot, Dictionary<HumanBodyBones, HashSet<Transform>> sourceBoneMap, float targetHeight)
|
||||||
|
{
|
||||||
|
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
if (!sourceBoneMap.TryGetValue((HumanBodyBones)9, out var value) || value.Count == 0)
|
||||||
|
{
|
||||||
|
Debug.LogError((object)"[EdenAutoMorpher_ProfileSaver] Can't Find Neck Bones");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
float num = value.FirstOrDefault().position.y - sourceRoot.position.y;
|
||||||
|
if (Mathf.Approximately(num, 0f))
|
||||||
|
{
|
||||||
|
Debug.LogWarning((object)$"[EdenAutoMorpher_ProfileSaver] {((Object)sourceRoot).name} Neck Y가 0에 가까워 스케일 계산을 건너뜁니다. (neckY = {num})");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
float num2 = targetHeight / num;
|
||||||
|
Vector3 localScale = sourceRoot.localScale;
|
||||||
|
localScale *= num2;
|
||||||
|
sourceRoot.localScale = localScale;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SaveProfileToJson(ProfileData profileData, string savePath, string profileName)
|
||||||
|
{
|
||||||
|
if (profileData == null)
|
||||||
|
{
|
||||||
|
Debug.LogError((object)"[EdenAutoMorpher_ProfileSaver] ProfileData is null. Abort save.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(profileName))
|
||||||
|
{
|
||||||
|
Debug.LogError((object)"[EdenAutoMorpher_ProfileSaver] profileName is empty.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
string path = (profileName.EndsWith(".json") ? profileName : (profileName + ".json"));
|
||||||
|
string text = Path.Combine(Application.dataPath, savePath ?? string.Empty);
|
||||||
|
if (!Directory.Exists(text))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(text);
|
||||||
|
}
|
||||||
|
string text2 = Path.Combine(text, path);
|
||||||
|
string contents = JsonUtility.ToJson((object)profileData, true);
|
||||||
|
File.WriteAllText(text2, contents);
|
||||||
|
Debug.Log((object)("[EdenAutoMorpher_ProfileSaver] Profile saved successfully.\nPath: " + text2));
|
||||||
|
AssetDatabase.Refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsExistBaseData()
|
||||||
|
{
|
||||||
|
ProfileUtils profileUtils = new ProfileUtils();
|
||||||
|
return File.Exists(Path.Combine(Application.dataPath, profileUtils.GetBaseDataPath()));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 2fd1a8210b48a8d49843a3f2859e67b6
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts,
|
||||||
|
// for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies.
|
||||||
|
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
|
// Eden.AutoMorpher.profile.PCAData
|
||||||
|
using System;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
[Serializable]
|
||||||
|
public class PCAData
|
||||||
|
{
|
||||||
|
public Vector3 pcaCenter;
|
||||||
|
|
||||||
|
public Vector3 pcaPrincipalAxis;
|
||||||
|
|
||||||
|
public float pcaLength;
|
||||||
|
|
||||||
|
public float pcaAvgRadius;
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: ba923ad66ccb9824aa21217281bc8f03
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts,
|
||||||
|
// for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies.
|
||||||
|
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
|
// Eden.AutoMorpher.profile.ProfileBVH
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Eden.AutoMorpher.profile;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class ProfileBVH
|
||||||
|
{
|
||||||
|
public List<Vector3> vertices;
|
||||||
|
|
||||||
|
public profileBVHData[] datas;
|
||||||
|
|
||||||
|
public profileBVHNode[] nodes;
|
||||||
|
|
||||||
|
public int[] dataIndices;
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: ca85c008bacb4c04fab51354ef3d6365
|
||||||
@@ -0,0 +1,107 @@
|
|||||||
|
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts,
|
||||||
|
// for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies.
|
||||||
|
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
|
// Eden.AutoMorpher.profile.ProfileBakedBodyMesh
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class ProfileBakedBodyMesh
|
||||||
|
{
|
||||||
|
public SkinnedMeshRenderer smr;
|
||||||
|
|
||||||
|
public Mesh bakedMesh;
|
||||||
|
|
||||||
|
public Vector3[] worldVertices;
|
||||||
|
|
||||||
|
public BoneWeight[] boneWeights
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (!((Object)(object)smr != (Object)null))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return smr.sharedMesh.boneWeights;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Transform[] bones
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (!((Object)(object)smr != (Object)null))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return smr.bones;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProfileBakedBodyMesh(SkinnedMeshRenderer _smr)
|
||||||
|
{
|
||||||
|
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_006d: Expected O, but got Unknown
|
||||||
|
if ((Object)(object)_smr == (Object)null)
|
||||||
|
{
|
||||||
|
Debug.LogError((object)("[ProfileUtil - ProfileBakedBodyMesh] BakeBodyMesh Init : SkinnedMeshRenderer " + ((Object)((Component)_smr).gameObject).name + " is null"));
|
||||||
|
}
|
||||||
|
smr = _smr;
|
||||||
|
if ((Object)(object)_smr.sharedMesh == (Object)null)
|
||||||
|
{
|
||||||
|
Debug.LogError((object)("[ProfileUtil - ProfileBakedBodyMesh] BakeBodyMesh Init : SkinnedMeshRenderer " + ((Object)((Component)_smr).gameObject).name + " has null sharedMesh."));
|
||||||
|
}
|
||||||
|
bakedMesh = new Mesh();
|
||||||
|
smr.BakeMesh(bakedMesh);
|
||||||
|
worldVertices = CalculateWorldVertices(smr, bakedMesh);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ReBakeMesh()
|
||||||
|
{
|
||||||
|
smr.BakeMesh(bakedMesh);
|
||||||
|
worldVertices = CalculateWorldVertices(smr, bakedMesh);
|
||||||
|
}
|
||||||
|
|
||||||
|
~ProfileBakedBodyMesh()
|
||||||
|
{
|
||||||
|
smr = null;
|
||||||
|
bakedMesh = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Vector3[] CalculateWorldVertices(SkinnedMeshRenderer smr, Mesh bakedMesh)
|
||||||
|
{
|
||||||
|
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
if ((Object)(object)smr == (Object)null)
|
||||||
|
{
|
||||||
|
Debug.LogError((object)("[ProfileUtil - ProfileBakedBodyMesh] CalculateWorldVertices: smr " + ((Object)((Component)smr).gameObject).name + " == null"));
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if ((Object)(object)bakedMesh == (Object)null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
Transform transform = ((Component)smr).transform;
|
||||||
|
Vector3 lossyScale = transform.lossyScale;
|
||||||
|
Vector3 val = default(Vector3);
|
||||||
|
((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);
|
||||||
|
Vector3[] vertices = bakedMesh.vertices;
|
||||||
|
int num = vertices.Length;
|
||||||
|
Vector3[] array = (Vector3[])(object)new Vector3[num];
|
||||||
|
for (int i = 0; i < num; i++)
|
||||||
|
{
|
||||||
|
array[i] = ((Matrix4x4)(ref val2)).MultiplyPoint3x4(vertices[i]);
|
||||||
|
}
|
||||||
|
return array;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 1b9accce356c005478e76fd0fa193f3a
|
||||||
@@ -0,0 +1,133 @@
|
|||||||
|
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts,
|
||||||
|
// for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies.
|
||||||
|
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
|
// Eden.AutoMorpher.profile.ProfileData
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Eden.AutoMorpher.profile;
|
||||||
|
|
||||||
|
[Serializable]
|
||||||
|
public class ProfileData
|
||||||
|
{
|
||||||
|
public int version = 1;
|
||||||
|
|
||||||
|
public float neckTargetHeight = 1.5f;
|
||||||
|
|
||||||
|
public BoneSpatialData NeckSpatialData;
|
||||||
|
|
||||||
|
public BoneSpatialData LeftUpperArmSpatialData;
|
||||||
|
|
||||||
|
public BoneSpatialData RightUpperArmSpatialData;
|
||||||
|
|
||||||
|
public BoneSpatialData LeftLowerArmSpatialData;
|
||||||
|
|
||||||
|
public BoneSpatialData RightLowerArmSpatialData;
|
||||||
|
|
||||||
|
public BoneSpatialData LeftLowerArm_HandSpatialData;
|
||||||
|
|
||||||
|
public BoneSpatialData RightLowerArm_HandSpatialData;
|
||||||
|
|
||||||
|
public BoneSpatialData LeftUpperLegSpatialData;
|
||||||
|
|
||||||
|
public BoneSpatialData RightUpperLegSpatialData;
|
||||||
|
|
||||||
|
public BoneSpatialData LeftFootSpatialData;
|
||||||
|
|
||||||
|
public BoneSpatialData RightFootSpatialData;
|
||||||
|
|
||||||
|
public BoneSpatialData ChestSpatialData;
|
||||||
|
|
||||||
|
public BoneSpatialData UpperChestSpatialData;
|
||||||
|
|
||||||
|
public BoneSpatialData IntegratedChestSpatialData;
|
||||||
|
|
||||||
|
public BoneSpatialData SpineSpatialData;
|
||||||
|
|
||||||
|
public BoneSpatialData LeftHandSpatialData;
|
||||||
|
|
||||||
|
public BoneSpatialData LeftHandThumbSpatialData;
|
||||||
|
|
||||||
|
public BoneSpatialData LeftHandThumbProximalSpatialData;
|
||||||
|
|
||||||
|
public BoneSpatialData LeftHandThumbIntermediateSpatialData;
|
||||||
|
|
||||||
|
public BoneSpatialData LeftHandThumbDistalSpatialData;
|
||||||
|
|
||||||
|
public BoneSpatialData LeftHandIndexSpatialData;
|
||||||
|
|
||||||
|
public BoneSpatialData LeftHandIndexProximalSpatialData;
|
||||||
|
|
||||||
|
public BoneSpatialData LeftHandIndexIntermediateSpatialData;
|
||||||
|
|
||||||
|
public BoneSpatialData LeftHandIndexDistalSpatialData;
|
||||||
|
|
||||||
|
public BoneSpatialData LeftHandMiddleSpatialData;
|
||||||
|
|
||||||
|
public BoneSpatialData LeftHandMiddleProximalSpatialData;
|
||||||
|
|
||||||
|
public BoneSpatialData LeftHandMiddleIntermediateSpatialData;
|
||||||
|
|
||||||
|
public BoneSpatialData LeftHandMiddleDistalSpatialData;
|
||||||
|
|
||||||
|
public BoneSpatialData LeftHandRingSpatialData;
|
||||||
|
|
||||||
|
public BoneSpatialData LeftHandRingProximalSpatialData;
|
||||||
|
|
||||||
|
public BoneSpatialData LeftHandRingIntermediateSpatialData;
|
||||||
|
|
||||||
|
public BoneSpatialData LeftHandRingDistalSpatialData;
|
||||||
|
|
||||||
|
public BoneSpatialData LeftHandLittleSpatialData;
|
||||||
|
|
||||||
|
public BoneSpatialData LeftHandLittleProximalSpatialData;
|
||||||
|
|
||||||
|
public BoneSpatialData LeftHandLittleIntermediateSpatialData;
|
||||||
|
|
||||||
|
public BoneSpatialData LeftHandLittleDistalSpatialData;
|
||||||
|
|
||||||
|
public BoneSpatialData RightHandSpatialData;
|
||||||
|
|
||||||
|
public BoneSpatialData RightHandThumbSpatialData;
|
||||||
|
|
||||||
|
public BoneSpatialData RightHandThumbProximalSpatialData;
|
||||||
|
|
||||||
|
public BoneSpatialData RightHandThumbIntermediateSpatialData;
|
||||||
|
|
||||||
|
public BoneSpatialData RightHandThumbDistalSpatialData;
|
||||||
|
|
||||||
|
public BoneSpatialData RightHandIndexSpatialData;
|
||||||
|
|
||||||
|
public BoneSpatialData RightHandIndexProximalSpatialData;
|
||||||
|
|
||||||
|
public BoneSpatialData RightHandIndexIntermediateSpatialData;
|
||||||
|
|
||||||
|
public BoneSpatialData RightHandIndexDistalSpatialData;
|
||||||
|
|
||||||
|
public BoneSpatialData RightHandMiddleSpatialData;
|
||||||
|
|
||||||
|
public BoneSpatialData RightHandMiddleProximalSpatialData;
|
||||||
|
|
||||||
|
public BoneSpatialData RightHandMiddleIntermediateSpatialData;
|
||||||
|
|
||||||
|
public BoneSpatialData RightHandMiddleDistalSpatialData;
|
||||||
|
|
||||||
|
public BoneSpatialData RightHandRingSpatialData;
|
||||||
|
|
||||||
|
public BoneSpatialData RightHandRingProximalSpatialData;
|
||||||
|
|
||||||
|
public BoneSpatialData RightHandRingIntermediateSpatialData;
|
||||||
|
|
||||||
|
public BoneSpatialData RightHandRingDistalSpatialData;
|
||||||
|
|
||||||
|
public BoneSpatialData RightHandLittleSpatialData;
|
||||||
|
|
||||||
|
public BoneSpatialData RightHandLittleProximalSpatialData;
|
||||||
|
|
||||||
|
public BoneSpatialData RightHandLittleIntermediateSpatialData;
|
||||||
|
|
||||||
|
public BoneSpatialData RightHandLittleDistalSpatialData;
|
||||||
|
|
||||||
|
public int boneRootId;
|
||||||
|
|
||||||
|
public List<BoneData> bones;
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d62ebbd77f472fd4bb8abf3546d9d12a
|
||||||
@@ -0,0 +1,281 @@
|
|||||||
|
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts,
|
||||||
|
// for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies.
|
||||||
|
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
|
// Eden.AutoMorpher.profile.ProfileUtil_IndexUtil
|
||||||
|
using Eden.AutoMorpher.profile;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class ProfileUtil_IndexUtil
|
||||||
|
{
|
||||||
|
public class BlockPermutations
|
||||||
|
{
|
||||||
|
private struct XorShift32
|
||||||
|
{
|
||||||
|
private uint _state;
|
||||||
|
|
||||||
|
public XorShift32(uint seed)
|
||||||
|
{
|
||||||
|
_state = ((seed != 0) ? seed : 1831565813u);
|
||||||
|
}
|
||||||
|
|
||||||
|
public uint NextUInt()
|
||||||
|
{
|
||||||
|
uint state = _state;
|
||||||
|
state ^= state << 13;
|
||||||
|
state ^= state >> 17;
|
||||||
|
return _state = state ^ (state << 5);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int NextInt(int maxExclusive)
|
||||||
|
{
|
||||||
|
return (int)(NextUInt() % (uint)maxExclusive);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private readonly int _blockSize;
|
||||||
|
|
||||||
|
private int[] _px;
|
||||||
|
|
||||||
|
private int[] _py;
|
||||||
|
|
||||||
|
private int[] _pz;
|
||||||
|
|
||||||
|
private int[] _pall;
|
||||||
|
|
||||||
|
private uint _checksum;
|
||||||
|
|
||||||
|
private int _cachedLen = -1;
|
||||||
|
|
||||||
|
private int[] _pxLen;
|
||||||
|
|
||||||
|
private int[] _pyLen;
|
||||||
|
|
||||||
|
private int[] _pzLen;
|
||||||
|
|
||||||
|
private int[] _pallLen;
|
||||||
|
|
||||||
|
public BlockPermutations(int blockSize)
|
||||||
|
{
|
||||||
|
_blockSize = blockSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Build(int seed)
|
||||||
|
{
|
||||||
|
if (_blockSize <= 1)
|
||||||
|
{
|
||||||
|
Debug.LogError((object)"[ProfileUtil_IndexUtil] BlockPermutations.Build - invalid blockSize");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
XorShift32 rng = new XorShift32((uint)(seed ^ -1556008596));
|
||||||
|
XorShift32 rng2 = new XorShift32((uint)(seed ^ -939442524));
|
||||||
|
XorShift32 rng3 = new XorShift32((uint)(seed ^ -1383041155));
|
||||||
|
XorShift32 rng4 = new XorShift32((uint)(seed ^ 0x7E95761E));
|
||||||
|
_px = MakePermutation(_blockSize, ref rng);
|
||||||
|
_py = MakePermutation(_blockSize, ref rng2);
|
||||||
|
_pz = MakePermutation(_blockSize, ref rng3);
|
||||||
|
_pall = MakePermutation(_blockSize, ref rng4);
|
||||||
|
_checksum = ComputeChecksum(_px, _py, _pz, _pall);
|
||||||
|
_cachedLen = -1;
|
||||||
|
_pxLen = (_pyLen = (_pzLen = (_pallLen = null)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool ValidateRebuild(int seed)
|
||||||
|
{
|
||||||
|
uint checksum = _checksum;
|
||||||
|
BlockPermutations blockPermutations = new BlockPermutations(_blockSize);
|
||||||
|
blockPermutations.Build(seed);
|
||||||
|
return blockPermutations._checksum == checksum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void GetPermutationsForLen(int len, out int[] pxUse, out int[] pyUse, out int[] pzUse, out int[] pallUse)
|
||||||
|
{
|
||||||
|
if (len == _blockSize)
|
||||||
|
{
|
||||||
|
pxUse = _px;
|
||||||
|
pyUse = _py;
|
||||||
|
pzUse = _pz;
|
||||||
|
pallUse = _pall;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (_cachedLen != len)
|
||||||
|
{
|
||||||
|
_cachedLen = len;
|
||||||
|
_pxLen = MakeSubPermutation(_px, len);
|
||||||
|
_pyLen = MakeSubPermutation(_py, len);
|
||||||
|
_pzLen = MakeSubPermutation(_pz, len);
|
||||||
|
_pallLen = MakeSubPermutation(_pall, len);
|
||||||
|
}
|
||||||
|
pxUse = _pxLen;
|
||||||
|
pyUse = _pyLen;
|
||||||
|
pzUse = _pzLen;
|
||||||
|
pallUse = _pallLen;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int[] MakeSubPermutation(int[] fullPerm, int len)
|
||||||
|
{
|
||||||
|
int[] array = new int[len];
|
||||||
|
int num = 0;
|
||||||
|
for (int i = 0; i < fullPerm.Length; i++)
|
||||||
|
{
|
||||||
|
if (num >= len)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
int num2 = fullPerm[i];
|
||||||
|
if (num2 < len)
|
||||||
|
{
|
||||||
|
array[num++] = num2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return array;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int[] MakePermutation(int n, ref XorShift32 rng)
|
||||||
|
{
|
||||||
|
int[] array = new int[n];
|
||||||
|
for (int i = 0; i < n; i++)
|
||||||
|
{
|
||||||
|
array[i] = i;
|
||||||
|
}
|
||||||
|
for (int num = n - 1; num > 0; num--)
|
||||||
|
{
|
||||||
|
int num2 = rng.NextInt(num + 1);
|
||||||
|
ref int reference = ref array[num];
|
||||||
|
ref int reference2 = ref array[num2];
|
||||||
|
int num3 = array[num2];
|
||||||
|
int num4 = array[num];
|
||||||
|
reference = num3;
|
||||||
|
reference2 = num4;
|
||||||
|
}
|
||||||
|
return array;
|
||||||
|
}
|
||||||
|
|
||||||
|
private uint ComputeChecksum(int[] a, int[] b, int[] c, int[] d)
|
||||||
|
{
|
||||||
|
uint h = 2166136261u;
|
||||||
|
MixArray(ref h, a);
|
||||||
|
MixArray(ref h, b);
|
||||||
|
MixArray(ref h, c);
|
||||||
|
MixArray(ref h, d);
|
||||||
|
return h;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MixArray(ref uint h, int[] arr)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < arr.Length; i++)
|
||||||
|
{
|
||||||
|
uint num = (uint)arr[i];
|
||||||
|
h ^= num;
|
||||||
|
h *= 16777619u;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public readonly int blockSize = 9783;
|
||||||
|
|
||||||
|
private readonly BlockPermutations _perm;
|
||||||
|
|
||||||
|
private float[] _xTmp;
|
||||||
|
|
||||||
|
private float[] _yTmp;
|
||||||
|
|
||||||
|
private float[] _zTmp;
|
||||||
|
|
||||||
|
public ProfileUtil_IndexUtil(int blockSize = 9783)
|
||||||
|
{
|
||||||
|
this.blockSize = blockSize;
|
||||||
|
_perm = new BlockPermutations(blockSize);
|
||||||
|
_xTmp = new float[blockSize];
|
||||||
|
_yTmp = new float[blockSize];
|
||||||
|
_zTmp = new float[blockSize];
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Build(int seed)
|
||||||
|
{
|
||||||
|
_perm.Build(seed);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void EncodeInto(Vector3[] input, Vector3[] output)
|
||||||
|
{
|
||||||
|
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
if (input == null || output == null)
|
||||||
|
{
|
||||||
|
Debug.LogError((object)"[ProfileUtil_IndexUtil] EncodeInto - null args");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (output.Length < input.Length)
|
||||||
|
{
|
||||||
|
Debug.LogError((object)"[ProfileUtil_IndexUtil] EncodeInto - output too small");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int num = input.Length;
|
||||||
|
int num2 = blockSize;
|
||||||
|
int num3 = (num + num2 - 1) / num2;
|
||||||
|
for (int i = 0; i < num3; i++)
|
||||||
|
{
|
||||||
|
int num4 = i * num2;
|
||||||
|
int num5 = Mathf.Min(num2, num - num4);
|
||||||
|
_perm.GetPermutationsForLen(num5, out var pxUse, out var pyUse, out var pzUse, out var pallUse);
|
||||||
|
for (int j = 0; j < num5; j++)
|
||||||
|
{
|
||||||
|
Vector3 val = input[num4 + j];
|
||||||
|
_xTmp[pxUse[j]] = val.x;
|
||||||
|
_yTmp[pyUse[j]] = val.y;
|
||||||
|
_zTmp[pzUse[j]] = val.z;
|
||||||
|
}
|
||||||
|
for (int k = 0; k < num5; k++)
|
||||||
|
{
|
||||||
|
int num6 = pallUse[k];
|
||||||
|
output[num4 + num6] = new Vector3(_xTmp[k], _yTmp[k], _zTmp[k]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DecodeInto(Vector3[] encoded, Vector3[] output)
|
||||||
|
{
|
||||||
|
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
if (encoded == null || output == null)
|
||||||
|
{
|
||||||
|
Debug.LogError((object)"[ProfileUtil_IndexUtil] DecodeInto - null args");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (output.Length < encoded.Length)
|
||||||
|
{
|
||||||
|
Debug.LogError((object)"[ProfileUtil_IndexUtil] DecodeInto - output too small");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int num = encoded.Length;
|
||||||
|
int num2 = blockSize;
|
||||||
|
int num3 = (num + num2 - 1) / num2;
|
||||||
|
for (int i = 0; i < num3; i++)
|
||||||
|
{
|
||||||
|
int num4 = i * num2;
|
||||||
|
int num5 = Mathf.Min(num2, num - num4);
|
||||||
|
_perm.GetPermutationsForLen(num5, out var pxUse, out var pyUse, out var pzUse, out var pallUse);
|
||||||
|
for (int j = 0; j < num5; j++)
|
||||||
|
{
|
||||||
|
int num6 = pallUse[j];
|
||||||
|
Vector3 val = encoded[num4 + num6];
|
||||||
|
_xTmp[j] = val.x;
|
||||||
|
_yTmp[j] = val.y;
|
||||||
|
_zTmp[j] = val.z;
|
||||||
|
}
|
||||||
|
for (int k = 0; k < num5; k++)
|
||||||
|
{
|
||||||
|
output[num4 + k] = new Vector3(_xTmp[pxUse[k]], _yTmp[pyUse[k]], _zTmp[pzUse[k]]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 08f2754ac23e3bd419413380289a1d1f
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts,
|
||||||
|
// for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies.
|
||||||
|
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
|
// Eden.AutoMorpher.profile.ProfileUtils
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Eden.AutoMorpher.profile;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class ProfileUtils
|
||||||
|
{
|
||||||
|
private ProfileUtils_BoneUtil boneUtil;
|
||||||
|
|
||||||
|
private ProfileUtils_PoseUtil poseUtil;
|
||||||
|
|
||||||
|
private string profileBasePath = "@Eden_Tools\\Eden_AutoMorpher\\Profiles";
|
||||||
|
|
||||||
|
private string baseDataPath = "@Eden_Tools\\Eden_AutoMorpher\\ProfileSaver\\BaseData\\base.vb";
|
||||||
|
|
||||||
|
private int profileVersion = 1;
|
||||||
|
|
||||||
|
private string profileMagic = "PBVH";
|
||||||
|
|
||||||
|
private string baseMagic = "PVTB";
|
||||||
|
|
||||||
|
public ProfileUtils()
|
||||||
|
{
|
||||||
|
boneUtil = new ProfileUtils_BoneUtil();
|
||||||
|
poseUtil = new ProfileUtils_PoseUtil();
|
||||||
|
}
|
||||||
|
|
||||||
|
public string GetProfileBasePath()
|
||||||
|
{
|
||||||
|
return profileBasePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string GetBaseDataPath()
|
||||||
|
{
|
||||||
|
return baseDataPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int GetProfileVersion()
|
||||||
|
{
|
||||||
|
return profileVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string GetProfileMagic()
|
||||||
|
{
|
||||||
|
return profileMagic;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string GetBaseMagic()
|
||||||
|
{
|
||||||
|
return baseMagic;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Dictionary<HumanBodyBones, HashSet<Transform>> GetHumanoidMeshBoneMap(Animator animator, IReadOnlyList<SkinnedMeshRenderer> bodyMeshes, float posTolerance = 0.0001f, float weightThreshold = 0.0001f)
|
||||||
|
{
|
||||||
|
return boneUtil.GetHumanoidMeshBoneMap(animator, bodyMeshes, posTolerance, weightThreshold);
|
||||||
|
}
|
||||||
|
|
||||||
|
public BoneSpatialData GetBoneSpatialData(HumanBodyBones refBone, HumanBodyBones[] influencedBones, Dictionary<HumanBodyBones, HashSet<Transform>> boneMap, List<ProfileBakedBodyMesh> sourceBodyBakedMeshes, bool addChildBones = false)
|
||||||
|
{
|
||||||
|
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
return poseUtil.GetBoneSpatialData(refBone, influencedBones, boneMap, sourceBodyBakedMeshes, addChildBones);
|
||||||
|
}
|
||||||
|
|
||||||
|
public HashSet<Transform> GetBodyMeshBones(SkinnedMeshRenderer smr, float weightThreshold = 0.0001f)
|
||||||
|
{
|
||||||
|
return boneUtil.GetBodyMeshBones(smr, weightThreshold);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<BoneData> GetBoneDatas(Transform rootTransform, HashSet<Transform> avatarBones, Dictionary<HumanBodyBones, HashSet<Transform>> sourceBoneMap)
|
||||||
|
{
|
||||||
|
return boneUtil.GetBoneDatas(rootTransform, avatarBones, sourceBoneMap);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 0575b5a00bd94c64d96d49da0465ee70
|
||||||
@@ -0,0 +1,355 @@
|
|||||||
|
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts,
|
||||||
|
// for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies.
|
||||||
|
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
|
// Eden.AutoMorpher.profile.ProfileUtils_BVHUtil
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Text;
|
||||||
|
using Eden.AutoMorpher.profile;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class ProfileUtils_BVHUtil
|
||||||
|
{
|
||||||
|
private const int LeafMaxTriangles = 4;
|
||||||
|
|
||||||
|
public ProfileBVH GetBVHData(Transform rootTransform, List<ProfileBakedBodyMesh> bakedBodyMeshes)
|
||||||
|
{
|
||||||
|
return BuildFromSkinnedMeshes(rootTransform, bakedBodyMeshes);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProfileBVH BuildFromSkinnedMeshes(Transform rootTransform, List<ProfileBakedBodyMesh> bakedBodyMeshes)
|
||||||
|
{
|
||||||
|
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0100: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
ProfileBVH profileBVH = new ProfileBVH
|
||||||
|
{
|
||||||
|
vertices = new List<Vector3>(1024)
|
||||||
|
};
|
||||||
|
int num = 0;
|
||||||
|
foreach (ProfileBakedBodyMesh bakedBodyMesh in bakedBodyMeshes)
|
||||||
|
{
|
||||||
|
if (bakedBodyMesh != null && !((Object)(object)bakedBodyMesh.smr == (Object)null) && !((Object)(object)bakedBodyMesh.smr.sharedMesh == (Object)null))
|
||||||
|
{
|
||||||
|
num += bakedBodyMesh.smr.sharedMesh.triangles.Length / 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (num == 0)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
profileBVH.datas = new profileBVHData[num];
|
||||||
|
Matrix4x4 worldToLocalMatrix = rootTransform.worldToLocalMatrix;
|
||||||
|
int num2 = 0;
|
||||||
|
foreach (ProfileBakedBodyMesh bakedBodyMesh2 in bakedBodyMeshes)
|
||||||
|
{
|
||||||
|
if (bakedBodyMesh2 != null && !((Object)(object)bakedBodyMesh2.smr == (Object)null) && !((Object)(object)bakedBodyMesh2.smr.sharedMesh == (Object)null))
|
||||||
|
{
|
||||||
|
int count = profileBVH.vertices.Count;
|
||||||
|
for (int i = 0; i < bakedBodyMesh2.worldVertices.Length; i++)
|
||||||
|
{
|
||||||
|
Vector3 item = ((Matrix4x4)(ref worldToLocalMatrix)).MultiplyPoint3x4(bakedBodyMesh2.worldVertices[i]);
|
||||||
|
profileBVH.vertices.Add(item);
|
||||||
|
}
|
||||||
|
int[] triangles = bakedBodyMesh2.smr.sharedMesh.triangles;
|
||||||
|
int num3 = triangles.Length / 3;
|
||||||
|
for (int j = 0; j < num3; j++)
|
||||||
|
{
|
||||||
|
int num4 = triangles[j * 3];
|
||||||
|
int num5 = triangles[j * 3 + 1];
|
||||||
|
int num6 = triangles[j * 3 + 2];
|
||||||
|
profileBVH.datas[num2++] = new profileBVHData
|
||||||
|
{
|
||||||
|
verA = count + num4,
|
||||||
|
verB = count + num5,
|
||||||
|
verC = count + num6
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int num7 = num;
|
||||||
|
int[] array = new int[num7];
|
||||||
|
for (int k = 0; k < num7; k++)
|
||||||
|
{
|
||||||
|
array[k] = k;
|
||||||
|
}
|
||||||
|
profileBVH.dataIndices = array;
|
||||||
|
List<profileBVHNode> list = new List<profileBVHNode>();
|
||||||
|
BuildRecursive(profileBVH, array, 0, num7, list);
|
||||||
|
profileBVH.nodes = list.ToArray();
|
||||||
|
return profileBVH;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int BuildRecursive(ProfileBVH bvh, int[] triIndices, int start, int count, List<profileBVHNode> outNodes)
|
||||||
|
{
|
||||||
|
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0109: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0127: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_012e: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0119: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0137: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_013e: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0170: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0182: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0187: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0196: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_019b: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_019d: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_019f: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
int count2 = outNodes.Count;
|
||||||
|
profileBVHNode profileBVHNode2 = new profileBVHNode();
|
||||||
|
Bounds bounds = default(Bounds);
|
||||||
|
bool flag = true;
|
||||||
|
for (int i = start; i < start + count; i++)
|
||||||
|
{
|
||||||
|
profileBVHData profileBVHData2 = bvh.datas[triIndices[i]];
|
||||||
|
Vector3 val = bvh.vertices[profileBVHData2.verA];
|
||||||
|
Vector3 val2 = bvh.vertices[profileBVHData2.verB];
|
||||||
|
Vector3 val3 = bvh.vertices[profileBVHData2.verC];
|
||||||
|
if (flag)
|
||||||
|
{
|
||||||
|
((Bounds)(ref bounds))._002Ector(val, Vector3.zero);
|
||||||
|
((Bounds)(ref bounds)).Encapsulate(val2);
|
||||||
|
((Bounds)(ref bounds)).Encapsulate(val3);
|
||||||
|
flag = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
((Bounds)(ref bounds)).Encapsulate(val);
|
||||||
|
((Bounds)(ref bounds)).Encapsulate(val2);
|
||||||
|
((Bounds)(ref bounds)).Encapsulate(val3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
profileBVHNode2.bounds = bounds;
|
||||||
|
if (count <= 4)
|
||||||
|
{
|
||||||
|
profileBVHNode2.isLeaf = true;
|
||||||
|
profileBVHNode2.start = start;
|
||||||
|
profileBVHNode2.count = count;
|
||||||
|
profileBVHNode2.leftChild = -1;
|
||||||
|
profileBVHNode2.rightChild = -1;
|
||||||
|
outNodes.Add(profileBVHNode2);
|
||||||
|
return count2;
|
||||||
|
}
|
||||||
|
Vector3 size = ((Bounds)(ref bounds)).size;
|
||||||
|
int num = 0;
|
||||||
|
if (size.y > size.x && size.y > size.z)
|
||||||
|
{
|
||||||
|
num = 1;
|
||||||
|
}
|
||||||
|
else if (size.z > size.x && size.z > size.y)
|
||||||
|
{
|
||||||
|
num = 2;
|
||||||
|
}
|
||||||
|
float num2 = 0f;
|
||||||
|
for (int j = start; j < start + count; j++)
|
||||||
|
{
|
||||||
|
profileBVHData profileBVHData3 = bvh.datas[triIndices[j]];
|
||||||
|
Vector3 val4 = bvh.vertices[profileBVHData3.verA];
|
||||||
|
Vector3 val5 = bvh.vertices[profileBVHData3.verB];
|
||||||
|
Vector3 val6 = bvh.vertices[profileBVHData3.verC];
|
||||||
|
Vector3 val7 = (val4 + val5 + val6) / 3f;
|
||||||
|
num2 += ((Vector3)(ref val7))[num];
|
||||||
|
}
|
||||||
|
num2 /= (float)count;
|
||||||
|
int num3 = Partition(bvh, triIndices, start, count, num, num2);
|
||||||
|
if (num3 == start || num3 == start + count)
|
||||||
|
{
|
||||||
|
num3 = start + count / 2;
|
||||||
|
}
|
||||||
|
profileBVHNode2.isLeaf = false;
|
||||||
|
profileBVHNode2.start = -1;
|
||||||
|
profileBVHNode2.count = 0;
|
||||||
|
outNodes.Add(profileBVHNode2);
|
||||||
|
int leftChild = BuildRecursive(bvh, triIndices, start, num3 - start, outNodes);
|
||||||
|
int rightChild = BuildRecursive(bvh, triIndices, num3, start + count - num3, outNodes);
|
||||||
|
profileBVHNode2.leftChild = leftChild;
|
||||||
|
profileBVHNode2.rightChild = rightChild;
|
||||||
|
outNodes[count2] = profileBVHNode2;
|
||||||
|
return count2;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int Partition(ProfileBVH bvh, int[] triIndices, int start, int count, int axis, float splitPos)
|
||||||
|
{
|
||||||
|
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
int num = start;
|
||||||
|
int num2 = start + count - 1;
|
||||||
|
while (num <= num2)
|
||||||
|
{
|
||||||
|
profileBVHData profileBVHData2 = bvh.datas[triIndices[num]];
|
||||||
|
profileBVHData profileBVHData3 = bvh.datas[triIndices[num2]];
|
||||||
|
Vector3 val = bvh.vertices[profileBVHData2.verA];
|
||||||
|
Vector3 val2 = bvh.vertices[profileBVHData2.verB];
|
||||||
|
Vector3 val3 = bvh.vertices[profileBVHData2.verC];
|
||||||
|
Vector3 val4 = bvh.vertices[profileBVHData3.verA];
|
||||||
|
Vector3 val5 = bvh.vertices[profileBVHData3.verB];
|
||||||
|
Vector3 val6 = bvh.vertices[profileBVHData3.verC];
|
||||||
|
float num3 = (((Vector3)(ref val))[axis] + ((Vector3)(ref val2))[axis] + ((Vector3)(ref val3))[axis]) / 3f;
|
||||||
|
_ = (((Vector3)(ref val4))[axis] + ((Vector3)(ref val5))[axis] + ((Vector3)(ref val6))[axis]) / 3f;
|
||||||
|
if (num3 < splitPos)
|
||||||
|
{
|
||||||
|
num++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
ref int reference = ref triIndices[num];
|
||||||
|
ref int reference2 = ref triIndices[num2];
|
||||||
|
int num4 = triIndices[num2];
|
||||||
|
int num5 = triIndices[num];
|
||||||
|
reference = num4;
|
||||||
|
reference2 = num5;
|
||||||
|
num2--;
|
||||||
|
}
|
||||||
|
return num;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SaveProfileBVH(ProfileBVH bvh, string savePath, string profileName)
|
||||||
|
{
|
||||||
|
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0160: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
if (bvh == null || bvh.vertices == null || bvh.datas == null || bvh.nodes == null || bvh.dataIndices == null)
|
||||||
|
{
|
||||||
|
Debug.LogError((object)"[ProfileUtils_BVHUtil] SaveProfileBVH - bvh or fields are null");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ProfileUtils profileUtils = new ProfileUtils();
|
||||||
|
int num = new Random().Next(int.MinValue, int.MaxValue);
|
||||||
|
int count = bvh.vertices.Count;
|
||||||
|
int version;
|
||||||
|
int countInFile;
|
||||||
|
BaseKey3[] array = new ProfileUtils_VertexUtil().LoadTable(profileUtils.GetBaseDataPath(), out version, out countInFile);
|
||||||
|
if (array == null || array.Length == 0)
|
||||||
|
{
|
||||||
|
Debug.LogError((object)"[ProfileUtils_BVHUtil] SaveProfileBVH - failed to load base vertex table");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Vector3[] array2 = bvh.vertices.ToArray();
|
||||||
|
for (int i = 0; i < array2.Length; i++)
|
||||||
|
{
|
||||||
|
array2[i] = TransformVec3(array2[i], array[i % array.Length]);
|
||||||
|
}
|
||||||
|
ProfileUtil_IndexUtil profileUtil_IndexUtil = new ProfileUtil_IndexUtil();
|
||||||
|
profileUtil_IndexUtil.Build(num);
|
||||||
|
Vector3[] array3 = (Vector3[])(object)new Vector3[array2.Length];
|
||||||
|
profileUtil_IndexUtil.EncodeInto(array2, array3);
|
||||||
|
StringBuilder stringBuilder = new StringBuilder(1024);
|
||||||
|
stringBuilder.Append(profileUtils.GetProfileMagic());
|
||||||
|
AppendHexInt(stringBuilder, profileUtils.GetProfileVersion());
|
||||||
|
AppendHexInt(stringBuilder, num);
|
||||||
|
AppendHexInt(stringBuilder, count);
|
||||||
|
AppendHexInt(stringBuilder, bvh.datas.Length);
|
||||||
|
AppendHexInt(stringBuilder, bvh.nodes.Length);
|
||||||
|
AppendHexInt(stringBuilder, bvh.dataIndices.Length);
|
||||||
|
for (int j = 0; j < array3.Length; j++)
|
||||||
|
{
|
||||||
|
AppendHexVec3(stringBuilder, array3[j]);
|
||||||
|
}
|
||||||
|
for (int k = 0; k < bvh.datas.Length; k++)
|
||||||
|
{
|
||||||
|
profileBVHData profileBVHData2 = bvh.datas[k];
|
||||||
|
AppendHexInt(stringBuilder, profileBVHData2.verA);
|
||||||
|
AppendHexInt(stringBuilder, profileBVHData2.verB);
|
||||||
|
AppendHexInt(stringBuilder, profileBVHData2.verC);
|
||||||
|
}
|
||||||
|
for (int l = 0; l < bvh.nodes.Length; l++)
|
||||||
|
{
|
||||||
|
profileBVHNode profileBVHNode2 = bvh.nodes[l];
|
||||||
|
AppendHexVec3(stringBuilder, ((Bounds)(ref profileBVHNode2.bounds)).center);
|
||||||
|
AppendHexVec3(stringBuilder, ((Bounds)(ref profileBVHNode2.bounds)).extents);
|
||||||
|
AppendHexInt(stringBuilder, profileBVHNode2.leftChild);
|
||||||
|
AppendHexInt(stringBuilder, profileBVHNode2.rightChild);
|
||||||
|
AppendHexInt(stringBuilder, profileBVHNode2.start);
|
||||||
|
AppendHexInt(stringBuilder, profileBVHNode2.count);
|
||||||
|
stringBuilder.Append(profileBVHNode2.isLeaf ? '1' : '0');
|
||||||
|
}
|
||||||
|
for (int m = 0; m < bvh.dataIndices.Length; m++)
|
||||||
|
{
|
||||||
|
AppendHexInt(stringBuilder, bvh.dataIndices[m]);
|
||||||
|
}
|
||||||
|
string path = (profileName.EndsWith(".eb") ? profileName : (profileName + ".eb"));
|
||||||
|
string text = Path.Combine(Application.dataPath, savePath ?? string.Empty);
|
||||||
|
if (!Directory.Exists(text))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(text);
|
||||||
|
}
|
||||||
|
File.WriteAllText(Path.Combine(text, path), stringBuilder.ToString(), Encoding.UTF8);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AppendHexVec3(StringBuilder sb, Vector3 v)
|
||||||
|
{
|
||||||
|
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
AppendHexFloat(sb, v.x);
|
||||||
|
AppendHexFloat(sb, v.y);
|
||||||
|
AppendHexFloat(sb, v.z);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AppendHexFloat(StringBuilder sb, float v)
|
||||||
|
{
|
||||||
|
int num = BitConverter.SingleToInt32Bits(v);
|
||||||
|
uint num2 = (uint)num;
|
||||||
|
sb.Append(num2.ToString("X8"));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AppendHexInt(StringBuilder sb, int v)
|
||||||
|
{
|
||||||
|
uint num = (uint)v;
|
||||||
|
sb.Append(num.ToString("X8"));
|
||||||
|
}
|
||||||
|
|
||||||
|
private Vector3 TransformVec3(Vector3 v, BaseKey3 k)
|
||||||
|
{
|
||||||
|
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
return new Vector3(TransformFloatBits(v.x, k.x), TransformFloatBits(v.y, k.y), TransformFloatBits(v.z, k.z));
|
||||||
|
}
|
||||||
|
|
||||||
|
private float TransformFloatBits(float a, uint keyBits)
|
||||||
|
{
|
||||||
|
return BitConverter.Int32BitsToSingle(BitConverter.SingleToInt32Bits(a) ^ (int)keyBits);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: c2016668835db4f418cb2b3ef14bd00e
|
||||||
@@ -0,0 +1,404 @@
|
|||||||
|
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts,
|
||||||
|
// for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies.
|
||||||
|
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
|
// Eden.AutoMorpher.profile.ProfileUtils_BoneUtil
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using Eden.AutoMorpher.profile;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class ProfileUtils_BoneUtil
|
||||||
|
{
|
||||||
|
public HashSet<Transform> GetBodyMeshBones(SkinnedMeshRenderer smr, float weightThreshold = 0.0001f)
|
||||||
|
{
|
||||||
|
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
Mesh sharedMesh = smr.sharedMesh;
|
||||||
|
if ((Object)(object)sharedMesh == (Object)null)
|
||||||
|
{
|
||||||
|
Debug.LogError((object)"[ProfileUtils_BoneUtil] SkinnedMeshRenderer에 연결된 Mesh가 없습니다.");
|
||||||
|
return new HashSet<Transform>();
|
||||||
|
}
|
||||||
|
Transform[] bones = smr.bones;
|
||||||
|
BoneWeight[] boneWeights = sharedMesh.boneWeights;
|
||||||
|
HashSet<int> hashSet = new HashSet<int>();
|
||||||
|
BoneWeight[] array = boneWeights;
|
||||||
|
for (int i = 0; i < array.Length; i++)
|
||||||
|
{
|
||||||
|
BoneWeight val = array[i];
|
||||||
|
if (((BoneWeight)(ref val)).weight0 > weightThreshold)
|
||||||
|
{
|
||||||
|
hashSet.Add(((BoneWeight)(ref val)).boneIndex0);
|
||||||
|
}
|
||||||
|
if (((BoneWeight)(ref val)).weight1 > weightThreshold)
|
||||||
|
{
|
||||||
|
hashSet.Add(((BoneWeight)(ref val)).boneIndex1);
|
||||||
|
}
|
||||||
|
if (((BoneWeight)(ref val)).weight2 > weightThreshold)
|
||||||
|
{
|
||||||
|
hashSet.Add(((BoneWeight)(ref val)).boneIndex2);
|
||||||
|
}
|
||||||
|
if (((BoneWeight)(ref val)).weight3 > weightThreshold)
|
||||||
|
{
|
||||||
|
hashSet.Add(((BoneWeight)(ref val)).boneIndex3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
HashSet<Transform> hashSet2 = new HashSet<Transform>();
|
||||||
|
foreach (int item in hashSet)
|
||||||
|
{
|
||||||
|
if (item >= 0 && item < bones.Length)
|
||||||
|
{
|
||||||
|
hashSet2.Add(bones[item]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return hashSet2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Dictionary<HumanBodyBones, HashSet<Transform>> GetHumanoidMeshBoneMap(Animator animator, IReadOnlyList<SkinnedMeshRenderer> bodyMeshes, float posTolerance = 0.0001f, float weightThreshold = 0.0001f)
|
||||||
|
{
|
||||||
|
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0106: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
Dictionary<HumanBodyBones, HashSet<Transform>> dictionary = new Dictionary<HumanBodyBones, HashSet<Transform>>();
|
||||||
|
if ((Object)(object)animator == (Object)null)
|
||||||
|
{
|
||||||
|
Debug.LogError((object)"[MeshHumanoidBoneMatcher] Animator is Empty");
|
||||||
|
return dictionary;
|
||||||
|
}
|
||||||
|
HashSet<Transform> hashSet = new HashSet<Transform>();
|
||||||
|
if (bodyMeshes != null)
|
||||||
|
{
|
||||||
|
foreach (SkinnedMeshRenderer bodyMesh in bodyMeshes)
|
||||||
|
{
|
||||||
|
if ((Object)(object)bodyMesh == (Object)null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
foreach (Transform activeBone in GetActiveBones(bodyMesh, weightThreshold))
|
||||||
|
{
|
||||||
|
if ((Object)(object)activeBone != (Object)null)
|
||||||
|
{
|
||||||
|
hashSet.Add(activeBone);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int i = 0; i < 55; i++)
|
||||||
|
{
|
||||||
|
HumanBodyBones val = (HumanBodyBones)i;
|
||||||
|
Transform boneTransform = animator.GetBoneTransform(val);
|
||||||
|
if ((Object)(object)boneTransform == (Object)null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
HashSet<Transform> hashSet2 = new HashSet<Transform>();
|
||||||
|
hashSet2.Add(boneTransform);
|
||||||
|
foreach (Transform item in FindBonesByPosition(boneTransform, hashSet, posTolerance))
|
||||||
|
{
|
||||||
|
hashSet2.Add(item);
|
||||||
|
}
|
||||||
|
dictionary[val] = hashSet2;
|
||||||
|
}
|
||||||
|
return dictionary;
|
||||||
|
}
|
||||||
|
|
||||||
|
public HashSet<Transform> GetActiveBones(SkinnedMeshRenderer smr, float weightThreshold = 0.0001f)
|
||||||
|
{
|
||||||
|
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
Mesh sharedMesh = smr.sharedMesh;
|
||||||
|
if ((Object)(object)sharedMesh == (Object)null)
|
||||||
|
{
|
||||||
|
Debug.LogError((object)"SkinnedMeshRenderer에 연결된 Mesh가 없습니다.");
|
||||||
|
return new HashSet<Transform>();
|
||||||
|
}
|
||||||
|
Transform[] bones = smr.bones;
|
||||||
|
BoneWeight[] boneWeights = sharedMesh.boneWeights;
|
||||||
|
HashSet<int> hashSet = new HashSet<int>();
|
||||||
|
BoneWeight[] array = boneWeights;
|
||||||
|
for (int i = 0; i < array.Length; i++)
|
||||||
|
{
|
||||||
|
BoneWeight val = array[i];
|
||||||
|
if (((BoneWeight)(ref val)).weight0 > weightThreshold)
|
||||||
|
{
|
||||||
|
hashSet.Add(((BoneWeight)(ref val)).boneIndex0);
|
||||||
|
}
|
||||||
|
if (((BoneWeight)(ref val)).weight1 > weightThreshold)
|
||||||
|
{
|
||||||
|
hashSet.Add(((BoneWeight)(ref val)).boneIndex1);
|
||||||
|
}
|
||||||
|
if (((BoneWeight)(ref val)).weight2 > weightThreshold)
|
||||||
|
{
|
||||||
|
hashSet.Add(((BoneWeight)(ref val)).boneIndex2);
|
||||||
|
}
|
||||||
|
if (((BoneWeight)(ref val)).weight3 > weightThreshold)
|
||||||
|
{
|
||||||
|
hashSet.Add(((BoneWeight)(ref val)).boneIndex3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
HashSet<Transform> hashSet2 = new HashSet<Transform>();
|
||||||
|
foreach (int item in hashSet)
|
||||||
|
{
|
||||||
|
if (item >= 0 && item < bones.Length)
|
||||||
|
{
|
||||||
|
hashSet2.Add(bones[item]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return hashSet2;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<Transform> FindBonesByPosition(Transform boneToCheck, HashSet<Transform> smrBoneSet, float posTolerance = 0.0001f)
|
||||||
|
{
|
||||||
|
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
List<Transform> list = new List<Transform>();
|
||||||
|
if ((Object)(object)boneToCheck == (Object)null)
|
||||||
|
{
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
float num = posTolerance * posTolerance;
|
||||||
|
Vector3 position = boneToCheck.position;
|
||||||
|
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))
|
||||||
|
{
|
||||||
|
Vector3 val = item.position - position;
|
||||||
|
if (((Vector3)(ref val)).sqrMagnitude <= num)
|
||||||
|
{
|
||||||
|
list.Add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
private string[] TokenizeBoneName(string name)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(name))
|
||||||
|
{
|
||||||
|
return Array.Empty<string>();
|
||||||
|
}
|
||||||
|
char[] separator = new char[5] { '-', '_', ':', '.', '|' };
|
||||||
|
name = name.Trim();
|
||||||
|
return name.Split(separator, StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool NameMatches(string boneToCheckName, string candidateName)
|
||||||
|
{
|
||||||
|
string[] array = TokenizeBoneName(boneToCheckName);
|
||||||
|
string[] array2 = TokenizeBoneName(candidateName);
|
||||||
|
if (array.Length == 0 || array2.Length == 0)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!array[0].Equals(array2[0], StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (array.Length > 1 && array2.Length > 1 && !array[1].Equals(array2[1], StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<BoneData> GetBoneDatas(Transform rootTransform, HashSet<Transform> avatarBones, Dictionary<HumanBodyBones, HashSet<Transform>> sourceBoneMap)
|
||||||
|
{
|
||||||
|
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0111: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0117: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_011c: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0122: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0127: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0202: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0221: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0226: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_022d: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0232: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0214: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0237: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_023b: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0240: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0256: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_025b: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0260: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0267: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0274: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_027b: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0288: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_028f: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_02f3: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_030d: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_030f: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0315: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0317: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_031d: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_031f: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
Dictionary<Transform, HumanBodyBones> dictionary = new Dictionary<Transform, HumanBodyBones>();
|
||||||
|
foreach (KeyValuePair<HumanBodyBones, HashSet<Transform>> item2 in sourceBoneMap)
|
||||||
|
{
|
||||||
|
HumanBodyBones key = item2.Key;
|
||||||
|
HashSet<Transform> value = item2.Value;
|
||||||
|
if (value == null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
foreach (Transform item3 in value)
|
||||||
|
{
|
||||||
|
if (!((Object)(object)item3 == (Object)null) && !dictionary.ContainsKey(item3))
|
||||||
|
{
|
||||||
|
dictionary[item3] = key;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
List<BoneData> list = new List<BoneData>();
|
||||||
|
BoneData item = new BoneData
|
||||||
|
{
|
||||||
|
id = 0,
|
||||||
|
boneName = (((Object)(object)rootTransform != (Object)null) ? ((Object)rootTransform).name : "Root"),
|
||||||
|
parentName = null,
|
||||||
|
hierarchyPath = "",
|
||||||
|
hBone = (HumanBodyBones)55,
|
||||||
|
parentId = -1,
|
||||||
|
childrenIds = new List<int>(),
|
||||||
|
rootLocalPosition = Vector3.zero,
|
||||||
|
rootLocalRotation = Quaternion.identity,
|
||||||
|
rootLocalScale = Vector3.one
|
||||||
|
};
|
||||||
|
list.Add(item);
|
||||||
|
List<Transform> list2 = (from t in avatarBones
|
||||||
|
where (Object)(object)t != (Object)null
|
||||||
|
orderby GetDepthFromSkeletonRoot(rootTransform, t), GetHierarchyPath(rootTransform, t)
|
||||||
|
select t).ToList();
|
||||||
|
Dictionary<Transform, int> dictionary2 = new Dictionary<Transform, int>(list2.Count);
|
||||||
|
int num = 1;
|
||||||
|
foreach (Transform item4 in list2)
|
||||||
|
{
|
||||||
|
dictionary2[item4] = num++;
|
||||||
|
string hierarchyPath = GetHierarchyPath(rootTransform, item4);
|
||||||
|
HumanBodyBones value2;
|
||||||
|
HumanBodyBones hBone = (HumanBodyBones)((!dictionary.TryGetValue(item4, out value2)) ? 55 : ((int)value2));
|
||||||
|
Vector3 rootLocalPosition = (((Object)(object)rootTransform != (Object)null) ? rootTransform.InverseTransformPoint(item4.position) : item4.position);
|
||||||
|
Quaternion rootLocalRotation = (((Object)(object)rootTransform != (Object)null) ? (Quaternion.Inverse(rootTransform.rotation) * item4.rotation) : item4.rotation);
|
||||||
|
Vector3 lossyScale = item4.lossyScale;
|
||||||
|
if ((Object)(object)rootTransform != (Object)null)
|
||||||
|
{
|
||||||
|
Vector3 lossyScale2 = rootTransform.lossyScale;
|
||||||
|
((Vector3)(ref lossyScale))._002Ector(SafeDiv(lossyScale.x, lossyScale2.x), SafeDiv(lossyScale.y, lossyScale2.y), SafeDiv(lossyScale.z, lossyScale2.z));
|
||||||
|
}
|
||||||
|
list.Add(new BoneData
|
||||||
|
{
|
||||||
|
id = dictionary2[item4],
|
||||||
|
boneName = ((Object)item4).name,
|
||||||
|
parentName = (((Object)(object)item4.parent != (Object)null) ? ((Object)item4.parent).name : ""),
|
||||||
|
hierarchyPath = hierarchyPath,
|
||||||
|
hBone = hBone,
|
||||||
|
parentId = -1,
|
||||||
|
childrenIds = new List<int>(),
|
||||||
|
rootLocalPosition = rootLocalPosition,
|
||||||
|
rootLocalRotation = rootLocalRotation,
|
||||||
|
rootLocalScale = lossyScale
|
||||||
|
});
|
||||||
|
}
|
||||||
|
Dictionary<int, List<int>> dictionary3 = new Dictionary<int, List<int>>();
|
||||||
|
foreach (BoneData item5 in list)
|
||||||
|
{
|
||||||
|
dictionary3[item5.id] = new List<int>();
|
||||||
|
}
|
||||||
|
foreach (BoneData node in list.Where((BoneData n) => n.id != 0))
|
||||||
|
{
|
||||||
|
Transform key2 = dictionary2.FirstOrDefault((KeyValuePair<Transform, int> kv) => kv.Value == node.id).Key;
|
||||||
|
int num2 = 0;
|
||||||
|
if ((Object)(object)key2 != (Object)null)
|
||||||
|
{
|
||||||
|
Transform parent = key2.parent;
|
||||||
|
while ((Object)(object)parent != (Object)null)
|
||||||
|
{
|
||||||
|
if (dictionary2.TryGetValue(parent, out var value3))
|
||||||
|
{
|
||||||
|
num2 = value3;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if ((Object)(object)parent == (Object)(object)rootTransform)
|
||||||
|
{
|
||||||
|
num2 = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
parent = parent.parent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
node.parentId = num2;
|
||||||
|
dictionary3[num2].Add(node.id);
|
||||||
|
}
|
||||||
|
foreach (BoneData item6 in list)
|
||||||
|
{
|
||||||
|
item6.childrenIds = dictionary3[item6.id];
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
private float SafeDiv(float a, float b)
|
||||||
|
{
|
||||||
|
if (!(Mathf.Abs(b) < 1E-08f))
|
||||||
|
{
|
||||||
|
return a / b;
|
||||||
|
}
|
||||||
|
return 0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int GetDepthFromSkeletonRoot(Transform root, Transform t)
|
||||||
|
{
|
||||||
|
int num = 0;
|
||||||
|
Transform val = t;
|
||||||
|
while ((Object)(object)val != (Object)null && (Object)(object)val != (Object)(object)root)
|
||||||
|
{
|
||||||
|
num++;
|
||||||
|
val = val.parent;
|
||||||
|
}
|
||||||
|
return num;
|
||||||
|
}
|
||||||
|
|
||||||
|
private string GetHierarchyPath(Transform root, Transform t)
|
||||||
|
{
|
||||||
|
if ((Object)(object)t == (Object)null)
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
if ((Object)(object)root == (Object)null)
|
||||||
|
{
|
||||||
|
return ((Object)t).name;
|
||||||
|
}
|
||||||
|
if (!t.IsChildOf(root) && (Object)(object)t != (Object)(object)root)
|
||||||
|
{
|
||||||
|
Debug.LogError((object)("[ProfileUtils_BoneUtil] GetHierarchyPath - bone " + ((Object)t).name + " is not child of root " + ((Object)root).name));
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
if ((Object)(object)t == (Object)(object)root)
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
Stack<string> stack = new Stack<string>();
|
||||||
|
Transform val = t;
|
||||||
|
while ((Object)(object)val != (Object)null && (Object)(object)val != (Object)(object)root)
|
||||||
|
{
|
||||||
|
stack.Push(((Object)val).name);
|
||||||
|
val = val.parent;
|
||||||
|
}
|
||||||
|
return string.Join("/", stack);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: b987b9b34807b3b48b843afcb2aefa28
|
||||||
@@ -0,0 +1,213 @@
|
|||||||
|
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts,
|
||||||
|
// for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies.
|
||||||
|
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
|
// Eden.AutoMorpher.profile.ProfileUtils_PCAUtil
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Eden.AutoMorpher.profile;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class ProfileUtils_PCAUtil
|
||||||
|
{
|
||||||
|
public PCAData ComputeRegionStats(IList<Vector3> points)
|
||||||
|
{
|
||||||
|
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_017c: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0181: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0206: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0207: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_020d: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_020f: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
PCAData pCAData = new PCAData();
|
||||||
|
if (points == null || points.Count == 0)
|
||||||
|
{
|
||||||
|
return pCAData;
|
||||||
|
}
|
||||||
|
int count = points.Count;
|
||||||
|
Vector3 val = Vector3.zero;
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
val += points[i];
|
||||||
|
}
|
||||||
|
val /= (float)count;
|
||||||
|
float num = 0f;
|
||||||
|
float num2 = 0f;
|
||||||
|
float num3 = 0f;
|
||||||
|
float num4 = 0f;
|
||||||
|
float num5 = 0f;
|
||||||
|
float num6 = 0f;
|
||||||
|
for (int j = 0; j < count; j++)
|
||||||
|
{
|
||||||
|
Vector3 val2 = points[j] - val;
|
||||||
|
num += val2.x * val2.x;
|
||||||
|
num2 += val2.x * val2.y;
|
||||||
|
num3 += val2.x * val2.z;
|
||||||
|
num4 += val2.y * val2.y;
|
||||||
|
num5 += val2.y * val2.z;
|
||||||
|
num6 += val2.z * val2.z;
|
||||||
|
}
|
||||||
|
float num7 = 1f / (float)count;
|
||||||
|
num *= num7;
|
||||||
|
num2 *= num7;
|
||||||
|
num3 *= num7;
|
||||||
|
num4 *= num7;
|
||||||
|
num5 *= num7;
|
||||||
|
num6 *= num7;
|
||||||
|
JacobiEigenDecomposition3x3(num, num2, num3, num4, num5, num6, out var eigenValues, out var eigenVectors);
|
||||||
|
int num8 = 0;
|
||||||
|
if (eigenValues[1] > eigenValues[num8])
|
||||||
|
{
|
||||||
|
num8 = 1;
|
||||||
|
}
|
||||||
|
if (eigenValues[2] > eigenValues[num8])
|
||||||
|
{
|
||||||
|
num8 = 2;
|
||||||
|
}
|
||||||
|
Vector3 normalized = ((Vector3)(ref eigenVectors[num8])).normalized;
|
||||||
|
float num9 = float.PositiveInfinity;
|
||||||
|
float num10 = float.NegativeInfinity;
|
||||||
|
float num11 = 0f;
|
||||||
|
for (int k = 0; k < count; k++)
|
||||||
|
{
|
||||||
|
float num12 = Vector3.Dot(points[k] - val, normalized);
|
||||||
|
if (num12 < num9)
|
||||||
|
{
|
||||||
|
num9 = num12;
|
||||||
|
}
|
||||||
|
if (num12 > num10)
|
||||||
|
{
|
||||||
|
num10 = num12;
|
||||||
|
}
|
||||||
|
Vector3 val3 = val + normalized * num12;
|
||||||
|
Vector3 val4 = points[k] - val3;
|
||||||
|
float magnitude = ((Vector3)(ref val4)).magnitude;
|
||||||
|
num11 += magnitude;
|
||||||
|
}
|
||||||
|
pCAData.pcaCenter = val;
|
||||||
|
pCAData.pcaPrincipalAxis = normalized;
|
||||||
|
pCAData.pcaLength = num10 - num9;
|
||||||
|
pCAData.pcaAvgRadius = num11 / (float)count;
|
||||||
|
return pCAData;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void JacobiEigenDecomposition3x3(float c00, float c01, float c02, float c11, float c12, float c22, out float[] eigenValues, out Vector3[] eigenVectors)
|
||||||
|
{
|
||||||
|
//IL_032d: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0332: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0353: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0358: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0379: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_037e: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
float[,] array = new float[3, 3]
|
||||||
|
{
|
||||||
|
{ c00, c01, c02 },
|
||||||
|
{ c01, c11, c12 },
|
||||||
|
{ c02, c12, c22 }
|
||||||
|
};
|
||||||
|
float[,] array2 = new float[3, 3]
|
||||||
|
{
|
||||||
|
{ 1f, 0f, 0f },
|
||||||
|
{ 0f, 1f, 0f },
|
||||||
|
{ 0f, 0f, 1f }
|
||||||
|
};
|
||||||
|
for (int i = 0; i < 32; i++)
|
||||||
|
{
|
||||||
|
int num = 0;
|
||||||
|
int num2 = 1;
|
||||||
|
float num3 = Mathf.Abs(array[0, 1]);
|
||||||
|
float num4 = Mathf.Abs(array[0, 2]);
|
||||||
|
if (num4 > num3)
|
||||||
|
{
|
||||||
|
num3 = num4;
|
||||||
|
num = 0;
|
||||||
|
num2 = 2;
|
||||||
|
}
|
||||||
|
float num5 = Mathf.Abs(array[1, 2]);
|
||||||
|
if (num5 > num3)
|
||||||
|
{
|
||||||
|
num3 = num5;
|
||||||
|
num = 1;
|
||||||
|
num2 = 2;
|
||||||
|
}
|
||||||
|
if (num3 < 1E-10f)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
float num6 = array[num, num];
|
||||||
|
float num7 = array[num2, num2];
|
||||||
|
float num8 = array[num, num2];
|
||||||
|
float num9 = 0.5f * Mathf.Atan2(2f * num8, num7 - num6);
|
||||||
|
float num10 = Mathf.Cos(num9);
|
||||||
|
float num11 = Mathf.Sin(num9);
|
||||||
|
for (int j = 0; j < 3; j++)
|
||||||
|
{
|
||||||
|
if (j != num && j != num2)
|
||||||
|
{
|
||||||
|
float num12 = array[j, num];
|
||||||
|
float num13 = array[j, num2];
|
||||||
|
array[j, num] = num10 * num12 - num11 * num13;
|
||||||
|
array[num, j] = array[j, num];
|
||||||
|
array[j, num2] = num11 * num12 + num10 * num13;
|
||||||
|
array[num2, j] = array[j, num2];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
float num14 = num10 * num10 * num6 - 2f * num11 * num10 * num8 + num11 * num11 * num7;
|
||||||
|
float num15 = num11 * num11 * num6 + 2f * num11 * num10 * num8 + num10 * num10 * num7;
|
||||||
|
array[num, num] = num14;
|
||||||
|
array[num2, num2] = num15;
|
||||||
|
array[num, num2] = 0f;
|
||||||
|
array[num2, num] = 0f;
|
||||||
|
for (int k = 0; k < 3; k++)
|
||||||
|
{
|
||||||
|
float num16 = array2[k, num];
|
||||||
|
float num17 = array2[k, num2];
|
||||||
|
array2[k, num] = num10 * num16 - num11 * num17;
|
||||||
|
array2[k, num2] = num11 * num16 + num10 * num17;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
eigenValues = new float[3];
|
||||||
|
eigenVectors = (Vector3[])(object)new Vector3[3];
|
||||||
|
eigenValues[0] = array[0, 0];
|
||||||
|
eigenValues[1] = array[1, 1];
|
||||||
|
eigenValues[2] = array[2, 2];
|
||||||
|
eigenVectors[0] = new Vector3(array2[0, 0], array2[1, 0], array2[2, 0]);
|
||||||
|
eigenVectors[1] = new Vector3(array2[0, 1], array2[1, 1], array2[2, 1]);
|
||||||
|
eigenVectors[2] = new Vector3(array2[0, 2], array2[1, 2], array2[2, 2]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 404cff939caffe44bbb6cfbb33580445
|
||||||
@@ -0,0 +1,166 @@
|
|||||||
|
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts,
|
||||||
|
// for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies.
|
||||||
|
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
|
// Eden.AutoMorpher.profile.ProfileUtils_PoseUtil
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using Eden.AutoMorpher.profile;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class ProfileUtils_PoseUtil
|
||||||
|
{
|
||||||
|
public BoneSpatialData GetBoneSpatialData(HumanBodyBones refBone, HumanBodyBones[] influencedBones, Dictionary<HumanBodyBones, HashSet<Transform>> boneMap, List<ProfileBakedBodyMesh> sourceBodyBakedMeshes, bool addChildBones = false)
|
||||||
|
{
|
||||||
|
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
BoneSpatialData boneSpatialData = new BoneSpatialData();
|
||||||
|
boneSpatialData.refBone = refBone;
|
||||||
|
Transform baseBoneFromBoneMap = GetBaseBoneFromBoneMap(boneMap, refBone);
|
||||||
|
if ((Object)(object)baseBoneFromBoneMap == (Object)null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
List<Vector3> refVertices = GetRefVertices(influencedBones, boneMap, sourceBodyBakedMeshes, addChildBones);
|
||||||
|
boneSpatialData.pcaData = GetPCAData(baseBoneFromBoneMap, refVertices);
|
||||||
|
Transform baseBoneFromBoneMap2 = GetBaseBoneFromBoneMap(boneMap, (HumanBodyBones)0);
|
||||||
|
boneSpatialData.volumeData = GetVolumeData(baseBoneFromBoneMap, baseBoneFromBoneMap2, refVertices);
|
||||||
|
return boneSpatialData;
|
||||||
|
}
|
||||||
|
|
||||||
|
private unsafe List<Vector3> GetRefVertices(HumanBodyBones[] influencedBones, Dictionary<HumanBodyBones, HashSet<Transform>> boneMap, List<ProfileBakedBodyMesh> sourceBodyBakedMeshes, bool addChildBones = false, float weightThreshold = 0.15f, int sampleStep = 1)
|
||||||
|
{
|
||||||
|
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_018b: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0190: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0212: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
List<Vector3> list = new List<Vector3>();
|
||||||
|
HashSet<Transform> targetBoneSet = new HashSet<Transform>();
|
||||||
|
foreach (HumanBodyBones key in influencedBones)
|
||||||
|
{
|
||||||
|
if (!boneMap.TryGetValue(key, out var value) || value == null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
foreach (Transform item in value)
|
||||||
|
{
|
||||||
|
if ((Object)(object)item != (Object)null)
|
||||||
|
{
|
||||||
|
targetBoneSet.Add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (targetBoneSet.Count == 0)
|
||||||
|
{
|
||||||
|
string text = string.Join(", ", influencedBones.Select((HumanBodyBones b) => ((object)(*(HumanBodyBones*)(&b))/*cast due to .constrained prefix*/).ToString()));
|
||||||
|
Debug.LogError((object)("[ProfileSaver_PoseUtil] CollectBodyPartVerticesWorld: targetBoneSet is empty.\nMissing Humanoid Set : " + text));
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
if (addChildBones)
|
||||||
|
{
|
||||||
|
Transform[] array = targetBoneSet.ToArray();
|
||||||
|
targetBoneSet.Clear();
|
||||||
|
Transform[] array2 = array;
|
||||||
|
for (int i = 0; i < array2.Length; i++)
|
||||||
|
{
|
||||||
|
AddDescendants(array2[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach (ProfileBakedBodyMesh sourceBodyBakedMesh in sourceBodyBakedMeshes)
|
||||||
|
{
|
||||||
|
BoneWeight[] boneWeights = sourceBodyBakedMesh.boneWeights;
|
||||||
|
Transform[] bones = sourceBodyBakedMesh.bones;
|
||||||
|
if (boneWeights == null || boneWeights.Length == 0 || bones == null || bones.Length == 0)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
Vector3[] worldVertices = sourceBodyBakedMesh.worldVertices;
|
||||||
|
if (worldVertices == null || worldVertices.Length == 0)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
int num = Mathf.Min(worldVertices.Length, boneWeights.Length);
|
||||||
|
for (int num2 = 0; num2 < num; num2 += sampleStep)
|
||||||
|
{
|
||||||
|
BoneWeight val = boneWeights[num2];
|
||||||
|
float wSum = 0f;
|
||||||
|
Acc(((BoneWeight)(ref val)).boneIndex0, ((BoneWeight)(ref val)).weight0);
|
||||||
|
Acc(((BoneWeight)(ref val)).boneIndex1, ((BoneWeight)(ref val)).weight1);
|
||||||
|
Acc(((BoneWeight)(ref val)).boneIndex2, ((BoneWeight)(ref val)).weight2);
|
||||||
|
Acc(((BoneWeight)(ref val)).boneIndex3, ((BoneWeight)(ref val)).weight3);
|
||||||
|
if (!(wSum < weightThreshold))
|
||||||
|
{
|
||||||
|
list.Add(worldVertices[num2]);
|
||||||
|
}
|
||||||
|
void Acc(int index, float w)
|
||||||
|
{
|
||||||
|
if (index >= 0 && index < bones.Length && !(w <= 0f))
|
||||||
|
{
|
||||||
|
Transform val2 = bones[index];
|
||||||
|
if ((Object)(object)val2 != (Object)null && targetBoneSet.Contains(val2))
|
||||||
|
{
|
||||||
|
wSum += w;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
void AddDescendants(Transform t)
|
||||||
|
{
|
||||||
|
if (!((Object)(object)t == (Object)null) && targetBoneSet.Add(t))
|
||||||
|
{
|
||||||
|
for (int j = 0; j < t.childCount; j++)
|
||||||
|
{
|
||||||
|
AddDescendants(t.GetChild(j));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private PCAData GetPCAData(Transform originTransform, List<Vector3> points)
|
||||||
|
{
|
||||||
|
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
PCAData pCAData = new ProfileUtils_PCAUtil().ComputeRegionStats(points);
|
||||||
|
if ((Object)(object)originTransform == (Object)null)
|
||||||
|
{
|
||||||
|
return pCAData;
|
||||||
|
}
|
||||||
|
PCAData obj = new PCAData
|
||||||
|
{
|
||||||
|
pcaCenter = originTransform.InverseTransformPoint(pCAData.pcaCenter)
|
||||||
|
};
|
||||||
|
Vector3 val = originTransform.InverseTransformDirection(pCAData.pcaPrincipalAxis);
|
||||||
|
obj.pcaPrincipalAxis = ((Vector3)(ref val)).normalized;
|
||||||
|
obj.pcaLength = pCAData.pcaLength;
|
||||||
|
obj.pcaAvgRadius = pCAData.pcaAvgRadius;
|
||||||
|
if (Mathf.Abs(pCAData.pcaLength) < 0.0001f)
|
||||||
|
{
|
||||||
|
Debug.LogWarning((object)("[ProfileUtils_PoseUtil] GetPCAData - " + ((Object)originTransform).name + " Pca Length is to Small"));
|
||||||
|
}
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
private VolumeData GetVolumeData(Transform originTransform, Transform axisTransform, List<Vector3> points)
|
||||||
|
{
|
||||||
|
return new ProfileUtils_VolumeUtil().GetVolumeData(originTransform, axisTransform, points);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Transform GetBaseBoneFromBoneMap(Dictionary<HumanBodyBones, HashSet<Transform>> boneMap, HumanBodyBones bone)
|
||||||
|
{
|
||||||
|
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
if (boneMap == null || !boneMap.TryGetValue(bone, out var value) || value == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return value.FirstOrDefault();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 094b9fc668fbf684aa9bd5db84b2aaad
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts,
|
||||||
|
// for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies.
|
||||||
|
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
|
// Eden.AutoMorpher.profile.ProfileUtils_VertexUtil
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Text;
|
||||||
|
using Eden.AutoMorpher.profile;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class ProfileUtils_VertexUtil
|
||||||
|
{
|
||||||
|
public BaseKey3[] LoadTable(string path, out int version, out int countInFile)
|
||||||
|
{
|
||||||
|
version = 0;
|
||||||
|
countInFile = 0;
|
||||||
|
if (string.IsNullOrEmpty(path))
|
||||||
|
{
|
||||||
|
Debug.LogError((object)"[ProfileUtil_VertexUtil] LoadTable - path is null or empty");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
path = Path.Combine(Application.dataPath, path);
|
||||||
|
if (!File.Exists(path))
|
||||||
|
{
|
||||||
|
Debug.LogError((object)"[ProfileUtil_VertexUtil] LoadTable - file not found");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
string text;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
text = File.ReadAllText(path, Encoding.UTF8);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Debug.LogError((object)("[ProfileUtil_VertexUtil] LoadTable - read failed: " + ex.Message));
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
int num = 0;
|
||||||
|
string baseMagic = new ProfileUtils().GetBaseMagic();
|
||||||
|
if (text.Length < 4 || text.Substring(0, 4) != baseMagic)
|
||||||
|
{
|
||||||
|
Debug.LogError((object)"[ProfileUtil_VertexUtil] LoadTable - MAGIC mismatch");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
num += 4;
|
||||||
|
version = ReadHexIntSafe(text, ref num);
|
||||||
|
countInFile = ReadHexIntSafe(text, ref num);
|
||||||
|
if (countInFile <= 0)
|
||||||
|
{
|
||||||
|
Debug.LogError((object)"[ProfileUtil_VertexUtil] LoadTable - invalid count");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
BaseKey3[] array = new BaseKey3[countInFile];
|
||||||
|
for (int i = 0; i < countInFile; i++)
|
||||||
|
{
|
||||||
|
array[i] = ReadHexKey3Safe(text, ref num);
|
||||||
|
}
|
||||||
|
return array;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int ReadHexIntSafe(string s, ref int p)
|
||||||
|
{
|
||||||
|
if (p + 8 > s.Length)
|
||||||
|
{
|
||||||
|
Debug.LogError((object)"[ProfileUtil_VertexUtil] ReadHexIntSafe - out of range");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
string value = s.Substring(p, 8);
|
||||||
|
p += 8;
|
||||||
|
return (int)Convert.ToUInt32(value, 16);
|
||||||
|
}
|
||||||
|
|
||||||
|
private BaseKey3 ReadHexKey3Safe(string s, ref int p)
|
||||||
|
{
|
||||||
|
int x = ReadHexIntSafe(s, ref p);
|
||||||
|
uint y = (uint)ReadHexIntSafe(s, ref p);
|
||||||
|
uint z = (uint)ReadHexIntSafe(s, ref p);
|
||||||
|
return new BaseKey3((uint)x, y, z);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 26eb8c4f9b6a08e4abb70a33d9b81ccf
|
||||||
@@ -0,0 +1,136 @@
|
|||||||
|
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts,
|
||||||
|
// for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies.
|
||||||
|
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
|
// Eden.AutoMorpher.profile.ProfileUtils_VolumeUtil
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Eden.AutoMorpher.profile;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class ProfileUtils_VolumeUtil
|
||||||
|
{
|
||||||
|
public VolumeData GetVolumeData(Transform originTransform, Transform axisTransform, List<Vector3> points, int sampleStep = 1)
|
||||||
|
{
|
||||||
|
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0106: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0107: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_010e: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0114: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0115: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_011d: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0122: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0125: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_012f: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0134: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_013c: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0141: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0144: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0149: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_014e: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0153: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_015b: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0160: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0163: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0168: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_016d: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0172: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_017a: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_017f: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0182: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0187: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_018c: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0191: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0199: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_019e: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
if ((Object)(object)originTransform == (Object)null)
|
||||||
|
{
|
||||||
|
Debug.LogError((object)"[ProfileUtils_VolumeUtil] originTransform is null");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if ((Object)(object)axisTransform == (Object)null)
|
||||||
|
{
|
||||||
|
Debug.LogError((object)"[ProfileUtils_VolumeUtil] axisTransform is null");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (points == null || points.Count == 0)
|
||||||
|
{
|
||||||
|
Debug.LogError((object)"[ProfileUtils_VolumeUtil] There is No Points to calculate volume");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
VolumeData volumeData = new VolumeData();
|
||||||
|
Vector3 forward = axisTransform.forward;
|
||||||
|
Vector3 right = axisTransform.right;
|
||||||
|
Vector3 up = axisTransform.up;
|
||||||
|
float num = float.PositiveInfinity;
|
||||||
|
float num2 = float.NegativeInfinity;
|
||||||
|
float num3 = float.PositiveInfinity;
|
||||||
|
float num4 = float.NegativeInfinity;
|
||||||
|
float num5 = float.PositiveInfinity;
|
||||||
|
float num6 = float.NegativeInfinity;
|
||||||
|
for (int i = 0; i < points.Count; i += sampleStep)
|
||||||
|
{
|
||||||
|
Vector3 val = points[i] - originTransform.position;
|
||||||
|
float num7 = Vector3.Dot(val, up);
|
||||||
|
if (num7 < num)
|
||||||
|
{
|
||||||
|
num = num7;
|
||||||
|
}
|
||||||
|
if (num7 > num2)
|
||||||
|
{
|
||||||
|
num2 = num7;
|
||||||
|
}
|
||||||
|
float num8 = Vector3.Dot(val, forward);
|
||||||
|
if (num8 < num3)
|
||||||
|
{
|
||||||
|
num3 = num8;
|
||||||
|
}
|
||||||
|
if (num8 > num4)
|
||||||
|
{
|
||||||
|
num4 = num8;
|
||||||
|
}
|
||||||
|
float num9 = Vector3.Dot(val, right);
|
||||||
|
if (num9 < num5)
|
||||||
|
{
|
||||||
|
num5 = num9;
|
||||||
|
}
|
||||||
|
if (num9 > num6)
|
||||||
|
{
|
||||||
|
num6 = num9;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
volumeData.forwardDir = forward;
|
||||||
|
volumeData.rightDir = right;
|
||||||
|
volumeData.upDir = up;
|
||||||
|
volumeData.fMaxLocalPos = originTransform.InverseTransformPoint(originTransform.position + forward * num4);
|
||||||
|
volumeData.fMinLocalPos = originTransform.InverseTransformPoint(originTransform.position + forward * num3);
|
||||||
|
volumeData.rMaxLocalPos = originTransform.InverseTransformPoint(originTransform.position + right * num6);
|
||||||
|
volumeData.rMinLocalPos = originTransform.InverseTransformPoint(originTransform.position + right * num5);
|
||||||
|
volumeData.uMaxLocalPos = originTransform.InverseTransformPoint(originTransform.position + up * num2);
|
||||||
|
volumeData.uMinLocalPos = originTransform.InverseTransformPoint(originTransform.position + up * num);
|
||||||
|
return volumeData;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: b1bc4188262eb1140b111907361dfc56
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts,
|
||||||
|
// for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies.
|
||||||
|
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
|
// Eden.AutoMorpher.profile.VolumeData
|
||||||
|
using System;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
[Serializable]
|
||||||
|
public class VolumeData
|
||||||
|
{
|
||||||
|
public Vector3 forwardDir;
|
||||||
|
|
||||||
|
public Vector3 rightDir;
|
||||||
|
|
||||||
|
public Vector3 upDir;
|
||||||
|
|
||||||
|
public Vector3 fMaxLocalPos;
|
||||||
|
|
||||||
|
public Vector3 fMinLocalPos;
|
||||||
|
|
||||||
|
public Vector3 rMaxLocalPos;
|
||||||
|
|
||||||
|
public Vector3 rMinLocalPos;
|
||||||
|
|
||||||
|
public Vector3 uMaxLocalPos;
|
||||||
|
|
||||||
|
public Vector3 uMinLocalPos;
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: c9990806ed64171428cb56bac9d781fa
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts,
|
||||||
|
// for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies.
|
||||||
|
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
|
// Eden.AutoMorpher.profile.profileBVHData
|
||||||
|
public class profileBVHData
|
||||||
|
{
|
||||||
|
public int verA;
|
||||||
|
|
||||||
|
public int verB;
|
||||||
|
|
||||||
|
public int verC;
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 3e693ae64a726864a88a172c17d13af9
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts,
|
||||||
|
// for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies.
|
||||||
|
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
|
// Eden.AutoMorpher.profile.profileBVHNode
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class profileBVHNode
|
||||||
|
{
|
||||||
|
public Bounds bounds;
|
||||||
|
|
||||||
|
public int leftChild;
|
||||||
|
|
||||||
|
public int rightChild;
|
||||||
|
|
||||||
|
public int start;
|
||||||
|
|
||||||
|
public int count;
|
||||||
|
|
||||||
|
public bool isLeaf;
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d1647fc2736619c4fbf9804e952bf2c6
|
||||||
Reference in New Issue
Block a user