Exemple #1
0
 private void FinishedProcessingSingle(LipSyncData outputData, AutoSync.ASProcessDelegateData data)
 {
     if (data.success)
     {
         setup.data             = (TemporaryLipSyncData)outputData;
         setup.changed          = true;
         setup.previewOutOfDate = true;
         setup.disabled         = false;
         setup.ShowNotification(new GUIContent("AutoSync Completed Successfully"));
         Close();
     }
     else
     {
         Debug.LogFormat("AutoSync Failed: {0}", data.message);
         ShowNotification(new GUIContent(data.message));
     }
 }
Exemple #2
0
    private void FinishedProcessingMulti(LipSyncData outputData, AutoSync.ASProcessDelegateData data)
    {
        if (data.success)
        {
            var settings = LipSyncEditorExtensions.GetProjectFile();

            // Create File
            string outputPath = AssetDatabase.GetAssetPath(outputData.clip);
            outputPath = Path.ChangeExtension(outputPath, xmlMode ? "xml" : "asset");

            try
            {
                LipSyncClipSetup.SaveFile(settings, outputPath, xmlMode, outputData.transcript, outputData.length, outputData.phonemeData, outputData.emotionData,
                                          outputData.gestureData, outputData.clip);
            }
            catch (Exception e)
            {
                Debug.LogError(e.StackTrace);
            }
        }
        else
        {
            batchIncomplete = true;
            string clipName = "Undefined";
            if (outputData.clip)
            {
                clipName = outputData.clip.name;
            }

            Debug.LogErrorFormat("AutoSync: Processing failed on clip '{0}'. Continuing with batch.", clipName);
        }

        if (currentClip < clips.Count)
        {
            currentClip++;

            if (autoSyncInstance == null)
            {
                autoSyncInstance = new AutoSync();
            }

            LipSyncData tempData = CreateInstance <LipSyncData>();
            tempData.clip   = clips[currentClip];
            tempData.length = tempData.clip.length;

            if (loadTranscripts)
            {
                tempData.transcript = AutoSyncUtility.TryGetTranscript(tempData.clip);
            }

            autoSyncInstance.RunSequence(currentModules.ToArray(), FinishedProcessingMulti, tempData);
        }
        else
        {
            AssetDatabase.Refresh();
            EditorUtility.ClearProgressBar();

            if (!batchIncomplete)
            {
                setup.ShowNotification(new GUIContent("Batch AutoSync Completed Successfully"));
            }
            else
            {
                setup.ShowNotification(new GUIContent("Batch AutoSync Completed With Errors"));
            }

            Close();
        }
    }