コード例 #1
0
 static void DrawTrackDropDownMenu(Rect rect, WindowState state)
 {
     if (GUI.Button(rect, GUIContent.none, DirectorStyles.Instance.trackOptions))
     {
         SequencerContextMenu.ShowMarkerHeaderContextMenu(null, state);
     }
 }
コード例 #2
0
        protected override bool ContextClick(Event evt, WindowState state)
        {
            if (evt.alt)
            {
                return(false);
            }

            var selectable = PickerUtils.PickedSelectable();

            if (selectable != null && selectable.IsSelected())
            {
                SequencerContextMenu.ShowItemContextMenu(evt.mousePosition);
                return(true);
            }

            var trackGUI = PickerUtils.PickedTrackBaseGUI();

            if (trackGUI != null)
            {
                SelectionManager.SelectOnly(trackGUI.track);
                trackGUI.drawer.trackMenuContext.clipTimeCreation = TrackDrawer.TrackMenuContext.ClipTimeCreation.Mouse;
                trackGUI.drawer.trackMenuContext.mousePosition    = evt.mousePosition;
                trackGUI.DisplayTrackMenu();
                return(true);
            }

            return(false);
        }
        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;
        }
コード例 #4
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);
                }
            }
        }
コード例 #5
0
        public virtual void OnBuildTrackContextMenu(GenericMenu menu, TrackAsset trackAsset, WindowState state)
        {
            var mousePosition = trackMenuContext.mousePosition;
            var candidateTime = TimelineHelpers.GetCandidateTime(state, mousePosition, trackAsset);

            SequencerContextMenu.AddClipMenuCommands(menu, trackAsset, candidateTime);
            SequencerContextMenu.AddMarkerMenuCommands(menu, trackAsset, candidateTime);
        }
コード例 #6
0
 static void DrawTrackDropDownMenu(Rect rect)
 {
     if (GUI.Button(rect, GUIContent.none, DirectorStyles.Instance.trackOptions))
     {
         SelectionManager.SelectOnly(TimelineEditor.inspectedAsset.markerTrack);
         SequencerContextMenu.ShowTrackContextMenu(null);
     }
 }
コード例 #7
0
        protected override bool ContextClick(Event evt, WindowState state)
        {
            if (!IsMouseOverMarkerHeader(evt.mousePosition, state))
            {
                return(false);
            }

            SelectionManager.SelectOnly(state.editSequence.asset.markerTrack);
            SequencerContextMenu.ShowTrackContextMenu(evt.mousePosition);
            return(true);
        }
コード例 #8
0
        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();
        }
コード例 #9
0
        public static void ShowMenu(Vector2?mousePosition, WindowState state)
        {
            var menu = new GenericMenu();

            ContextMenus.markerHeaderMenu.AddToMenu(menu, state);
            var timeline         = state.editSequence.asset;
            var time             = TimelineHelpers.GetCandidateTime(state, mousePosition);
            var enabled          = timeline.markerTrack == null || !timeline.markerTrack.lockedInHierarchy && !state.editSequence.isReadOnly;
            var addMarkerCommand = new Func <Type, IMarker>(type => AddMarkerCommand(type, time, state));

            SequencerContextMenu.AddMarkerMenuCommands(menu, timeline.markerTrack, addMarkerCommand, enabled);
            menu.ShowAsContext();
        }
コード例 #10
0
        protected override bool ContextClick(Event evt, WindowState state)
        {
            if (!state.showMarkerHeader)
            {
                return(false);
            }

            if (!(state.GetWindow().markerHeaderRect.Contains(evt.mousePosition) ||
                  state.GetWindow().markerContentRect.Contains(evt.mousePosition)))
            {
                return(false);
            }

            SequencerContextMenu.ShowMarkerHeaderContextMenu(evt.mousePosition, state);
            return(true);
        }
コード例 #11
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);
                return(true);
            }

            return(false);
        }
コード例 #12
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);
        }
コード例 #13
0
        static IMarker AddMarkerCommand(Type markerType, double time, WindowState state)
        {
            var timeline = state.editSequence.asset;

            timeline.CreateMarkerTrack();
            var markerTrack = timeline.markerTrack;

            var marker = SequencerContextMenu.AddMarkerCommand(markerTrack, markerType, time);

            if (typeof(INotification).IsAssignableFrom(markerType))
            {
                // If we have no binding for the Notifications, set it to the director GO
                var director = state.editSequence.director;
                if (director != null && director.GetGenericBinding(markerTrack) == null)
                {
                    director.SetGenericBinding(markerTrack, director.gameObject);
                }
            }

            return(marker);
        }
コード例 #14
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, 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);
                }
            }
        }
コード例 #15
0
 public override void Init(IControl parent)
 {
     parent.ContextClick += delegate(object target, Event evt, TimelineWindow.TimelineState state)
     {
         IEnumerable <TimelineMarkerGUI> source = SelectionManager.SelectedMarkerGUI();
         bool result;
         if (!source.Any <TimelineMarkerGUI>())
         {
             result = base.IgnoreEvent();
         }
         else if (!source.Any((TimelineMarkerGUI c) => c.bounds.Contains(evt.get_mousePosition())))
         {
             result = base.IgnoreEvent();
         }
         else
         {
             TimelineMarkerGUI timelineMarkerGUI = target as TimelineMarkerGUI;
             SequencerContextMenu.Show(timelineMarkerGUI.parentTrackGUI.drawer, evt.get_mousePosition());
             result = base.ConsumeEvent();
         }
         return(result);
     };
 }
コード例 #16
0
        public static void ShowMenu(Vector2?mousePosition, WindowState state)
        {
            var menu = new GenericMenu();

            ContextMenus.markerHeaderMenu.AddToMenu(menu, state);
            var timeline    = state.editSequence.asset;
            var markerTypes = TypeUtility.GetMarkerTypes(); // Marker track supports all Markers for now

            if (markerTypes.Any())
            {
                menu.AddSeparator(string.Empty);
                var time             = TimelineHelpers.GetCandidateTime(state, mousePosition);
                var addMarkerCommand = new Func <Type, IMarker>(type => AddMarkerCommand(type, time, state));
                var enabled          = timeline.markerTrack == null || !timeline.markerTrack.lockedInHierarchy;
                SequencerContextMenu.AddMarkerMenuCommands(menu, markerTypes, addMarkerCommand, enabled);
            }

            if (timeline.markerTrack != null)
            {
                SequencerContextMenu.RemoveInvalidMarkersMenuItem(menu, timeline.markerTrack);
            }

            menu.ShowAsContext();
        }
コード例 #17
0
 public void DisplayTrackMenu()
 {
     SequencerContextMenu.ShowTrackContextMenu(drawer, track, Event.current.mousePosition);
 }
コード例 #18
0
 void ContextClickOutsideItemsCallback()
 {
     SequencerContextMenu.ShowNewTracksContextMenu(null, m_State);
     Event.current.Use();
 }
コード例 #19
0
 void OnAddTrackClicked()
 {
     SequencerContextMenu.ShowNewTracksContextMenu(track, this, TimelineWindow.state);
 }