public void RunModuleSafely(AutoSyncModule module, LipSyncData data, ASProcessDelegate callback, bool silent = false) { if (finalData == null) { finalData = new ASProcessDelegateData(true, "", ClipFeatures.None); } if (AutoSyncUtility.CheckIsClipCompatible(data, module)) { if (!silent) { if (moduleSequence != null) { EditorUtility.DisplayProgressBar("AutoSync", string.Format("Processing module {0}/{1}. Please Wait.", index + 1, moduleSequence.Length), index + 1f / (float)moduleSequence.Length); } else { EditorUtility.DisplayProgressBar("AutoSync", "Processing module, Please Wait.", 1f); } } module.Process(data, callback); } else { EditorUtility.ClearProgressBar(); callback.Invoke(data, new ASProcessDelegateData(false, "Module failed compatibility check.", ClipFeatures.None)); moduleSequence = null; finalData = null; } }
public void RunModuleSafely(AutoSyncModule module, LipSyncData data, ASProcessDelegate callback, bool silent = false) { if (finalData == null) { finalData = new ASProcessDelegateData(true, "", ClipFeatures.None); } var missingFeatures = AutoSyncUtility.GetMissingClipFeatures(data, module); if (missingFeatures == ClipFeatures.None) { if (!silent) { if (moduleSequence != null) { EditorUtility.DisplayProgressBar("AutoSync", string.Format("Processing module {0}/{1}. Please Wait.", index + 1, moduleSequence.Length), index + 1f / (float)moduleSequence.Length); } else { EditorUtility.DisplayProgressBar("AutoSync", "Processing module, Please Wait.", 1f); } } module.Process(data, callback); } else { EditorUtility.ClearProgressBar(); callback.Invoke(data, new ASProcessDelegateData(false, string.Format("Failed: Missing {0}. See console for details.", missingFeatures.ToString()), ClipFeatures.None)); if ((missingFeatures & ClipFeatures.AudioClip) == ClipFeatures.AudioClip) { Debug.Log("Missing AudioClip. This module requires an audioclip in order to work. Make sure you've assigned an AudioClip at the top of the Clip Editor before running AutoSync."); } if ((missingFeatures & ClipFeatures.Emotions) == ClipFeatures.Emotions) { Debug.Log("Missing Emotions. This module requires Emotion markers in order to work. You will either need to add some using the Emotions tab of the Clip Editor, or by adding a module first that will create them."); } if ((missingFeatures & ClipFeatures.Gestures) == ClipFeatures.Gestures) { Debug.Log("Missing Gestures. This module requires Gesture markers in order to work. You will either need to add some using the Gestures tab of the Clip Editor, or by adding a module first that will create them."); } if ((missingFeatures & ClipFeatures.Phonemes) == ClipFeatures.Phonemes) { Debug.Log("Missing Phonemes. This module requires Phoneme markers in order to work. You will either need to add some using the Phonemes tab of the Clip Editor, or by adding a module first that will create them."); } if ((missingFeatures & ClipFeatures.Transcript) == ClipFeatures.Transcript) { Debug.Log("Missing Transcript. This module requires a transcript in order to work. The Clip Editor can load one from a text file with the same name as your AudioClip, or you can either add one from Edit>Clip Settings or add a module first that will create them."); } moduleSequence = null; finalData = null; } }
public void RunSequence(AutoSyncModule[] moduleSequence, ASProcessDelegate onFinishedCallback, LipSyncData inputData, bool silent = false) { index = 0; this.moduleSequence = moduleSequence; this.onFinishedCallback = onFinishedCallback; silentMode = silent; finalData = new ASProcessDelegateData(true, "", ClipFeatures.None); if (moduleSequence.Length > 0) { RunModuleSafely(moduleSequence[index], inputData, ProcessNext, silent); } }