예제 #1
0
        public static void ShowItemContextMenu(Vector2 mousePosition)
        {
            var menu  = new GenericMenu();
            var state = TimelineWindow.instance.state;

            TimelineAction.AddToMenu(menu, state, mousePosition);

            if (SelectionManager.SelectedClips().Any())
            {
                ItemAction <TimelineClip> .AddToMenu(menu, state);
            }
            if (SelectionManager.SelectedMarkers().Any())
            {
                ItemAction <IMarker> .AddToMenu(menu, state);
            }

            var clipGUI = PickerUtils.PickedLayerableOfType <TimelineClipGUI>();

            if (clipGUI != null && clipGUI.drawer != null)
            {
                var clips = SelectionManager.SelectedClips().ToArray();
                if (clips.Length > 0)
                {
                    clipGUI.drawer.OnBuildClipContextMenu(menu, clips, state);
                    AddMarkerMenuCommands(menu, clipGUI.clip.parentTrack, TimelineHelpers.GetCandidateTime(state, mousePosition));
                }
            }

            menu.ShowAsContext();
        }
예제 #2
0
        public static void ShowTrackContextMenu(TrackDrawer drawer, TrackAsset track, Vector2 mousePosition)
        {
            var menu = new GenericMenu();

            TimelineAction.AddToMenu(menu, TimelineWindow.instance.state, mousePosition);
            menu.AddSeparator("");

            TrackAction.AddToMenu(menu, TimelineWindow.instance.state);

            var groupTrack = track as GroupTrack;

            if (groupTrack == null)
            {
                if (drawer != null)
                {
                    drawer.OnBuildTrackContextMenu(menu, track, TimelineWindow.instance.state);
                }
            }
            else
            {
                // Add all the track types..
                menu.AddSeparator("");
                TimelineGroupGUI.AddMenuItems(menu, groupTrack);
            }

            menu.ShowAsContext();
        }
        public static void Show(TrackDrawer drawer, Vector2 mousePosition)
        {
            GenericMenu genericMenu = new GenericMenu();

            TimelineAction.AddToMenu(genericMenu, TimelineWindow.instance.state);
            ItemAction <TimelineClip> .AddToMenu(genericMenu, TimelineWindow.instance.state);

            ItemAction <TimelineMarker> .AddToMenu(genericMenu, TimelineWindow.instance.state);

            if (drawer != null)
            {
                TimelineClip[] array = SelectionManager.SelectedItems <TimelineClip>().ToArray <TimelineClip>();
                if (array.Length > 0)
                {
                    genericMenu.AddSeparator("");
                    drawer.OnBuildClipContextMenu(genericMenu, array, TimelineWindow.instance.state);
                }
            }
            genericMenu.ShowAsContext();
        }
        public static void Show(TrackDrawer drawer, TrackAsset track, Vector2 mousePosition)
        {
            GenericMenu genericMenu = new GenericMenu();

            TimelineAction.AddToMenu(genericMenu, TimelineWindow.instance.state);
            genericMenu.AddSeparator("");
            TrackAction.AddToMenu(genericMenu, TimelineWindow.instance.state);
            GroupTrack groupTrack = track as GroupTrack;

            if (groupTrack == null)
            {
                if (drawer != null)
                {
                    genericMenu.AddSeparator("");
                    drawer.OnBuildTrackContextMenu(genericMenu, track, TimelineWindow.instance.state);
                }
            }
            else
            {
                genericMenu.AddSeparator("");
                TimelineGroupGUI.AddMenuItems(genericMenu, groupTrack);
            }
            genericMenu.ShowAsContext();
        }