public void GenCustomMenu() { GenericMenu pm = new GenericMenu(); bool cd = (state.seqence.trackTrees.Length > 1); if (SeqenceWindow.inst.tree.AnySelect()) { pm.AddItem(EditorGUIUtility.TrTextContent("UnSelect All tracks \t #u"), false, tree.ResetSelect, false); pm.AddDisabledItem(EditorGUIUtility.TrTextContent("Select All tracks \t %s")); } else { pm.AddDisabledItem(EditorGUIUtility.TrTextContent("UnSelect All tracks \t %u")); pm.AddItem(EditorGUIUtility.TrTextContent("Select All tracks \t #s"), false, tree.ResetSelect, true); } if (cd) { pm.AddItem(EditorGUIUtility.TrTextContent("Mute All tracks \t #m"), false, MuteAll); pm.AddItem(EditorGUIUtility.TrTextContent("Lock All tracks \t #l"), false, LockAll); } else { pm.AddDisabledItem(EditorGUIUtility.TrTextContent("Mute All tracks \t #m"), false); pm.AddDisabledItem(EditorGUIUtility.TrTextContent("Lock All tracks \t #l"), false); } var paste = EditorGUIUtility.TrTextContent("Paste Track\t #p"); if (EditorTrack.clipboardTrack != null) { pm.AddItem(paste, false, PasteTrack); } else { pm.AddDisabledItem(paste, false); } pm.AddSeparator(""); pm.AddItem(EditorGUIUtility.TrTextContent("Add XGroupTrack"), false, OnAddTrackItem, typeof(XGroupTrack)); var types = TypeUtilities.AllRootTrackExcMarkers(); for (int i = 0; i < types.Count; i++) { string str = types[i].ToString(); int idx = str.LastIndexOf('.'); if (idx >= 0) { str = "Add " + str.Substring(idx + 1); } pm.AddItem(EditorGUIUtility.TrTextContent(str), false, OnAddTrackItem, types[i]); } Rect rect = new Rect(Event.current.mousePosition, new Vector2(200, 0)); pm.DropDown(rect); }
private void GroupMenu() { var e = Event.current; if (e.type == EventType.ContextClick) { if (area.Contains(e.mousePosition)) { GenericMenu pm = new GenericMenu(); var types = TypeUtilities.AllRootTrackExcMarkers(); for (int i = 0; i < types.Count; i++) { string str = types[i].ToString(); int idx = str.LastIndexOf('.'); if (idx >= 0) { str = "Add " + str.Substring(idx + 1); } pm.AddItem(EditorGUIUtility.TrTextContent(str), false, OnAddTrackItem, types[i]); } var del = EditorGUIUtility.TrTextContent("Delete Track"); var dels = EditorGUIUtility.TrTextContent("Delete Tracks (Childs Include)"); pm.AddSeparator(""); if (track.childs == null || track.childs.Length <= 0) { pm.AddItem(del, false, DeleteTrack); pm.AddDisabledItem(dels, false); } else { pm.AddDisabledItem(del, false); pm.AddItem(dels, false, DeleteTrack); } pm.ShowAsContext(); e.Use(); } } }