Esempio n. 1
0
 private void Update()
 {
     if (BlendShapeAvatar != null)
     {
         if (m_merger == null)
         {
             m_merger = new BlendShapeMerger(BlendShapeAvatar.Clips, transform);
         }
     }
 }
Esempio n. 2
0
        public void Initialize()
        {
            if (BlendShapeAvatar == null)
            {
                return;
            }

            if (m_merger == null)
            {
                m_merger = new BlendShapeMerger(BlendShapeAvatar.Clips, transform);
            }
        }
Esempio n. 3
0
 private void Start()
 {
     if (m_destroyed)
     {
         return;
     }
     if (BlendShapeAvatar == null)
     {
         return;
     }
     // m_merger の null check は必用か?
     m_merger = new BlendShapeMerger(BlendShapeAvatar.Clips, transform);
 }
Esempio n. 4
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. 5
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();
            }
        }