Esempio n. 1
0
 /// <summary>
 /// Set blendShape values immediate.
 /// </summary>
 /// <param name="values"></param>
 public void SetValues(IEnumerable <KeyValuePair <BlendShapeKey, float> > values)
 {
     if (m_merger != null)
     {
         m_merger.SetValues(values);
     }
 }
Esempio n. 2
0
        void OnBlendShapeGUI(VRMBlendShapeProxy proxy)
        {
            if (!State.ExportRoot.scene.IsValid())
            {
                EditorGUILayout.HelpBox(BlendShapeTabMessages.CANNOT_MANIPULATE_PREFAB.Msg(), MessageType.Warning);
                return;
            }

            if (!proxy)
            {
                EditorGUILayout.HelpBox("no BlendShapeProxy", MessageType.Warning);
                return;
            }
            var avatar = proxy.BlendShapeAvatar;

            if (!avatar)
            {
                return;
            }

            m_merger = new BlendShapeMerger(avatar.Clips, proxy.transform);


            GUILayout.Space(20);

            EditorGUILayout.HelpBox(BlendShapeTabMessages.SCENE_MESSAGE.Msg(), MessageType.Info);

            var options = avatar.Clips.Select(x => x.ToString()).ToArray();

            m_selected = EditorGUILayout.Popup("select blendshape", m_selected, options);

            if (GUILayout.Button(BlendShapeTabMessages.APPLY_BLENDSHAPECLIP_BUTTON.Msg()))
            {
                m_merger.SetValues(avatar.Clips.Select((x, i) => new KeyValuePair <BlendShapeKey, float>(x.Key, i == m_selected ? 1 : 0)));
                m_merger.Apply();
                m_settings.PoseFreeze = true;
            }

            if (GUILayout.Button(BlendShapeTabMessages.CLEAR_BLENDSHAPE_BUTTON.Msg()))
            {
                m_merger.SetValues(avatar.Clips.Select(x => new KeyValuePair <BlendShapeKey, float>(x.Key, 0)));
                m_merger.Apply();
            }
        }
Esempio n. 3
0
        void OnBlendShapeGUI(VRMBlendShapeProxy proxy)
        {
            if (!m_state.ExportRoot.scene.IsValid())
            {
                EditorGUILayout.HelpBox("prefab は操作できません", MessageType.Warning);
                return;
            }

            if (!proxy)
            {
                return;
            }
            var avatar = proxy.BlendShapeAvatar;

            if (!avatar)
            {
                return;
            }

            m_merger = new BlendShapeMerger(avatar.Clips, proxy.transform);


            GUILayout.Space(20);

            EditorGUILayout.HelpBox("シーン上のExportRootにBlendShapeを適用します。Exportすると適用された状態がBakeされます。", MessageType.Info);

            var options = avatar.Clips.Select(x => x.ToString()).ToArray();

            m_selected = EditorGUILayout.Popup("select blendshape", m_selected, options);

            if (GUILayout.Button("選択されたBlendShapeを適用する"))
            {
                m_merger.SetValues(avatar.Clips.Select((x, i) => new KeyValuePair <BlendShapeKey, float>(x.Key, i == m_selected ? 1 : 0)));
                m_merger.Apply();
                m_settings.PoseFreeze = true;
            }

            if (GUILayout.Button("BlendShapeをClearする"))
            {
                m_merger.SetValues(avatar.Clips.Select(x => new KeyValuePair <BlendShapeKey, float>(x.Key, 0)));
                m_merger.Apply();
            }
        }