static void DrawClipEditorBackground(ClipDrawData drawData) { var isRepaint = (Event.current.type == EventType.Repaint); if (isRepaint && drawData.clipEditor != null) { var customBodyRect = drawData.clippedRect; customBodyRect.yMin += k_ClipInlineWidth; customBodyRect.yMax -= k_ClipSwatchLineThickness; var region = new ClipBackgroundRegion(customBodyRect, drawData.localVisibleStartTime, drawData.localVisibleEndTime); try { drawData.clipEditor.DrawBackground(drawData.clip, region); } catch (Exception e) { Debug.LogException(e); } } }
static void DrawLoops(ClipDrawData drawData) { var oldColor = GUI.color; int loopIndex = drawData.uiClip.minLoopIndex; for (int l = 0; l < drawData.uiClip.loopRects.Count; l++) { Rect theRect = drawData.uiClip.loopRects[l]; theRect.x -= drawData.unclippedRect.x; theRect.x += 1; theRect.width -= 2.0f; theRect.y = 5.0f; theRect.height -= 4.0f; theRect.xMin -= 4f; if (theRect.width >= 5f) { GUI.color = new Color(0.0f, 0.0f, 0.0f, 0.2f); GUI.Label(theRect, GUIContent.none, DirectorStyles.Instance.displayBackground); if (theRect.width > 36.0f) { var style = DirectorStyles.Instance.fontClipLoop; GUI.color = new Color(0.0f, 0.0f, 0.0f, 0.3f); var loopContent = new GUIContent(drawData.uiClip.supportsLooping ? GetLoopString(loopIndex) : Styles.HoldText); GUI.Label(theRect, loopContent, style); } } loopIndex++; if (!drawData.uiClip.supportsLooping) { break; } } GUI.color = oldColor; }
static void DrawClipBorder(ClipDrawData drawData, ClipBlends blends) { var clipGUI = drawData.uiClip; ClipBorder border = null; var animTrack = drawData.clip.parentTrack as AnimationTrack; if (drawData.state.recording && animTrack == null && drawData.clip.parentTrack.IsRecordingToClip(drawData.clip)) { border = ClipBorder.kRecording; } else if (drawData.selected) { border = ClipBorder.kSelection; } if (border != null) { DrawBorder(clipGUI.clipCenterSection, border, blends, drawData.previousClip); } }
static void DrawClipBorder(ClipDrawData drawData) { var animTrack = drawData.clip.parentTrack as AnimationTrack; var selectionBorder = ClipBorder.Selection(); if (TimelineWindow.instance.state.recording && animTrack == null && drawData.clip.parentTrack.IsRecordingToClip(drawData.clip)) { DrawClipSelectionBorder(drawData.clipCenterSection, selectionBorder, drawData.clipBlends); return; } DrawClipDefaultBorder(drawData.clipCenterSection, ClipBorder.Default(), drawData.clipBlends); if (drawData.selected) { DrawClipSelectionBorder(drawData.clipCenterSection, selectionBorder, drawData.clipBlends); } if (drawData.previousClip != null && drawData.previousClipSelected) { DrawClipBlendSelectionBorder(drawData.clipCenterSection, selectionBorder, drawData.clipBlends); } }
static void DrawClipBorder(ClipDrawData drawData) { var animTrack = drawData.clip.GetParentTrack() as AnimationTrack; var selectionBorder = ClipBorder.Selection(); if (TimelineWindow.instance.state.recording && animTrack == null && drawData.clip.GetParentTrack().IsRecordingToClip(drawData.clip)) { DrawClipSelectionBorder(drawData.clipCenterSection, selectionBorder, drawData.clipBlends); return; } DrawClipDefaultBorder(drawData.clipCenterSection, ClipBorder.Default(), drawData.clipBlends); if (drawData.selected) { DrawClipSelectionBorder(drawData.clipCenterSection, selectionBorder, drawData.clipBlends); } if (drawData.previousClip != null && drawData.previousClipSelected) { bool shouldDrawLeftLine = Math.Abs(drawData.previousClip.start - drawData.clip.start) < double.Epsilon; DrawClipBlendSelectionBorder(drawData.clipCenterSection, selectionBorder, drawData.clipBlends, shouldDrawLeftLine); } }
public static void DrawRecordProhibited(ClipDrawData drawData) { DrawRecordInvalidClip(drawData); DrawRecordOnBlend(drawData); }
public static void DrawDefaultClip(ClipDrawData drawData) { DrawClipBackground(drawData.clipCenterSection, drawData.clipBlends, drawData.selected); if (drawData.targetRect.width > k_MinClipWidth) { var isRepaint = (Event.current.type == EventType.Repaint); if (isRepaint && drawData.clipEditor != null) { var customBodyRect = drawData.clippedRect; customBodyRect.yMin += k_ClipInlineWidth; customBodyRect.yMax -= k_ClipSwatchLineThickness; var region = new ClipBackgroundRegion(customBodyRect, drawData.localVisibleStartTime, drawData.localVisibleEndTime); try { drawData.clipEditor.DrawBackground(drawData.clip, region); } catch (Exception e) { Debug.LogException(e); } } } else { drawData.targetRect.width = k_MinClipWidth; drawData.clipCenterSection.width = k_MinClipWidth; } DrawClipEdges(drawData.targetRect, drawData.ClipDrawOptions.highlightColor, s_InlineLightColor, s_InlineShadowColor, drawData.clipBlends.inKind != BlendKind.Mix, drawData.clipBlends.outKind != BlendKind.Mix); DrawClipTimescale(drawData.targetRect, drawData.clip.timeScale); if (drawData.targetRect.width >= k_ClipInOutMinWidth) { DrawClipInOut(drawData.targetRect, drawData.clip); } var labelRect = drawData.clipCenterSection; if (drawData.targetRect.width >= k_ClipLoopsMinWidth) { bool selected = drawData.selected || drawData.inlineCurvesSelected; if (selected) { if (drawData.loopRects != null && drawData.loopRects.Any()) { DrawLoops(drawData); var l = drawData.loopRects[0]; labelRect.xMax = Math.Min(labelRect.xMax, l.x - drawData.unclippedRect.x); } } } labelRect.xMin += k_ClipLabelPadding; labelRect.xMax -= k_ClipLabelPadding; if (labelRect.width > k_ClipLabelMinWidth) { DrawClipLabel(drawData, labelRect, Color.white); } DrawClipBorder(drawData); }
public virtual void DrawClip(ClipDrawData drawData) { ClipDrawer.DrawDefaultClip(drawData, GetClipDrawing(drawData.clip), BlendsFromGUI(drawData.uiClip)); }
public virtual void DrawCustomClipBody(ClipDrawData drawData, Rect centerRect) { }
public static void DrawDefaultClip(ClipDrawData drawData, ClipDrawing drawing, ClipBlends blends) { DrawClipBackground(drawData.clipCenterSection, blends, drawData.selected); if (drawData.targetRect.width > k_MinClipWidth) { var customBodyRect = drawData.clippedRect; customBodyRect.yMin += k_ClipInlineWidth; customBodyRect.yMax -= k_ClipSwatchLineThickness; // TODO: Remove this when clip editors land if (drawData.trackDrawer != null) { drawData.trackDrawer.DrawCustomClipBody(drawData, customBodyRect); } } else { drawData.targetRect.width = k_MinClipWidth; drawData.clipCenterSection.width = k_MinClipWidth; } DrawClipEdges(drawData.targetRect, drawing.highlightColor, s_InlineLightColor, s_InlineShadowColor, drawData.uiClip.blendInKind != BlendKind.Mix, drawData.uiClip.blendOutKind != BlendKind.Mix); DrawClipTimescale(drawData.targetRect, drawData.clip.timeScale); if (drawData.targetRect.width >= k_ClipInOutMinWidth) { DrawClipInOut(drawData.targetRect, drawData.clip); } var labelRect = drawData.clipCenterSection; if (drawData.targetRect.width >= k_ClipLoopsMinWidth) { bool selected = drawData.selected || drawData.inlineCurvesSelected; if (selected) { if (drawData.uiClip.loopRects != null && drawData.uiClip.loopRects.Any()) { DrawLoops(drawData); var l = drawData.uiClip.loopRects[0]; labelRect.xMax = Math.Min(labelRect.xMax, l.x - drawData.unclippedRect.x); } } } labelRect.xMin += k_ClipLabelPadding; labelRect.xMax -= k_ClipLabelPadding; if (labelRect.width > k_ClipLabelMinWidth) { DrawClipLabel(drawData, labelRect, Color.white, drawing.errorText); } DrawClipBorder(drawData, blends); }