Example #1
0
        internal static void BuildTrackContextMenu(List <MenuActionItem> items, TrackAsset[] tracks, Vector2?mousePosition)
        {
            if (tracks == null || tracks.Length == 0)
            {
                return;
            }

            TimelineAction.GetMenuEntries(TimelineAction.MenuActions, mousePosition, items);
            TrackAction.GetMenuEntries(TimelineWindow.instance.state, mousePosition, tracks, items);
            AddLayeredTrackCommands(items, tracks);

            var first      = tracks.First().GetType();
            var allTheSame = tracks.All(t => t.GetType() == first);

            if (allTheSame)
            {
                if (first != typeof(GroupTrack))
                {
                    var candidateTime = TimelineHelpers.GetCandidateTime(TimelineWindow.instance.state, mousePosition, tracks);
                    AddClipMenuCommands(items, tracks, candidateTime);
                    AddMarkerMenuCommands(items, tracks, candidateTime);
                }
                else
                {
                    BuildNewTracksContextMenu(items, tracks, TimelineWindow.instance.state, Styles.addItemTemplate);
                }
            }
        }
Example #2
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));
            }
        }
Example #3
0
        internal static void BuildMarkerHeaderContextMenu(List <MenuActionItem> menu, Vector2?mousePosition, WindowState state)
        {
            TimelineAction.GetMenuEntries(MarkerHeaderMenuItems, null, menu);

            var timeline = state.editSequence.asset;
            var time     = TimelineHelpers.GetCandidateTime(state, mousePosition);
            var enabled  = timeline.markerTrack == null || !timeline.markerTrack.lockedInHierarchy;

            var addMarkerCommand = new Action <Type, Object>
                                   (
                (type, obj) => AddSingleMarkerCallback(type, time, timeline, state.editSequence.director, obj)
                                   );

            AddMarkerMenuCommands(menu, new TrackAsset[] { timeline.markerTrack }, addMarkerCommand, enabled);
        }