public override bool Execute(ActionContext actionContext) { WindowState state = TimelineEditor.state; PlayableDirector director = TimelineEditor.inspectedDirector; if (!CanExecute(state, actionContext) || director == null) { return(false); } IEnumerable <TrackAsset> keyableTracks = GetKeyableTracks(state, actionContext); var curveSelected = SelectionManager.GetCurrentInlineEditorCurve(); if (curveSelected != null) { var sel = curveSelected.clipCurveEditor.GetSelectedProperties().ToList(); var go = (director.GetGenericBinding(curveSelected.owner) as Component).gameObject; if (sel.Count > 0) { TimelineRecording.KeyProperties(go, state, sel); } else { var binding = director.GetGenericBinding(curveSelected.owner) as Component; TimelineRecording.KeyAllProperties(binding, state); } } else { foreach (var track in keyableTracks) { var binding = director.GetGenericBinding(track) as Component; TimelineRecording.KeyAllProperties(binding, state); } } return(true); }
private void DrawTrackButtons(Rect headerRect, WindowState state) { const float buttonSize = WindowConstants.trackHeaderButtonSize; const float padding = WindowConstants.trackHeaderButtonPadding; var buttonRect = new Rect(headerRect.xMax - buttonSize - padding, headerRect.y + ((headerRect.height - buttonSize) / 2f), buttonSize, buttonSize); if (GUI.Button(buttonRect, EditorGUIUtility.IconContent("CreateAddNew"), m_Styles.trackGroupAddButton)) { // the drop down will apply to all selected tracks if (!SelectionManager.Contains(track)) { SelectionManager.Clear(); SelectionManager.Add(track); } SequencerContextMenu.ShowNewTracksContextMenu(SelectionManager.SelectedTracks().ToArray(), TimelineWindow.state); } buttonRect.x -= buttonSize; buttonRect.x -= Spaced(DrawMuteButton(buttonRect, state)); buttonRect.x -= Spaced(DrawLockButton(buttonRect, state)); }
protected override bool MouseDown(Event evt, WindowState state) { // If we hit this point this means no one used the mouse down events. We can safely clear the selection if needed if (evt.button != 0) { return(false); } var window = state.GetWindow(); if (!window.sequenceRect.Contains(evt.mousePosition)) { return(false); } if (ItemSelection.CanClearSelection(evt)) { SelectionManager.Clear(); return(true); } return(false); }
void OnDisable() { if (instance == this) { instance = null; } if (state != null) { state.Reset(); } if (instance == null) { SelectionManager.RemoveTimelineSelection(); } AnimationClipCurveCache.Instance.OnDisable(); TrackAsset.OnClipPlayableCreate -= m_PlayableLookup.UpdatePlayableLookup; TrackAsset.OnTrackAnimationPlayableCreate -= m_PlayableLookup.UpdatePlayableLookup; TimelineWindowViewPrefs.SaveAll(); TimelineWindowViewPrefs.UnloadAllViewModels(); }
static void AddNewTrackMenuCommand(GenericMenu menu, TrackAsset parentTrack, TimelineGroupGUI parentGroup, Type type, WindowState state) { GenericMenu.MenuFunction2 lastMethod = trackType => { SelectionManager.Clear(); if (parentTrack is GroupTrack) { parentTrack.SetCollapsed(false); } var track = state.GetWindow().AddTrack((Type)trackType, parentGroup == null ? null : parentGroup.track); if (parentGroup != null) { state.GetWindow().treeView.data.SetExpanded(parentGroup, true); } if (track.GetType() == typeof(ActivationTrack)) { var clip = track.CreateClip(0); clip.displayName = ActivationTrackDrawer.Styles.ClipText.text; state.Refresh(); } }; var category = TimelineHelpers.GetTrackCategoryName(type); if (!string.IsNullOrEmpty(category)) { category += "/"; } var name = category + TimelineHelpers.GetTrackMenuName(type); var disabled = parentTrack != null && parentTrack.lockedInHierarchy; AddCommandToMenu(menu, name, lastMethod, type, !disabled); }
static void AddTrackMenuCommands(GenericMenu newTrackMenu, TrackAsset parentTrack, TimelineGroupGUI parentGroup, WindowState state) { // Add Group or SubGroup var title = parentTrack == null?L10n.Tr("Track Group") : L10n.Tr("Track Sub-Group"); var disabled = parentTrack != null && parentTrack.lockedInHierarchy; GenericMenu.MenuFunction command = () => { SelectionManager.Clear(); TimelineGroupGUI.Create(parentTrack, title); state.Refresh(); }; AddCommandToMenu(newTrackMenu, title, command, !disabled); newTrackMenu.AddSeparator(""); var allTypes = TypeUtility.AllTrackTypes().Where(x => x != typeof(GroupTrack) && !TypeUtility.IsHiddenInMenu(x) && x.IsPublic).ToList(); var builtIn = allTypes.Where(x => x.Assembly.Equals(typeof(TimelineAsset).Assembly)).OrderBy(i => i.FullName).ToList(); var customTypes = allTypes.Except(builtIn).ToList(); foreach (var t in builtIn) { AddNewTrackMenuCommand(newTrackMenu, parentTrack, parentGroup, t, state); } if (builtIn.Any() && customTypes.Any()) { newTrackMenu.AddSeparator(""); } foreach (var t in customTypes) { AddNewTrackMenuCommand(newTrackMenu, parentTrack, parentGroup, t, state); } }
public override void Init(IControl parent) { parent.KeyDown += delegate(object target, Event evt, TimelineWindow.TimelineState state) { bool result; if (state.IsEditingASubItem()) { result = base.IgnoreEvent(); } else { TimelineClipGUI timelineClipGUI = target as TimelineClipGUI; if (!SelectionManager.Contains(timelineClipGUI.clip)) { result = base.IgnoreEvent(); } else { result = ItemAction <TimelineClip> .HandleShortcut(state, evt, timelineClipGUI.clip); } } return(result); }; }
void SelectionChangedCallback(int[] ids) { if (Event.current.button == 1 && PickerUtils.PickedLayerableOfType <ISelectable>() != null) { return; } if (Event.current.command || Event.current.control || Event.current.shift) { SelectionManager.UnSelectTracks(); } else { SelectionManager.Clear(); } foreach (var id in ids) { var trackGUI = (TimelineTrackBaseGUI)m_TreeView.FindItem(id); SelectionManager.Add(trackGUI.track); } m_State.GetWindow().Repaint(); }
static void PasteTracks(WindowState state) { var trackData = TimelineEditor.clipboard.GetTracks().ToList(); if (trackData.Any()) { SelectionManager.RemoveTimelineSelection(); } foreach (var track in trackData) { var newTrack = track.item.Duplicate(state.editSequence.director, state.editSequence.asset); SelectionManager.Add(newTrack); foreach (var childTrack in newTrack.GetFlattenedChildTracks()) { SelectionManager.Add(childTrack); } if (track.parent != null && track.parent.timelineAsset == state.editSequence.asset) { track.parent.AddChild(newTrack); } } }
internal void SetShowMarkerHeader(bool newValue) { TimelineAsset asset = state.editSequence.asset; if (state.showMarkerHeader == newValue || asset == null) { return; } string undoOperation = L10n.Tr("Toggle Show Markers"); if (newValue) { //Create the marker track if it does not exist TimelineUndo.PushUndo(asset, undoOperation); asset.CreateMarkerTrack(); } else { SelectionManager.Remove(asset.markerTrack); } asset.markerTrack.SetShowTrackMarkers(newValue); }
public static IMarker CreateMarkerAtTime(TrackAsset parent, Type markerType, double time) { var marker = parent.CreateMarker(markerType, time); var obj = marker as ScriptableObject; if (obj != null) { obj.name = TypeUtility.GetDisplayName(markerType); } SelectionManager.Add(marker); try { CustomTimelineEditorCache.GetMarkerEditor(marker).OnCreate(marker, null); } catch (Exception e) { Debug.LogException(e); } return(marker); }
public override ActionValidity Validate(ActionContext context) { return(SelectionManager.Count() > 0 ? ActionValidity.Valid : ActionValidity.NotApplicable); }
public override MenuActionDisplayState GetDisplayState(WindowState state) { return(SelectionManager.Count() > 0 ? MenuActionDisplayState.Visible : MenuActionDisplayState.Disabled); }
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); }
public bool IsEditingASubItem() { return(IsCurrentEditingASequencerTextField() || !SelectionManager.IsCurveEditorFocused(null)); }
protected override bool MouseDrag(Event evt, WindowState state) { if (state.editSequence.isReadOnly) { return(false); } // case 1099285 - ctrl-click can cause no clips to be selected var selectedItemsGUI = SelectionManager.SelectedItems(); if (!selectedItemsGUI.Any()) { m_Dragged = false; return(false); } const float hDeadZone = 5.0f; const float vDeadZone = 5.0f; bool vDone = m_VerticalMovementDone || Math.Abs(evt.mousePosition.y - m_MouseDownPosition.y) > vDeadZone; bool hDone = m_HorizontalMovementDone || Math.Abs(evt.mousePosition.x - m_MouseDownPosition.x) > hDeadZone; m_CycleMarkersPending = false; if (!m_Dragged) { var canStartMove = vDone || hDone; if (canStartMove) { state.AddCaptured(this); m_Dragged = true; var referenceTrack = GetTrackDropTargetAt(state, m_MouseDownPosition); foreach (var item in selectedItemsGUI) { item.gui.StartDrag(); } m_MoveItemHandler = new MoveItemHandler(state); m_MoveItemHandler.Grab(selectedItemsGUI, referenceTrack, m_MouseDownPosition); m_SnapEngine = new SnapEngine(m_MoveItemHandler, m_MoveItemHandler, ManipulateEdges.Both, state, m_MouseDownPosition); m_TimeAreaAutoPanner = new TimeAreaAutoPanner(state); } } if (!m_VerticalMovementDone) { m_VerticalMovementDone = vDone; if (m_VerticalMovementDone) { m_MoveItemHandler.OnTrackDetach(); } } if (!m_HorizontalMovementDone) { m_HorizontalMovementDone = hDone; } if (m_Dragged) { if (m_HorizontalMovementDone) { m_SnapEngine.Snap(evt.mousePosition, evt.modifiers); } if (m_VerticalMovementDone) { var track = GetTrackDropTargetAt(state, evt.mousePosition); m_MoveItemHandler.UpdateTrackTarget(track); } state.Evaluate(); } return(true); }
public override void Init(IControl parent) { parent.MouseDown += delegate(object target, Event evt, TimelineWindow.TimelineState state) { this.m_UndoSet = false; this.m_IsCaptured = (this.m_CaptureOnNextMouseDrag = false); bool result; if (evt.get_modifiers() == 4 || evt.get_button() == 2 || evt.get_button() == 1) { result = base.IgnoreEvent(); } else if (!SelectionManager.IsMouseHoveringOnItem()) { result = base.IgnoreEvent(); } else { TimelineClipGUI timelineClipGUI = (TimelineClipGUI)target; if (!SelectionManager.Contains(timelineClipGUI.clip)) { result = base.IgnoreEvent(); } else { this.m_FrameSnap.Reset(); this.m_CaptureOnNextMouseDrag = true; this.m_MouseDownPosition = evt.get_mousePosition(); this.m_HasValidDropTarget = false; result = base.ConsumeEvent(); } } return(result); }; parent.MouseUp += delegate(object target, Event evt, TimelineWindow.TimelineState state) { bool result; if (!this.m_IsCaptured) { result = base.IgnoreEvent(); } else { this.m_MagnetEngine = null; if (this.m_IsVerticalDrag) { state.captured.Clear(); this.m_IsVerticalDrag = false; state.isDragging = false; if (this.m_HasValidDropTarget && this.m_DropTarget != null) { TimelineClipGUI timelineClipGUI = (TimelineClipGUI)target; if (TrackExtensions.MoveClipToTrack(timelineClipGUI.clip, this.m_DropTarget.track)) { timelineClipGUI.clip.start = (double)state.PixelToTime(this.m_PreviewRect.get_x()); timelineClipGUI.parentTrackGUI.SortClipsByStartTime(); this.m_DropTarget.SortClipsByStartTime(); state.Refresh(); } } } state.Evaluate(); state.captured.Remove(target as IControl); this.m_IsCaptured = false; this.m_IsDragDriver = false; result = base.ConsumeEvent(); } return(result); }; parent.DragExited += delegate(object target, Event evt, TimelineWindow.TimelineState state) { this.m_IsVerticalDrag = false; return(base.IgnoreEvent()); }; parent.MouseDrag += delegate(object target, Event evt, TimelineWindow.TimelineState state) { if (!this.m_IsCaptured && this.m_CaptureOnNextMouseDrag) { state.captured.Add(target as IControl); this.m_IsCaptured = true; this.m_CaptureOnNextMouseDrag = false; TimelineClipGUI timelineClipGUI = (TimelineClipGUI)target; this.m_IsDragDriver = MoveItemUtilities.IsDriver(timelineClipGUI, evt, state); if (this.m_IsDragDriver) { this.m_DragPixelOffset = Vector2.get_zero(); this.m_IsDragDriverActive = false; if (!SelectionManager.IsMultiSelect() && state.edgeSnaps) { this.m_MagnetEngine = new MagnetEngine(timelineClipGUI, new MoveClipAttractionHandler(), state); } } } bool result; if (!this.m_IsCaptured) { result = base.IgnoreEvent(); } else { TimelineClipGUI timelineClipGUI2 = (TimelineClipGUI)target; if (SelectionManager.Count() == 1) { TimelineClipGUI timelineClipGUI3 = SelectionManager.SelectedClipGUI().FirstOrDefault <TimelineClipGUI>(); if (timelineClipGUI3 != null) { TimelineTrackGUI dropTargetAt = MoveClip.GetDropTargetAt(state, evt.get_mousePosition()); if (dropTargetAt != null) { bool flag = dropTargetAt != timelineClipGUI3.parentTrackGUI; if (flag && !this.m_IsVerticalDrag) { state.isDragging = true; this.m_HasValidDropTarget = false; this.m_DropTarget = null; this.m_MouseDownPosition.x = evt.get_mousePosition().x; this.m_PreviewOffset = this.m_MouseDownPosition - timelineClipGUI2.bounds.get_position(); } else if (this.m_IsVerticalDrag && !flag) { state.isDragging = false; this.m_HasValidDropTarget = false; this.m_DropTarget = null; this.m_DragPixelOffset = evt.get_mousePosition() - this.m_MouseDownPosition - evt.get_delta(); } this.m_IsVerticalDrag = flag; } } } if (this.m_IsVerticalDrag) { this.m_PreviewRect = new Rect(evt.get_mousePosition().x, evt.get_mousePosition().y, timelineClipGUI2.bounds.get_width(), timelineClipGUI2.bounds.get_height()); this.m_PreviewRect.set_position(this.m_PreviewRect.get_position() - this.m_PreviewOffset); this.UpdateDragTarget(timelineClipGUI2, evt.get_mousePosition(), state); result = base.ConsumeEvent(); } else { if (this.m_IsDragDriver) { this.m_DragPixelOffset += evt.get_delta(); this.m_IsDragDriverActive |= (Math.Abs(this.m_DragPixelOffset.x) > MoveClip.kDragBufferInPixels); if (this.m_IsDragDriverActive) { float delta = this.m_DragPixelOffset.x / state.timeAreaScale.x; this.m_DragPixelOffset = Vector3.get_zero(); this.SetUndo(); if (SelectionManager.IsMultiSelect()) { double currentValue = (from x in SelectionManager.SelectedItems <TimelineClip>() select x.start).DefaultIfEmpty(timelineClipGUI2.clip.start).Min(); this.m_FrameSnap.ApplyOffset(currentValue, delta, state); foreach (TimelineClip current in from x in SelectionManager.SelectedItems <TimelineClip>() orderby x.start select x) { if (current.start + this.m_FrameSnap.lastOffsetApplied < 0.0) { break; } current.start += this.m_FrameSnap.lastOffsetApplied; } } else { timelineClipGUI2.clip.start = this.m_FrameSnap.ApplyOffset(timelineClipGUI2.clip.start, delta, state); } if (this.m_MagnetEngine != null) { this.m_MagnetEngine.Snap(evt.get_delta().x); } timelineClipGUI2.InvalidateEditor(); timelineClipGUI2.parentTrackGUI.SortClipsByStartTime(); state.Evaluate(); } } result = base.ConsumeEvent(); } } return(result); }; parent.Overlay += delegate(object target, Event evt, TimelineWindow.TimelineState state) { if (this.m_MagnetEngine != null) { this.m_MagnetEngine.OnGUI(); } bool result; if (this.m_IsVerticalDrag) { TimelineClipGUI timelineClipGUI = (TimelineClipGUI)target; Color color = (!this.m_HasValidDropTarget) ? DirectorStyles.Instance.customSkin.colorInvalidDropTarget : DirectorStyles.Instance.customSkin.colorValidDropTarget; timelineClipGUI.DrawDragPreview(this.m_PreviewRect, color); result = base.ConsumeEvent(); } else if (this.m_IsDragDriver) { IEnumerable <TimelineClip> enumerable = SelectionManager.SelectedItems <TimelineClip>(); double num = 1.7976931348623157E+308; double num2 = -1.7976931348623157E+308; foreach (TimelineClip current in enumerable) { if (current.start < num) { num = current.start; } if (current.end > num2) { num2 = current.end; } } this.m_SelectionIndicator.Draw(num, num2, this.m_MagnetEngine); result = base.ConsumeEvent(); } else { result = base.IgnoreEvent(); } return(result); }; }
public static void AddToMenu(GenericMenu menu, WindowState state) { var tracks = SelectionManager.SelectedTracks().ToArray(); if (tracks.Length == 0) { return; } actions.ForEach(action => { var subMenuPath = string.Empty; var categoryAttr = GetCategoryAttribute(action); if (categoryAttr != null) { subMenuPath = categoryAttr.Category; if (!subMenuPath.EndsWith("/")) { subMenuPath += "/"; } } string displayName = action.GetDisplayName(state, tracks); string menuItemName = subMenuPath + displayName; var separator = GetSeparator(action); var canBeAddedToMenu = !TypeUtility.IsHiddenInMenu(action.GetType()); if (canBeAddedToMenu) { Vector2?currentMousePosition = null; if (Event.current != null) { currentMousePosition = Event.current.mousePosition; } action.mousePosition = currentMousePosition; var displayState = action.GetDisplayState(state, tracks); if (displayState == MenuActionDisplayState.Visible && !IsActionActiveInMode(action, TimelineWindow.instance.currentMode.mode)) { displayState = MenuActionDisplayState.Disabled; } action.mousePosition = null; if (displayState == MenuActionDisplayState.Visible) { menu.AddItem(new GUIContent(menuItemName), action.IsChecked(state, tracks), f => { action.Execute(state, tracks); }, action); } if (displayState == MenuActionDisplayState.Disabled) { menu.AddDisabledItem(new GUIContent(menuItemName), action.IsChecked(state, tracks)); } if (displayState != MenuActionDisplayState.Hidden && separator != null && separator.after) { menu.AddSeparator(subMenuPath); } } }); }
public override bool IsSelected() { return(SelectionManager.Contains(clip)); }
public override void Select() { zOrder = zOrderProvider.Next(); SelectionManager.Add(clip); }
static void ExecuteInternal(WindowState state, IList <PlayableDirector> directors, int directorIndex, TimelineClip clip) { SelectionManager.Clear(); state.GetWindow().SetCurrentTimeline(directors[directorIndex], clip); }
public override void Draw(Rect headerRect, Rect contentRect, WindowState state) { if (track == null || m_IsRoot) { return; } if (m_MustRecomputeUnions) { RecomputeRectUnions(); } if (depth == 1) { Graphics.DrawBackgroundRect(state, headerRect); } var background = headerRect; background.height = expandedRect.height; var groupColor = TrackResourceCache.GetTrackColor(track); m_TreeViewRect = contentRect; var col = groupColor; var isSelected = SelectionManager.Contains(track); if (isSelected) { col = DirectorStyles.Instance.customSkin.colorSelection; } else if (isDropTarget) { col = DirectorStyles.Instance.customSkin.colorDropTarget; } else { if (m_GroupDepth % 2 == 1) { float h, s, v; Color.RGBToHSV(col, out h, out s, out v); v += 0.06f; col = Color.HSVToRGB(h, s, v); } } if (background.width > 0) { using (new GUIColorOverride(col)) GUI.Box(background, GUIContent.none, m_Styles.groupBackground); } var trackRectBackground = headerRect; trackRectBackground.xMin += background.width; trackRectBackground.width = contentRect.width; trackRectBackground.height = background.height; if (isSelected) { col = state.IsEditingASubTimeline() ? m_Styles.customSkin.colorTrackSubSequenceBackgroundSelected : m_Styles.customSkin.colorTrackBackgroundSelected; } else { col = m_Styles.customSkin.colorGroupTrackBackground; } EditorGUI.DrawRect(trackRectBackground, col); if (!isExpanded && children != null && children.Count > 0) { var collapsedTrackRect = contentRect; foreach (var u in m_Unions) { u.Draw(collapsedTrackRect, state); } } using (new GUIGroupScope(headerRect)) { var groupRect = new Rect(0, 0, headerRect.width, headerRect.height); DrawName(groupRect, isSelected); DrawTrackButtons(groupRect, state); } if (IsTrackRecording(state)) { using (new GUIColorOverride(DirectorStyles.Instance.customSkin.colorTrackBackgroundRecording)) GUI.Label(background, GUIContent.none, m_Styles.displayBackground); } // is this a referenced track? if (m_IsReferencedTrack) { var refRect = contentRect; refRect.x = state.timeAreaRect.xMax - 20.0f; refRect.y += 5.0f; refRect.width = 30.0f; GUI.Label(refRect, DirectorStyles.referenceTrackLabel, EditorStyles.label); } var bgRect = contentRect; if (track as GroupTrack != null || AllChildrenMuted(this)) { bgRect.height = expandedRect.height; } DrawTrackState(contentRect, bgRect, track); }
public override void Init(IControl parent) { parent.MouseDown += delegate(object target, Event evt, TimelineWindow.TimelineState state) { bool result; if (state.IsCurrentEditingASequencerTextField()) { result = base.IgnoreEvent(); } else if (evt.get_button() != 0 && evt.get_button() != 1) { result = base.IgnoreEvent(); } else if (evt.get_modifiers() == 4) { result = base.IgnoreEvent(); } else if (TimelineWindow.instance.sequenceHeaderBounds.Contains(evt.get_mousePosition())) { foreach (TimelineTrackBaseGUI current in TimelineWindow.instance.allTracks) { Rect headerBounds = current.headerBounds; headerBounds.set_y(headerBounds.get_y() + TimelineWindow.instance.treeviewBounds.get_y()); if (headerBounds.Contains(evt.get_mousePosition())) { result = base.IgnoreEvent(); return(result); } } if (evt.get_modifiers() == null) { SelectionManager.Clear(); } result = base.IgnoreEvent(); } else { this.m_ActiveRect = TimelineWindow.instance.clipArea; if (!this.m_ActiveRect.Contains(evt.get_mousePosition())) { result = base.IgnoreEvent(); } else { List <IBounds> elementsAtPosition = Manipulator.GetElementsAtPosition(state.quadTree, evt.get_mousePosition()); bool flag; if (!RectangleSelect.CanStartRectableSelect(evt, elementsAtPosition, out flag)) { if (flag) { RectangleSelect.HandleReselection(elementsAtPosition); } else { RectangleSelect.HandleSingleSelection(evt, state, elementsAtPosition); } result = base.IgnoreEvent(); } else { state.captured.Add(target as IControl); this.m_IsCaptured = true; this.m_Start = evt.get_mousePosition(); this.m_End = evt.get_mousePosition(); if (RectangleSelect.CanClearSelection(evt)) { SelectionManager.Clear(); } result = base.IgnoreEvent(); } } } return(result); }; parent.KeyDown += delegate(object target, Event evt, TimelineWindow.TimelineState state) { bool result; if (this.m_IsCaptured && evt.get_keyCode() == 27) { state.captured.Remove(target as IControl); this.m_IsCaptured = false; result = base.ConsumeEvent(); } else { result = base.IgnoreEvent(); } return(result); }; parent.MouseUp += delegate(object target, Event evt, TimelineWindow.TimelineState state) { bool result; if (!this.m_IsCaptured) { if (evt.get_modifiers() == null && evt.get_button() == 0 && SelectionManager.IsMultiSelect()) { List <IBounds> elementsAtPosition = Manipulator.GetElementsAtPosition(state.quadTree, evt.get_mousePosition()); TimelineItemGUI timelineItemGUI = RectangleSelect.PickItemGUI(elementsAtPosition); if (timelineItemGUI != null && SelectionManager.Contains(timelineItemGUI.item)) { SelectionManager.Clear(); SelectionManager.Add(timelineItemGUI.item); } } result = base.IgnoreEvent(); } else { state.captured.Remove(target as IControl); this.m_IsCaptured = false; Rect r = this.CurrentSelectionRect(); if (r.get_width() < 1f || r.get_height() < 1f) { result = base.IgnoreEvent(); } else { List <IBounds> elementsInRectangle = Manipulator.GetElementsInRectangle(state.quadTree, r); if (elementsInRectangle.Count == 0) { result = base.IgnoreEvent(); } else { if (RectangleSelect.CanClearSelection(evt)) { SelectionManager.Clear(); } foreach (IBounds current in elementsInRectangle) { if (!(current is TimelineGroupGUI)) { if (current is TimelineItemGUI) { SelectionManager.Add(((TimelineItemGUI)current).item); } } } result = base.ConsumeEvent(); } } } return(result); }; parent.MouseDrag += delegate(object target, Event evt, TimelineWindow.TimelineState state) { bool result; if (!this.m_IsCaptured) { result = base.IgnoreEvent(); } else { this.m_End = evt.get_mousePosition(); result = base.ConsumeEvent(); } return(result); }; parent.Overlay += new TimelineUIEvent(this.DrawSelection); }
public override void Deselect() { SelectionManager.Remove(clip); }
public static void Do(TimelineAsset timeline, TrackAsset track) { SelectionManager.Remove(track); TrackModifier.DeleteTrack(timeline, track); }