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(); }
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(); }