예제 #1
0
        public static void FinishTrim()
        {
            s_CurrentTrimItem = null;

            TimelineCursors.ClearCursor();
            ClearEditMode();
        }
예제 #2
0
        public static void FinishTrim()
        {
            s_CurrentTrimItem = null;

            TimelineCursors.ClearCursor();
            ClearEditMode();

            TimelineEditor.Refresh(RefreshReason.ContentsModified);
        }
예제 #3
0
        protected override bool MouseUp(Event evt, WindowState state)
        {
            if (m_Active)
            {
                TimelineCursors.ClearCursor();
                state.editorWindow.Repaint();
            }

            return(false);
        }
예제 #4
0
        protected override bool MouseDown(Event evt, WindowState state)
        {
            if ((evt.button == 2 && evt.modifiers == EventModifiers.None) ||
                (evt.button == 0 && evt.modifiers == EventModifiers.Alt))
            {
                TimelineCursors.SetCursor(TimelineCursors.CursorType.Pan);

                m_Active = true;
                return(true);
            }

            return(false);
        }
예제 #5
0
        protected override bool MouseUp(Event evt, WindowState state)
        {
            if (!m_Dragged)
            {
                var item = PickerUtils.TopmostPickedItem() as ISelectable;

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

                if (!item.IsSelected())
                {
                    return(false);
                }

                // Re-selecting an item part of a multi-selection should only keep this item selected.
                if (SelectionManager.Count() > 1 && ItemSelection.CanClearSelection(evt))
                {
                    SelectionManager.Clear();
                    item.Select();
                    return(true);
                }

                if (m_CycleMarkersPending)
                {
                    m_CycleMarkersPending = false;
                    TimelineMarkerClusterGUI.CycleMarkers();
                    return(true);
                }

                return(false);
            }

            m_TimeAreaAutoPanner = null;

            DropItems();

            m_SnapEngine      = null;
            m_MoveItemHandler = null;

            state.Evaluate();
            state.RemoveCaptured(this);
            m_Dragged = false;
            TimelineCursors.ClearCursor();

            return(true);
        }
        public void DrawGUI(WindowState state, Rect bounds, Color color, TrimEdge edge)
        {
            if (EditModeUtils.HasBlends(m_Item, edge))
            {
                EditModeGUIUtils.DrawBoundsEdge(bounds, color, edge);
                var cursorType = (edge == TrimEdge.End)
                    ? TimelineCursors.CursorType.MixRight
                    : TimelineCursors.CursorType.MixLeft;

                TimelineCursors.SetCursor(cursorType);
            }
            else
            {
                TimelineCursors.ClearCursor();
            }
        }
예제 #7
0
        protected override bool MouseUp(Event evt, WindowState state)
        {
            if (!m_IsCaptured)
            {
                return(false);
            }
            m_IsCaptured = false;
            m_UndoSaved  = false;
            state.captured.Clear();

            // Clear cursor only when OnGUI Process (not in test)
            if (GUIUtility.guiDepth > 0)
            {
                TimelineCursors.ClearCursor();
            }

            return(true);
        }
예제 #8
0
        public void DrawGUI(WindowState state, IEnumerable <MovingItems> movingItems, Color color)
        {
            var selectionHasAnyBlendIn  = false;
            var selectionHasAnyBlendOut = false;

            foreach (var grabbedItems in movingItems)
            {
                var bounds = grabbedItems.onTrackItemsBounds;

                var counter = 0;
                foreach (var item in grabbedItems.items.OfType <IBlendable>())
                {
                    if (item.hasLeftBlend)
                    {
                        EditModeGUIUtils.DrawBoundsEdge(bounds[counter], color, TrimEdge.Start);
                        selectionHasAnyBlendIn = true;
                    }

                    if (item.hasRightBlend)
                    {
                        EditModeGUIUtils.DrawBoundsEdge(bounds[counter], color, TrimEdge.End);
                        selectionHasAnyBlendOut = true;
                    }
                    counter++;
                }
            }

            if (selectionHasAnyBlendIn && selectionHasAnyBlendOut)
            {
                TimelineCursors.SetCursor(TimelineCursors.CursorType.MixBoth);
            }
            else if (selectionHasAnyBlendIn)
            {
                TimelineCursors.SetCursor(TimelineCursors.CursorType.MixLeft);
            }
            else if (selectionHasAnyBlendOut)
            {
                TimelineCursors.SetCursor(TimelineCursors.CursorType.MixRight);
            }
            else
            {
                TimelineCursors.ClearCursor();
            }
        }
예제 #9
0
        public static void FinishMove()
        {
            var manipulatedItemsList = s_CurrentMoveItemHandler.movingItems;

            moveMode.FinishMove(manipulatedItemsList);

            foreach (var itemsGroup in manipulatedItemsList)
            {
                foreach (var item in itemsGroup.items)
                {
                    item.parentTrack = itemsGroup.targetTrack;
                }
            }

            s_CurrentMoveItemHandler = null;

            TimelineCursors.ClearCursor();
            ClearEditMode();
        }
예제 #10
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);
        }
        public void OnGUI(Event evt)
        {
            if (!m_Grabbing)
            {
                return;
            }

            if (evt.type != EventType.Repaint)
            {
                return;
            }

            var isValid = IsValidDrop();

            using (new GUIViewportScope(m_State.GetWindow().sequenceContentRect))
            {
                foreach (var grabbedClip in movingItems)
                {
                    grabbedClip.RefreshBounds(m_State, evt.mousePosition);

                    if (!grabbedClip.HasAnyDetachedParents())
                    {
                        continue;
                    }

                    grabbedClip.Draw(isValid);
                }

                if (isValid)
                {
                    EditMode.DrawMoveGUI(m_State, movingItems);
                }
                else
                {
                    TimelineCursors.ClearCursor();
                }
            }
        }
        public void DrawGUI(WindowState state, IEnumerable <MovingItems> movingItems, Color color)
        {
            var operationWillReplace = false;

            foreach (var itemsPerTrack in movingItems)
            {
                var bounds = itemsPerTrack.onTrackItemsBounds;

                var counter = 0;
                foreach (var item in itemsPerTrack.items)
                {
                    if (EditModeUtils.GetFirstIntersectedItem(itemsPerTrack.items, item.start) != null)
                    {
                        EditModeGUIUtils.DrawBoundsEdge(bounds[counter], color, TrimEdge.Start);
                        operationWillReplace = true;
                    }

                    if (EditModeUtils.GetFirstIntersectedItem(itemsPerTrack.items, item.end) != null)
                    {
                        EditModeGUIUtils.DrawBoundsEdge(bounds[counter], color, TrimEdge.End);
                        operationWillReplace = true;
                    }

                    counter++;
                    // TODO Display swallowed clips?
                }
            }

            if (operationWillReplace)
            {
                TimelineCursors.SetCursor(TimelineCursors.CursorType.Replace);
            }
            else
            {
                TimelineCursors.ClearCursor();
            }
        }
        public void DrawGUI(WindowState state, IEnumerable <MovingItems> movingItems, Color color)
        {
            if (m_Detached)
            {
                var xMin = float.MaxValue;
                var xMax = float.MinValue;

                foreach (var grabbedItems in movingItems)
                {
                    xMin = Math.Min(xMin, grabbedItems.onTrackItemsBounds.Min(b => b.xMin)); // TODO Cache this?
                    xMax = Math.Max(xMax, grabbedItems.onTrackItemsBounds.Max(b => b.xMax));
                }

                foreach (var grabbedItems in movingItems)
                {
                    var bounds = Rect.MinMaxRect(xMin, grabbedItems.onTrackItemsBounds[0].yMin,
                                                 xMax, grabbedItems.onTrackItemsBounds[0].yMax);

                    EditModeGUIUtils.DrawOverlayRect(bounds, new Color(1.0f, 1.0f, 1.0f, 0.5f));

                    EditModeGUIUtils.DrawBoundsEdge(bounds, color, TrimEdge.Start);
                }
            }
            else
            {
                foreach (var grabbedItems in movingItems)
                {
                    var bounds = Rect.MinMaxRect(grabbedItems.onTrackItemsBounds.Min(b => b.xMin), grabbedItems.onTrackItemsBounds[0].yMin,
                                                 grabbedItems.onTrackItemsBounds.Max(b => b.xMax), grabbedItems.onTrackItemsBounds[0].yMax);

                    EditModeGUIUtils.DrawBoundsEdge(bounds, color, TrimEdge.Start);
                }
            }

            TimelineCursors.SetCursor(TimelineCursors.CursorType.Ripple);
        }
        public void DrawGUI(WindowState state, Rect bounds, Color color, TrimEdge edge)
        {
            bool shouldDraw = m_ItemToBeReplaced != null && (edge == TrimEdge.End && m_Item.end > m_ClipOriginalEdgeValue) ||
                              (edge == TrimEdge.Start && m_Item.start < m_ClipOriginalEdgeValue);

            if (shouldDraw)
            {
                var cursorType = TimelineCursors.CursorType.Replace;
                if (EditModeUtils.HasBlends(m_Item, edge))
                {
                    color      = DirectorStyles.kMixToolColor;
                    cursorType = (edge == TrimEdge.End)
                        ? TimelineCursors.CursorType.MixRight
                        : TimelineCursors.CursorType.MixLeft;
                }

                EditModeGUIUtils.DrawBoundsEdge(bounds, color, edge);
                TimelineCursors.SetCursor(cursorType);
            }
            else
            {
                TimelineCursors.ClearCursor();
            }
        }
예제 #15
0
 public void DrawGUI(WindowState state, Rect bounds, Color color, TrimEdge edge)
 {
     EditModeGUIUtils.DrawBoundsEdge(bounds, color, edge);
     TimelineCursors.SetCursor(TimelineCursors.CursorType.Ripple);
 }