Пример #1
0
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        reader = target as PhonemesToBlendShapes;
        bool isPlaying = Application.isPlaying && reader.audio != null && reader.audio.isPlaying;

        CheckRemapArraySize();

        //Playing refresh
        if (isPlaying)
        {
            time = reader.audio.time / reader.audio.clip.length;
            Repaint();
        }

        //Draw graph
        float temp = time;

        if (reader.clip != null)
        {
            Phonemes_Editor.DrawGraph(reader.clip.phonemes.refined, ref temp, Repaint, BlendShapeField);
        }
        if (temp != time)
        {
            time = temp;
            if (!Application.isPlaying)
            {
                reader.Evaluate(time);
            }
        }

        //Draw play button
        if (Application.isPlaying)
        {
            if (!isPlaying)
            {
                if (GUILayout.Button("Play"))
                {
                    reader.audio.Play();
                }
            }
            else
            {
                if (GUILayout.Button("Stop"))
                {
                    reader.audio.Stop();
                }
            }
        }
    }
Пример #2
0
 private void OnEnable()
 {
     reader = target as PhonemesToBlendShapes;
     LoadBlendShapes();
 }