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

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

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

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

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

            return(true);
        }
        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);
        }
        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);
        }
Пример #4
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();
        }
Пример #5
0
 public static bool Do(TimelineWindow.TimelineState state, TimelineClip clip)
 {
     TimelineClip[] items = new TimelineClip[]
     {
         clip
     };
     return(ItemAction <TimelineClip> .DoInternal(typeof(CopyClipsToClipboard), state, items));
 }
Пример #6
0
 public static bool Do(TimelineWindow.TimelineState state, TimelineMarker theMarker)
 {
     TimelineMarker[] items = new TimelineMarker[]
     {
         theMarker
     };
     return(ItemAction <TimelineMarker> .DoInternal(typeof(CopyMarkersToClipboard), state, items));
 }
Пример #7
0
        internal static void BuildItemContextMenu(List <MenuActionItem> items, Vector2 mousePosition, TimelineClip[] clips, IMarker[] markers)
        {
            var state = TimelineWindow.instance.state;

            TimelineAction.GetMenuEntries(TimelineAction.MenuActions, mousePosition, items);
            ItemAction <TimelineClip> .GetMenuEntries(clips, items);

            ItemAction <IMarker> .GetMenuEntries(markers, items);

            if (clips.Length > 0)
            {
                AddMarkerMenuCommands(items, clips.Select(c => c.parentTrack).Distinct().ToList(), TimelineHelpers.GetCandidateTime(state, mousePosition));
            }
        }
Пример #8
0
        public static bool InvokeByName <T>(string actionName, TimelineWindow.TimelineState state, ITimelineItem[] items) where T : class, ITimelineItem
        {
            T[]  array = items.OfType <T>().ToArray <T>();
            bool result;

            if (!array.Any <T>())
            {
                result = false;
            }
            else
            {
                ItemAction <T> itemAction = ItemAction <T> .actions.First((ItemAction <T> x) => x.GetType().Name == actionName);

                result = (itemAction != null && itemAction.Execute(state, array));
            }
            return(result);
        }
Пример #9
0
        protected override bool ExecuteCommand(Event evt, WindowState state)
        {
            var consumed = false;
            var clips    = SelectionManager.SelectedClips();

            foreach (var clip in clips)
            {
                consumed |= ItemAction <TimelineClip> .HandleShortcut(state, evt, clip);
            }

            var markers = SelectionManager.SelectedMarkers();

            foreach (var marker in markers)
            {
                consumed |= ItemAction <IMarker> .HandleShortcut(state, evt, marker);
            }

            return(consumed);
        }
        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 override void Init(IControl parent)
 {
     parent.KeyDown += delegate(object target, Event evt, TimelineWindow.TimelineState state)
     {
         bool result;
         if (state.IsEditingASubItem())
         {
             result = base.IgnoreEvent();
         }
         else
         {
             TimelineClipGUI timelineClipGUI = target as TimelineClipGUI;
             if (!SelectionManager.Contains(timelineClipGUI.clip))
             {
                 result = base.IgnoreEvent();
             }
             else
             {
                 result = ItemAction <TimelineClip> .HandleShortcut(state, evt, timelineClipGUI.clip);
             }
         }
         return(result);
     };
 }
Пример #12
0
 public static bool Do(TimelineWindow.TimelineState state, TimelineClip[] clips)
 {
     return(ItemAction <TimelineClip> .DoInternal(typeof(CopyClipsToClipboard), state, clips));
 }
Пример #13
0
        protected static bool DoInternal(Type t, TimelineWindow.TimelineState state, T[] items)
        {
            ItemAction <T> itemAction = (ItemAction <T>)t.GetConstructors()[0].Invoke(null);

            return(itemAction.CanExecute(state, items) && itemAction.Execute(state, items));
        }
Пример #14
0
 public static bool Do(TimelineWindow.TimelineState state, TimelineMarker[] markers)
 {
     return(ItemAction <TimelineMarker> .DoInternal(typeof(CopyMarkersToClipboard), state, markers));
 }