Ejemplo n.º 1
0
        protected override bool MouseDown(Event evt, WindowState state)
        {
            if (state.IsCurrentEditingASequencerTextField())
            {
                return(false);
            }

            m_ActiveRect = TimelineWindow.instance.sequenceContentRect;

            if (!m_ActiveRect.Contains(evt.mousePosition))
            {
                return(false);
            }

            if (!CanStartRectangle(evt))
            {
                return(false);
            }

            if (enableAutoPan)
            {
                m_TimeAreaAutoPanner = new TimeAreaAutoPanner(state);
            }

            m_StartPoint = new TimelinePoint(state, evt.mousePosition);
            m_EndPixel   = evt.mousePosition;

            state.AddCaptured(this);

            return(true);
        }
Ejemplo n.º 2
0
        protected override bool MouseDown(Event evt, WindowState state)
        {
            m_Target = PickerUtils.FirstPickedElementOfType <TrackResizeHandle>();
            if (m_Target == null)
            {
                return(false);
            }

            m_NumberOfContributingTracks = 1;
            var selectedTracks = SelectionManager.SelectedTrackGUI().ToList();

            if (selectedTracks.Any() && selectedTracks.Contains(m_Target.trackGUI)) //resize all selected tracks
            {
                var allTrackGui = state.GetWindow().treeView.allTrackGuis;
                m_TracksToResize              = allTrackGui.OfType <TimelineTrackGUI>().Where(i => SelectionManager.Contains(i.track)).ToList();
                m_NumberOfContributingTracks += m_TracksToResize.IndexOf(m_Target.trackGUI);
            }
            else
            {
                m_TracksToResize = new List <TimelineTrackGUI> {
                    m_Target.trackGUI
                }
            };

            m_Captured = true;
            state.AddCaptured(this);

            return(true);
        }
Ejemplo n.º 3
0
        protected override bool MouseDown(Event evt, WindowState state)
        {
            var handle = PickerUtils.PickedLayerableOfType <TimelineClipHandle>();

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

            if (handle.clipGUI.clip.parentTrack != null && handle.clipGUI.clip.parentTrack.lockedInHierarchy)
            {
                return(false);
            }

            if (ItemSelection.CanClearSelection(evt))
            {
                SelectionManager.Clear();
            }

            if (!SelectionManager.Contains(handle.clipGUI.clip))
            {
                SelectionManager.Add(handle.clipGUI.clip);
            }

            m_TrimClipHandler = handle;

            m_IsCaptured = true;
            state.AddCaptured(this);

            m_UndoSaved = false;

            var clip = m_TrimClipHandler.clipGUI.clip;

            m_OriginalDuration        = clip.duration;
            m_OriginalTimeScale       = clip.timeScale;
            m_OriginalEaseInDuration  = clip.easeInDuration;
            m_OriginalEaseOutDuration = clip.easeOutDuration;

            RefreshOverlayStrings(m_TrimClipHandler, state);

            // in ripple trim, the right edge moves and needs to snap
            var edges = ManipulateEdges.Right;

            if (EditMode.editType != EditMode.EditType.Ripple && m_TrimClipHandler.trimDirection == TrimEdge.Start)
            {
                edges = ManipulateEdges.Left;
            }
            m_SnapEngine = new SnapEngine(m_TrimClipHandler.clipGUI, new TrimClipAttractionHandler(), edges, state,
                                          evt.mousePosition);

            EditMode.BeginTrim(ItemsUtils.ToItem(clip), m_TrimClipHandler.trimDirection);

            return(true);
        }
Ejemplo n.º 4
0
        protected override bool MouseDown(Event evt, WindowState state)
        {
            Rect headerSplitterRect = state.GetWindow().headerSplitterRect;

            if (headerSplitterRect.Contains(evt.mousePosition))
            {
                m_Captured = true;
                state.AddCaptured(this);
                return(true);
            }

            return(false);
        }
Ejemplo n.º 5
0
        protected override bool MouseDown(Event evt, WindowState state)
        {
            m_Target = PickerUtils.FirstPickedElementOfType <InlineCurveResizeHandle>();
            if (m_Target == null)
            {
                return(false);
            }

            m_Captured         = true;
            m_CapturedHeight   = TimelineWindowViewPrefs.GetInlineCurveHeight(m_Target.trackGUI.track);
            m_CaptureMouseYPos = GUIUtility.GUIToScreenPoint(Event.current.mousePosition).y;
            state.AddCaptured(this);

            return(true);
        }
Ejemplo n.º 6
0
        protected override bool MouseDown(Event evt, WindowState state)
        {
            if (evt.button != 0)
            {
                return(false);
            }

            if (!m_OnMouseDown(evt, state))
            {
                return(false);
            }

            state.AddCaptured(this);
            m_IsCaptured = true;

            return(true);
        }
Ejemplo n.º 7
0
        protected bool MouseDownInternal(Event evt, WindowState state, TimelineClipHandle handle)
        {
            if (handle == null)
            {
                return(false);
            }

            if (handle.clipGUI.clip != null && !handle.clipGUI.clip.clipCaps.HasAny(ClipCaps.Blending))
            {
                return(false);
            }

            m_Edges = ManipulateEdges.Right;
            if (handle.trimDirection == TrimEdge.Start)
            {
                m_Edges = ManipulateEdges.Left;
            }

            if (m_Edges == ManipulateEdges.Left && handle.clipGUI.clip.hasBlendIn || m_Edges == ManipulateEdges.Right && handle.clipGUI.clip.hasBlendOut)
            {
                return(false);
            }

            m_IsCaptured = true;
            m_UndoSaved  = false;

            m_EaseClipHandler = handle;
            m_Clip            = handle.clipGUI.clip;
            m_OriginalValue   = m_Edges == ManipulateEdges.Left ? m_Clip.easeInDuration : m_Clip.easeOutDuration;


            // Change cursor only when OnGUI Process (not in test)
            if (GUIUtility.guiDepth > 0)
            {
                TimelineCursors.SetCursor(m_Edges == ManipulateEdges.Left ? TimelineCursors.CursorType.MixRight : TimelineCursors.CursorType.MixLeft);
            }

            state.AddCaptured(this);
            return(true);
        }
Ejemplo n.º 8
0
        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);
        }