예제 #1
0
        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);
        }
 public static void DrawSimpleClip(TimelineClipGUI clip, Rect targetRect, ClipBorder border, Color overlay, ClipDrawing drawing)
 {
     ClipDrawer.DrawSimpleClip(clip.clip, targetRect, border, overlay, drawing, BlendsFromGUI(clip));
 }
예제 #3
0
        public static void DrawSimpleClip(TimelineClip clip, Rect targetRect, ClipBorder border, Color overlay, ClipDrawing drawing, 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, drawing.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, drawing.errorText);
            }

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

            GUI.EndClip();
        }