Esempio n. 1
0
 static void DrawTrackDropDownMenu(Rect rect, WindowState state)
 {
     if (GUI.Button(rect, GUIContent.none, DirectorStyles.Instance.trackOptions))
     {
         SequencerContextMenu.ShowMarkerHeaderContextMenu(null, state);
     }
 }
        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;
        }
Esempio n. 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);
                }
            }
        }
        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);
        }
 static void DrawTrackDropDownMenu(Rect rect)
 {
     if (GUI.Button(rect, GUIContent.none, DirectorStyles.Instance.trackOptions))
     {
         SelectionManager.SelectOnly(TimelineEditor.inspectedAsset.markerTrack);
         SequencerContextMenu.ShowTrackContextMenu(null);
     }
 }
Esempio n. 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);
        }
        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 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();
        }
        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);
        }
        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);
        }
Esempio n. 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);
        }
        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);
        }
        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 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);
     };
 }
        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();
        }
 public void DisplayTrackMenu()
 {
     SequencerContextMenu.ShowTrackContextMenu(drawer, track, Event.current.mousePosition);
 }
 void ContextClickOutsideItemsCallback()
 {
     SequencerContextMenu.ShowNewTracksContextMenu(null, m_State);
     Event.current.Use();
 }
 void OnAddTrackClicked()
 {
     SequencerContextMenu.ShowNewTracksContextMenu(track, this, TimelineWindow.state);
 }