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);
            }
            buttonRect.x -= buttonSize;

            var suitePadding = DrawButtonSuite(2, ref buttonRect);

            DrawMuteButton(buttonRect, state);
            buttonRect.x -= buttonSize + padding;
            DrawLockButton(buttonRect, state);
            buttonRect.x -= suitePadding;
        }
        public static bool SelectDownTrack(bool shift = false)
        {
            if (TrackHeadActive())
            {
                var nextTrack = SelectionManager.SelectedTracks().Last().NextTrack();
                if (nextTrack != null)
                {
                    if (shift)
                    {
                        if (SelectionManager.Contains(nextTrack))
                        {
                            SelectionManager.Remove(SelectionManager.SelectedTracks().Last());
                        }
                        SelectionManager.Add(nextTrack);
                    }
                    else
                    {
                        SelectionManager.SelectOnly(nextTrack);
                    }

                    FrameTrackHeader(GetVisibleTracks().First(x => x.track == nextTrack));
                }
                return(true);
            }

            return(false);
        }
        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);
        }
        static bool InternalExecute(Event evt, WindowState state)
        {
            if (state.IsCurrentEditingASequencerTextField())
            {
                return(false);
            }

            var tracks = SelectionManager.SelectedTracks().ToList();
            var items  = SelectionManager.SelectedClipGUI();

            foreach (var item in items)
            {
                var trackGUI = item.parent as TimelineTrackBaseGUI;
                if (trackGUI == null)
                {
                    continue;
                }

                if (!tracks.Contains(trackGUI.track))
                {
                    tracks.Add(trackGUI.track);
                }
            }

            return(ActionManager.HandleShortcut(evt,
                                                ActionManager.TrackActions,
                                                x => ActionManager.ExecuteTrackAction(x, tracks)));
        }
Esempio n. 5
0
        public static bool HandleShortcut(TimelineWindow.TimelineState state, Event evt, TrackAsset track)
        {
            List <TrackAsset> list = SelectionManager.SelectedTracks().ToList <TrackAsset>();

            if (list.All((TrackAsset x) => x != track))
            {
                list.Add(track);
            }
            bool result;

            foreach (TrackAction current in TrackAction.actions)
            {
                object[] customAttributes = current.GetType().GetCustomAttributes(typeof(ShortcutAttribute), true);
                object[] array            = customAttributes;
                for (int i = 0; i < array.Length; i++)
                {
                    ShortcutAttribute shortcutAttribute = (ShortcutAttribute)array[i];
                    if (shortcutAttribute.IsRecognized(evt))
                    {
                        if (MenuItemActionBase.s_ShowActionTriggeredByShortcut)
                        {
                            Debug.Log(current.GetType().Name);
                        }
                        result = current.Execute(state, list.ToArray());
                        return(result);
                    }
                }
            }
            result = false;
            return(result);
        }
Esempio n. 6
0
        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()));
        }
 public static bool SelectUpTrack(bool shift = false)
 {
     if (TrackHeadActive())
     {
         var prevTrack = PreviousTrack(SelectionManager.SelectedTracks().Last());
         if (prevTrack != null)
         {
             if (shift)
             {
                 if (SelectionManager.Contains(prevTrack))
                 {
                     SelectionManager.Remove(SelectionManager.SelectedTracks().Last());
                 }
                 SelectionManager.Add(prevTrack);
             }
             else
             {
                 SelectionManager.SelectOnly(prevTrack);
             }
             FrameTrackHeader(GetVisibleTracks().First(x => x.track == prevTrack));
         }
         return(true);
     }
     return(false);
 }
Esempio n. 8
0
        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   = GetDisplayName(action);
                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);
                    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);
                    }
                }
            });
        }
        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 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);
        }
Esempio n. 12
0
        void AddButtonGUI()
        {
            if (currentMode.trackOptionsState.newButton == TimelineModeGUIState.Hidden)
            {
                return;
            }

            using (new EditorGUI.DisabledScope(currentMode.trackOptionsState.newButton == TimelineModeGUIState.Disabled))
            {
                if (EditorGUILayout.DropdownButton(DirectorStyles.newContent, FocusType.Passive, "Dropdown"))
                {
                    // if there is 1 and only 1 track selected, AND it's a group, add to that group
                    TrackAsset parent      = null;
                    var        groupTracks = SelectionManager.SelectedTracks().ToList();
                    if (groupTracks.Count == 1)
                    {
                        parent = groupTracks[0] as GroupTrack;
                        // if it's locked, add to the root instead
                        if (parent != null && parent.lockedInHierarchy)
                        {
                            parent = null;
                        }
                    }
                    SequencerContextMenu.ShowNewTracksContextMenu(parent, null, state);
                }
            }
        }
        public static bool CollapseGroup()
        {
            if (TrackHeadActive())
            {
                var quit = false;
                foreach (var track in SelectionManager.SelectedTracks())
                {
                    if (!track.GetChildTracks().Any())
                    {
                        continue;
                    }
                    if (!quit && !track.GetCollapsed())
                    {
                        quit = true;
                    }
                    track.SetCollapsed(true);
                }
                if (quit)
                {
                    TimelineEditor.Refresh(RefreshReason.ContentsModified);
                    return(true);
                }

                var selectedTrack = SelectionManager.SelectedTracks().LastOrDefault();
                var parent        = selectedTrack != null ? selectedTrack.parent as TrackAsset : null;
                if (parent)
                {
                    SelectionManager.SelectOnly(parent);
                    FrameTrackHeader(GetVisibleTracks().First(x => x.track == parent));
                    return(true);
                }
            }
            return(false);
        }
Esempio n. 14
0
        public static void BuildTrackContextMenu(List <MenuActionItem> items, Vector2?mousePosition)
        {
            var tracks = SelectionManager.SelectedTracks().ToArray();

            if (tracks.Length == 0)
            {
                return;
            }

            ActionManager.GetMenuEntries(ActionManager.TimelineActions, mousePosition, items);
            ActionManager.GetMenuEntries(ActionManager.TrackActions, 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(mousePosition, tracks);
                    AddClipMenuCommands(items, tracks, candidateTime);
                    AddMarkerMenuCommands(items, tracks, candidateTime);
                }
                else
                {
                    BuildNewTracksContextMenu(items, tracks, TimelineWindow.instance.state, Styles.addItemTemplate);
                }
            }
        }
Esempio n. 15
0
        public static IEnumerable <TimelineTrackBaseGUI> SelectedTrackGUI()
        {
            IEnumerable <TrackAsset> tracks = SelectionManager.SelectedTracks();

            return(from x in TimelineWindow.instance.allTracks
                   where tracks.Contains(x.track)
                   select x);
        }
 static bool CanDelete(WindowState state)
 {
     if (state.editSequence.isReadOnly)
     {
         return(false);
     }
     // All() returns true when empty
     return(SelectionManager.SelectedTracks().All(x => !x.lockedInHierarchy) &&
            SelectionManager.SelectedItems().All(x => x.parentTrack == null || !x.parentTrack.lockedInHierarchy));
 }
        void ContextClickItemCallback(int id)
        {
            // may not occur if another menu is active
            if (!m_TreeView.IsSelected(id))
            {
                SelectionChangedCallback(new[] { id });
            }

            SequencerContextMenu.ShowTrackContextMenu(SelectionManager.SelectedTracks().ToArray(), Event.current.mousePosition);

            Event.current.Use();
        }
        public static bool UnCollapseGroup()
        {
            if (TrackHeadActive())
            {
                var quit = false;
                foreach (var track in SelectionManager.SelectedTracks())
                {
                    if (!track.GetChildTracks().Any())
                    {
                        continue;
                    }

                    if (!quit && track.GetCollapsed())
                    {
                        quit = true;
                    }
                    track.SetCollapsed(false);
                }

                if (quit)
                {
                    TimelineEditor.Refresh(RefreshReason.ContentsModified);
                    return(true);
                }

                // Transition to Clip area
                var           visibleTracks = GetVisibleTracks().Select(x => x.track).ToList();
                var           idx           = visibleTracks.IndexOf(SelectionManager.SelectedTracks().Last());
                ITimelineItem item          = null;
                for (var i = idx; i < visibleTracks.Count; ++i)
                {
                    var items = visibleTracks[i].GetItems().OfType <ClipItem>();
                    if (!items.Any())
                    {
                        continue;
                    }
                    item = items.First();
                    break;
                }

                if (item != null)
                {
                    SelectionManager.SelectOnly(item);
                    TimelineHelpers.FrameItems(new[] { item });
                    return(true);
                }
            }
            return(false);
        }
 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);
 }
Esempio n. 20
0
        static TrackAsset FindSuitableParentForSingleTrackPasteWithoutMouse(ItemsPerTrack itemsGroup)
        {
            var groupParent    = itemsGroup.targetTrack; //set a main parent in the clipboard
            var selectedTracks = SelectionManager.SelectedTracks();

            if (selectedTracks.Contains(groupParent))
            {
                return(groupParent);
            }

            //find a selected track suitable for all items
            var itemsToPaste    = itemsGroup.items;
            var compatibleTrack = selectedTracks.FirstOrDefault(t => IsTrackValidForItems(t, itemsToPaste));

            return(compatibleTrack != null ? compatibleTrack : groupParent);
        }
Esempio n. 21
0
        static TrackAsset FindSuitableParentForSingleTrackPasteWithoutMouse(ItemsPerTrack itemsGroup)
        {
            var groupParent    = itemsGroup.targetTrack; //set a main parent in the clipboard
            var selectedTracks = SelectionManager.SelectedTracks();

            if (selectedTracks.Contains(groupParent))
            {
                return(groupParent);
            }

            //find a selected track suitable for all items
            var itemsToPaste    = itemsGroup.items;
            var compatibleTrack = selectedTracks.Where(t => !t.lockedInHierarchy).FirstOrDefault(t => itemsToPaste.All(i => i.IsCompatibleWithTrack(t)));

            return(compatibleTrack != null ? compatibleTrack : groupParent);
        }
Esempio n. 22
0
        float DrawTrackDropDownMenu(Rect rect)
        {
            rect.y += WindowConstants.trackOptionButtonVerticalPadding;

            if (GUI.Button(rect, GUIContent.none, m_Styles.trackOptions))
            {
                // the drop down will apply to all selected tracks
                if (!SelectionManager.Contains(track))
                {
                    SelectionManager.Clear();
                    SelectionManager.Add(track);
                }

                SequencerContextMenu.ShowTrackContextMenu(SelectionManager.SelectedTracks().ToArray(), null);
            }

            return(WindowConstants.trackHeaderButtonSize);
        }
Esempio n. 23
0
 public static void AddToMenu(GenericMenu menu, TimelineWindow.TimelineState state)
 {
     TrackAsset[] tracks = SelectionManager.SelectedTracks().ToArray <TrackAsset>();
     TrackAction.actions.ForEach(delegate(TrackAction action)
     {
         string text = string.Empty;
         CategoryAttribute categoryAttribute = MenuItemActionBase.GetCategoryAttribute(action);
         if (categoryAttribute == null)
         {
             text = string.Empty;
         }
         else
         {
             text = categoryAttribute.Category;
             if (!text.EndsWith("/"))
             {
                 text += "/";
             }
         }
         string displayName = MenuItemActionBase.GetDisplayName(action);
         string text2       = text + displayName;
         SeparatorMenuItemAttribute separator = MenuItemActionBase.GetSeparator(action);
         bool flag = !MenuItemActionBase.IsHiddenInMenu(action);
         if (flag)
         {
             MenuActionDisplayState displayState = action.GetDisplayState(state, tracks);
             if (displayState == MenuActionDisplayState.Visible)
             {
                 menu.AddItem(new GUIContent(text2), false, delegate(object f)
                 {
                     action.Execute(state, tracks);
                 }, action);
             }
             if (displayState == MenuActionDisplayState.Disabled)
             {
                 menu.AddDisabledItem(new GUIContent(text2));
             }
             if (displayState != MenuActionDisplayState.Hidden && separator != null && separator.after)
             {
                 menu.AddSeparator(text);
             }
         }
     });
 }
        static bool CanPasteItems(ICollection <ItemsPerTrack> itemsGroups, double?invocationTime)
        {
            var hasItemsCopiedFromMultipleTracks = itemsGroups.Count > 1;
            var allItemsCopiedFromCurrentAsset   = itemsGroups.All(x => x.targetTrack.timelineAsset == TimelineEditor.inspectedAsset);
            var hasUsedShortcut = invocationTime == null;
            var anySourceLocked = itemsGroups.Any(x => x.targetTrack != null && x.targetTrack.lockedInHierarchy);

            var targetTrack = GetPickedTrack();

            if (targetTrack == null)
            {
                targetTrack = SelectionManager.SelectedTracks().FirstOrDefault();
            }

            //do not paste if the user copied items from another timeline
            //if the copied items comes from > 1 track (since we do not know where to paste the copied items)
            //or if a keyboard shortcut was used (since the user will not see the paste result)
            if (!allItemsCopiedFromCurrentAsset)
            {
                var isSelectedTrackInCurrentAsset = targetTrack != null && targetTrack.timelineAsset == TimelineEditor.inspectedAsset;
                if (hasItemsCopiedFromMultipleTracks || (hasUsedShortcut && !isSelectedTrackInCurrentAsset))
                {
                    return(false);
                }
            }

            // pasting to items to their source track, if items from multiple tracks are selected
            // and no track is in the selection items will each be pasted to their respective track.
            if (targetTrack == null || itemsGroups.All(x => x.targetTrack == targetTrack))
            {
                return(!anySourceLocked);
            }

            if (hasItemsCopiedFromMultipleTracks)
            {
                //do not paste if the track which received the paste action does not contain a copied clip
                return(!anySourceLocked && itemsGroups.Select(x => x.targetTrack).Contains(targetTrack));
            }

            var copiedItems = itemsGroups.SelectMany(i => i.items);

            return(IsTrackValidForItems(targetTrack, copiedItems));
        }
Esempio n. 25
0
 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);
     };
 }
Esempio n. 26
0
 public override bool Execute(TimelineWindow.TimelineState state)
 {
     Clipboard.Clear();
     TimelineClip[] array = SelectionManager.SelectedItems <TimelineClip>().ToArray <TimelineClip>();
     if (array.Length > 0)
     {
         CopyClipsToClipboard.Do(state, array);
     }
     TimelineMarker[] array2 = SelectionManager.SelectedItems <TimelineMarker>().ToArray <TimelineMarker>();
     if (array2.Length > 0)
     {
         CopyMarkersToClipboard.Do(state, array2);
     }
     TrackAsset[] array3 = SelectionManager.SelectedTracks().ToArray <TrackAsset>();
     if (array3.Length > 0)
     {
         CopyTracksToClipboard.Do(state, array3);
     }
     return(true);
 }
        public override bool Execute(WindowState state)
        {
            if (KeyboardNavigation.TrackHeadActive())
            {
                return(KeyboardNavigation.FocusFirstVisibleItem(state, SelectionManager.SelectedTracks()));
            }

            if (!KeyboardNavigation.ClipAreaActive())
            {
                return(KeyboardNavigation.FocusFirstVisibleItem(state));
            }

            var item = KeyboardNavigation.GetVisibleSelectedItems().LastOrDefault();

            if (item != null)
            {
                SelectionManager.SelectOnly(item.parentTrack);
            }
            return(true);
        }
Esempio n. 28
0
        static bool CanPasteItems(ICollection <ItemsPerTrack> itemsGroups, WindowState state, Vector2?mousePosition)
        {
            var hasItemsCopiedFromMultipleTracks = itemsGroups.Count > 1;
            var allItemsCopiedFromCurrentAsset   = itemsGroups.All(x => x.targetTrack.timelineAsset == state.editSequence.asset);
            var hasUsedShortcut = mousePosition == null;
            var anySourceLocked = itemsGroups.Any(x => x.targetTrack != null && x.targetTrack.lockedInHierarchy);

            var targetTrack = GetPickedTrack();

            if (targetTrack == null)
            {
                targetTrack = SelectionManager.SelectedTracks().FirstOrDefault();
            }

            //do not paste if the user copied items from another timeline
            //if the copied items comes from > 1 track (since we do not know where to paste the copied items)
            //or if a keyboard shortcut was used (since the user will not see the paste result)
            if (!allItemsCopiedFromCurrentAsset)
            {
                var isSelectedTrackInCurrentAsset = targetTrack != null && targetTrack.timelineAsset == state.editSequence.asset;
                if (hasItemsCopiedFromMultipleTracks || (hasUsedShortcut && !isSelectedTrackInCurrentAsset))
                {
                    return(false);
                }
            }

            if (hasUsedShortcut)
            {
                return(!anySourceLocked); // copy/paste to same track
            }
            if (hasItemsCopiedFromMultipleTracks)
            {
                //do not paste if the track which received the paste action does not contain a copied clip
                return(!anySourceLocked && itemsGroups.Select(x => x.targetTrack).Contains(targetTrack));
            }

            var copiedItems = itemsGroups.SelectMany(i => i.items);

            return(IsTrackValidForItems(targetTrack, copiedItems));
        }
        void AddButtonGUI()
        {
            if (currentMode.trackOptionsState.newButton == TimelineModeGUIState.Hidden)
            {
                return;
            }

            using (new EditorGUI.DisabledScope(currentMode.trackOptionsState.newButton == TimelineModeGUIState.Disabled))
            {
                if (EditorGUILayout.DropdownButton(DirectorStyles.newContent, FocusType.Passive, EditorStyles.toolbarPopup))
                {
                    // if there is 1 and only 1 track selected, AND it's a group, add to that group
                    var groupTracks = SelectionManager.SelectedTracks().ToList();
                    if (groupTracks.Any(x => x.GetType() != typeof(GroupTrack) || x.lockedInHierarchy))
                    {
                        groupTracks = null;
                    }

                    SequencerContextMenu.ShowNewTracksContextMenu(groupTracks, state);
                }
            }
        }
 public static bool TrackHeadActive()
 {
     return(SelectionManager.SelectedTracks().Any(x => x.IsVisibleRecursive()) && !ClipAreaActive());
 }