public static void AddMarkerMenuCommands(GenericMenu menu, TrackAsset trackAsset, double candidateTime) { var markerTypes = TypeUtility.GetMarkerTypes().Where(x => TypeUtility.DoesTrackSupportMarkerType(trackAsset, x)).ToArray(); if (markerTypes.Any()) { menu.AddSeparator(String.Empty); var addMarkerCommand = new Func <Type, IMarker>(type => AddMarkerCommand(trackAsset, type, candidateTime)); AddMarkerMenuCommands(menu, markerTypes, addMarkerCommand, !trackAsset.lockedInHierarchy); } RemoveInvalidMarkersMenuItem(menu, trackAsset); }
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(); }