public override bool Execute(WindowState state)
        {
            TimelineEditor.clipboard.Clear();

            var clips = SelectionManager.SelectedClips().ToArray();

            if (clips.Length > 0)
            {
                ItemAction <TimelineClip> .Invoke <CopyClipsToClipboard>(state, clips);
            }
            var markers = SelectionManager.SelectedMarkers().ToArray();

            if (markers.Length > 0)
            {
                ItemAction <IMarker> .Invoke <CopyMarkersToClipboard>(state, markers);
            }
            var tracks = SelectionManager.SelectedTracks().ToArray();

            if (tracks.Length > 0)
            {
                CopyTracksToClipboard.Do(state, tracks);
            }

            return(true);
        }
Exemplo n.º 2
0
        public static void ShowItemContextMenu(Vector2 mousePosition)
        {
            var menu  = new GenericMenu();
            var state = TimelineWindow.instance.state;

            TimelineAction.AddToMenu(menu, state, mousePosition);

            if (SelectionManager.SelectedClips().Any())
            {
                ItemAction <TimelineClip> .AddToMenu(menu, state);
            }
            if (SelectionManager.SelectedMarkers().Any())
            {
                ItemAction <IMarker> .AddToMenu(menu, state);
            }

            var clipGUI = PickerUtils.PickedLayerableOfType <TimelineClipGUI>();

            if (clipGUI != null && clipGUI.drawer != null)
            {
                var clips = SelectionManager.SelectedClips().ToArray();
                if (clips.Length > 0)
                {
                    clipGUI.drawer.OnBuildClipContextMenu(menu, clips, state);
                    AddMarkerMenuCommands(menu, clipGUI.clip.parentTrack, TimelineHelpers.GetCandidateTime(state, mousePosition));
                }
            }

            menu.ShowAsContext();
        }
Exemplo n.º 3
0
 void UnSelectMarkerOnHeaderTrack()
 {
     foreach (IMarker marker in SelectionManager.SelectedMarkers())
     {
         if (marker.parent == editSequence.asset.markerTrack)
         {
             SelectionManager.Remove(marker);
         }
     }
 }
Exemplo n.º 4
0
        public override bool Execute(WindowState state)
        {
            var inlineCurveEditor = SelectionManager.GetCurrentInlineEditorCurve();

            if (ShouldHandleInlineCurve(inlineCurveEditor))
            {
                FrameInlineCurves(inlineCurveEditor, state, true);
                return(true);
            }

            if (state.IsCurrentEditingASequencerTextField())
            {
                return(false);
            }

            if (SelectionManager.Count() == 0)
            {
                Invoke <FrameAllAction>(state);
                return(true);
            }

            var startTime = float.MaxValue;
            var endTime   = float.MinValue;

            var clips   = SelectionManager.SelectedClipGUI();
            var markers = SelectionManager.SelectedMarkers();

            if (!clips.Any() && !markers.Any())
            {
                return(false);
            }

            foreach (var c in clips)
            {
                startTime = Mathf.Min(startTime, (float)c.clip.start);
                endTime   = Mathf.Max(endTime, (float)c.clip.end);
                if (c.clipCurveEditor != null)
                {
                    c.clipCurveEditor.FrameClip();
                }
            }

            foreach (var marker in markers)
            {
                startTime = Mathf.Min(startTime, (float)marker.time);
                endTime   = Mathf.Max(endTime, (float)marker.time);
            }

            FrameRange(startTime, endTime, state);

            return(true);
        }
Exemplo n.º 5
0
        public static bool CanCycleMarkers()
        {
            if (!SelectionManager.SelectedMarkers().Any())
            {
                return(false);
            }

            var cluster = PickerUtils.PickedLayerableOfType <TimelineMarkerClusterGUI>();

            if (cluster == null)
            {
                return(false);
            }

            // Only cycle if the marker is selected and nothing else is selected
            return(cluster.topMarker.IsSelected() && SelectionManager.Count() == 1);
        }
Exemplo n.º 6
0
        protected override bool ExecuteCommand(Event evt, WindowState state)
        {
            var consumed = false;
            var clips    = SelectionManager.SelectedClips();

            foreach (var clip in clips)
            {
                consumed |= ItemAction <TimelineClip> .HandleShortcut(state, evt, clip);
            }

            var markers = SelectionManager.SelectedMarkers();

            foreach (var marker in markers)
            {
                consumed |= ItemAction <IMarker> .HandleShortcut(state, evt, marker);
            }

            return(consumed);
        }
Exemplo n.º 7
0
        protected override bool ContextClick(Event evt, WindowState state)
        {
            if (evt.alt)
            {
                return(false);
            }

            var selectable = PickerUtils.PickedLayerableOfType <ISelectable>();

            if (selectable != null && selectable.IsSelected())
            {
                SequencerContextMenu.ShowItemContextMenu(evt.mousePosition,
                                                         SelectionManager.SelectedClips().ToArray(),
                                                         SelectionManager.SelectedMarkers().ToArray());
                return(true);
            }

            return(false);
        }
Exemplo n.º 8
0
        public override bool Execute(WindowState state)
        {
            if (state.IsEditingASubItem())
            {
                return(false);
            }

            if (SelectionManager.Count() == 0)
            {
                return(false);
            }

            var startTime = float.MaxValue;
            var endTime   = float.MinValue;

            var clips   = SelectionManager.SelectedClipGUI();
            var markers = SelectionManager.SelectedMarkers();

            if (!clips.Any() && !markers.Any())
            {
                return(false);
            }

            foreach (var c in clips)
            {
                startTime = Mathf.Min(startTime, (float)c.clip.start);
                endTime   = Mathf.Max(endTime, (float)c.clip.end);
                if (c.clipCurveEditor != null)
                {
                    c.clipCurveEditor.FrameClip();
                }
            }

            foreach (var marker in markers)
            {
                startTime = Mathf.Min(startTime, (float)marker.time);
                endTime   = Mathf.Max(endTime, (float)marker.time);
            }

            FrameRange(startTime, endTime, state);

            return(true);
        }