Beispiel #1
0
    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");

        window.settings = LipSyncEditorExtensions.GetProjectFile();
    }
    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);
        }
    }