private static void DrawClipTimescale(TrackDrawer.ClipDrawData drawData)
 {
     if (drawData.clip.timeScale != 1.0)
     {
         float   num            = 4f;
         float   num2           = 6f;
         float   segmentsLength = (drawData.clip.timeScale <= 1.0) ? 15f : 5f;
         Vector3 vector         = new Vector3(drawData.targetRect.get_min().x + num, drawData.targetRect.get_min().y + num2, 0f);
         Vector3 vector2        = new Vector3(drawData.targetRect.get_max().x - num, drawData.targetRect.get_min().y + num2, 0f);
         Graphics.DrawDottedLine(vector, vector2, segmentsLength, DirectorStyles.Instance.customSkin.colorClipFont);
         Graphics.DrawDottedLine(vector + new Vector3(0f, 1f, 0f), vector2 + new Vector3(0f, 1f, 0f), segmentsLength, DirectorStyles.Instance.customSkin.colorClipFont);
     }
 }
Example #2
0
        static void DrawClipTimescale(Rect targetRect, double timeScale)
        {
            if (timeScale != 1.0)
            {
                const float xOffset       = 4.0f;
                const float yOffset       = 6.0f;
                var         segmentLength = timeScale > 1.0f ? 5.0f : 15.0f;
                var         start         = new Vector3(targetRect.min.x + xOffset, targetRect.min.y + yOffset, 0.0f);
                var         end           = new Vector3(targetRect.max.x - xOffset, targetRect.min.y + yOffset, 0.0f);

                Graphics.DrawDottedLine(start, end, segmentLength, DirectorStyles.Instance.customSkin.colorClipFont);
                Graphics.DrawDottedLine(start + new Vector3(0.0f, 1.0f, 0.0f), end + new Vector3(0.0f, 1.0f, 0.0f), segmentLength, DirectorStyles.Instance.customSkin.colorClipFont);
            }
        }
        static void DrawClipTimescale(Rect targetRect, Rect clippedRect, double timeScale)
        {
            if (timeScale != 1.0)
            {
                const float xOffset       = 4.0f;
                const float yOffset       = 6.0f;
                var         segmentLength = timeScale > 1.0f ? 5.0f : 15.0f;

                // clamp to the visible region to reduce the line count (case 1213189), but adject the start segment to match the visuals of drawing targetRect
                var startX = clippedRect.min.x - ((clippedRect.min.x - targetRect.min.x) % (segmentLength * 2));
                var endX   = clippedRect.max.x;

                var start = new Vector3(startX + xOffset, targetRect.min.y + yOffset, 0.0f);
                var end   = new Vector3(endX - xOffset, targetRect.min.y + yOffset, 0.0f);

                Graphics.DrawDottedLine(start, end, segmentLength, DirectorStyles.Instance.customSkin.colorClipFont);
                Graphics.DrawDottedLine(start + new Vector3(0.0f, 1.0f, 0.0f), end + new Vector3(0.0f, 1.0f, 0.0f), segmentLength, DirectorStyles.Instance.customSkin.colorClipFont);
            }
        }
Example #4
0
        public void Draw(double beginTime, double endTime, MagnetEngine magnetEngine)
        {
            TimelineWindow.TimelineState state = TimelineWindow.instance.state;
            Rect timeAreaBounds = TimelineWindow.instance.timeAreaBounds;

            timeAreaBounds.set_xMin(Mathf.Max(TimelineWindow.instance.timeAreaBounds.get_xMin(), state.TimeToTimeAreaPixel(beginTime)));
            timeAreaBounds.set_xMax(state.TimeToTimeAreaPixel(endTime));
            Rect position = TimelineWindow.instance.get_position();

            using (new GUIViewportScope(TimelineWindow.instance.timeAreaBounds))
            {
                Color textColor = DirectorStyles.Instance.selectedStyle.get_focused().get_textColor();
                textColor.a = 0.12f;
                EditorGUI.DrawRect(timeAreaBounds, textColor);
                this.m_BeginSelectionTooltip.text = state.TimeAsString(beginTime, "F2");
                this.m_EndSelectionTooltip.text   = state.TimeAsString(endTime, "F2");
                Rect bounds = this.m_BeginSelectionTooltip.bounds;
                bounds.set_xMin(timeAreaBounds.get_xMin() - bounds.get_width() / 2f);
                bounds.set_y(timeAreaBounds.get_y());
                this.m_BeginSelectionTooltip.bounds = bounds;
                bounds = this.m_EndSelectionTooltip.bounds;
                bounds.set_xMin(timeAreaBounds.get_xMax() - bounds.get_width() / 2f);
                bounds.set_y(timeAreaBounds.get_y());
                this.m_EndSelectionTooltip.bounds = bounds;
                if (beginTime >= 0.0)
                {
                    this.m_BeginSelectionTooltip.Draw();
                }
                this.m_EndSelectionTooltip.Draw();
            }
            if (beginTime >= 0.0)
            {
                if (magnetEngine == null || !magnetEngine.IsSnappedAtTime((double)state.PixelToTime(timeAreaBounds.get_xMin())))
                {
                    Graphics.DrawDottedLine(new Vector3(timeAreaBounds.get_xMin(), timeAreaBounds.get_yMax(), 0f), new Vector3(timeAreaBounds.get_xMin(), timeAreaBounds.get_yMax() + position.get_height()), 4f, Color.get_black());
                }
                if (magnetEngine == null || !magnetEngine.IsSnappedAtTime((double)state.PixelToTime(timeAreaBounds.get_xMax())))
                {
                    Graphics.DrawDottedLine(new Vector3(timeAreaBounds.get_xMax(), timeAreaBounds.get_yMax(), 0f), new Vector3(timeAreaBounds.get_xMax(), timeAreaBounds.get_yMax() + position.get_height()), 4f, Color.get_black());
                }
            }
        }
        private bool DrawSelection(object target, Event e, TimelineWindow.TimelineState state)
        {
            bool result;

            if (!this.m_IsCaptured)
            {
                result = false;
            }
            else
            {
                Rect    rect    = this.CurrentSelectionRect();
                Vector3 vector  = rect.get_min();
                Vector3 vector2 = new Vector2(rect.get_xMax(), rect.get_yMin());
                Vector3 vector3 = rect.get_max();
                Vector3 vector4 = new Vector2(rect.get_xMin(), rect.get_yMax());
                Graphics.DrawDottedLine(vector, vector2, RectangleSelect.k_SegmentSize, DirectorStyles.Instance.customSkin.colorRectangleSelect);
                Graphics.DrawDottedLine(vector2, vector3, RectangleSelect.k_SegmentSize, DirectorStyles.Instance.customSkin.colorRectangleSelect);
                Graphics.DrawDottedLine(vector3, vector4, RectangleSelect.k_SegmentSize, DirectorStyles.Instance.customSkin.colorRectangleSelect);
                Graphics.DrawDottedLine(vector4, vector, RectangleSelect.k_SegmentSize, DirectorStyles.Instance.customSkin.colorRectangleSelect);
                result = true;
            }
            return(result);
        }
        public void Draw(Rect rect, TimelineWindow.TimelineState state, double time)
        {
            Vector2 min = rect.get_min();

            min.y += 4f;
            min.x  = state.TimeToPixel(time);
            TimeAreaItem.Alignment alignment = this.alignment;
            if (alignment != TimeAreaItem.Alignment.Center)
            {
                if (alignment != TimeAreaItem.Alignment.Left)
                {
                    if (alignment == TimeAreaItem.Alignment.Right)
                    {
                        this.m_BoundingRect = new Rect(min.x, min.y, this.widgetWidth, this.widgetHeight);
                    }
                }
                else
                {
                    this.m_BoundingRect = new Rect(min.x - this.widgetWidth, min.y, this.widgetWidth, this.widgetHeight);
                }
            }
            else
            {
                this.m_BoundingRect = new Rect(min.x - this.widgetWidth / 2f, min.y, this.widgetWidth, this.widgetHeight);
            }
            if (Event.get_current().get_type() == 7)
            {
                if (this.m_BoundingRect.get_xMax() < state.timeAreaRect.get_xMin())
                {
                    return;
                }
                if (this.m_BoundingRect.get_xMin() > state.timeAreaRect.get_xMax())
                {
                    return;
                }
            }
            float   num = state.timeAreaRect.get_yMax() - DirectorStyles.kDurationGuiThickness;
            Vector3 p   = new Vector3(min.x, num, 0f);
            Vector3 p2  = new Vector3(min.x, num + Mathf.Min(rect.get_height(), state.windowHeight), 0f);

            if (this.drawLine)
            {
                if (this.dottedLine)
                {
                    Graphics.DrawDottedLine(p, p2, 5f, this.lineColor);
                }
                else
                {
                    Rect rect2 = Rect.MinMaxRect(p.x - 0.5f, p.y, p2.x + 0.5f, p2.y);
                    EditorGUI.DrawRect(rect2, this.lineColor);
                }
            }
            if (this.drawHead)
            {
                Color color = GUI.get_color();
                GUI.set_color(this.headColor);
                GUI.Box(this.bounds, this.m_HeaderContent, this.m_Style);
                GUI.set_color(color);
                if (this.canMoveHead)
                {
                    EditorGUIUtility.AddCursorRect(this.bounds, 8);
                }
            }
            if (this.showTooltip)
            {
                this.m_Tooltip.text = state.TimeAsString(time, "F2");
                Vector2 position = this.bounds.get_position();
                position.y  = state.timeAreaRect.get_y();
                position.y -= this.m_Tooltip.bounds.get_height();
                position.x -= Mathf.Abs(this.m_Tooltip.bounds.get_width() - this.bounds.get_width()) / 2f;
                Rect bounds = this.bounds;
                bounds.set_position(position);
                this.m_Tooltip.bounds = bounds;
                this.m_Tooltip.Draw();
            }
        }