public static Cutscene CreateCutscene()
        {
            var cutscene = Cutscene.Create();

            CutsceneEditor.ShowWindow(cutscene);
            Selection.activeObject = cutscene;
            return(cutscene);
        }
Beispiel #2
0
        public override void OnInspectorGUI()
        {
            cutscene = (Cutscene)target;

            var e = Event.current;

            GUI.skin.GetStyle("label").richText = true;

            if (e.rawType == EventType.MouseDown && e.button == 0)               //generic undo
            {
                Undo.RegisterFullObjectHierarchyUndo(cutscene.groupsRoot.gameObject, "Cutscene Inspector");
                Undo.RecordObject(cutscene, "Cutscene Inspector");
                willDirty = true;
            }

            if (e.rawType == EventType.MouseUp && e.button == 0 || e.rawType == EventType.KeyUp)
            {
                willDirty = true;
                if (CutsceneUtility.selectedObject != null && CutsceneUtility.selectedObject.startTime <= cutscene.currentTime)
                {
                    willResample = true;
                }
            }

            GUILayout.Space(5);
            if (GUILayout.Button("EDIT IN SLATE"))
            {
                CutsceneEditor.ShowWindow(cutscene);
            }
            GUILayout.Space(5);

            DoCutsceneInspector();
            DoSelectionInspector();


            if (willDirty)
            {
                willDirty = false;
                EditorUtility.SetDirty(cutscene);
                if (CutsceneUtility.selectedObject as UnityEngine.Object != null)
                {
                    EditorUtility.SetDirty((UnityEngine.Object)CutsceneUtility.selectedObject);
                }
            }

            if (willResample)              //resample after the changes on fresh gui pass
            {
                willResample = false;
                //delaycall so that other gui controls are finalized before resample.
                EditorApplication.delayCall += () => { if (cutscene != null)
                                                       {
                                                           cutscene.ReSample();
                                                       }
                };
            }

            Repaint();
        }
 public static void OpenDirectorWindow()
 {
     CutsceneEditor.ShowWindow(null);
 }