void DrawTrackButtons(Rect headerRect, WindowState state) { const float buttonSize = WindowConstants.trackHeaderButtonSize; const float padding = WindowConstants.trackHeaderButtonPadding; var buttonRect = new Rect(headerRect.xMax - buttonSize - padding, headerRect.y + ((headerRect.height - buttonSize) / 2f), buttonSize, buttonSize); if (GUI.Button(buttonRect, EditorGUIUtility.IconContent("CreateAddNew"), m_Styles.trackGroupAddButton)) { // the drop down will apply to all selected tracks if (!SelectionManager.Contains(track)) { SelectionManager.Clear(); SelectionManager.Add(track); } SequencerContextMenu.ShowNewTracksContextMenu(SelectionManager.SelectedTracks().ToArray(), TimelineWindow.state, buttonRect); } buttonRect.x -= buttonSize; var suitePadding = DrawButtonSuite(2, ref buttonRect); DrawMuteButton(buttonRect, state); buttonRect.x -= buttonSize + padding; DrawLockButton(buttonRect, state); buttonRect.x -= suitePadding; }
void AddButtonGUI() { if (currentMode.trackOptionsState.newButton == TimelineModeGUIState.Hidden) { return; } using (new EditorGUI.DisabledScope(currentMode.trackOptionsState.newButton == TimelineModeGUIState.Disabled)) { if (EditorGUILayout.DropdownButton(DirectorStyles.newContent, FocusType.Passive, "Dropdown")) { // if there is 1 and only 1 track selected, AND it's a group, add to that group TrackAsset parent = null; var groupTracks = SelectionManager.SelectedTracks().ToList(); if (groupTracks.Count == 1) { parent = groupTracks[0] as GroupTrack; // if it's locked, add to the root instead if (parent != null && parent.lockedInHierarchy) { parent = null; } } SequencerContextMenu.ShowNewTracksContextMenu(parent, null, state); } } }
void AddButtonGUI() { if (currentMode.trackOptionsState.newButton == TimelineModeGUIState.Hidden) { return; } using (new EditorGUI.DisabledScope(currentMode.trackOptionsState.newButton == TimelineModeGUIState.Disabled)) { if (EditorGUILayout.DropdownButton(DirectorStyles.newContent, FocusType.Passive, EditorStyles.toolbarPopup)) { // if there is 1 and only 1 track selected, AND it's a group, add to that group var groupTracks = SelectionManager.SelectedTracks().ToList(); if (groupTracks.Any(x => x.GetType() != typeof(GroupTrack) || x.lockedInHierarchy)) { groupTracks = null; } SequencerContextMenu.ShowNewTracksContextMenu(groupTracks, state); } } }
void ContextClickOutsideItemsCallback() { SequencerContextMenu.ShowNewTracksContextMenu(null, m_State); Event.current.Use(); }
void OnAddTrackClicked() { SequencerContextMenu.ShowNewTracksContextMenu(track, this, TimelineWindow.state); }