void TracksGUI(Rect clientRect, WindowState state, TimelineModeGUIState trackState) { if (Event.current.type == EventType.Repaint && treeView != null) { state.headerSpacePartitioner.Clear(); state.spacePartitioner.Clear(); } if (state.IsEditingASubTimeline() && !state.IsEditingAnEmptyTimeline()) { var headerRect = clientRect; headerRect.width = state.sequencerHeaderWidth; Graphics.DrawBackgroundRect(state, headerRect); var clipRect = clientRect; clipRect.xMin = headerRect.xMax; Graphics.DrawBackgroundRect(state, clipRect, subSequenceMode: true); } else { Graphics.DrawBackgroundRect(state, clientRect); } if (!state.IsEditingAnEmptyTimeline()) { m_TimeArea.DrawMajorTicks(sequenceContentRect, state.referenceSequence.frameRate); } GUILayout.BeginVertical(); { GUILayout.Space(5.0f); GUILayout.BeginHorizontal(); if (this.state.editSequence.asset == null) { DrawNoSequenceGUI(state); } else { DrawTracksGUI(clientRect, trackState); } GUILayout.EndHorizontal(); } GUILayout.EndVertical(); Graphics.DrawShadow(clientRect); }
void DrawHeaderBackgroundBottomFiller() { var rect = sequenceRect; rect.yMin = rect.yMax; rect.yMax = rect.yMax + WindowConstants.sliderWidth; if (state.editSequence.asset != null && !state.IsEditingAnEmptyTimeline()) { rect.width = state.sequencerHeaderWidth; } using (new GUIViewportScope(rect)) { Graphics.DrawBackgroundRect(state, rect); } HandleBottomFillerDragAndDrop(rect); }
public override void Draw(Rect headerRect, Rect contentRect, WindowState state) { if (track == null || m_IsRoot) { return; } if (m_MustRecomputeUnions) { RecomputeRectUnions(); } if (depth == 1) { Graphics.DrawBackgroundRect(state, headerRect); } var background = headerRect; background.height = expandedRect.height; var groupColor = TrackResourceCache.GetTrackColor(track); m_TreeViewRect = contentRect; var col = groupColor; var isSelected = SelectionManager.Contains(track); if (isSelected) { col = DirectorStyles.Instance.customSkin.colorSelection; } else if (isDropTarget) { col = DirectorStyles.Instance.customSkin.colorDropTarget; } else { if (m_GroupDepth % 2 == 1) { float h, s, v; Color.RGBToHSV(col, out h, out s, out v); v += 0.06f; col = Color.HSVToRGB(h, s, v); } } if (background.width > 0) { using (new GUIColorOverride(col)) GUI.Box(background, GUIContent.none, m_Styles.groupBackground); } var trackRectBackground = headerRect; trackRectBackground.xMin += background.width; trackRectBackground.width = contentRect.width; trackRectBackground.height = background.height; if (isSelected) { col = state.IsEditingASubTimeline() ? m_Styles.customSkin.colorTrackSubSequenceBackgroundSelected : m_Styles.customSkin.colorTrackBackgroundSelected; } else { col = m_Styles.customSkin.colorGroupTrackBackground; } EditorGUI.DrawRect(trackRectBackground, col); if (!isExpanded && children != null && children.Count > 0) { var collapsedTrackRect = contentRect; foreach (var u in m_Unions) { u.Draw(collapsedTrackRect, state); } } using (new GUIGroupScope(headerRect)) { var groupRect = new Rect(0, 0, headerRect.width, headerRect.height); DrawName(groupRect, isSelected); DrawTrackButtons(groupRect, state); } if (IsTrackRecording(state)) { using (new GUIColorOverride(DirectorStyles.Instance.customSkin.colorTrackBackgroundRecording)) GUI.Label(background, GUIContent.none, m_Styles.displayBackground); } // is this a referenced track? if (m_IsReferencedTrack) { var refRect = contentRect; refRect.x = state.timeAreaRect.xMax - 20.0f; refRect.y += 5.0f; refRect.width = 30.0f; GUI.Label(refRect, DirectorStyles.referenceTrackLabel, EditorStyles.label); } var bgRect = contentRect; if (track as GroupTrack != null || AllChildrenMuted(this)) { bgRect.height = expandedRect.height; } DrawTrackState(contentRect, bgRect, track); }
public override void Draw(Rect headerRect, Rect contentRect, WindowState state) { if (track == null) { return; } if (m_IsRoot) { return; } if (m_MustRecomputeUnions) { RecomputeRectUnions(); } if (depth == 1) { Graphics.DrawBackgroundRect(state, headerRect); } var background = headerRect; background.height = expandedRect.height; var groupColor = TrackResourceCache.GetTrackColor(track); m_TreeViewRect = contentRect; var col = groupColor; var isSelected = SelectionManager.Contains(track); if (isSelected) { col = DirectorStyles.Instance.customSkin.colorSelection; } else if (isDropTarget) { col = DirectorStyles.Instance.customSkin.colorDropTarget; } else { if (m_GroupDepth % 2 == 1) { float h, s, v; Color.RGBToHSV(col, out h, out s, out v); v += 0.06f; col = Color.HSVToRGB(h, s, v); } } // Draw Rounded Rectangle of the group... using (new GUIColorOverride(col)) GUI.Box(background, GUIContent.none, m_Styles.groupBackground); var trackRectBackground = headerRect; trackRectBackground.xMin += background.width; trackRectBackground.width = contentRect.width; trackRectBackground.height = background.height; if (isSelected) { col = state.IsEditingASubTimeline() ? m_Styles.customSkin.colorTrackSubSequenceBackgroundSelected : m_Styles.customSkin.colorTrackBackgroundSelected; } else { col = m_Styles.customSkin.colorGroupTrackBackground; } EditorGUI.DrawRect(trackRectBackground, col); if (!isExpanded && children != null && children.Count > 0) { var collapsedTrackRect = contentRect; foreach (var u in m_Unions) { u.Draw(collapsedTrackRect, state); } } // Draw the name of the Group... var labelRect = headerRect; labelRect.xMin += 20; var actorName = track != null ? track.name : "missing"; labelRect.width = m_Styles.groupFont.CalcSize(new GUIContent(actorName)).x; labelRect.width = Math.Max(labelRect.width, 50.0f); // if we aren't bound to anything, we show a text field that allows to rename the actor // otherwise we show a ObjectField to allow binding to a go if (track != null && track is GroupTrack) { var textColor = m_Styles.groupFont.normal.textColor; if (isSelected) { textColor = Color.white; } string newName; EditorGUI.BeginChangeCheck(); using (new StyleNormalColorOverride(m_Styles.groupFont, textColor)) { newName = EditorGUI.DelayedTextField(labelRect, GUIContent.none, track.GetInstanceID(), track.name, m_Styles.groupFont); } if (EditorGUI.EndChangeCheck() && !string.IsNullOrEmpty(newName)) { track.name = newName; displayName = track.name; } } DrawTrackButtons(headerRect, state); if (IsTrackRecording(state)) { using (new GUIColorOverride(DirectorStyles.Instance.customSkin.colorTrackBackgroundRecording)) GUI.Label(background, GUIContent.none, m_Styles.displayBackground); } // is this a referenced track? if (m_IsReferencedTrack) { var refRect = contentRect; refRect.x = state.timeAreaRect.xMax - 20.0f; refRect.y += 5.0f; refRect.width = 30.0f; GUI.Label(refRect, DirectorStyles.referenceTrackLabel, EditorStyles.label); } Rect bgRect = contentRect; if (track as GroupTrack != null || AllChildrenMuted(this)) { bgRect.height = expandedRect.height; } DrawTrackState(contentRect, bgRect, track); }