Ejemplo n.º 1
0
        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;
            }
        }
Ejemplo n.º 2
0
        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;
            }
        }