public static void AddMenuItems(GenericMenu menu, GroupTrack track) { TimelineWindow.TimelineState state = TimelineWindow.instance.state; TrackType[] array = TimelineHelpers.GetMixableTypes(); array = (from x in array orderby(!x.trackType.Assembly.FullName.Contains("UnityEngine.Sequence")) ? 1 : 0 select x).ToArray <TrackType>(); TrackType[] array2 = array; for (int i = 0; i < array2.Length; i++) { TrackType trackType = array2[i]; if (trackType.trackType != typeof(GroupTrack)) { GenericMenu.MenuFunction2 menuFunction = delegate(object e) { track.SetCollapsed(false); state.GetWindow().AddTrack((e as TrackType).trackType, track, null); TimelineTrackBaseGUI timelineTrackBaseGUI = TimelineTrackBaseGUI.FindGUITrack(track); if (timelineTrackBaseGUI != null) { TimelineWindow.instance.treeView.data.SetExpanded(timelineTrackBaseGUI, true); } }; object obj = trackType; string text = TimelineHelpers.GetTrackCategoryName(trackType); if (!string.IsNullOrEmpty(text)) { text += "/"; } menu.AddItem(new GUIContent("Add " + text + TimelineHelpers.GetTrackMenuName(trackType)), false, menuFunction, obj); } } }
public static TimelineWindowTimeControl CreateTimeController(TimelineWindow.TimelineState state, TimelineWindowTimeControl.ClipData clipData) { AnimationWindow window = EditorWindow.GetWindow <AnimationWindow>(); TimelineWindowTimeControl timelineWindowTimeControl = ScriptableObject.CreateInstance <TimelineWindowTimeControl>(); timelineWindowTimeControl.Init(state.GetWindow(), window.get_state(), clipData); return(timelineWindowTimeControl); }
public override bool Execute(TimelineWindow.TimelineState state) { bool result; if (state.IsEditingASubItem()) { result = false; } else { TimelineWindow window = state.GetWindow(); if (window == null || window.treeView == null) { result = false; } else { TrackAsset[] visibleTracks = window.treeView.visibleTracks; if (visibleTracks.Length == 0) { result = false; } else { float num = 3.40282347E+38f; float num2 = -3.40282347E+38f; TrackAsset[] array = visibleTracks; for (int i = 0; i < array.Length; i++) { TrackAsset trackAsset = array[i]; double num3; double num4; trackAsset.GetSequenceTime(out num3, out num4); num = Mathf.Min(num, (float)num3); num2 = Mathf.Max(num2, (float)(num3 + num4)); } float num5 = num2 - Math.Max(0f, num); if (num5 > 0f) { state.SetTimeAreaShownRange(Mathf.Max(-10f, num - num5 * 0.1f), num2 + num5 * 0.1f); } else { state.SetTimeAreaShownRange(0f, 100f); } state.Evaluate(); result = true; } } } return(result); }
private static void SelectMenuCallback(Func <TimelineClip, bool> selector, TimelineWindow.TimelineState state) { List <TimelineClipGUI> allClipGuis = state.GetWindow().treeView.allClipGuis; if (allClipGuis != null) { SelectionManager.Clear(); for (int num = 0; num != allClipGuis.Count; num++) { TimelineClipGUI timelineClipGUI = allClipGuis[num]; if (timelineClipGUI != null && timelineClipGUI.clip != null && selector(timelineClipGUI.clip)) { SelectionManager.Add(timelineClipGUI.clip); } } } }
public void FinalizeRecording(TimelineWindow.TimelineState state) { for (int num = 0; num != this.m_ProcessedClips.Count; num++) { AnimationTrackRecorder.ProcessTemporaryKeys(this.m_ProcessedClips[num]); } this.m_RefreshState |= this.m_TracksToProcess.Any <TrackAsset>(); this.m_TracksToProcess.Clear(); if (this.m_ProcessedClips.Count > 0 || this.m_RefreshState) { state.GetWindow().RebuildGraphIfNecessary(false); } state.RebindAnimators(this.m_RebindList); if (this.m_ProcessedClips.Count > 0 || this.m_RefreshState) { state.EvaluateImmediate(); } }
private float DrawInlineCurveButton(Rect rect, TimelineWindow.TimelineState state) { float result; if (!this.CanDrawInlineCurve()) { result = 0f; } else { bool flag = GUI.Toggle(rect, base.track.GetShowInlineCurves(), GUIContent.none, DirectorStyles.Instance.curves); if (flag != base.track.GetShowInlineCurves()) { TimelineUndo.PushUndo(base.track, (!flag) ? "Hide Inline Curves" : "Show Inline Curves"); base.track.SetShowInlineCurves(flag); state.GetWindow().treeView.CalculateRowRects(); } result = 16f; } return(result); }
public override bool Execute(TimelineWindow.TimelineState state) { IClipCurveEditorOwner currentInlineEditorCurve = SelectionManager.GetCurrentInlineEditorCurve(); bool result; if (currentInlineEditorCurve != null && currentInlineEditorCurve.clipCurveEditor != null) { currentInlineEditorCurve.clipCurveEditor.SelectAllKeys(); result = true; } else { SelectionManager.Clear(); state.GetWindow().allTracks.ForEach(delegate(TimelineTrackBaseGUI x) { SelectionManager.Add(x.track); }); result = true; } return(result); }
public override void Draw(Rect headerRect, Rect trackRect, TimelineWindow.TimelineState state, float identWidth) { if (base.track.GetShowInlineCurves() && this.inlineCurveEditor == null) { this.inlineCurveEditor = new InlineCurveEditor(this); } this.UpdateInfiniteClipEditor(base.track as AnimationTrack, state.GetWindow()); Rect trackRect2 = trackRect; float num = this.InlineAnimationCurveHeight(); trackRect.set_height(trackRect.get_height() - num); if (Event.get_current().get_type() == 7) { this.m_TrackRect = trackRect; state.quadTree.Insert(this); int num2 = this.BlendHash(); if (this.m_BlendHash != num2) { this.UpdateClipOverlaps(); this.m_BlendHash = num2; } base.isDropTarget = false; } if (TimelineTrackGUI.s_ArmForRecordContentOn == null) { TimelineTrackGUI.s_ArmForRecordContentOn = new GUIContent(TimelineWindow.styles.autoKey.get_active().get_background()); } if (TimelineTrackGUI.s_ArmForRecordContentOff == null) { TimelineTrackGUI.s_ArmForRecordContentOff = new GUIContent(TimelineWindow.styles.autoKey.get_normal().get_background()); } base.track.SetCollapsed(!base.isExpanded); headerRect.set_width(headerRect.get_width() - 2f); if (this.m_TrackHash != base.track.Hash()) { this.RebuildGUICache(state); } bool flag = false; Vector2 timeAreaShownRange = state.timeAreaShownRange; if (base.drawer != null) { flag = base.drawer.DrawTrack(trackRect, base.track, timeAreaShownRange, state); } if (!flag) { using (new GUIViewportScope(trackRect)) { this.DrawBackground(trackRect, state); if (this.resortClips) { int num3 = 0; this.SortClipsByStartTime(); this.ResetClipParityID(); foreach (TimelineClipGUI current in this.m_ClipGUICache) { current.parityID = this.GetNextClipParityID(); current.zOrder = num3++; if (SelectionManager.Contains(current.clip)) { current.zOrder += 1000; } } IEnumerable <TimelineClipGUI> selectedClips = SelectionManager.SelectedClipGUI(); this.m_ClipGUICache = (from x in this.m_ClipGUICache orderby selectedClips.Contains(x), x.clip.start select x).ToList <TimelineClipGUI>(); this.resortClips = false; } if (this.resortEvents) { int num4 = 0; this.SortEventsByStartTime(); foreach (TimelineMarkerGUI current2 in this.m_MarkerGuiCache) { current2.zOrder = num4++; if (SelectionManager.Contains(current2.timelineMarker)) { current2.zOrder += 1000; } } IEnumerable <TimelineMarkerGUI> selectedMarkers = SelectionManager.SelectedMarkerGUI(); this.m_MarkerGuiCache = (from x in this.m_MarkerGuiCache orderby selectedMarkers.Contains(x), x.timelineMarker.time select x).ToList <TimelineMarkerGUI>(); this.resortEvents = false; } this.DrawClips(trackRect, state); this.DrawEvents(trackRect, state); this.DrawClipConnectors(); } if (this.m_InfiniteTrackDrawer != null) { this.m_InfiniteTrackDrawer.DrawTrack(trackRect, base.track, timeAreaShownRange, state); } } this.DrawTrackHeader(headerRect, state, identWidth, num); this.DrawInlineCurves(headerRect, trackRect2, state, identWidth, num); this.DrawMuteState(trackRect, state); this.DrawLockState(trackRect, state); }