diff --git a/Scripts/BlendShape/BlendShapeMerger.cs b/Scripts/BlendShape/BlendShapeMerger.cs index 2e41939de..552f207f8 100644 --- a/Scripts/BlendShape/BlendShapeMerger.cs +++ b/Scripts/BlendShape/BlendShapeMerger.cs @@ -129,6 +129,15 @@ namespace VRM m_materialValueMap.Clear(); } + public void SetValues(IEnumerable> values) + { + foreach(var kv in values) + { + SetValue(kv.Key, kv.Value, false); + } + Apply(); + } + public void SetValue(BlendShapeKey key, float value, bool replace) { m_valueMap[key] = value; diff --git a/Scripts/BlendShape/VRMBlendShapeProxy.cs b/Scripts/BlendShape/VRMBlendShapeProxy.cs index c22cb5965..7d7188d41 100644 --- a/Scripts/BlendShape/VRMBlendShapeProxy.cs +++ b/Scripts/BlendShape/VRMBlendShapeProxy.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using UnityEngine; @@ -52,13 +53,32 @@ namespace VRM { return GetValue(new BlendShapeKey(key)); } - public void SetValue(BlendShapeKey key, float value, bool apply = true) + + [Obsolete("Use SetValues")] + public void SetValue(BlendShapeKey key, float value, bool apply) { if (m_merger != null) { m_merger.SetValue(key, value, apply); } } + + public void SetValue(BlendShapeKey key, float value) + { + if (m_merger != null) + { + m_merger.SetValue(key, value, true); + } + } + + public void SetValues(IEnumerable> values) + { + if (m_merger != null) + { + m_merger.SetValues(values); + } + } + public float GetValue(BlendShapeKey key) { if (m_merger == null)