Пример #1
0
        public void KeyTest()
        {
            var key = CreateBlendShapeKey("Blink", BlendShapePreset.Blink);

            Assert.AreEqual(key, CreateBlendShapeKey("Blink", BlendShapePreset.Blink));
            Assert.AreEqual(key, BlendShapeKey.CreateFromPreset(BlendShapePreset.Blink));
            Assert.AreEqual(key, CreateBlendShapeKey("xxx", BlendShapePreset.Blink));

            var dict = new Dictionary <BlendShapeKey, float>();

            dict[key] = 1.0f;

            Assert.IsTrue(dict.ContainsKey(CreateBlendShapeKey("Blink", BlendShapePreset.Blink)));
            Assert.IsTrue(dict.ContainsKey(BlendShapeKey.CreateFromPreset(BlendShapePreset.Blink)));
            Assert.IsTrue(dict.ContainsKey(CreateBlendShapeKey("xxx", BlendShapePreset.Blink)));

            dict.Clear();

            var key2 = BlendShapeKey.CreateUnknown("Blink"); // name: Blink, Preset: Unknown

            dict[key2] = 1.0f;

            Assert.AreEqual(key2, CreateBlendShapeKey("Blink", BlendShapePreset.Unknown));
            Assert.AreNotEqual(key2, BlendShapeKey.CreateUnknown("blink"));
            Assert.AreNotEqual(key2, CreateBlendShapeKey("Blink", BlendShapePreset.Blink));
            Assert.AreNotEqual(key2, BlendShapeKey.CreateFromPreset(BlendShapePreset.Blink));

            Assert.IsFalse(dict.ContainsKey(BlendShapeKey.CreateUnknown("blink")));
            Assert.IsFalse(dict.ContainsKey(CreateBlendShapeKey("Blink", BlendShapePreset.Blink)));
            Assert.IsFalse(dict.ContainsKey(BlendShapeKey.CreateFromPreset(BlendShapePreset.Blink)));
        }
Пример #2
0
 public static void SetValue(this VRMBlendShapeProxy proxy, String key, float value, bool apply)
 {
     if (apply)
     {
         proxy.ImmediatelySetValue(BlendShapeKey.CreateUnknown(key), value);
     }
     else
     {
         proxy.AccumulateValue(BlendShapeKey.CreateUnknown(key), value);
     }
 }
Пример #3
0
 public BlendShapeClip GetClip(String name)
 {
     return(GetClip(BlendShapeKey.CreateUnknown(name)));
 }
Пример #4
0
 public static void AccumulateValue(this VRMBlendShapeProxy proxy, String key, float value)
 {
     proxy.AccumulateValue(BlendShapeKey.CreateUnknown(key), value);
 }
Пример #5
0
 public static void ImmediatelySetValue(this VRMBlendShapeProxy proxy, String key, float value)
 {
     proxy.ImmediatelySetValue(BlendShapeKey.CreateUnknown(key), value);
 }
Пример #6
0
 public static float GetValue(this VRMBlendShapeProxy proxy, String key)
 {
     return(proxy.GetValue(BlendShapeKey.CreateUnknown(key)));
 }