void DrawSimpleClip(Rect targetRect, ClipBorder border, Color overlay)
        {
            var drawOptions = UpdateClipDrawOptions(CustomTimelineEditorCache.GetClipEditor(clip), clip);
            var blends      = GetClipBlends();

            ClipDrawer.DrawSimpleClip(clip, targetRect, border, overlay, drawOptions, blends);
        }
        public static void DrawBorder(Rect centerRect, ClipBorder border, ClipBlends blends, TimelineClip prevClip = null)
        {
            var thickness = border.thickness;
            var color     = border.color;

            // Draw top selected lines.
            EditorGUI.DrawRect(new Rect(centerRect.xMin, centerRect.yMin, centerRect.width, thickness), color);

            // Draw bottom selected lines.
            EditorGUI.DrawRect(new Rect(centerRect.xMin, centerRect.yMax - thickness, centerRect.width, thickness), color);

            // Draw Left Selected Lines
            if (blends.inKind == BlendKind.None)
            {
                EditorGUI.DrawRect(new Rect(centerRect.xMin, centerRect.yMin, thickness, centerRect.height), color);
            }
            else
            {
                var mixInRect = blends.inRect;

                if (blends.inKind == BlendKind.Ease)
                {
                    EditorGUI.DrawRect(new Rect(mixInRect.xMin, mixInRect.yMax - thickness, mixInRect.width, thickness), color);

                    EditorGUI.DrawRect(new Rect(mixInRect.xMin, mixInRect.yMin, thickness, mixInRect.height), color);

                    Graphics.DrawLineAA(2.0f * thickness, new Vector3(mixInRect.xMin, mixInRect.yMax - 1f, 0), new Vector3(mixInRect.xMax, mixInRect.yMin + 1f, 0), color);
                }
                else if (blends.inKind == BlendKind.Mix)
                {
                    EditorGUI.DrawRect(new Rect(mixInRect.xMin, mixInRect.yMin, mixInRect.width, thickness), color);

                    // If there's another clip in the left, draw the blend.
                    if (prevClip != null && SelectionManager.Contains(prevClip))
                    {
                        EditorGUI.DrawRect(new Rect(mixInRect.xMin, mixInRect.yMax - thickness, mixInRect.width, thickness), color); //  Bottom
                    }
                    Graphics.DrawLineAA(2.0f * thickness, new Vector3(mixInRect.xMin, mixInRect.yMin + 1f, 0), new Vector3(mixInRect.xMax, mixInRect.yMax - 1f, 0), color);
                }
            }

            // Draw Right Selected Lines
            if (blends.outKind == BlendKind.None)
            {
                EditorGUI.DrawRect(new Rect(centerRect.xMax - thickness, centerRect.yMin, thickness, centerRect.height), color);
            }
            else
            {
                var mixOutRect = blends.outRect;
                EditorGUI.DrawRect(new Rect(mixOutRect.xMin, mixOutRect.yMax - thickness, mixOutRect.width, thickness), color);

                if (blends.outKind == BlendKind.Ease)
                {
                    EditorGUI.DrawRect(new Rect(mixOutRect.xMax - thickness, mixOutRect.yMin, thickness, mixOutRect.height), color);
                }

                Graphics.DrawLineAA(2.0f * thickness, new Vector3(mixOutRect.xMin, mixOutRect.yMin + 1f, 0), new Vector3(mixOutRect.xMax, mixOutRect.yMax - 1f, 0), color);
            }
        }
Beispiel #3
0
        static void DrawClipBlendSelectionBorder(Rect clipRect, ClipBorder border, ClipBlends blends)
        {
            var color     = border.color;
            var thickness = border.thickness;

            if (blends.inKind == BlendKind.Mix)
            {
                DrawBlendLine(blends.inRect, BlendAngle.Descending, thickness, color);
                var xBottom1 = blends.inRect.xMin;
                var xBottom2 = blends.inRect.xMax;
                EditorGUI.DrawRect(new Rect(xBottom1, clipRect.max.y - thickness, xBottom2 - xBottom1, thickness), color);
            }
        }
Beispiel #4
0
        static void DrawBorderOfAddedRecordingClip(Rect trackRect, TrackAsset trackAsset, Vector2 visibleTime, WindowState state)
        {
            if (!state.IsArmedForRecord(trackAsset))
            {
                return;
            }

            AnimationTrack animTrack = trackAsset as AnimationTrack;

            if (animTrack == null || !animTrack.inClipMode)
            {
                return;
            }

            // make sure there is no clip but we can add one
            TimelineClip clip = null;

            if (trackAsset.FindRecordingClipAtTime(state.editSequence.time, out clip) || clip != null)
            {
                return;
            }

            float yMax = trackRect.yMax;
            float yMin = trackRect.yMin;

            double startGap = 0;
            double endGap   = 0;

            trackAsset.GetGapAtTime(state.editSequence.time, out startGap, out endGap);
            if (double.IsInfinity(endGap))
            {
                endGap = visibleTime.y;
            }

            if (startGap > visibleTime.y || endGap < visibleTime.x)
            {
                return;
            }


            startGap = Math.Max(startGap, visibleTime.x);
            endGap   = Math.Min(endGap, visibleTime.y);

            float xMin = state.TimeToPixel(startGap);
            float xMax = state.TimeToPixel(endGap);

            var r = Rect.MinMaxRect(xMin, yMin, xMax, yMax);

            ClipDrawer.DrawClipSelectionBorder(r, ClipBorder.Recording(), ClipBlends.kNone);
        }
Beispiel #5
0
        public static void DrawAnimationRecordBorder(ClipDrawData drawData)
        {
            if (!drawData.clip.parentTrack.IsRecordingToClip(drawData.clip))
            {
                return;
            }

            var time = TimelineWindow.instance.state.editSequence.time;

            if (time < drawData.clip.start + drawData.clip.mixInDuration || time > drawData.clip.end - drawData.clip.mixOutDuration)
            {
                return;
            }

            DrawClipSelectionBorder(drawData.clipCenterSection, ClipBorder.Recording(), ClipBlends.kNone);
        }
        public static void DrawSimpleClip(TimelineClip clip, Rect targetRect, ClipBorder border, Color overlay, ClipDrawOptions drawOptions, ClipBlends blends)
        {
            GUI.BeginClip(targetRect);

            var clipRect = new Rect(0.0f, 0.0f, targetRect.width, targetRect.height);

            var orgColor = GUI.color;

            GUI.color = overlay;

            DrawClipBackground(clipRect, ClipBlends.kNone, false);
            GUI.color = orgColor;

            if (clipRect.width <= k_MinClipWidth)
            {
                clipRect.width = k_MinClipWidth;
            }

            DrawClipEdges(clipRect, drawOptions.highlightColor * overlay, s_InlineLightColor * overlay, s_InlineShadowColor * overlay,
                          blends.inKind != BlendKind.Mix, blends.outKind != BlendKind.Mix);

            DrawClipTimescale(clipRect, clip.timeScale);

            if (targetRect.width >= k_ClipInOutMinWidth)
            {
                DrawClipInOut(clipRect, clip);
            }

            var textRect = clipRect;

            textRect.xMin += k_ClipLabelPadding;
            textRect.xMax -= k_ClipLabelPadding;

            if (textRect.width > k_ClipLabelMinWidth)
            {
                DrawClipLabel(clip.displayName, textRect, Color.white, drawOptions.errorText);
            }

            if (border != null)
            {
                DrawBorder(clipRect, border, ClipBlends.kNone);
            }

            GUI.EndClip();
        }
        public static void DrawAnimationRecordBorder(ClipDrawData drawData)
        {
            if (!drawData.clip.GetParentTrack().IsRecordingToClip(drawData.clip))
            {
                return;
            }

            var time  = new DiscreteTime(TimelineWindow.instance.state.editSequence.time);
            var start = new DiscreteTime(drawData.clip.start + drawData.clip.mixInDuration);
            var end   = new DiscreteTime(drawData.clip.end - drawData.clip.mixOutDuration);

            if (time < start || time >= end)
            {
                return;
            }

            DrawClipSelectionBorder(drawData.clipCenterSection, ClipBorder.Recording(), ClipBlends.kNone);
        }
        static void DrawClipBorder(ClipDrawData drawData)
        {
            ClipBorder border    = null;
            var        animTrack = drawData.clip.parentTrack as AnimationTrack;

            if (TimelineWindow.instance.state.recording && animTrack == null && drawData.clip.parentTrack.IsRecordingToClip(drawData.clip))
            {
                border = ClipBorder.kRecording;
            }
            else if (drawData.selected)
            {
                border = ClipBorder.kSelection;
            }

            if (border != null)
            {
                DrawBorder(drawData.clipCenterSection, border, drawData.clipBlends, drawData.previousClip);
            }
        }
Beispiel #9
0
        public static void DrawSimpleClip(TimelineClip clip, Rect targetRect, ClipBorder border, Color overlay, ClipDrawOptions drawOptions)
        {
            GUI.BeginClip(targetRect);
            var clipRect = new Rect(0.0f, 0.0f, targetRect.width, targetRect.height);

            var orgColor = GUI.color;

            GUI.color = overlay;

            DrawClipBackground(clipRect, false);
            GUI.color = orgColor;

            if (clipRect.width <= k_MinClipWidth)
            {
                clipRect.width = k_MinClipWidth;
            }

            DrawClipSwatch(targetRect, drawOptions.highlightColor * overlay);

            if (targetRect.width >= k_ClipInOutMinWidth)
            {
                DrawClipInOut(clipRect, clip);
            }

            var textRect = clipRect;

            textRect.xMin += k_ClipLabelPadding;
            textRect.xMax -= k_ClipLabelPadding;

            if (textRect.width > k_ClipLabelMinWidth)
            {
                DrawClipLabel(clip.displayName, textRect, Color.white, drawOptions.errorText);
            }

            if (border != null)
            {
                DrawClipSelectionBorder(clipRect, border, ClipBlends.kNone);
            }

            GUI.EndClip();
        }
        public static void DrawClipSelectionBorder(Rect clipRect, ClipBorder border, ClipBlends blends)
        {
            var thickness = border.thickness;
            var color     = border.color;
            var min       = clipRect.min;
            var max       = clipRect.max;

            //Left line
            if (blends.inKind == BlendKind.None)
            {
                EditorGUI.DrawRect(new Rect(min.x, min.y, thickness, max.y - min.y), color);
            }
            else
            {
                DrawBlendLine(blends.inRect, blends.inKind == BlendKind.Mix ? BlendAngle.Descending : BlendAngle.Ascending, thickness, color);
            }

            //Right line
            if (blends.outKind == BlendKind.None)
            {
                EditorGUI.DrawRect(new Rect(max.x - thickness, min.y, thickness, max.y - min.y), color);
            }
            else
            {
                DrawBlendLine(blends.outRect, BlendAngle.Descending, thickness, color);
            }

            //Top line
            var xTop1 = blends.inKind == BlendKind.Mix ? blends.inRect.xMin : min.x;
            var xTop2 = max.x;

            EditorGUI.DrawRect(new Rect(xTop1, min.y, xTop2 - xTop1, thickness), color);

            //Bottom line
            var xBottom1 = blends.inKind == BlendKind.Ease ? blends.inRect.xMin : min.x;
            var xBottom2 = blends.outKind == BlendKind.None ? max.x : blends.outRect.xMax;

            EditorGUI.DrawRect(new Rect(xBottom1, max.y - thickness, xBottom2 - xBottom1, thickness), color);
        }
Beispiel #11
0
        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 DrawClipDefaultBorder(Rect clipRect, ClipBorder border, ClipBlends blends)
        {
            var color     = border.color;
            var thickness = border.thickness;

            // Draw vertical lines at the edges of the clip
            EditorGUI.DrawRect(new Rect(clipRect.xMin, clipRect.y, thickness, clipRect.height), color); //left
            //only draw the right one when no out mix blend
            if (blends.outKind != BlendKind.Mix)
            {
                EditorGUI.DrawRect(new Rect(clipRect.xMax - thickness, clipRect.y, thickness, clipRect.height), color); //right
            }
            //draw a vertical line for the previous clip
            if (blends.inKind == BlendKind.Mix)
            {
                EditorGUI.DrawRect(new Rect(blends.inRect.xMin, blends.inRect.y, thickness, blends.inRect.height), color); //left
            }
            //Draw blend line
            if (blends.inKind == BlendKind.Mix)
            {
                DrawBlendLine(blends.inRect, BlendAngle.Descending, thickness, color);
            }
        }
Beispiel #13
0
        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 void DrawGhostClip(Rect targetRect)
 {
     DrawSimpleClip(targetRect, ClipBorder.Selection(), new Color(1.0f, 1.0f, 1.0f, 0.5f));
 }
 public static void DrawSimpleClip(TimelineClipGUI clip, Rect targetRect, ClipBorder border, Color overlay, ClipDrawing drawing)
 {
     ClipDrawer.DrawSimpleClip(clip.clip, targetRect, border, overlay, drawing, BlendsFromGUI(clip));
 }
 public void DrawInvalidClip(Rect targetRect)
 {
     DrawSimpleClip(targetRect, ClipBorder.Selection(), DirectorStyles.Instance.customSkin.colorInvalidClipOverlay);
 }