private void DrawTextArea()
        {
            //Tags buttons
            drawer.DrawTagsBtnsLayout(false);

            //Separator
            Rect rect = GUILayoutUtility.GetRect(1.0f, 1.0f, GUILayout.ExpandWidth(true));

            rect.Set(rect.x, rect.y, rect.width, 1.0f);
            EditorGUI.DrawRect(rect, Color.grey * 0.2f);

            //Draw text field
            drawer.DoLayout(true, false);

            //Draw character count bar
            rect = GUILayoutUtility.GetRect(Screen.width, 25).Shrink(10);
            rect.Set(rect.x, rect.y - 10, rect.width, rect.height + 10);
            drawer.DrawCharCountBar(rect);

            //Draw bottom text buttons
            GUILayout.Space(5);
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            if (request == null)
            {
                EditorGUI.BeginDisabledGroup(string.IsNullOrEmpty(clip.text.userString));
                if (GUILayout.Button("Generate Audio"))
                {
                    request       = AsyncRequest.Make(clip);
                    clip.phonemes = null;
                }
                EditorGUI.EndDisabledGroup();
            }
            else
            {
                if (GUILayout.Button("Select parent"))
                {
                    Selection.activeObject = clip.speech;
                }
            }

            GUILayout.EndHorizontal();
        }
Ejemplo n.º 2
0
        public void DrawOneShotGUI()
        {
            //Check connection
            if (!Settings.haveProject)
            {
                Utils.ConnectionRequireMessage();
            }
            EditorGUI.BeginDisabledGroup(!Settings.haveProject);

            //Update progress bar if exist
            if (drawProgressBar)
            {
                EditorUtility.DisplayProgressBar("Resemble", "Download clip...", preview.download.progress);
                if (preview.download.isDone)
                {
                    drawProgressBar = false;
                    EditorUtility.ClearProgressBar();
                }
            }

            //Init components
            if (Resources.instance.oneShotText == null)
            {
                Resources.instance.oneShotText = new Text();
            }
            if (drawer == null)
            {
                drawer = new Text_Editor(Resources.instance.oneShotText, SetDirty, Repaint);
            }

            //Tags
            drawer.DrawTagsBtnsLayout(!Settings.haveProject);

            //Draw text area
            Rect rect = GUILayoutUtility.GetRect(Screen.width, 300).Shrink(10);

            drawer.DrawTextArea(rect, Settings.haveProject);

            //Draw char count progress bar
            rect.Set(rect.x, rect.y + rect.height, rect.width, 16);
            drawer.DrawCharCountBar(rect);
            GUILayout.Space(20);


            //Bot commands
            GUILayout.BeginHorizontal();
            GUILayout.Space(10);

            //Voice field
            DrawVoiceField();

            //Generate button
            EditorGUI.BeginDisabledGroup(string.IsNullOrEmpty(voiceUUID) || string.IsNullOrEmpty(text.userString));
            if (GUILayout.Button("Generate audio", GUILayout.ExpandWidth(false)))
            {
                Generate();
            }
            EditorGUI.EndDisabledGroup();

            GUILayout.Space(7);
            GUILayout.EndHorizontal();
            EditorGUI.EndDisabledGroup();


            //Footer
            GUILayout.FlexibleSpace();
            Utils.DrawSeparator();
            GUILayout.Label("The audio files generated here will not be saved in the Resemble project.", Styles.settingsBody);
        }