protected override bool DoubleClick(Event evt, WindowState state)
        {
            if (evt.button != 0)
            {
                return(false);
            }

            var guiClip = PickerUtils.PickedSelectableOfType <TimelineClipGUI>();

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

            if (guiClip.clip.curves != null || guiClip.clip.animationClip != null)
            {
                ItemAction <TimelineClip> .Invoke <EditClipInAnimationWindow>(state, guiClip.clip);
            }

            if (guiClip.clip.asset is IDirectorDriver)
            {
                ItemAction <TimelineClip> .Invoke <EditSubTimeline>(state, guiClip.clip);
            }

            return(true);
        }
示例#2
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.PickedSelectableOfType <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();
        }
        public static void CycleMarkers()
        {
            var cluster = PickerUtils.PickedSelectableOfType <TimelineMarkerClusterGUI>();

            if (cluster == null)
            {
                return;
            }

            cluster.topMarker.Deselect();
            cluster.CycleTop();
            cluster.topMarker.Select();
        }
        public static bool CanCycleMarkers()
        {
            if (!SelectionManager.SelectedMarkers().Any())
            {
                return(false);
            }

            var cluster = PickerUtils.PickedSelectableOfType <TimelineMarkerClusterGUI>();

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

            // Only cycle if the marker is selected and nothing else is selected
            return(cluster.topMarker.IsSelected() && SelectionManager.Count() == 1);
        }