Ejemplo n.º 1
0
 private void DrawDefaultClip(TrackDrawer.ClipDrawData drawData)
 {
     if (drawData.targetRect.get_width() < TrackDrawer.k_MinClipWidth)
     {
         drawData.targetRect.set_width(TrackDrawer.k_MinClipWidth);
         drawData.clipCenterSection.set_width(TrackDrawer.k_MinClipWidth);
         this.DrawClipBody(drawData, false);
         TrackDrawer.DrawClipSelected(drawData);
         this.DrawClipText(drawData.title, drawData.targetRect, 1);
     }
     else
     {
         this.DrawClipBody(drawData, true);
         TrackDrawer.DrawClipSelected(drawData);
         TrackDrawer.DrawClipRecorded(drawData);
         TrackDrawer.DrawClipTimescale(drawData);
         TrackDrawer.DrawClipInOut(drawData);
         Rect clipCenterSection = drawData.clipCenterSection;
         if (clipCenterSection.get_width() < 20f)
         {
             if (drawData.targetRect.get_width() > 20f)
             {
                 this.DrawClipText(drawData.title, clipCenterSection, 1);
             }
         }
         else
         {
             TrackDrawer.DrawLoops(drawData, clipCenterSection);
             this.DrawClipText(drawData.title, clipCenterSection, 1);
         }
     }
 }
Ejemplo n.º 2
0
 private static void DrawClipSelected(TrackDrawer.ClipDrawData drawData)
 {
     if (SelectionManager.Contains(drawData.uiClip.clip))
     {
         Rect rect = drawData.clipCenterSection;
         TrackDrawer.DrawBorder(drawData, Color.get_white());
         if (drawData.uiClip.blendInKind == TimelineClipGUI.BlendKind.Ease)
         {
             rect = drawData.uiClip.mixInRect;
             rect.set_position(Vector2.get_zero());
             EditorGUI.DrawRect(new Rect(rect.get_xMin(), rect.get_yMax() - 2f, rect.get_width(), 2f), Color.get_white());
         }
         if (drawData.uiClip.blendInKind == TimelineClipGUI.BlendKind.Mix)
         {
             rect = drawData.uiClip.mixInRect;
             rect.set_position(Vector2.get_zero());
             EditorGUI.DrawRect(new Rect(rect.get_xMin(), rect.get_yMin(), rect.get_width(), 2f), Color.get_white());
             Graphics.DrawLineAA(4f, new Vector3(rect.get_xMin(), rect.get_yMin(), 0f), new Vector3(rect.get_xMax(), rect.get_yMax() - 1f, 0f), Color.get_white());
             if (drawData.uiClip.previousClip != null && SelectionManager.Contains(drawData.uiClip.previousClip.clip))
             {
                 EditorGUI.DrawRect(new Rect(rect.get_xMin(), rect.get_yMax() - 2f, rect.get_width(), 2f), Color.get_white());
                 EditorGUI.DrawRect(new Rect(rect.get_xMax() - 2f, rect.get_yMin(), 2f, rect.get_height()), Color.get_white());
                 EditorGUI.DrawRect(new Rect(rect.get_xMin(), rect.get_yMin(), 2f, rect.get_height()), Color.get_white());
             }
         }
         if (drawData.uiClip.blendOutKind == TimelineClipGUI.BlendKind.Ease || drawData.uiClip.blendOutKind == TimelineClipGUI.BlendKind.Mix)
         {
             rect = drawData.uiClip.mixOutRect;
             rect.set_x(drawData.targetRect.get_xMax() - rect.get_width());
             rect.set_y(0f);
             EditorGUI.DrawRect(new Rect(rect.get_xMin(), rect.get_yMax() - 2f, rect.get_width(), 2f), Color.get_white());
             Graphics.DrawLineAA(4f, new Vector3(rect.get_xMin(), rect.get_yMin(), 0f), new Vector3(rect.get_xMax(), rect.get_yMax() - 1f, 0f), Color.get_white());
         }
     }
 }
Ejemplo n.º 3
0
        private void DrawClipBody(TrackDrawer.ClipDrawData drawData, bool drawCustomBody)
        {
            DirectorStyles instance           = DirectorStyles.Instance;
            Color          colorClipHighlight = instance.customSkin.colorClipHighlight;
            Color          colorClipShadow    = instance.customSkin.colorClipShadow;
            GUIStyle       gUIStyle           = instance.timelineClip;

            if (drawData.selected)
            {
                gUIStyle = instance.timelineClipSelected;
            }
            GUI.Box(drawData.clipCenterSection, GUIContent.none, gUIStyle);
            if (drawCustomBody)
            {
                Rect clippedRect = drawData.clippedRect;
                clippedRect.set_yMin(clippedRect.get_yMin() + 2f);
                clippedRect.set_yMax(clippedRect.get_yMax() - TrackDrawer.k_ClipColoredLineThickness);
                this.DrawCustomClipBody(drawData, clippedRect);
            }
            Rect targetRect = drawData.targetRect;

            targetRect.set_yMin(targetRect.get_yMax() - TrackDrawer.k_ClipColoredLineThickness);
            Color clipBaseColor = this.GetClipBaseColor(drawData.clip);

            EditorGUI.DrawRect(targetRect, clipBaseColor);
            EditorGUI.DrawRect(new Rect(drawData.targetRect.get_xMin(), drawData.targetRect.get_yMin(), drawData.targetRect.get_width() - 2f, 2f), colorClipHighlight);
            EditorGUI.DrawRect(new Rect(drawData.targetRect.get_xMin(), drawData.targetRect.get_yMin() + 2f, 2f, drawData.targetRect.get_height()), colorClipHighlight);
            EditorGUI.DrawRect(new Rect(drawData.targetRect.get_xMax() - 2f, drawData.targetRect.get_yMin(), 2f, drawData.targetRect.get_height()), colorClipShadow);
            EditorGUI.DrawRect(new Rect(drawData.targetRect.get_xMin(), drawData.targetRect.get_yMax() - 2f, drawData.targetRect.get_width(), 2f), colorClipShadow);
        }
Ejemplo n.º 4
0
 private static void DrawClipRecorded(TrackDrawer.ClipDrawData drawData)
 {
     if (drawData.state.recording && drawData.clip.recordable && drawData.clip.parentTrack.IsRecordingToClip(drawData.clip))
     {
         TrackDrawer.DrawBorder(drawData, DirectorStyles.Instance.customSkin.colorRecordingClipOutline);
     }
 }
Ejemplo n.º 5
0
 private static void DrawLoops(TrackDrawer.ClipDrawData drawData, Rect containerRect)
 {
     if (drawData.selected || drawData.inlineCurvesSelected)
     {
         Color color = GUI.get_color();
         GUI.set_color(Color.get_white());
         int num = drawData.uiClip.minLoopIndex;
         for (int i = 0; i < drawData.uiClip.loopRects.Count; i++)
         {
             Rect rect = drawData.uiClip.loopRects[i];
             rect.set_x(rect.get_x() - drawData.unclippedRect.get_x());
             rect.set_x(rect.get_x() + 1f);
             rect.set_width(rect.get_width() - 2f);
             rect.set_y(5f);
             rect.set_height(rect.get_height() - 4f);
             rect.set_xMin(rect.get_xMin() - 4f);
             if (rect.get_width() >= 10f)
             {
                 GUI.set_color(new Color(0f, 0f, 0f, 0.2f));
                 GUI.Box(rect, GUIContent.none, DirectorStyles.Instance.displayBackground);
             }
             if (rect.get_width() > 30f)
             {
                 GUI.set_color(Color.get_white());
                 Graphics.ShadowLabel(rect, (!drawData.uiClip.supportsLooping) ? TrackDrawer.k_HoldText : TrackDrawer.GetLoopString(num), DirectorStyles.Instance.fontClip, Color.get_white(), Color.get_black());
             }
             num++;
             if (!drawData.uiClip.supportsLooping)
             {
                 break;
             }
         }
         GUI.set_color(color);
     }
 }
Ejemplo n.º 6
0
        public override void DrawClip(TrackDrawer.ClipDrawData drawData)
        {
            TimelineClip clip = drawData.clip;

            if (clip.animationClip == null)
            {
                base.DrawClip(drawData);
            }
            else
            {
                bool flag = false;
                if (clip.asset != null)
                {
                    AnimationPlayableAsset animationPlayableAsset = clip.asset as AnimationPlayableAsset;
                    if (animationPlayableAsset != null)
                    {
                        flag = (animationPlayableAsset.clip == null);
                    }
                }
                if (flag)
                {
                    if (AnimationTrackDrawer.s_MissingIcon == null)
                    {
                        Texture2D errorIcon = EditorGUIUtility.get_errorIcon();
                        AnimationTrackDrawer.s_MissingIcon = new GUIContent(errorIcon, "This clip has no animation assigned");
                    }
                    base.DrawClipErrorIcon(drawData, AnimationTrackDrawer.s_MissingIcon);
                }
                base.DrawClip(drawData);
            }
        }
Ejemplo n.º 7
0
        protected void DrawClipErrorIcon(TrackDrawer.ClipDrawData clip, GUIContent content)
        {
            Rect  targetRect = clip.targetRect;
            float num        = Mathf.Min(targetRect.get_height() - 4f, (float)content.get_image().get_height());
            Rect  rect       = new Rect(targetRect.get_xMax() - 2f - (float)content.get_image().get_width(), targetRect.get_y() + (targetRect.get_height() - num) * 0.5f, (float)content.get_image().get_width(), num);

            GUI.Label(rect, content);
        }
Ejemplo n.º 8
0
 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);
     }
 }
Ejemplo n.º 9
0
        private static void DrawBorder(TrackDrawer.ClipDrawData drawData, Color color)
        {
            Rect clipCenterSection = drawData.clipCenterSection;

            EditorGUI.DrawRect(new Rect(clipCenterSection.get_xMin(), clipCenterSection.get_yMin(), clipCenterSection.get_width(), 2f), color);
            EditorGUI.DrawRect(new Rect(clipCenterSection.get_xMin(), clipCenterSection.get_yMax() - 2f, clipCenterSection.get_width(), 2f), color);
            if (drawData.uiClip.mixInRect.get_width() < 1f)
            {
                EditorGUI.DrawRect(new Rect(clipCenterSection.get_xMin(), clipCenterSection.get_yMin(), 2f, clipCenterSection.get_height()), color);
            }
            if (drawData.uiClip.mixOutRect.get_width() < 1f)
            {
                EditorGUI.DrawRect(new Rect(clipCenterSection.get_xMax() - 2f, clipCenterSection.get_yMin(), 2f, clipCenterSection.get_height()), color);
            }
        }
Ejemplo n.º 10
0
 private static void DrawClipInOut(TrackDrawer.ClipDrawData drawData)
 {
     if (drawData.clip.duration > drawData.clip.clipAssetDuration)
     {
         GUIStyle clipOut    = DirectorStyles.Instance.clipOut;
         Rect     targetRect = drawData.targetRect;
         targetRect.set_xMin(targetRect.get_xMax() - clipOut.get_fixedWidth() - 2f);
         targetRect.set_width(clipOut.get_fixedWidth());
         targetRect.set_yMin(targetRect.get_yMin() + (targetRect.get_height() - clipOut.get_fixedHeight()) / 2f);
         targetRect.set_height(clipOut.get_fixedHeight());
         GUI.Box(targetRect, GUIContent.none, clipOut);
     }
     if (drawData.clip.clipIn > 0.0)
     {
         GUIStyle clipIn      = DirectorStyles.Instance.clipIn;
         Rect     targetRect2 = drawData.targetRect;
         targetRect2.set_xMin(clipIn.get_fixedWidth());
         targetRect2.set_width(clipIn.get_fixedWidth());
         targetRect2.set_yMin(targetRect2.get_yMin() + (targetRect2.get_height() - clipIn.get_fixedHeight()) / 2f);
         targetRect2.set_height(clipIn.get_fixedHeight());
         GUI.Box(targetRect2, GUIContent.none, clipIn);
     }
 }
Ejemplo n.º 11
0
 public virtual void DrawClip(TrackDrawer.ClipDrawData drawData)
 {
     this.DrawDefaultClip(drawData);
 }
Ejemplo n.º 12
0
 protected virtual void DrawCustomClipBody(TrackDrawer.ClipDrawData drawData, Rect centerRect)
 {
 }
Ejemplo n.º 13
0
 private bool HasErrors(TrackDrawer.ClipDrawData drawData)
 {
     return(drawData.clip.asset == null);
 }