public static void CreateWindow(ModalParent parent, LipSyncClipSetup setup, EmotionMarker marker)
        {
            MarkerSettingsWindow window = Create(parent, setup, 1);

            window.eMarker = new EmotionMarker[] { marker };

            for (int i = 0; i < setup.settings.emotions.Length; i++)
            {
                if (setup.settings.emotions[i] == marker.emotion)
                {
                    window.emotionNumber = i;
                    break;
                }
            }

            window.startTime             = marker.startTime;
            window.endTime               = marker.endTime;
            window.intensity             = marker.intensity;
            window.modifierOn            = marker.continuousVariation;
            window.maxVariationFrequency = marker.variationFrequency;
            window.intensityModifier     = marker.intensityVariation;
            window.blendableModifier     = marker.blendableVariation;
            window.boneRotationModifier  = marker.boneRotationVariation;
            window.bonePositionModifier  = marker.bonePositionVariation;

            window.modifierBool = new AnimBool(window.modifierOn, window.Repaint);
        }
    public override void OnInspectorGUI()
    {
        GUILayout.Space(10);
        EditorGUILayout.HelpBox(infoString, MessageType.Info);
        GUILayout.Space(10);
        if (GUILayout.Button("Edit LipSync Data", GUILayout.Height(50)))
        {
            LipSyncClipSetup.ShowWindow(AssetDatabase.GetAssetPath(target), false);
        }
        GUILayout.Space(10);
        if (lsdTarget.isPreprocessed)
        {
            EditorGUILayout.HelpBox("This clip has been preprocessed for a specific LipSync component. This is good for performance, but may cause the clip to play back incorrectly on other characters, or not at all. \nYou can remove this pre-processing data if you'd like the clip to be completely retargetable.", MessageType.Warning);
            GUI.color = Color.red;
            if (GUILayout.Button("Remove Pre-processed Data", GUILayout.Height(30)))
            {
                if (EditorUtility.DisplayDialog("Delete Data", "Are you sure? Undoing this action will required pre-processing again from the Preprocessor window.", "Yes", "No"))
                {
                    serializedObject.Update();
                    serializedObject.FindProperty("isPreprocessed").boolValue = false;
                    serializedObject.ApplyModifiedProperties();
                }
            }
            GUI.color = Color.white;
        }

        Update();
    }
        public static void CreateWindow(ModalParent parent, LipSyncClipSetup setup, int markerType)
        {
            DefaultMarkerSettingsWindow window = Create(parent, setup, 0);

            window.markerType = markerType;
            if (markerType == 0)
            {
                window.intensity            = setup.defaultPhonemeIntensity;
                window.modifierOn           = setup.defaultUseRandomness;
                window.intensityModifier    = setup.defaultIntensityRandomness;
                window.blendableModifier    = setup.defaultBlendableRandomness;
                window.boneRotationModifier = setup.defaultBonePositionRandomness;
                window.bonePositionModifier = setup.defaultBoneRotationRandomness;
            }
            else if (markerType == 1)
            {
                window.intensity             = setup.defaultEmotionIntensity;
                window.modifierOn            = setup.defaultContinuousVariation;
                window.maxVariationFrequency = setup.defaultVariationFrequency;
                window.intensityModifier     = setup.defaultIntensityVariation;
                window.blendableModifier     = setup.defaultBlendableVariation;
                window.boneRotationModifier  = setup.defaultBonePositionVariation;
                window.bonePositionModifier  = setup.defaultBoneRotationVariation;
            }

            window.modifierBool = new AnimBool(window.modifierOn, window.Repaint);
        }
Exemplo n.º 4
0
    public override void OnInspectorGUI()
    {
        GUILayout.Space(10);
        if (GUILayout.Button("Edit LipSync Data", GUILayout.Height(50)))
        {
            LipSyncClipSetup.ShowWindow(AssetDatabase.GetAssetPath(target), false);
        }

        Update();
    }
Exemplo n.º 5
0
    public static void CreateWindow(ModalParent parent, LipSyncClipSetup setup)
    {
        SetIntensityWindow window = CreateInstance <SetIntensityWindow>();

        window.position     = new Rect(parent.center.x - 250, parent.center.y - 75, 500, 150);
        window.minSize      = new Vector2(500, 150);
        window.titleContent = new GUIContent("Set Intensities");
        window.setup        = setup;

        window.Show(parent);
    }
        private static DefaultMarkerSettingsWindow Create(ModalParent parent, LipSyncClipSetup setup, int markerType)
        {
            DefaultMarkerSettingsWindow window = CreateInstance <DefaultMarkerSettingsWindow>();

            window.position     = new Rect(parent.center.x - 250, parent.center.y - 100, 500, 200);
            window.minSize      = new Vector2(500, 200);
            window.titleContent = new GUIContent("Default Marker Settings");

            window.setup      = setup;
            window.markerType = markerType;
            window.Show(parent);
            return(window);
        }
Exemplo n.º 7
0
    public static void CreateWindow(ModalParent parent, LipSyncClipSetup setup, int mode)
    {
        AutoSyncWindow window = CreateInstance <AutoSyncWindow>();

        window.position     = new Rect(parent.center.x - 250, parent.center.y - 150, 500, 300);
        window.minSize      = new Vector2(500, 300);
        window.titleContent = new GUIContent("AutoSync");

        window.setup = setup;

        window.tab  = mode;
        window.clip = setup.clip;
        window.Show(parent);
    }
Exemplo n.º 8
0
    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);
    }
Exemplo n.º 9
0
    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();
        }
    }
        public static void CreateWindow(ModalParent parent, LipSyncClipSetup setup, PhonemeMarker marker)
        {
            MarkerSettingsWindow window = Create(parent, setup, 0);

            window.pMarker = new PhonemeMarker[] { marker };

            window.time                 = marker.time;
            window.phonemeNumber        = marker.phonemeNumber;
            window.intensity            = marker.intensity;
            window.modifierOn           = marker.useRandomness;
            window.intensityModifier    = marker.intensityRandomness;
            window.blendableModifier    = marker.blendableRandomness;
            window.boneRotationModifier = marker.boneRotationRandomness;
            window.bonePositionModifier = marker.bonePositionRandomness;

            window.modifierBool = new AnimBool(window.modifierOn, window.Repaint);
        }
Exemplo n.º 11
0
        public static ClipSettingsWindow CreateWindow(ModalParent parent, LipSyncClipSetup setup)
        {
            ClipSettingsWindow window = CreateInstance <ClipSettingsWindow>();

            window.length     = setup.FileLength;
            window.transcript = setup.Transcript;
            window.end        = window.length;

            window.position     = new Rect(parent.center.x - 250, parent.center.y - 100, 500, 200);
            window.minSize      = new Vector2(500, 200);
            window.titleContent = new GUIContent("Clip Settings");

            window.adjustMarkersAnimBool = new AnimBool(window.willTrim, window.Repaint);

            window.setup = setup;
            window.Show(parent);
            return(window);
        }
Exemplo n.º 12
0
        public static void CreateWindow(ModalParent parent, LipSyncClipSetup setup, EmotionMarker marker)
        {
            MarkerSettingsWindow window = Create(parent, setup, 1);

            window.eMarker = new EmotionMarker[] { marker };

            window.startTime             = marker.startTime;
            window.endTime               = marker.endTime;
            window.intensity             = marker.intensity;
            window.modifierOn            = marker.continuousVariation;
            window.maxVariationFrequency = marker.variationFrequency;
            window.intensityModifier     = marker.intensityVariation;
            window.blendableModifier     = marker.blendableVariation;
            window.boneRotationModifier  = marker.boneRotationVariation;
            window.bonePositionModifier  = marker.bonePositionVariation;

            window.modifierBool = new AnimBool(window.modifierOn, window.Repaint);
        }
Exemplo n.º 13
0
    static void OnProjectWindowItem(string itemGUID, Rect itemRect)
    {
        if (Selection.activeObject is LipSyncData)
        {
            //Draw project view summary

            // Sanity check - make sure we're dealing with the item we selected. The itemGUID parameter
            // contains the asset GUID of the current item being updated by the project window.
            if (AssetDatabase.GUIDToAssetPath(itemGUID) == AssetDatabase.GetAssetPath(Selection.activeObject))
            {
                if (Event.current.isMouse && Event.current.clickCount == 2)
                {
                    LipSyncClipSetup.ShowWindow(AssetDatabase.GUIDToAssetPath(itemGUID), false);

                    Event.current.Use();
                }
            }
        }
    }
Exemplo n.º 14
0
    public static void CreateWindow(ModalParent parent, LipSyncClipSetup setup, int mode, params int[] modules)
    {
        AutoSyncWindow window = CreateInstance <AutoSyncWindow>();

        window.position     = new Rect(parent.center.x - 250, parent.center.y - 400, 500, 800);
        window.minSize      = new Vector2(400, 500);
        window.titleContent = new GUIContent("AutoSync");

        window.setup = setup;

        window.tab  = mode;
        window.clip = setup.Clip;

        window.OnEnable();
        for (int i = 0; i < modules.Length; i++)
        {
            window.AddModule(modules[i]);
        }

        window.Show(parent);
    }
Exemplo n.º 15
0
        private static MarkerSettingsWindow Create(ModalParent parent, LipSyncClipSetup setup, int markerType)
        {
            MarkerSettingsWindow window = CreateInstance <MarkerSettingsWindow>();

            window.phonemeNames  = setup.settings.phonemeSet.phonemes.phonemeNames.ToArray();
            window.phonemeValues = new int[window.phonemeNames.Length];

            for (int i = 0; i < window.phonemeValues.Length; i++)
            {
                window.phonemeValues[i] = i;
            }

            window.position     = new Rect(parent.center.x - 250, parent.center.y - 100, 500, 200);
            window.minSize      = new Vector2(500, 200);
            window.titleContent = new GUIContent("Marker Settings");

            window.setup      = setup;
            window.markerType = markerType;
            window.Show(parent);
            return(window);
        }
        public static void CreateWindow(ModalParent parent, LipSyncClipSetup setup, List <PhonemeMarker> collection, List <int> selection)
        {
            MarkerSettingsWindow window = Create(parent, setup, 0);

            window.pMarker = new PhonemeMarker[selection.Count];

            for (int i = 0; i < selection.Count; i++)
            {
                window.pMarker[i] = collection[selection[i]];
            }

            SetProperty(GetFieldValues <float>(window.pMarker, "time"), out window.time, out window.setTime);
            SetProperty(GetFieldValues <int>(window.pMarker, "phonemeNumber"), out window.phonemeNumber, out window.setPhonemeNumber);
            SetProperty(GetFieldValues <float>(window.pMarker, "intensity"), out window.intensity, out window.setIntensity);
            SetProperty(GetFieldValues <bool>(window.pMarker, "useRandomness"), out window.modifierOn, out window.setModifierOn);
            SetProperty(GetFieldValues <float>(window.pMarker, "intensityRandomness"), out window.intensityModifier, out window.setIntensityModifier);
            SetProperty(GetFieldValues <float>(window.pMarker, "blendableRandomness"), out window.blendableModifier, out window.setBlendableModifier);
            SetProperty(GetFieldValues <float>(window.pMarker, "boneRotationRandomness"), out window.boneRotationModifier, out window.setBoneRotationModifier);
            SetProperty(GetFieldValues <float>(window.pMarker, "bonePositionRandomness"), out window.bonePositionModifier, out window.setBonePositionModifier);

            window.modifierBool = new AnimBool(window.modifierOn, window.Repaint);
        }
        public static void CreateWindow(ModalParent parent, LipSyncClipSetup setup, List <EmotionMarker> collection, List <int> selection)
        {
            MarkerSettingsWindow window = Create(parent, setup, 1);

            window.eMarker = new EmotionMarker[selection.Count];

            for (int i = 0; i < selection.Count; i++)
            {
                window.eMarker[i] = collection[selection[i]];
            }

            string[] emotions       = GetFieldValues <string>(window.eMarker, "emotion");
            int[]    emotionNumbers = new int[emotions.Length];

            for (int e = 0; e < emotions.Length; e++)
            {
                for (int i = 0; i < setup.settings.emotions.Length; i++)
                {
                    if (string.Equals(setup.settings.emotions[i], emotions[e]))
                    {
                        emotionNumbers[e] = i;
                        break;
                    }
                }
            }

            SetProperty(emotionNumbers, out window.emotionNumber, out window.setEmotion);
            SetProperty(GetFieldValues <float>(window.eMarker, "startTime"), out window.startTime, out window.setStartTime);
            SetProperty(GetFieldValues <float>(window.eMarker, "endTime"), out window.endTime, out window.setEndTime);
            SetProperty(GetFieldValues <float>(window.eMarker, "intensity"), out window.intensity, out window.setIntensity);
            SetProperty(GetFieldValues <bool>(window.eMarker, "continuousVariation"), out window.modifierOn, out window.setModifierOn);
            SetProperty(GetFieldValues <float>(window.eMarker, "variationFrequency"), out window.maxVariationFrequency, out window.setMaxVariationFrequency);
            SetProperty(GetFieldValues <float>(window.eMarker, "intensityVariation"), out window.intensityModifier, out window.setIntensityModifier);
            SetProperty(GetFieldValues <float>(window.eMarker, "blendableVariation"), out window.blendableModifier, out window.setBlendableModifier);
            SetProperty(GetFieldValues <float>(window.eMarker, "boneRotationVariation"), out window.boneRotationModifier, out window.setBoneRotationModifier);
            SetProperty(GetFieldValues <float>(window.eMarker, "bonePositionVariation"), out window.bonePositionModifier, out window.setBonePositionModifier);

            window.modifierBool = new AnimBool(window.modifierOn, window.Repaint);
        }
Exemplo n.º 18
0
        public static void CreateWindow(ModalParent parent, LipSyncClipSetup setup, List <EmotionMarker> collection, List <int> selection)
        {
            MarkerSettingsWindow window = Create(parent, setup, 1);

            window.eMarker = new EmotionMarker[selection.Count];

            for (int i = 0; i < selection.Count; i++)
            {
                window.eMarker[i] = collection[selection[i]];
            }

            SetProperty(GetFieldValues <float>(window.eMarker, "startTime"), out window.startTime, out window.setStartTime);
            SetProperty(GetFieldValues <float>(window.eMarker, "endTime"), out window.endTime, out window.setEndTime);
            SetProperty(GetFieldValues <float>(window.eMarker, "intensity"), out window.intensity, out window.setIntensity);
            SetProperty(GetFieldValues <bool>(window.eMarker, "continuousVariation"), out window.modifierOn, out window.setModifierOn);
            SetProperty(GetFieldValues <float>(window.eMarker, "variationFrequency"), out window.maxVariationFrequency, out window.setMaxVariationFrequency);
            SetProperty(GetFieldValues <float>(window.eMarker, "intensityVariation"), out window.intensityModifier, out window.setIntensityModifier);
            SetProperty(GetFieldValues <float>(window.eMarker, "blendableVariation"), out window.blendableModifier, out window.setBlendableModifier);
            SetProperty(GetFieldValues <float>(window.eMarker, "boneRotationVariation"), out window.boneRotationModifier, out window.setBoneRotationModifier);
            SetProperty(GetFieldValues <float>(window.eMarker, "bonePositionVariation"), out window.bonePositionModifier, out window.setBonePositionModifier);

            window.modifierBool = new AnimBool(window.modifierOn, window.Repaint);
        }
Exemplo n.º 19
0
    private static void OpenFromMenu()
    {
        var clipSetup = LipSyncClipSetup.ShowWindow();

        CreateWindow(clipSetup, clipSetup, 1);
    }
Exemplo n.º 20
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();
        }
    }
Exemplo n.º 21
0
 public static void CreateWindow(LipSyncClipSetup setup, EmotionMixer mixer, LipSyncProject settings)
 {
     Create(setup, mixer, settings);
 }