private void DrawSpeechProperties()
        {
            //Voice field
            EditorGUILayout.BeginHorizontal();
            GUILayout.Label("Voice", GUILayout.Width(EditorGUIUtility.labelWidth - 2));
            if (EditorGUILayout.DropdownButton(new GUIContent(string.IsNullOrEmpty(speech.voiceName) ? "None" : speech.voiceName), FocusType.Passive))
            {
                VoicePopup.Show(voiceRect, (Voice voice) =>
                {
                    speech.voiceName = voice.name;
                    speech.voiceUUID = voice.uuid;
                    EditorUtility.SetDirty(speech);
                });
            }

            //Set rect for popup
            if (Event.current.type == EventType.Repaint)
            {
                voiceRect = GUIUtility.GUIToScreenRect(GUILayoutUtility.GetLastRect().Offset(0, 18, 0, 100));
            }
            EditorGUILayout.EndHorizontal();

            //Begin Change Check
            EditorGUI.BeginChangeCheck();

            //Include phonemes
            speech.includePhonemes = EditorGUILayout.Toggle("Include phonemes", speech.includePhonemes);

            //Phoneme table
            if (speech.includePhonemes)
            {
                PhonemeTable temp = EditorGUILayout.ObjectField(phonemeTableLabel, speech.phonemeTable, typeof(PhonemeTable), false) as PhonemeTable;

                //Update phoneme table on clip when change
                if (temp != speech.phonemeTable)
                {
                    speech.phonemeTable = temp;
                    for (int i = 0; i < speech.clips.Count; i++)
                    {
                        if (speech.clips[i].havePhonemes)
                        {
                            speech.clips[i].phonemes.UpdateTable(temp);
                        }
                    }
                }
            }

            //Apply change if any
            if (EditorGUI.EndChangeCheck())
            {
                EditorUtility.SetDirty(speech);
            }

            GUILayout.Space(5);
            Utils.DrawSeparator();
        }
Exemple #2
0
 private void DrawVoiceField()
 {
     if (EditorGUILayout.DropdownButton(new GUIContent(string.IsNullOrEmpty(voiceName) ? "None" : voiceName), FocusType.Passive))
     {
         VoicePopup.Show(voiceRect, (Voice voice) =>
         {
             voiceName = voice.name;
             voiceUUID = voice.uuid;
         });
     }
     if (Event.current.type == EventType.Repaint)
     {
         voiceRect = GUIUtility.GUIToScreenRect(GUILayoutUtility.GetLastRect().Offset(0, 18, 0, 100));
     }
 }
Exemple #3
0
        public static void Show(Rect rect, ValidateCallback callback)
        {
            //Close window if already open
            if (window != null)
            {
                window.Close();
                return;
            }

            //Open window
            VoicePopup.callback       = callback;
            Settings.OnRefreshVoices += OnRefreshVoices;
            Settings.RefreshVoices();
            voices = Settings.voices;
            window = CreateInstance <VoicePopup>();
            window.ShowPopup();
            window.titleContent = new GUIContent("Voices");
            window.position     = rect;
        }
Exemple #4
0
 private new void Close()
 {
     window = null;
     Settings.OnRefreshVoices -= OnRefreshVoices;
     base.Close();
 }