mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-05-14 06:19:47 -05:00
BlendShapeClipHandler is obsolete
This commit is contained in:
parent
063df8b6a0
commit
04a1abab4e
|
|
@ -13,12 +13,6 @@ namespace VRM
|
|||
BlendShapes = GetComponent<VRMBlendShapeProxy>();
|
||||
}
|
||||
|
||||
BlendShapeClipHandler m_appyerA;
|
||||
BlendShapeClipHandler m_appyerI;
|
||||
BlendShapeClipHandler m_appyerU;
|
||||
BlendShapeClipHandler m_appyerE;
|
||||
BlendShapeClipHandler m_appyerO;
|
||||
|
||||
Coroutine m_coroutine;
|
||||
|
||||
[SerializeField]
|
||||
|
|
@ -30,29 +24,23 @@ namespace VRM
|
|||
if (BlendShapes == null) return;
|
||||
if (BlendShapes.BlendShapeAvatar == null) return;
|
||||
var avatar = BlendShapes.BlendShapeAvatar;
|
||||
|
||||
m_appyerA = new BlendShapeClipHandler(avatar.GetClip("A"), transform);
|
||||
m_appyerI = new BlendShapeClipHandler(avatar.GetClip("I"), transform);
|
||||
m_appyerU = new BlendShapeClipHandler(avatar.GetClip("U"), transform);
|
||||
m_appyerE = new BlendShapeClipHandler(avatar.GetClip("E"), transform);
|
||||
m_appyerO = new BlendShapeClipHandler(avatar.GetClip("O"), transform);
|
||||
}
|
||||
|
||||
static IEnumerator RoutineNest(BlendShapeClipHandler applyer, float velocity, float wait)
|
||||
IEnumerator RoutineNest(BlendShapePreset preset, float velocity, float wait)
|
||||
{
|
||||
for (var value = 0.0f; value <= 1.0f; value += velocity)
|
||||
{
|
||||
if (applyer != null) applyer.Apply(value);
|
||||
BlendShapes.SetValue(preset, value);
|
||||
yield return null;
|
||||
}
|
||||
if (applyer != null) applyer.Apply(1.0f);
|
||||
BlendShapes.SetValue(preset, 1.0f);
|
||||
yield return new WaitForSeconds(wait);
|
||||
for (var value = 1.0f; value >= 0; value -= velocity)
|
||||
{
|
||||
if (applyer != null) applyer.Apply(value);
|
||||
BlendShapes.SetValue(preset, value);
|
||||
yield return null;
|
||||
}
|
||||
if (applyer != null) applyer.Apply(0);
|
||||
BlendShapes.SetValue(preset, 0);
|
||||
yield return new WaitForSeconds(wait * 2);
|
||||
}
|
||||
|
||||
|
|
@ -64,11 +52,11 @@ namespace VRM
|
|||
|
||||
var velocity = 0.1f;
|
||||
|
||||
yield return RoutineNest(m_appyerA, velocity, m_wait);
|
||||
yield return RoutineNest(m_appyerI, velocity, m_wait);
|
||||
yield return RoutineNest(m_appyerU, velocity, m_wait);
|
||||
yield return RoutineNest(m_appyerE, velocity, m_wait);
|
||||
yield return RoutineNest(m_appyerO, velocity, m_wait);
|
||||
yield return RoutineNest(BlendShapePreset.A, velocity, m_wait);
|
||||
yield return RoutineNest(BlendShapePreset.I, velocity, m_wait);
|
||||
yield return RoutineNest(BlendShapePreset.U, velocity, m_wait);
|
||||
yield return RoutineNest(BlendShapePreset.E, velocity, m_wait);
|
||||
yield return RoutineNest(BlendShapePreset.O, velocity, m_wait);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
using UnityEngine;
|
||||
using System.Linq;
|
||||
|
||||
using System;
|
||||
|
||||
namespace VRM
|
||||
{
|
||||
[Obsolete("Use VRMBlendShapeProxy")]
|
||||
public class BlendShapeClipHandler
|
||||
{
|
||||
BlendShapeClip m_clip;
|
||||
|
|
@ -17,7 +18,7 @@ namespace VRM
|
|||
{
|
||||
m_clip = clip;
|
||||
|
||||
if (m_clip != null && m_clip.Values!=null && transform != null)
|
||||
if (m_clip != null && m_clip.Values != null && transform != null)
|
||||
{
|
||||
m_renderers = m_clip.Values.Select(x =>
|
||||
{
|
||||
|
|
@ -45,7 +46,7 @@ namespace VRM
|
|||
{
|
||||
var binding = m_clip.Values[i];
|
||||
var target = m_renderers[i];
|
||||
if(binding.Index>=0 && binding.Index < target.sharedMesh.blendShapeCount)
|
||||
if (binding.Index >= 0 && binding.Index < target.sharedMesh.blendShapeCount)
|
||||
{
|
||||
target.SetBlendShapeWeight(binding.Index, binding.Weight * value);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user