private void DrawPhonemePreview(Rect rect, Phonemes phonemes) { //No phonemes if (phonemes == null) { if (Utils.BoxWithLink("There is no refined phonemes.", "Rebuild", MessageType.Error)) { clip.phonemes.UpdateTable(clip.speech.phonemeTable); } return; } //Draw top rect Rect topRect = new Rect(rect.x, rect.y, rect.width, 18); EditorGUI.DrawRect(topRect, Phonemes_Editor.graphBgColor); //Draw curves and fields float maxValue = 0.0f; string maxValueName = ""; Color maxValueColor = Color.white; for (int i = 0; i < phonemes.curves.Length; i++) { Color curveColor = Color.HSVToRGB((i * 0.13f) % 1.0f, 0.8f, 1.0f); EditorGUIUtility.DrawCurveSwatch(rect, phonemes.curves[i].curve, null, curveColor, Phonemes_Editor.transparent, new Rect(0, 0, 1, 1)); float value = phonemes.curves[i].curve.Evaluate(clipTime); if (value > maxValue) { maxValue = value; maxValueName = phonemes.curves[i].name; maxValueColor = curveColor; } } //Draw maxValue top label if (maxValue > 0.0001f) { topRect.x = rect.x + rect.width * clipTime; Color guiColor = GUI.color; GUI.color = maxValueColor; GUI.Label(topRect, maxValueName, Styles.whiteLabel); GUI.color = guiColor; } //Commands GUILayout.Space(5); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button("Rebuild")) { clip.phonemes.UpdateTable(clip.speech.phonemeTable); } GUILayout.EndHorizontal(); }
private void DrawProjectList(Rect areaRect) { //Mouse event Vector2 mp = Event.current.mousePosition; mp.y += projectListScroll.y - areaRect.y + 3; //Begin scroll view projectListScroll = GUILayout.BeginScrollView(projectListScroll, false, true, GUILayout.MinHeight(100)); bool searchEnable = !string.IsNullOrEmpty(search); string searchPattern = searchEnable ? search.ToLower() : ""; int j = 0; for (int i = 0; i < Settings.projects.Length; i++) { //Search filter string name = Settings.projects[i].name; if (searchEnable) { if (!name.ToLower().Contains(searchPattern)) { continue; } } //Draw project line Rect rect = GUILayoutUtility.GetRect(Screen.width, 16f); rect.Set(rect.x, rect.y, rect.width, rect.height); if (rect.Contains(mp)) { if (GUI.Button(rect, "", GUI.skin.box)) { selected = j; } } if (j == selected) { EditorGUI.DrawRect(rect, Color.cyan * 0.2f); } else if (j % 2 == 0) { EditorGUI.DrawRect(rect, Color.white * 0.1f); } j++; GUI.Label(rect, Settings.projects[i].name); } //No projects with this name if (searchEnable && j == 0) { GUILayout.Label("No projects matching the search", EditorStyles.centeredGreyMiniLabel); } //No project on Resemble if (Settings.projects.Length == 0) { if (Settings.tryToConnect) { GUILayout.Label("Refreshing...", EditorStyles.centeredGreyMiniLabel); } else { if (Utils.BoxWithLink("You don't have a project on Resemble yet. Please go to", "Resemble.ai to create a new project.", MessageType.Info)) { WebPage.ResembleProjects.Open(); } ; } } GUILayout.EndScrollView(); }
private void DrawOptionsSettingsGUI() { //Update settings GUILayout.Label("Update", Styles.header); bool drawRefreshButton = true; switch (Updates.status) { case Updates.Status.unknown: Updates.CheckStatus(); Utils.DrawPendingLabel("Checking..."); drawRefreshButton = false; break; case Updates.Status.checking: Utils.DrawPendingLabel("Checking..."); drawRefreshButton = false; break; case Updates.Status.error: Utils.BoxWithLink("Unable to check for updates. Check your internet connection or update manually.", "Github page", WebPage.PluginGithub, MessageType.Error); break; case Updates.Status.updated: GUILayout.Label("Your plugin is up to date."); break; case Updates.Status.outdated: GUILayout.Label("Your plugin is out of date."); if (GUILayout.Button("Update")) { Updates.Update(); } EditorGUILayout.HelpBox("An outdated plugin may not work. It is strongly recommended to keep the plugin up to date.", MessageType.Warning); break; default: break; } GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (drawRefreshButton && GUILayout.Button("Refresh")) { Updates.CheckStatus(); } if (Updates.status == Updates.Status.updated && GUILayout.Button("Reimport")) { Updates.Update(); } GUILayout.EndHorizontal(); //Path settings Utils.DrawSeparator(); GUILayout.Space(20); GUILayout.Label(new GUIContent("Paths", "Describe where AudioClips from CharacterSets should be generated."), Styles.header); //Path methode Settings.pathMethode = (Settings.PathMethode)EditorGUILayout.EnumPopup( pathMethode, Settings.pathMethode); //Target folders fields switch (Settings.pathMethode) { case Settings.PathMethode.Absolute: Settings.folderPathA = FolderField("Target folder", Settings.folderPathA); break; case Settings.PathMethode.SamePlace: break; case Settings.PathMethode.MirrorHierarchy: Settings.folderPathB = FolderField("Resemble Speechs root", Settings.folderPathB); Settings.folderPathA = FolderField("AudioClips root", Settings.folderPathA); break; } //Use subFolders Settings.useSubDirectory = EditorGUILayout.Toggle(useSubFolder, Settings.useSubDirectory); //Draw example image Texture image = Resources.instance.pathImages[(int)Settings.pathMethode * 2 + (Settings.useSubDirectory ? 1 : 0)]; Rect rect = GUILayoutUtility.GetAspectRect(image.width / image.height); GUI.Label(rect, image); //Generation settings Utils.DrawSeparator(); GUILayout.Space(20); GUILayout.Label("Generation", Styles.header); Settings.forceGeneration = !EditorGUILayout.Toggle( new GUIContent("Bypass if unchanged", "Bypass the generation if the clip is similar to the api one and just download the existing clip."), !Settings.forceGeneration); GUILayout.Space(10); }