public static void AddToMenu(GenericMenu menu, TimelineWindow.TimelineState state) { T[] items = (from x in SelectionManager.SelectedItemGUI() select x.selectableObject).OfType <T>().ToArray <T>(); if (items.Length >= 1) { menu.AddSeparator(""); ItemAction <T> .actions.ForEach(delegate(ItemAction <T> action) { string text = string.Empty; CategoryAttribute categoryAttribute = MenuItemActionBase.GetCategoryAttribute(action); if (categoryAttribute == null) { text = string.Empty; } else { text = categoryAttribute.Category; if (!text.EndsWith("/")) { text += "/"; } } string displayName = MenuItemActionBase.GetDisplayName(action); string text2 = text + displayName; SeparatorMenuItemAttribute separator = MenuItemActionBase.GetSeparator(action); bool flag = !MenuItemActionBase.IsHiddenInMenu(action); if (flag) { MenuActionDisplayState displayState = action.GetDisplayState(state, items); if (displayState == MenuActionDisplayState.Visible) { if (separator != null && separator.before) { menu.AddSeparator(text); } menu.AddItem(new GUIContent(text2), false, delegate(object f) { action.Execute(state, items); }, action); } if (displayState == MenuActionDisplayState.Disabled) { menu.AddDisabledItem(new GUIContent(text2)); } if (displayState != MenuActionDisplayState.Hidden && separator != null && separator.after) { menu.AddSeparator(text); } } }); } }
public static void AddToMenu(GenericMenu menu, TimelineWindow.TimelineState state) { TrackAsset[] tracks = SelectionManager.SelectedTracks().ToArray <TrackAsset>(); TrackAction.actions.ForEach(delegate(TrackAction action) { string text = string.Empty; CategoryAttribute categoryAttribute = MenuItemActionBase.GetCategoryAttribute(action); if (categoryAttribute == null) { text = string.Empty; } else { text = categoryAttribute.Category; if (!text.EndsWith("/")) { text += "/"; } } string displayName = MenuItemActionBase.GetDisplayName(action); string text2 = text + displayName; SeparatorMenuItemAttribute separator = MenuItemActionBase.GetSeparator(action); bool flag = !MenuItemActionBase.IsHiddenInMenu(action); if (flag) { MenuActionDisplayState displayState = action.GetDisplayState(state, tracks); if (displayState == MenuActionDisplayState.Visible) { menu.AddItem(new GUIContent(text2), false, delegate(object f) { action.Execute(state, tracks); }, action); } if (displayState == MenuActionDisplayState.Disabled) { menu.AddDisabledItem(new GUIContent(text2)); } if (displayState != MenuActionDisplayState.Hidden && separator != null && separator.after) { menu.AddSeparator(text); } } }); }