private void OnGUI() { GUILayout.Label("Server URL:"); serverAdress = GUILayout.TextField(serverAdress); GUILayout.Label("DH token:"); dhToken = GUILayout.TextField(dhToken); GUILayout.Label("TTS token:"); ttsToken = GUILayout.TextField(ttsToken); GUILayout.Label("Text:"); text = GUILayout.TextArea(text); GUILayout.Label("Voice ID:"); selectedVoiceID = EditorGUILayout.Popup(selectedVoiceID, ServerAPI.AvaliableVoiceID); GUILayout.Space(20); generateLipSync = GUILayout.Toggle(generateLipSync, "Generate Lip Sync?"); if (generateLipSync) { GUILayout.Space(10); GUILayout.Label("Emotion:"); selectedEmotionsATL = EditorGUILayout.Popup(selectedEmotionsATL, ServerAPI.AvaliableEmotionsATL); GUILayout.Label("Engine ID:"); selectedEngineATL = EditorGUILayout.Popup(selectedEngineATL, ServerAPI.AvaliableEnginesATL); GUILayout.Space(5); GUILayout.Label("Eyes movement:"); eyesMode = EditorGUILayout.Popup(eyesMode, ServerAPI.EyesMovementModes); GUILayout.Label("Neck movement:"); neckMode = EditorGUILayout.Popup(neckMode, ServerAPI.NeckMovementModes); GUILayout.Space(10); } var isReady = !string.IsNullOrEmpty(serverAdress) && !string.IsNullOrEmpty(text); GUI.enabled = isReady; if (GUILayout.Button("Generate")) { var tts = new ParamsTTS() { ttsToken = ttsToken, text = text, ttsEngine = "latest", voiceID = ServerAPI.AvaliableVoiceID[selectedVoiceID] }; var wav = ServerAPI.GenerateTTS(serverAdress, tts, dhToken); if (wav != null) { string lipsync = null; if (generateLipSync) { var atlParams = new ParamsATL() { engine = ServerAPI.AvaliableEnginesATL[selectedEngineATL], explicitEmotion = ServerAPI.AvaliableEmotionsATL[selectedEmotionsATL], eyeMovementParameters = new EyeMovementParams() { eyeMovementMode = ServerAPI.EyesMovementModes[eyesMode] }, neckMovementParameters = new NeckMovementParams() { neckMovementMode = ServerAPI.NeckMovementModes[neckMode] } }; lipsync = ServerAPI.GenerateLipSync(serverAdress, atlParams, wav, dhToken); } pathToSave = EditorUtility.SaveFilePanelInProject("Save file to...", "pharace.wav", "wav", ""); if (string.IsNullOrEmpty(pathToSave)) { return; } File.WriteAllBytes(pathToSave, wav); if (lipsync != null) { var jsonAnimPath = Path.ChangeExtension(pathToSave, "json"); File.WriteAllText(jsonAnimPath, lipsync); } AssetDatabase.Refresh(); } } GUI.enabled = true; }