A game about forced loneliness, made by TACStudios
at master 56 lines 1.9 kB view raw
1namespace UnityEditor.Timeline 2{ 3 partial class TimelineWindow 4 { 5 void InitializeStateChange() 6 { 7 state.OnPlayStateChange += OnPreviewPlayModeChanged; 8 state.OnDirtyStampChange += OnStateChange; 9 state.OnBeforeSequenceChange += OnBeforeSequenceChange; 10 state.OnAfterSequenceChange += OnAfterSequenceChange; 11 12 state.OnRebuildGraphChange += () => 13 { 14 // called when the graph is rebuild, since the UI tree isn't necessarily rebuilt. 15 if (!state.rebuildGraph) 16 { 17 // send callbacks to the tacks 18 if (treeView != null) 19 { 20 var allTrackGuis = treeView.allTrackGuis; 21 if (allTrackGuis != null) 22 { 23 for (int i = 0; i < allTrackGuis.Count; i++) 24 allTrackGuis[i].OnGraphRebuilt(); 25 } 26 } 27 } 28 }; 29 30 state.OnTimeChange += () => 31 { 32 if (EditorApplication.isPlaying == false) 33 { 34 state.UpdateRecordingState(); 35 EditorApplication.SetSceneRepaintDirty(); 36 } 37 38 if (state.ignorePreview && state.IsPlayableGraphDone()) 39 state.Pause(); 40 41 // the time is sync'd prior to the callback 42 state.Evaluate(); // will do the repaint 43 44 InspectorWindow.RepaintAllInspectors(); 45 }; 46 47 state.OnRecordingChange += () => 48 { 49 if (!state.recording) 50 { 51 TrackAssetRecordingExtensions.ClearRecordingState(); 52 } 53 }; 54 } 55 } 56}