public static void ShowWindow() { string[] guids = AssetDatabase.FindAssets("ProjectSettings t:LipSyncProject"); string path = ""; if (guids.Length > 0) { path = AssetDatabase.GUIDToAssetPath(guids[0]); if (guids.Length > 1) { Debug.LogWarning("LipSync: Multiple LipSyncProject files found. Only one will be used."); } } LipSyncProject settings = (LipSyncProject)AssetDatabase.LoadAssetAtPath(path, typeof(LipSyncProject)); if (settings == null) { settings = ScriptableObject.CreateInstance <LipSyncProject>(); LipSyncProject newSettings = ScriptableObject.CreateInstance <LipSyncProject>(); newSettings.emotions = new string[] { "default" }; newSettings.emotionColors = new Color[] { new Color(1f, 0.7f, 0.1f) }; EditorUtility.CopySerialized(newSettings, settings); AssetDatabase.CreateAsset(settings, "Assets/Rogo Digital/LipSync Lite/ProjectSettings.asset"); AssetDatabase.Refresh(); DestroyImmediate(newSettings); } Selection.activeObject = settings; }
void FinishedProcessingMulti(AudioClip finishedClip, List <PhonemeMarker> markers) { //Get Settings File string[] guids = AssetDatabase.FindAssets("ProjectSettings t:LipSyncProject"); string spath = ""; if (guids.Length > 0) { spath = AssetDatabase.GUIDToAssetPath(guids[0]); if (guids.Length > 1) { Debug.LogWarning("LipSync: Multiple LipSyncProject files found. Only one will be used."); } } LipSyncProject settings = (LipSyncProject)AssetDatabase.LoadAssetAtPath(spath, typeof(LipSyncProject)); // Create File string path = AssetDatabase.GetAssetPath(finishedClip); path = Path.ChangeExtension(path, xmlMode ? "xml" : "asset"); try { LipSyncClipSetup.SaveFile(settings, path, xmlMode, "", finishedClip.length, markers.ToArray(), new EmotionMarker[0], new GestureMarker[0], finishedClip); } catch { Debug.Log(settings); Debug.Log(path); Debug.Log(xmlMode); Debug.Log(finishedClip); Debug.Log(markers); } if (currentClip < clips.Count) { AutoSync.AutoSyncOptions options = new AutoSync.AutoSyncOptions(languageModelNames[languageModel], attemptAudioConversion, allphone_ciEnabled, backtraceEnabled, beamExponent, pbeamExponent, lwValue, doCleanup, cleanupAggression); AutoSync.ProcessAudio(clips[currentClip], FinishedProcessingMulti, OnAutoSyncFailed, (currentClip + 1).ToString() + "/" + clips.Count.ToString(), options); currentClip++; } else { AssetDatabase.Refresh(); EditorUtility.ClearProgressBar(); setup.ShowNotification(new GUIContent("Batch AutoSync Complete.")); Close(); } }
void OnEnable() { myTarget = (LipSyncProject)target; if (EditorGUIUtility.isProSkin) { logo = (Texture2D)EditorGUIUtility.Load("Rogo Digital/Lipsync/Dark/logo_component.png"); } else { logo = (Texture2D)EditorGUIUtility.Load("Rogo Digital/Lipsync/Light/logo_component.png"); } phonemeSet = serializedObject.FindProperty("phonemeSet"); emotions = serializedObject.FindProperty("emotions"); emotionColors = serializedObject.FindProperty("emotionColors"); gestures = serializedObject.FindProperty("gestures"); }
public static void ShowWindow(LipSync component, AnimatorController controller) { GestureSetupWizard window = EditorWindow.GetWindow <GestureSetupWizard>(true); window.component = component; window.controller = controller; window.topMessage = "Setting up Gestures for " + controller.name + "."; window.totalSteps = 2; window.Focus(); window.titleContent = new GUIContent("Gesture Setup Wizard"); //Get Settings File string[] guids = AssetDatabase.FindAssets("ProjectSettings t:LipSyncProject"); string path = ""; if (guids.Length > 0) { path = AssetDatabase.GUIDToAssetPath(guids[0]); if (guids.Length > 1) { Debug.LogWarning("LipSync: Multiple LipSyncProject files found. Only one will be used."); } } window.settings = (LipSyncProject)AssetDatabase.LoadAssetAtPath(path, typeof(LipSyncProject)); if (window.settings == null) { window.settings = ScriptableObject.CreateInstance <LipSyncProject>(); LipSyncProject newSettings = ScriptableObject.CreateInstance <LipSyncProject>(); newSettings.emotions = new string[] { "default" }; newSettings.emotionColors = new Color[] { new Color(1f, 0.7f, 0.1f) }; EditorUtility.CopySerialized(newSettings, window.settings); AssetDatabase.CreateAsset(window.settings, "Assets/Rogo Digital/LipSync/ProjectSettings.asset"); AssetDatabase.Refresh(); DestroyImmediate(newSettings); } }
private static EmotionMixerWindow Create(LipSyncClipSetup setup, EmotionMixer mixer, LipSyncProject settings) { EmotionMixerWindow window = CreateInstance <EmotionMixerWindow>(); window.position = new Rect(setup.center.x - 250, setup.center.y - 100, 500, 200); window.minSize = new Vector2(500, 200); window.titleContent = new GUIContent("Emotion Mixer"); window.mixer = mixer; window.settings = settings; window.setup = setup; window.Setup(); window.Show(setup); return(window); }
public static void CreateWindow(LipSyncClipSetup setup, EmotionMixer mixer, LipSyncProject settings) { Create(setup, mixer, settings); }