포매팅
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
// Eden.AutoMorpher.profile.BaseKey3
|
// Eden.AutoMorpher.profile.BaseKey3
|
||||||
public struct BaseKey3
|
public struct BaseKey3
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
// Eden.AutoMorpher.profile.BoneData
|
// Eden.AutoMorpher.profile.BoneData
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
// Eden.AutoMorpher.profile.BoneSpatialData
|
// Eden.AutoMorpher.profile.BoneSpatialData
|
||||||
using System;
|
using System;
|
||||||
using Eden.AutoMorpher.profile;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
[Serializable]
|
[Serializable]
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
// Eden.AutoMorpher.profile.EdenAutoMorpher_ProfileSaver
|
// Eden.AutoMorpher.profile.EdenAutoMorpher_ProfileSaver
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Eden.AutoMorpher.profile;
|
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
@@ -20,44 +19,44 @@ public class EdenAutoMorpher_ProfileSaver : MonoBehaviour
|
|||||||
[ContextMenu("SaveProfile")]
|
[ContextMenu("SaveProfile")]
|
||||||
public void SaveProfile()
|
public void SaveProfile()
|
||||||
{
|
{
|
||||||
Vector3 position = sourceAvatar.position;
|
Vector3 position = this.sourceAvatar.position;
|
||||||
Quaternion rotation = sourceAvatar.rotation;
|
Quaternion rotation = this.sourceAvatar.rotation;
|
||||||
Vector3 localScale = sourceAvatar.localScale;
|
Vector3 localScale = this.sourceAvatar.localScale;
|
||||||
Transform parent = sourceAvatar.parent;
|
Transform parent = this.sourceAvatar.parent;
|
||||||
sourceAvatar.SetParent(null);
|
this.sourceAvatar.SetParent(null);
|
||||||
sourceAvatar.position = Vector3.zero;
|
this.sourceAvatar.position = Vector3.zero;
|
||||||
sourceAvatar.rotation = Quaternion.identity;
|
this.sourceAvatar.rotation = Quaternion.identity;
|
||||||
sourceAvatar.localScale = Vector3.one;
|
this.sourceAvatar.localScale = Vector3.one;
|
||||||
ProfileData newProfileData = new ProfileData();
|
ProfileData newProfileData = new ProfileData();
|
||||||
ProfileUtils profileUtils = new ProfileUtils();
|
ProfileUtils profileUtils = new ProfileUtils();
|
||||||
newProfileData.version = profileUtils.GetProfileVersion();
|
newProfileData.version = profileUtils.GetProfileVersion();
|
||||||
Animator component = sourceAvatar.GetComponent<Animator>();
|
Animator component = this.sourceAvatar.GetComponent<Animator>();
|
||||||
if (component == null)
|
if (component == null)
|
||||||
{
|
{
|
||||||
Debug.LogError("[EdenAutoMorpher_ProfileSaver] Source Avatar Has No Animator\nSet Animator to Source Avatar " + sourceAvatar.name);
|
Debug.LogError("[EdenAutoMorpher_ProfileSaver] Source Avatar Has No Animator\nSet Animator to Source Avatar " + this.sourceAvatar.name);
|
||||||
}
|
}
|
||||||
Dictionary<HumanBodyBones, HashSet<Transform>> humanoidMeshBoneMap = profileUtils.GetHumanoidMeshBoneMap(component, sourceBodyMeshes);
|
Dictionary<HumanBodyBones, HashSet<Transform>> humanoidMeshBoneMap = profileUtils.GetHumanoidMeshBoneMap(component, this.sourceBodyMeshes);
|
||||||
List<ProfileBakedBodyMesh> list = new List<ProfileBakedBodyMesh>();
|
List<ProfileBakedBodyMesh> list = new List<ProfileBakedBodyMesh>();
|
||||||
foreach (SkinnedMeshRenderer sourceBodyMesh in sourceBodyMeshes)
|
foreach (SkinnedMeshRenderer sourceBodyMesh in this.sourceBodyMeshes)
|
||||||
{
|
{
|
||||||
list.Add(new ProfileBakedBodyMesh(sourceBodyMesh));
|
list.Add(new ProfileBakedBodyMesh(sourceBodyMesh));
|
||||||
}
|
}
|
||||||
SaveBoneData(ref newProfileData, sourceAvatar, humanoidMeshBoneMap, list);
|
this.SaveBoneData(ref newProfileData, this.sourceAvatar, humanoidMeshBoneMap, list);
|
||||||
ProfileUtils_BVHUtil profileUtils_BVHUtil = new ProfileUtils_BVHUtil();
|
ProfileUtils_BVHUtil profileUtils_BVHUtil = new ProfileUtils_BVHUtil();
|
||||||
ProfileBVH bVHData = profileUtils_BVHUtil.GetBVHData(sourceAvatar, list);
|
ProfileBVH bVHData = profileUtils_BVHUtil.GetBVHData(this.sourceAvatar, list);
|
||||||
profileUtils_BVHUtil.SaveProfileBVH(bVHData, Path.Combine(profileUtils.GetProfileBasePath(), profileName), profileName);
|
profileUtils_BVHUtil.SaveProfileBVH(bVHData, Path.Combine(profileUtils.GetProfileBasePath(), this.profileName), this.profileName);
|
||||||
newProfileData.neckTargetHeight = 1.5f;
|
newProfileData.neckTargetHeight = 1.5f;
|
||||||
AdjustAvatarHigh(sourceAvatar, humanoidMeshBoneMap, 1.5f);
|
this.AdjustAvatarHigh(this.sourceAvatar, humanoidMeshBoneMap, 1.5f);
|
||||||
foreach (ProfileBakedBodyMesh item in list)
|
foreach (ProfileBakedBodyMesh item in list)
|
||||||
{
|
{
|
||||||
item.ReBakeMesh();
|
item.ReBakeMesh();
|
||||||
}
|
}
|
||||||
SaveSpatialData(ref newProfileData, humanoidMeshBoneMap, list);
|
this.SaveSpatialData(ref newProfileData, humanoidMeshBoneMap, list);
|
||||||
SaveProfileToJson(newProfileData, Path.Combine(profileUtils.GetProfileBasePath(), profileName), profileName);
|
this.SaveProfileToJson(newProfileData, Path.Combine(profileUtils.GetProfileBasePath(), this.profileName), this.profileName);
|
||||||
sourceAvatar.SetParent(parent);
|
this.sourceAvatar.SetParent(parent);
|
||||||
sourceAvatar.position = position;
|
this.sourceAvatar.position = position;
|
||||||
sourceAvatar.rotation = rotation;
|
this.sourceAvatar.rotation = rotation;
|
||||||
sourceAvatar.localScale = localScale;
|
this.sourceAvatar.localScale = localScale;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SaveSpatialData(ref ProfileData newProfileData, Dictionary<HumanBodyBones, HashSet<Transform>> sourceBoneMap, List<ProfileBakedBodyMesh> sourceBodyBakedMeshes)
|
public void SaveSpatialData(ref ProfileData newProfileData, Dictionary<HumanBodyBones, HashSet<Transform>> sourceBoneMap, List<ProfileBakedBodyMesh> sourceBodyBakedMeshes)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
// Eden.AutoMorpher.profile.PCAData
|
// Eden.AutoMorpher.profile.PCAData
|
||||||
using System;
|
using System;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
// Eden.AutoMorpher.profile.ProfileBVH
|
// Eden.AutoMorpher.profile.ProfileBVH
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Eden.AutoMorpher.profile;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
public class ProfileBVH
|
public class ProfileBVH
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
// Eden.AutoMorpher.profile.ProfileBakedBodyMesh
|
// Eden.AutoMorpher.profile.ProfileBakedBodyMesh
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
@@ -14,11 +14,11 @@ public class ProfileBakedBodyMesh
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (!(smr != null))
|
if (!(this.smr != null))
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return smr.sharedMesh.boneWeights;
|
return this.smr.sharedMesh.boneWeights;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -26,11 +26,11 @@ public class ProfileBakedBodyMesh
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (!(smr != null))
|
if (!(this.smr != null))
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return smr.bones;
|
return this.smr.bones;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -40,26 +40,26 @@ public class ProfileBakedBodyMesh
|
|||||||
{
|
{
|
||||||
Debug.LogError("[ProfileUtil - ProfileBakedBodyMesh] BakeBodyMesh Init : SkinnedMeshRenderer " + _smr.gameObject.name + " is null");
|
Debug.LogError("[ProfileUtil - ProfileBakedBodyMesh] BakeBodyMesh Init : SkinnedMeshRenderer " + _smr.gameObject.name + " is null");
|
||||||
}
|
}
|
||||||
smr = _smr;
|
this.smr = _smr;
|
||||||
if (_smr.sharedMesh == null)
|
if (_smr.sharedMesh == null)
|
||||||
{
|
{
|
||||||
Debug.LogError("[ProfileUtil - ProfileBakedBodyMesh] BakeBodyMesh Init : SkinnedMeshRenderer " + _smr.gameObject.name + " has null sharedMesh.");
|
Debug.LogError("[ProfileUtil - ProfileBakedBodyMesh] BakeBodyMesh Init : SkinnedMeshRenderer " + _smr.gameObject.name + " has null sharedMesh.");
|
||||||
}
|
}
|
||||||
bakedMesh = new Mesh();
|
this.bakedMesh = new Mesh();
|
||||||
smr.BakeMesh(bakedMesh);
|
this.smr.BakeMesh(this.bakedMesh);
|
||||||
worldVertices = CalculateWorldVertices(smr, bakedMesh);
|
this.worldVertices = this.CalculateWorldVertices(this.smr, this.bakedMesh);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ReBakeMesh()
|
public void ReBakeMesh()
|
||||||
{
|
{
|
||||||
smr.BakeMesh(bakedMesh);
|
this.smr.BakeMesh(this.bakedMesh);
|
||||||
worldVertices = CalculateWorldVertices(smr, bakedMesh);
|
this.worldVertices = this.CalculateWorldVertices(this.smr, this.bakedMesh);
|
||||||
}
|
}
|
||||||
|
|
||||||
~ProfileBakedBodyMesh()
|
~ProfileBakedBodyMesh()
|
||||||
{
|
{
|
||||||
smr = null;
|
this.smr = null;
|
||||||
bakedMesh = null;
|
this.bakedMesh = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Vector3[] CalculateWorldVertices(SkinnedMeshRenderer smr, Mesh bakedMesh)
|
private Vector3[] CalculateWorldVertices(SkinnedMeshRenderer smr, Mesh bakedMesh)
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
// Eden.AutoMorpher.profile.ProfileData
|
// Eden.AutoMorpher.profile.ProfileData
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Eden.AutoMorpher.profile;
|
|
||||||
|
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public class ProfileData
|
public class ProfileData
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
// Eden.AutoMorpher.profile.ProfileUtil_IndexUtil
|
// Eden.AutoMorpher.profile.ProfileUtil_IndexUtil
|
||||||
using Eden.AutoMorpher.profile;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
public class ProfileUtil_IndexUtil
|
public class ProfileUtil_IndexUtil
|
||||||
@@ -13,20 +12,20 @@ public class ProfileUtil_IndexUtil
|
|||||||
|
|
||||||
public XorShift32(uint seed)
|
public XorShift32(uint seed)
|
||||||
{
|
{
|
||||||
_state = ((seed != 0) ? seed : 1831565813u);
|
this._state = ((seed != 0) ? seed : 1831565813u);
|
||||||
}
|
}
|
||||||
|
|
||||||
public uint NextUInt()
|
public uint NextUInt()
|
||||||
{
|
{
|
||||||
uint state = _state;
|
uint state = this._state;
|
||||||
state ^= state << 13;
|
state ^= state << 13;
|
||||||
state ^= state >> 17;
|
state ^= state >> 17;
|
||||||
return _state = state ^ (state << 5);
|
return this._state = state ^ (state << 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int NextInt(int maxExclusive)
|
public int NextInt(int maxExclusive)
|
||||||
{
|
{
|
||||||
return (int)(NextUInt() % (uint)maxExclusive);
|
return (int)(this.NextUInt() % (uint)maxExclusive);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,12 +53,12 @@ public class ProfileUtil_IndexUtil
|
|||||||
|
|
||||||
public BlockPermutations(int blockSize)
|
public BlockPermutations(int blockSize)
|
||||||
{
|
{
|
||||||
_blockSize = blockSize;
|
this._blockSize = blockSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Build(int seed)
|
public void Build(int seed)
|
||||||
{
|
{
|
||||||
if (_blockSize <= 1)
|
if (this._blockSize <= 1)
|
||||||
{
|
{
|
||||||
Debug.LogError("[ProfileUtil_IndexUtil] BlockPermutations.Build - invalid blockSize");
|
Debug.LogError("[ProfileUtil_IndexUtil] BlockPermutations.Build - invalid blockSize");
|
||||||
return;
|
return;
|
||||||
@@ -68,45 +67,45 @@ public class ProfileUtil_IndexUtil
|
|||||||
XorShift32 rng2 = new XorShift32((uint)(seed ^ -939442524));
|
XorShift32 rng2 = new XorShift32((uint)(seed ^ -939442524));
|
||||||
XorShift32 rng3 = new XorShift32((uint)(seed ^ -1383041155));
|
XorShift32 rng3 = new XorShift32((uint)(seed ^ -1383041155));
|
||||||
XorShift32 rng4 = new XorShift32((uint)(seed ^ 0x7E95761E));
|
XorShift32 rng4 = new XorShift32((uint)(seed ^ 0x7E95761E));
|
||||||
_px = MakePermutation(_blockSize, ref rng);
|
this._px = this.MakePermutation(this._blockSize, ref rng);
|
||||||
_py = MakePermutation(_blockSize, ref rng2);
|
this._py = this.MakePermutation(this._blockSize, ref rng2);
|
||||||
_pz = MakePermutation(_blockSize, ref rng3);
|
this._pz = this.MakePermutation(this._blockSize, ref rng3);
|
||||||
_pall = MakePermutation(_blockSize, ref rng4);
|
this._pall = this.MakePermutation(this._blockSize, ref rng4);
|
||||||
_checksum = ComputeChecksum(_px, _py, _pz, _pall);
|
this._checksum = this.ComputeChecksum(this._px, this._py, this._pz, this._pall);
|
||||||
_cachedLen = -1;
|
this._cachedLen = -1;
|
||||||
_pxLen = (_pyLen = (_pzLen = (_pallLen = null)));
|
this._pxLen = (this._pyLen = (this._pzLen = (this._pallLen = null)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool ValidateRebuild(int seed)
|
public bool ValidateRebuild(int seed)
|
||||||
{
|
{
|
||||||
uint checksum = _checksum;
|
uint checksum = this._checksum;
|
||||||
BlockPermutations blockPermutations = new BlockPermutations(_blockSize);
|
BlockPermutations blockPermutations = new BlockPermutations(this._blockSize);
|
||||||
blockPermutations.Build(seed);
|
blockPermutations.Build(seed);
|
||||||
return blockPermutations._checksum == checksum;
|
return blockPermutations._checksum == checksum;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void GetPermutationsForLen(int len, out int[] pxUse, out int[] pyUse, out int[] pzUse, out int[] pallUse)
|
public void GetPermutationsForLen(int len, out int[] pxUse, out int[] pyUse, out int[] pzUse, out int[] pallUse)
|
||||||
{
|
{
|
||||||
if (len == _blockSize)
|
if (len == this._blockSize)
|
||||||
{
|
{
|
||||||
pxUse = _px;
|
pxUse = this._px;
|
||||||
pyUse = _py;
|
pyUse = this._py;
|
||||||
pzUse = _pz;
|
pzUse = this._pz;
|
||||||
pallUse = _pall;
|
pallUse = this._pall;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (_cachedLen != len)
|
if (this._cachedLen != len)
|
||||||
{
|
{
|
||||||
_cachedLen = len;
|
this._cachedLen = len;
|
||||||
_pxLen = MakeSubPermutation(_px, len);
|
this._pxLen = this.MakeSubPermutation(this._px, len);
|
||||||
_pyLen = MakeSubPermutation(_py, len);
|
this._pyLen = this.MakeSubPermutation(this._py, len);
|
||||||
_pzLen = MakeSubPermutation(_pz, len);
|
this._pzLen = this.MakeSubPermutation(this._pz, len);
|
||||||
_pallLen = MakeSubPermutation(_pall, len);
|
this._pallLen = this.MakeSubPermutation(this._pall, len);
|
||||||
}
|
}
|
||||||
pxUse = _pxLen;
|
pxUse = this._pxLen;
|
||||||
pyUse = _pyLen;
|
pyUse = this._pyLen;
|
||||||
pzUse = _pzLen;
|
pzUse = this._pzLen;
|
||||||
pallUse = _pallLen;
|
pallUse = this._pallLen;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int[] MakeSubPermutation(int[] fullPerm, int len)
|
private int[] MakeSubPermutation(int[] fullPerm, int len)
|
||||||
@@ -151,10 +150,10 @@ public class ProfileUtil_IndexUtil
|
|||||||
private uint ComputeChecksum(int[] a, int[] b, int[] c, int[] d)
|
private uint ComputeChecksum(int[] a, int[] b, int[] c, int[] d)
|
||||||
{
|
{
|
||||||
uint h = 2166136261u;
|
uint h = 2166136261u;
|
||||||
MixArray(ref h, a);
|
this.MixArray(ref h, a);
|
||||||
MixArray(ref h, b);
|
this.MixArray(ref h, b);
|
||||||
MixArray(ref h, c);
|
this.MixArray(ref h, c);
|
||||||
MixArray(ref h, d);
|
this.MixArray(ref h, d);
|
||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -182,15 +181,15 @@ public class ProfileUtil_IndexUtil
|
|||||||
public ProfileUtil_IndexUtil(int blockSize = 9783)
|
public ProfileUtil_IndexUtil(int blockSize = 9783)
|
||||||
{
|
{
|
||||||
this.blockSize = blockSize;
|
this.blockSize = blockSize;
|
||||||
_perm = new BlockPermutations(blockSize);
|
this._perm = new BlockPermutations(blockSize);
|
||||||
_xTmp = new float[blockSize];
|
this._xTmp = new float[blockSize];
|
||||||
_yTmp = new float[blockSize];
|
this._yTmp = new float[blockSize];
|
||||||
_zTmp = new float[blockSize];
|
this._zTmp = new float[blockSize];
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Build(int seed)
|
public void Build(int seed)
|
||||||
{
|
{
|
||||||
_perm.Build(seed);
|
this._perm.Build(seed);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void EncodeInto(Vector3[] input, Vector3[] output)
|
public void EncodeInto(Vector3[] input, Vector3[] output)
|
||||||
@@ -206,24 +205,24 @@ public class ProfileUtil_IndexUtil
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int num = input.Length;
|
int num = input.Length;
|
||||||
int num2 = blockSize;
|
int num2 = this.blockSize;
|
||||||
int num3 = (num + num2 - 1) / num2;
|
int num3 = (num + num2 - 1) / num2;
|
||||||
for (int i = 0; i < num3; i++)
|
for (int i = 0; i < num3; i++)
|
||||||
{
|
{
|
||||||
int num4 = i * num2;
|
int num4 = i * num2;
|
||||||
int num5 = Mathf.Min(num2, num - num4);
|
int num5 = Mathf.Min(num2, num - num4);
|
||||||
_perm.GetPermutationsForLen(num5, out var pxUse, out var pyUse, out var pzUse, out var pallUse);
|
this._perm.GetPermutationsForLen(num5, out var pxUse, out var pyUse, out var pzUse, out var pallUse);
|
||||||
for (int j = 0; j < num5; j++)
|
for (int j = 0; j < num5; j++)
|
||||||
{
|
{
|
||||||
Vector3 vector = input[num4 + j];
|
Vector3 vector = input[num4 + j];
|
||||||
_xTmp[pxUse[j]] = vector.x;
|
this._xTmp[pxUse[j]] = vector.x;
|
||||||
_yTmp[pyUse[j]] = vector.y;
|
this._yTmp[pyUse[j]] = vector.y;
|
||||||
_zTmp[pzUse[j]] = vector.z;
|
this._zTmp[pzUse[j]] = vector.z;
|
||||||
}
|
}
|
||||||
for (int k = 0; k < num5; k++)
|
for (int k = 0; k < num5; k++)
|
||||||
{
|
{
|
||||||
int num6 = pallUse[k];
|
int num6 = pallUse[k];
|
||||||
output[num4 + num6] = new Vector3(_xTmp[k], _yTmp[k], _zTmp[k]);
|
output[num4 + num6] = new Vector3(this._xTmp[k], this._yTmp[k], this._zTmp[k]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -241,24 +240,24 @@ public class ProfileUtil_IndexUtil
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int num = encoded.Length;
|
int num = encoded.Length;
|
||||||
int num2 = blockSize;
|
int num2 = this.blockSize;
|
||||||
int num3 = (num + num2 - 1) / num2;
|
int num3 = (num + num2 - 1) / num2;
|
||||||
for (int i = 0; i < num3; i++)
|
for (int i = 0; i < num3; i++)
|
||||||
{
|
{
|
||||||
int num4 = i * num2;
|
int num4 = i * num2;
|
||||||
int num5 = Mathf.Min(num2, num - num4);
|
int num5 = Mathf.Min(num2, num - num4);
|
||||||
_perm.GetPermutationsForLen(num5, out var pxUse, out var pyUse, out var pzUse, out var pallUse);
|
this._perm.GetPermutationsForLen(num5, out var pxUse, out var pyUse, out var pzUse, out var pallUse);
|
||||||
for (int j = 0; j < num5; j++)
|
for (int j = 0; j < num5; j++)
|
||||||
{
|
{
|
||||||
int num6 = pallUse[j];
|
int num6 = pallUse[j];
|
||||||
Vector3 vector = encoded[num4 + num6];
|
Vector3 vector = encoded[num4 + num6];
|
||||||
_xTmp[j] = vector.x;
|
this._xTmp[j] = vector.x;
|
||||||
_yTmp[j] = vector.y;
|
this._yTmp[j] = vector.y;
|
||||||
_zTmp[j] = vector.z;
|
this._zTmp[j] = vector.z;
|
||||||
}
|
}
|
||||||
for (int k = 0; k < num5; k++)
|
for (int k = 0; k < num5; k++)
|
||||||
{
|
{
|
||||||
output[num4 + k] = new Vector3(_xTmp[pxUse[k]], _yTmp[pyUse[k]], _zTmp[pzUse[k]]);
|
output[num4 + k] = new Vector3(this._xTmp[pxUse[k]], this._yTmp[pyUse[k]], this._zTmp[pzUse[k]]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
// Eden.AutoMorpher.profile.ProfileUtils
|
// Eden.AutoMorpher.profile.ProfileUtils
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Eden.AutoMorpher.profile;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
public class ProfileUtils
|
public class ProfileUtils
|
||||||
@@ -22,52 +21,52 @@ public class ProfileUtils
|
|||||||
|
|
||||||
public ProfileUtils()
|
public ProfileUtils()
|
||||||
{
|
{
|
||||||
boneUtil = new ProfileUtils_BoneUtil();
|
this.boneUtil = new ProfileUtils_BoneUtil();
|
||||||
poseUtil = new ProfileUtils_PoseUtil();
|
this.poseUtil = new ProfileUtils_PoseUtil();
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetProfileBasePath()
|
public string GetProfileBasePath()
|
||||||
{
|
{
|
||||||
return profileBasePath;
|
return this.profileBasePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetBaseDataPath()
|
public string GetBaseDataPath()
|
||||||
{
|
{
|
||||||
return baseDataPath;
|
return this.baseDataPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int GetProfileVersion()
|
public int GetProfileVersion()
|
||||||
{
|
{
|
||||||
return profileVersion;
|
return this.profileVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetProfileMagic()
|
public string GetProfileMagic()
|
||||||
{
|
{
|
||||||
return profileMagic;
|
return this.profileMagic;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetBaseMagic()
|
public string GetBaseMagic()
|
||||||
{
|
{
|
||||||
return baseMagic;
|
return this.baseMagic;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Dictionary<HumanBodyBones, HashSet<Transform>> GetHumanoidMeshBoneMap(Animator animator, IReadOnlyList<SkinnedMeshRenderer> bodyMeshes, float posTolerance = 0.0001f, float weightThreshold = 0.0001f)
|
public Dictionary<HumanBodyBones, HashSet<Transform>> GetHumanoidMeshBoneMap(Animator animator, IReadOnlyList<SkinnedMeshRenderer> bodyMeshes, float posTolerance = 0.0001f, float weightThreshold = 0.0001f)
|
||||||
{
|
{
|
||||||
return boneUtil.GetHumanoidMeshBoneMap(animator, bodyMeshes, posTolerance, weightThreshold);
|
return this.boneUtil.GetHumanoidMeshBoneMap(animator, bodyMeshes, posTolerance, weightThreshold);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BoneSpatialData GetBoneSpatialData(HumanBodyBones refBone, HumanBodyBones[] influencedBones, Dictionary<HumanBodyBones, HashSet<Transform>> boneMap, List<ProfileBakedBodyMesh> sourceBodyBakedMeshes, bool addChildBones = false)
|
public BoneSpatialData GetBoneSpatialData(HumanBodyBones refBone, HumanBodyBones[] influencedBones, Dictionary<HumanBodyBones, HashSet<Transform>> boneMap, List<ProfileBakedBodyMesh> sourceBodyBakedMeshes, bool addChildBones = false)
|
||||||
{
|
{
|
||||||
return poseUtil.GetBoneSpatialData(refBone, influencedBones, boneMap, sourceBodyBakedMeshes, addChildBones);
|
return this.poseUtil.GetBoneSpatialData(refBone, influencedBones, boneMap, sourceBodyBakedMeshes, addChildBones);
|
||||||
}
|
}
|
||||||
|
|
||||||
public HashSet<Transform> GetBodyMeshBones(SkinnedMeshRenderer smr, float weightThreshold = 0.0001f)
|
public HashSet<Transform> GetBodyMeshBones(SkinnedMeshRenderer smr, float weightThreshold = 0.0001f)
|
||||||
{
|
{
|
||||||
return boneUtil.GetBodyMeshBones(smr, weightThreshold);
|
return this.boneUtil.GetBodyMeshBones(smr, weightThreshold);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<BoneData> GetBoneDatas(Transform rootTransform, HashSet<Transform> avatarBones, Dictionary<HumanBodyBones, HashSet<Transform>> sourceBoneMap)
|
public List<BoneData> GetBoneDatas(Transform rootTransform, HashSet<Transform> avatarBones, Dictionary<HumanBodyBones, HashSet<Transform>> sourceBoneMap)
|
||||||
{
|
{
|
||||||
return boneUtil.GetBoneDatas(rootTransform, avatarBones, sourceBoneMap);
|
return this.boneUtil.GetBoneDatas(rootTransform, avatarBones, sourceBoneMap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
// Eden.AutoMorpher.profile.ProfileUtils_BVHUtil
|
// Eden.AutoMorpher.profile.ProfileUtils_BVHUtil
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Eden.AutoMorpher.profile;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
public class ProfileUtils_BVHUtil
|
public class ProfileUtils_BVHUtil
|
||||||
@@ -13,7 +12,7 @@ public class ProfileUtils_BVHUtil
|
|||||||
|
|
||||||
public ProfileBVH GetBVHData(Transform rootTransform, List<ProfileBakedBodyMesh> bakedBodyMeshes)
|
public ProfileBVH GetBVHData(Transform rootTransform, List<ProfileBakedBodyMesh> bakedBodyMeshes)
|
||||||
{
|
{
|
||||||
return BuildFromSkinnedMeshes(rootTransform, bakedBodyMeshes);
|
return this.BuildFromSkinnedMeshes(rootTransform, bakedBodyMeshes);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProfileBVH BuildFromSkinnedMeshes(Transform rootTransform, List<ProfileBakedBodyMesh> bakedBodyMeshes)
|
public ProfileBVH BuildFromSkinnedMeshes(Transform rootTransform, List<ProfileBakedBodyMesh> bakedBodyMeshes)
|
||||||
@@ -71,7 +70,7 @@ public class ProfileUtils_BVHUtil
|
|||||||
}
|
}
|
||||||
profileBVH.dataIndices = array;
|
profileBVH.dataIndices = array;
|
||||||
List<profileBVHNode> list = new List<profileBVHNode>();
|
List<profileBVHNode> list = new List<profileBVHNode>();
|
||||||
BuildRecursive(profileBVH, array, 0, num7, list);
|
this.BuildRecursive(profileBVH, array, 0, num7, list);
|
||||||
profileBVH.nodes = list.ToArray();
|
profileBVH.nodes = list.ToArray();
|
||||||
return profileBVH;
|
return profileBVH;
|
||||||
}
|
}
|
||||||
@@ -133,7 +132,7 @@ public class ProfileUtils_BVHUtil
|
|||||||
num2 += ((vector2 + vector3 + vector4) / 3f)[num];
|
num2 += ((vector2 + vector3 + vector4) / 3f)[num];
|
||||||
}
|
}
|
||||||
num2 /= (float)count;
|
num2 /= (float)count;
|
||||||
int num3 = Partition(bvh, triIndices, start, count, num, num2);
|
int num3 = this.Partition(bvh, triIndices, start, count, num, num2);
|
||||||
if (num3 == start || num3 == start + count)
|
if (num3 == start || num3 == start + count)
|
||||||
{
|
{
|
||||||
num3 = start + count / 2;
|
num3 = start + count / 2;
|
||||||
@@ -142,8 +141,8 @@ public class ProfileUtils_BVHUtil
|
|||||||
profileBVHNode2.start = -1;
|
profileBVHNode2.start = -1;
|
||||||
profileBVHNode2.count = 0;
|
profileBVHNode2.count = 0;
|
||||||
outNodes.Add(profileBVHNode2);
|
outNodes.Add(profileBVHNode2);
|
||||||
int leftChild = BuildRecursive(bvh, triIndices, start, num3 - start, outNodes);
|
int leftChild = this.BuildRecursive(bvh, triIndices, start, num3 - start, outNodes);
|
||||||
int rightChild = BuildRecursive(bvh, triIndices, num3, start + count - num3, outNodes);
|
int rightChild = this.BuildRecursive(bvh, triIndices, num3, start + count - num3, outNodes);
|
||||||
profileBVHNode2.leftChild = leftChild;
|
profileBVHNode2.leftChild = leftChild;
|
||||||
profileBVHNode2.rightChild = rightChild;
|
profileBVHNode2.rightChild = rightChild;
|
||||||
outNodes[count2] = profileBVHNode2;
|
outNodes[count2] = profileBVHNode2;
|
||||||
@@ -203,7 +202,7 @@ public class ProfileUtils_BVHUtil
|
|||||||
Vector3[] array2 = bvh.vertices.ToArray();
|
Vector3[] array2 = bvh.vertices.ToArray();
|
||||||
for (int i = 0; i < array2.Length; i++)
|
for (int i = 0; i < array2.Length; i++)
|
||||||
{
|
{
|
||||||
array2[i] = TransformVec3(array2[i], array[i % array.Length]);
|
array2[i] = this.TransformVec3(array2[i], array[i % array.Length]);
|
||||||
}
|
}
|
||||||
ProfileUtil_IndexUtil profileUtil_IndexUtil = new ProfileUtil_IndexUtil();
|
ProfileUtil_IndexUtil profileUtil_IndexUtil = new ProfileUtil_IndexUtil();
|
||||||
profileUtil_IndexUtil.Build(num);
|
profileUtil_IndexUtil.Build(num);
|
||||||
@@ -211,37 +210,37 @@ public class ProfileUtils_BVHUtil
|
|||||||
profileUtil_IndexUtil.EncodeInto(array2, array3);
|
profileUtil_IndexUtil.EncodeInto(array2, array3);
|
||||||
StringBuilder stringBuilder = new StringBuilder(1024);
|
StringBuilder stringBuilder = new StringBuilder(1024);
|
||||||
stringBuilder.Append(profileUtils.GetProfileMagic());
|
stringBuilder.Append(profileUtils.GetProfileMagic());
|
||||||
AppendHexInt(stringBuilder, profileUtils.GetProfileVersion());
|
this.AppendHexInt(stringBuilder, profileUtils.GetProfileVersion());
|
||||||
AppendHexInt(stringBuilder, num);
|
this.AppendHexInt(stringBuilder, num);
|
||||||
AppendHexInt(stringBuilder, count);
|
this.AppendHexInt(stringBuilder, count);
|
||||||
AppendHexInt(stringBuilder, bvh.datas.Length);
|
this.AppendHexInt(stringBuilder, bvh.datas.Length);
|
||||||
AppendHexInt(stringBuilder, bvh.nodes.Length);
|
this.AppendHexInt(stringBuilder, bvh.nodes.Length);
|
||||||
AppendHexInt(stringBuilder, bvh.dataIndices.Length);
|
this.AppendHexInt(stringBuilder, bvh.dataIndices.Length);
|
||||||
for (int j = 0; j < array3.Length; j++)
|
for (int j = 0; j < array3.Length; j++)
|
||||||
{
|
{
|
||||||
AppendHexVec3(stringBuilder, array3[j]);
|
this.AppendHexVec3(stringBuilder, array3[j]);
|
||||||
}
|
}
|
||||||
for (int k = 0; k < bvh.datas.Length; k++)
|
for (int k = 0; k < bvh.datas.Length; k++)
|
||||||
{
|
{
|
||||||
profileBVHData profileBVHData2 = bvh.datas[k];
|
profileBVHData profileBVHData2 = bvh.datas[k];
|
||||||
AppendHexInt(stringBuilder, profileBVHData2.verA);
|
this.AppendHexInt(stringBuilder, profileBVHData2.verA);
|
||||||
AppendHexInt(stringBuilder, profileBVHData2.verB);
|
this.AppendHexInt(stringBuilder, profileBVHData2.verB);
|
||||||
AppendHexInt(stringBuilder, profileBVHData2.verC);
|
this.AppendHexInt(stringBuilder, profileBVHData2.verC);
|
||||||
}
|
}
|
||||||
for (int l = 0; l < bvh.nodes.Length; l++)
|
for (int l = 0; l < bvh.nodes.Length; l++)
|
||||||
{
|
{
|
||||||
profileBVHNode profileBVHNode2 = bvh.nodes[l];
|
profileBVHNode profileBVHNode2 = bvh.nodes[l];
|
||||||
AppendHexVec3(stringBuilder, profileBVHNode2.bounds.center);
|
this.AppendHexVec3(stringBuilder, profileBVHNode2.bounds.center);
|
||||||
AppendHexVec3(stringBuilder, profileBVHNode2.bounds.extents);
|
this.AppendHexVec3(stringBuilder, profileBVHNode2.bounds.extents);
|
||||||
AppendHexInt(stringBuilder, profileBVHNode2.leftChild);
|
this.AppendHexInt(stringBuilder, profileBVHNode2.leftChild);
|
||||||
AppendHexInt(stringBuilder, profileBVHNode2.rightChild);
|
this.AppendHexInt(stringBuilder, profileBVHNode2.rightChild);
|
||||||
AppendHexInt(stringBuilder, profileBVHNode2.start);
|
this.AppendHexInt(stringBuilder, profileBVHNode2.start);
|
||||||
AppendHexInt(stringBuilder, profileBVHNode2.count);
|
this.AppendHexInt(stringBuilder, profileBVHNode2.count);
|
||||||
stringBuilder.Append(profileBVHNode2.isLeaf ? '1' : '0');
|
stringBuilder.Append(profileBVHNode2.isLeaf ? '1' : '0');
|
||||||
}
|
}
|
||||||
for (int m = 0; m < bvh.dataIndices.Length; m++)
|
for (int m = 0; m < bvh.dataIndices.Length; m++)
|
||||||
{
|
{
|
||||||
AppendHexInt(stringBuilder, bvh.dataIndices[m]);
|
this.AppendHexInt(stringBuilder, bvh.dataIndices[m]);
|
||||||
}
|
}
|
||||||
string path = (profileName.EndsWith(".eb") ? profileName : (profileName + ".eb"));
|
string path = (profileName.EndsWith(".eb") ? profileName : (profileName + ".eb"));
|
||||||
string text = Path.Combine(Application.dataPath, savePath ?? string.Empty);
|
string text = Path.Combine(Application.dataPath, savePath ?? string.Empty);
|
||||||
@@ -254,9 +253,9 @@ public class ProfileUtils_BVHUtil
|
|||||||
|
|
||||||
private void AppendHexVec3(StringBuilder sb, Vector3 v)
|
private void AppendHexVec3(StringBuilder sb, Vector3 v)
|
||||||
{
|
{
|
||||||
AppendHexFloat(sb, v.x);
|
this.AppendHexFloat(sb, v.x);
|
||||||
AppendHexFloat(sb, v.y);
|
this.AppendHexFloat(sb, v.y);
|
||||||
AppendHexFloat(sb, v.z);
|
this.AppendHexFloat(sb, v.z);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AppendHexFloat(StringBuilder sb, float v)
|
private void AppendHexFloat(StringBuilder sb, float v)
|
||||||
@@ -274,7 +273,7 @@ public class ProfileUtils_BVHUtil
|
|||||||
|
|
||||||
private Vector3 TransformVec3(Vector3 v, BaseKey3 k)
|
private Vector3 TransformVec3(Vector3 v, BaseKey3 k)
|
||||||
{
|
{
|
||||||
return new Vector3(TransformFloatBits(v.x, k.x), TransformFloatBits(v.y, k.y), TransformFloatBits(v.z, k.z));
|
return new Vector3(this.TransformFloatBits(v.x, k.x), this.TransformFloatBits(v.y, k.y), this.TransformFloatBits(v.z, k.z));
|
||||||
}
|
}
|
||||||
|
|
||||||
private float TransformFloatBits(float a, uint keyBits)
|
private float TransformFloatBits(float a, uint keyBits)
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
// Eden.AutoMorpher.profile.ProfileUtils_BoneUtil
|
// Eden.AutoMorpher.profile.ProfileUtils_BoneUtil
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Eden.AutoMorpher.profile;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
public class ProfileUtils_BoneUtil
|
public class ProfileUtils_BoneUtil
|
||||||
@@ -68,7 +67,7 @@ public class ProfileUtils_BoneUtil
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
foreach (Transform activeBone in GetActiveBones(bodyMesh, weightThreshold))
|
foreach (Transform activeBone in this.GetActiveBones(bodyMesh, weightThreshold))
|
||||||
{
|
{
|
||||||
if (activeBone != null)
|
if (activeBone != null)
|
||||||
{
|
{
|
||||||
@@ -87,7 +86,7 @@ public class ProfileUtils_BoneUtil
|
|||||||
}
|
}
|
||||||
HashSet<Transform> hashSet2 = new HashSet<Transform>();
|
HashSet<Transform> hashSet2 = new HashSet<Transform>();
|
||||||
hashSet2.Add(boneTransform);
|
hashSet2.Add(boneTransform);
|
||||||
foreach (Transform item in FindBonesByPosition(boneTransform, hashSet, posTolerance))
|
foreach (Transform item in this.FindBonesByPosition(boneTransform, hashSet, posTolerance))
|
||||||
{
|
{
|
||||||
hashSet2.Add(item);
|
hashSet2.Add(item);
|
||||||
}
|
}
|
||||||
@@ -150,7 +149,7 @@ public class ProfileUtils_BoneUtil
|
|||||||
Vector3 position = boneToCheck.position;
|
Vector3 position = boneToCheck.position;
|
||||||
foreach (Transform item in smrBoneSet)
|
foreach (Transform item in smrBoneSet)
|
||||||
{
|
{
|
||||||
if (!(item == null) && !(item == boneToCheck) && NameMatches(item.gameObject.name, boneToCheck.gameObject.name) && (item.position - position).sqrMagnitude <= num)
|
if (!(item == null) && !(item == boneToCheck) && this.NameMatches(item.gameObject.name, boneToCheck.gameObject.name) && (item.position - position).sqrMagnitude <= num)
|
||||||
{
|
{
|
||||||
list.Add(item);
|
list.Add(item);
|
||||||
}
|
}
|
||||||
@@ -171,8 +170,8 @@ public class ProfileUtils_BoneUtil
|
|||||||
|
|
||||||
private bool NameMatches(string boneToCheckName, string candidateName)
|
private bool NameMatches(string boneToCheckName, string candidateName)
|
||||||
{
|
{
|
||||||
string[] array = TokenizeBoneName(boneToCheckName);
|
string[] array = this.TokenizeBoneName(boneToCheckName);
|
||||||
string[] array2 = TokenizeBoneName(candidateName);
|
string[] array2 = this.TokenizeBoneName(candidateName);
|
||||||
if (array.Length == 0 || array2.Length == 0)
|
if (array.Length == 0 || array2.Length == 0)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@@ -224,14 +223,14 @@ public class ProfileUtils_BoneUtil
|
|||||||
list.Add(item);
|
list.Add(item);
|
||||||
List<Transform> list2 = (from t in avatarBones
|
List<Transform> list2 = (from t in avatarBones
|
||||||
where t != null
|
where t != null
|
||||||
orderby GetDepthFromSkeletonRoot(rootTransform, t), GetHierarchyPath(rootTransform, t)
|
orderby this.GetDepthFromSkeletonRoot(rootTransform, t), this.GetHierarchyPath(rootTransform, t)
|
||||||
select t).ToList();
|
select t).ToList();
|
||||||
Dictionary<Transform, int> dictionary2 = new Dictionary<Transform, int>(list2.Count);
|
Dictionary<Transform, int> dictionary2 = new Dictionary<Transform, int>(list2.Count);
|
||||||
int num = 1;
|
int num = 1;
|
||||||
foreach (Transform item4 in list2)
|
foreach (Transform item4 in list2)
|
||||||
{
|
{
|
||||||
dictionary2[item4] = num++;
|
dictionary2[item4] = num++;
|
||||||
string hierarchyPath = GetHierarchyPath(rootTransform, item4);
|
string hierarchyPath = this.GetHierarchyPath(rootTransform, item4);
|
||||||
HumanBodyBones value2;
|
HumanBodyBones value2;
|
||||||
HumanBodyBones hBone = (dictionary.TryGetValue(item4, out value2) ? value2 : HumanBodyBones.LastBone);
|
HumanBodyBones hBone = (dictionary.TryGetValue(item4, out value2) ? value2 : HumanBodyBones.LastBone);
|
||||||
Vector3 rootLocalPosition = ((rootTransform != null) ? rootTransform.InverseTransformPoint(item4.position) : item4.position);
|
Vector3 rootLocalPosition = ((rootTransform != null) ? rootTransform.InverseTransformPoint(item4.position) : item4.position);
|
||||||
@@ -240,7 +239,7 @@ public class ProfileUtils_BoneUtil
|
|||||||
if (rootTransform != null)
|
if (rootTransform != null)
|
||||||
{
|
{
|
||||||
Vector3 lossyScale = rootTransform.lossyScale;
|
Vector3 lossyScale = rootTransform.lossyScale;
|
||||||
rootLocalScale = new Vector3(SafeDiv(rootLocalScale.x, lossyScale.x), SafeDiv(rootLocalScale.y, lossyScale.y), SafeDiv(rootLocalScale.z, lossyScale.z));
|
rootLocalScale = new Vector3(this.SafeDiv(rootLocalScale.x, lossyScale.x), this.SafeDiv(rootLocalScale.y, lossyScale.y), this.SafeDiv(rootLocalScale.z, lossyScale.z));
|
||||||
}
|
}
|
||||||
list.Add(new BoneData
|
list.Add(new BoneData
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
// Eden.AutoMorpher.profile.ProfileUtils_PCAUtil
|
// Eden.AutoMorpher.profile.ProfileUtils_PCAUtil
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Eden.AutoMorpher.profile;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
public class ProfileUtils_PCAUtil
|
public class ProfileUtils_PCAUtil
|
||||||
@@ -43,7 +42,7 @@ public class ProfileUtils_PCAUtil
|
|||||||
num4 *= num7;
|
num4 *= num7;
|
||||||
num5 *= num7;
|
num5 *= num7;
|
||||||
num6 *= num7;
|
num6 *= num7;
|
||||||
JacobiEigenDecomposition3x3(num, num2, num3, num4, num5, num6, out var eigenValues, out var eigenVectors);
|
this.JacobiEigenDecomposition3x3(num, num2, num3, num4, num5, num6, out var eigenValues, out var eigenVectors);
|
||||||
int num8 = 0;
|
int num8 = 0;
|
||||||
if (eigenValues[1] > eigenValues[num8])
|
if (eigenValues[1] > eigenValues[num8])
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
// Eden.AutoMorpher.profile.ProfileUtils_PoseUtil
|
// Eden.AutoMorpher.profile.ProfileUtils_PoseUtil
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Eden.AutoMorpher.profile;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
public class ProfileUtils_PoseUtil
|
public class ProfileUtils_PoseUtil
|
||||||
@@ -11,15 +10,15 @@ public class ProfileUtils_PoseUtil
|
|||||||
{
|
{
|
||||||
BoneSpatialData boneSpatialData = new BoneSpatialData();
|
BoneSpatialData boneSpatialData = new BoneSpatialData();
|
||||||
boneSpatialData.refBone = refBone;
|
boneSpatialData.refBone = refBone;
|
||||||
Transform baseBoneFromBoneMap = GetBaseBoneFromBoneMap(boneMap, refBone);
|
Transform baseBoneFromBoneMap = this.GetBaseBoneFromBoneMap(boneMap, refBone);
|
||||||
if (baseBoneFromBoneMap == null)
|
if (baseBoneFromBoneMap == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
List<Vector3> refVertices = GetRefVertices(influencedBones, boneMap, sourceBodyBakedMeshes, addChildBones);
|
List<Vector3> refVertices = this.GetRefVertices(influencedBones, boneMap, sourceBodyBakedMeshes, addChildBones);
|
||||||
boneSpatialData.pcaData = GetPCAData(baseBoneFromBoneMap, refVertices);
|
boneSpatialData.pcaData = this.GetPCAData(baseBoneFromBoneMap, refVertices);
|
||||||
Transform baseBoneFromBoneMap2 = GetBaseBoneFromBoneMap(boneMap, HumanBodyBones.Hips);
|
Transform baseBoneFromBoneMap2 = this.GetBaseBoneFromBoneMap(boneMap, HumanBodyBones.Hips);
|
||||||
boneSpatialData.volumeData = GetVolumeData(baseBoneFromBoneMap, baseBoneFromBoneMap2, refVertices);
|
boneSpatialData.volumeData = this.GetVolumeData(baseBoneFromBoneMap, baseBoneFromBoneMap2, refVertices);
|
||||||
return boneSpatialData;
|
return boneSpatialData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
// Eden.AutoMorpher.profile.ProfileUtils_VertexUtil
|
// Eden.AutoMorpher.profile.ProfileUtils_VertexUtil
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Eden.AutoMorpher.profile;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
public class ProfileUtils_VertexUtil
|
public class ProfileUtils_VertexUtil
|
||||||
@@ -41,8 +40,8 @@ public class ProfileUtils_VertexUtil
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
num += 4;
|
num += 4;
|
||||||
version = ReadHexIntSafe(text, ref num);
|
version = this.ReadHexIntSafe(text, ref num);
|
||||||
countInFile = ReadHexIntSafe(text, ref num);
|
countInFile = this.ReadHexIntSafe(text, ref num);
|
||||||
if (countInFile <= 0)
|
if (countInFile <= 0)
|
||||||
{
|
{
|
||||||
Debug.LogError("[ProfileUtil_VertexUtil] LoadTable - invalid count");
|
Debug.LogError("[ProfileUtil_VertexUtil] LoadTable - invalid count");
|
||||||
@@ -51,7 +50,7 @@ public class ProfileUtils_VertexUtil
|
|||||||
BaseKey3[] array = new BaseKey3[countInFile];
|
BaseKey3[] array = new BaseKey3[countInFile];
|
||||||
for (int i = 0; i < countInFile; i++)
|
for (int i = 0; i < countInFile; i++)
|
||||||
{
|
{
|
||||||
array[i] = ReadHexKey3Safe(text, ref num);
|
array[i] = this.ReadHexKey3Safe(text, ref num);
|
||||||
}
|
}
|
||||||
return array;
|
return array;
|
||||||
}
|
}
|
||||||
@@ -70,9 +69,9 @@ public class ProfileUtils_VertexUtil
|
|||||||
|
|
||||||
private BaseKey3 ReadHexKey3Safe(string s, ref int p)
|
private BaseKey3 ReadHexKey3Safe(string s, ref int p)
|
||||||
{
|
{
|
||||||
int x = ReadHexIntSafe(s, ref p);
|
int x = this.ReadHexIntSafe(s, ref p);
|
||||||
uint y = (uint)ReadHexIntSafe(s, ref p);
|
uint y = (uint)this.ReadHexIntSafe(s, ref p);
|
||||||
uint z = (uint)ReadHexIntSafe(s, ref p);
|
uint z = (uint)this.ReadHexIntSafe(s, ref p);
|
||||||
return new BaseKey3((uint)x, y, z);
|
return new BaseKey3((uint)x, y, z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
// Eden.AutoMorpher.profile.ProfileUtils_VolumeUtil
|
// Eden.AutoMorpher.profile.ProfileUtils_VolumeUtil
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Eden.AutoMorpher.profile;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
public class ProfileUtils_VolumeUtil
|
public class ProfileUtils_VolumeUtil
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
// Eden.AutoMorpher.profile.VolumeData
|
// Eden.AutoMorpher.profile.VolumeData
|
||||||
using System;
|
using System;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
// Eden.AutoMorpher.profile.profileBVHData
|
// Eden.AutoMorpher.profile.profileBVHData
|
||||||
public class profileBVHData
|
public class profileBVHData
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
// EdenAutoMorpher_ProfileSaver_Script, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
// Eden.AutoMorpher.profile.profileBVHNode
|
// Eden.AutoMorpher.profile.profileBVHNode
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user