From b8223a20c3928242a9c64fd2d8ce4269fe31adf4 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Wed, 19 May 2021 16:04:16 +0900 Subject: [PATCH] export with bone normalize cause, drop look at curve params --- Assets/VRM/Runtime/LookAt/CurveMapper.cs | 24 ++++++++++++++++++- .../SkinnedMeshUtility/VRMBoneNormalizer.cs | 7 ++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/Assets/VRM/Runtime/LookAt/CurveMapper.cs b/Assets/VRM/Runtime/LookAt/CurveMapper.cs index cbc750d2ad..c18d2c3bb0 100644 --- a/Assets/VRM/Runtime/LookAt/CurveMapper.cs +++ b/Assets/VRM/Runtime/LookAt/CurveMapper.cs @@ -7,7 +7,7 @@ namespace VRM { [Serializable] - public class CurveMapper + public class CurveMapper : IEquatable { public AnimationCurve Curve = AnimationCurve.Linear(0, 0, 1.0f, 1.0f); @@ -37,6 +37,12 @@ public void OnValidate() } } + public void Assign(CurveMapper mapper) + { + CurveXRangeDegree = mapper.CurveXRangeDegree; + CurveYRangeDegree = mapper.CurveYRangeDegree; + } + public void Apply(glTF_VRM_DegreeMap degreeMap) { CurveXRangeDegree = degreeMap.xRange; @@ -71,5 +77,21 @@ public float Map(float src) } return Curve.Evaluate(src / CurveXRangeDegree) * CurveYRangeDegree; } + + public bool Equals(CurveMapper other) + { + if (CurveXRangeDegree != other.CurveXRangeDegree) return false; + if (CurveYRangeDegree != other.CurveYRangeDegree) return false; + return true; + } + + public override bool Equals(object obj) + { + if (obj is CurveMapper mapper) + { + return Equals(mapper); + } + return base.Equals(obj); + } } } diff --git a/Assets/VRM/Runtime/SkinnedMeshUtility/VRMBoneNormalizer.cs b/Assets/VRM/Runtime/SkinnedMeshUtility/VRMBoneNormalizer.cs index 65b2a6b7a7..3b5891824f 100644 --- a/Assets/VRM/Runtime/SkinnedMeshUtility/VRMBoneNormalizer.cs +++ b/Assets/VRM/Runtime/SkinnedMeshUtility/VRMBoneNormalizer.cs @@ -228,6 +228,10 @@ public static GameObject Execute(GameObject go, bool forceTPose) if (src != null) { var dst = root.AddComponent(); + dst.HorizontalInner.Assign(src.HorizontalInner); + dst.HorizontalOuter.Assign(src.HorizontalOuter); + dst.VerticalUp.Assign(src.VerticalUp); + dst.VerticalDown.Assign(src.VerticalDown); } } { @@ -236,6 +240,9 @@ public static GameObject Execute(GameObject go, bool forceTPose) if (src != null) { var dst = root.AddComponent(); + dst.Horizontal.Assign(src.Horizontal); + dst.VerticalUp.Assign(src.VerticalUp); + dst.VerticalDown.Assign(src.VerticalDown); } }