internal bool Execute(WindowState state, Func <ITimelineItem, ITimelineItem, double> gapBetweenItems) { var selectedItems = SelectionManager.SelectedItems().ToItemsPerTrack().ToList(); if (selectedItems.Any()) { var requestedTime = CalculateDuplicateTime(selectedItems, gapBetweenItems); var duplicatedItems = TimelineHelpers.DuplicateItemsUsingCurrentEditMode(state, TimelineEditor.inspectedDirector, TimelineEditor.inspectedDirector, selectedItems, requestedTime, "Duplicate Items"); TimelineHelpers.FrameItems(state, duplicatedItems); SelectionManager.RemoveTimelineSelection(); foreach (var item in duplicatedItems) { SelectionManager.Add(item); } } var tracks = SelectionManager.SelectedTracks().ToArray(); if (tracks.Length > 0) { TrackAction.Invoke <DuplicateTracks>(state, tracks); } state.Refresh(); return(true); }
public override bool Execute(WindowState state) { if (SelectionManager.GetCurrentInlineEditorCurve() != null) { return(false); } if (!CanDelete(state)) { return(false); } var selectedItems = SelectionManager.SelectedItems(); DeleteItems(selectedItems); var tracks = SelectionManager.SelectedTracks().ToArray(); if (tracks.Any()) { TrackAction.Invoke <DeleteTracks>(state, tracks); } state.Refresh(); return(selectedItems.Any() || tracks.Length > 0); }
public static void ShowTrackContextMenu(TrackDrawer drawer, TrackAsset track, Vector2 mousePosition) { var menu = new GenericMenu(); TimelineAction.AddToMenu(menu, TimelineWindow.instance.state, mousePosition); menu.AddSeparator(""); TrackAction.AddToMenu(menu, TimelineWindow.instance.state); var groupTrack = track as GroupTrack; if (groupTrack == null) { if (drawer != null) { drawer.OnBuildTrackContextMenu(menu, track, TimelineWindow.instance.state); } } else { // Add all the track types.. menu.AddSeparator(""); TimelineGroupGUI.AddMenuItems(menu, groupTrack); } menu.ShowAsContext(); }
protected override bool ExecuteCommand(Event evt, WindowState state) { if (state.IsCurrentEditingASequencerTextField()) { return(false); } var tracks = SelectionManager.SelectedTracks().ToList(); var itemGUIs = SelectionManager.SelectedClipGUI(); foreach (var itemGUI in itemGUIs) { var trackGUI = itemGUI.parent == null ? null : itemGUI.parent as TimelineTrackBaseGUI; if (trackGUI == null) { continue; } if (!tracks.Contains(trackGUI.track)) { tracks.Add(trackGUI.track); } } return(TrackAction.HandleShortcut(state, evt, tracks.ToArray())); }
internal static void BuildTrackContextMenu(List <MenuActionItem> items, TrackAsset[] tracks, Vector2?mousePosition) { if (tracks == null || tracks.Length == 0) { return; } TimelineAction.GetMenuEntries(TimelineAction.MenuActions, mousePosition, items); TrackAction.GetMenuEntries(TimelineWindow.instance.state, mousePosition, tracks, items); AddLayeredTrackCommands(items, tracks); var first = tracks.First().GetType(); var allTheSame = tracks.All(t => t.GetType() == first); if (allTheSame) { if (first != typeof(GroupTrack)) { var candidateTime = TimelineHelpers.GetCandidateTime(TimelineWindow.instance.state, mousePosition, tracks); AddClipMenuCommands(items, tracks, candidateTime); AddMarkerMenuCommands(items, tracks, candidateTime); } else { BuildNewTracksContextMenu(items, tracks, TimelineWindow.instance.state, Styles.addItemTemplate); } } }
public override bool Execute(TimelineWindow.TimelineState state) { bool result; if (SelectionManager.GetCurrentInlineEditorCurve() != null) { result = false; } else { ITimelineItem[] array = (from x in SelectionManager.SelectedItemGUI() select x.selectableObject as ITimelineItem).ToArray <ITimelineItem>(); if (array.Length > 0) { ItemActionInvoker.InvokeByName <TimelineClip>("DeleteClips", state, array); ItemActionInvoker.InvokeByName <TimelineMarker>("DeleteMarkers", state, array); } TrackAsset[] array2 = SelectionManager.SelectedTracks().ToArray <TrackAsset>(); if (array2.Length > 0) { TrackAction.InvokeByName("DeleteTracks", state, array2); } result = (array.Length > 0 || array2.Length > 0); } return(result); }
public override bool Execute(TimelineWindow.TimelineState state) { ITimelineItem[] array = (from x in SelectionManager.SelectedItemGUI() select x.selectableObject as ITimelineItem).ToArray <ITimelineItem>(); if (array.Length > 0) { ItemActionInvoker.InvokeByName <TimelineClip>("DuplicateClips", state, array); ItemActionInvoker.InvokeByName <TimelineMarker>("DuplicateMarkers", state, array); } TrackAsset[] array2 = SelectionManager.SelectedTracks().ToArray <TrackAsset>(); if (array2.Length > 0) { TrackAction.InvokeByName("DuplicateTracks", state, array2); } return(true); }
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 { TimelineTrackBaseGUI trackGUI = target as TimelineTrackBaseGUI; if (trackGUI == null || trackGUI.track == null) { result = base.IgnoreEvent(); } else { bool arg_AC_0; if (!SelectionManager.SelectedTracks().Contains(trackGUI.track)) { arg_AC_0 = (from x in SelectionManager.SelectedItemGUI() select x).Any((TimelineItemGUI x) => x.parentTrackGUI == trackGUI); } else { arg_AC_0 = true; } bool flag = arg_AC_0; if (flag) { result = TrackAction.HandleShortcut(state, evt, trackGUI.track); } else { result = base.IgnoreEvent(); } } } return(result); }; }
public static void Show(TrackDrawer drawer, TrackAsset track, Vector2 mousePosition) { GenericMenu genericMenu = new GenericMenu(); TimelineAction.AddToMenu(genericMenu, TimelineWindow.instance.state); genericMenu.AddSeparator(""); TrackAction.AddToMenu(genericMenu, TimelineWindow.instance.state); GroupTrack groupTrack = track as GroupTrack; if (groupTrack == null) { if (drawer != null) { genericMenu.AddSeparator(""); drawer.OnBuildTrackContextMenu(genericMenu, track, TimelineWindow.instance.state); } } else { genericMenu.AddSeparator(""); TimelineGroupGUI.AddMenuItems(genericMenu, groupTrack); } genericMenu.ShowAsContext(); }