Răsfoiți Sursa

Better names, and documentation for the AnimationEditor components

BearishSun 9 ani în urmă
părinte
comite
a89a11ae21

+ 2 - 2
Source/MBansheeEditor/MBansheeEditor.csproj

@@ -52,8 +52,8 @@
     <Compile Include="Windows\Animation\GUICurveDrawing.cs" />
     <Compile Include="Windows\Animation\GUIFieldSelector.cs" />
     <Compile Include="Windows\Animation\GUIGraphValues.cs" />
-    <Compile Include="Windows\Animation\GUITicks.cs" />
-    <Compile Include="Windows\Animation\GUITimeline.cs" />
+    <Compile Include="Windows\Animation\GUIGraphTicks.cs" />
+    <Compile Include="Windows\Animation\GUIGraphTime.cs" />
     <Compile Include="Windows\BrowseDialog.cs" />
     <Compile Include="Windows\Build\BuildManager.cs" />
     <Compile Include="Windows\Build\BuildWindow.cs" />

+ 81 - 17
Source/MBansheeEditor/Windows/Animation/GUICurveDrawing.cs

@@ -10,7 +10,10 @@ namespace BansheeEditor
      *  @{
      */
 
-    // TODO DOC
+    /// <summary>
+    /// Draws one or multiple curves over the specified physical area. User can specify horizontal and vertical range to
+    /// display, as well as physical size of the GUI area.
+    /// </summary>
     internal class GUICurveDrawing
     {
         private const int LINE_SPLIT_WIDTH = 2;
@@ -27,20 +30,31 @@ namespace BansheeEditor
 
         private int drawableWidth;
         private GUICanvas canvas;
-        private GUITicks tickHandler;
-
+        private GUIGraphTicks tickHandler;
+
+        /// <summary>
+        /// Creates a new curve drawing GUI element.
+        /// </summary>
+        /// <param name="layout">Layout into which to add the GUI element.</param>
+        /// <param name="width">Width of the element in pixels.</param>
+        /// <param name="height">Height of the element in pixels.</param>
+        /// <param name="curves">Initial set of curves to display. </param>
         public GUICurveDrawing(GUILayout layout, int width, int height, EdAnimationCurve[] curves)
         {
             canvas = new GUICanvas();
             layout.AddElement(canvas);
 
-            tickHandler = new GUITicks(GUITickStepType.Time);
+            tickHandler = new GUIGraphTicks(GUITickStepType.Time);
 
             this.curves = curves;
 
             SetSize(width, height);
         }
 
+        /// <summary>
+        /// Change the set of curves to display.
+        /// </summary>
+        /// <param name="curves">New set of curves to draw on the GUI element.</param>
         public void SetCurves(EdAnimationCurve[] curves)
         {
             this.curves = curves;
@@ -48,6 +62,11 @@ namespace BansheeEditor
             Rebuild();
         }
 
+        /// <summary>
+        /// Change the physical size of the GUI element.
+        /// </summary>
+        /// <param name="width">Width of the element in pixels.</param>
+        /// <param name="height">Height of the element in pixels.</param>
         public void SetSize(int width, int height)
         {
             this.width = width;
@@ -56,13 +75,19 @@ namespace BansheeEditor
             canvas.SetWidth(width);
             canvas.SetHeight(height);
 
-            drawableWidth = Math.Max(0, width - GUITimeline.PADDING * 2);
+            drawableWidth = Math.Max(0, width - GUIGraphTime.PADDING * 2);
 
             tickHandler.SetRange(0.0f, xRange, drawableWidth);
 
             Rebuild();
         }
 
+        /// <summary>
+        /// Changes the visible range that the GUI element displays.
+        /// </summary>
+        /// <param name="xRange">Range of the horizontal area. Displayed area will range from [0, xRange].</param>
+        /// <param name="yRange">Range of the vertical area. Displayed area will range from 
+        ///                      [-yRange * 0.5, yRange * 0.5]</param>
         public void SetRange(float xRange, float yRange)
         {
             this.xRange = xRange;
@@ -73,6 +98,10 @@ namespace BansheeEditor
             Rebuild();
         }
 
+        /// <summary>
+        /// Number of frames per second, used for frame selection and marking.
+        /// </summary>
+        /// <param name="fps">Number of prames per second.</param>
         public void SetFPS(int fps)
         {
             this.fps = Math.Max(1, fps);
@@ -82,7 +111,10 @@ namespace BansheeEditor
             Rebuild();
         }
 
-        // Set to -1 to clear it
+        /// <summary>
+        /// Sets the frame at which to display the frame marker.
+        /// </summary>
+        /// <param name="frameIdx">Index of the frame to display the marker on, or -1 to clear the marker.</param>
         public void SetMarkedFrame(int frameIdx)
         {
             markedFrameIdx = frameIdx;
@@ -90,18 +122,25 @@ namespace BansheeEditor
             Rebuild();
         }
 
+        /// <summary>
+        /// Calculates the curve coordinates that are under the provided window coordinates.
+        /// </summary>
+        /// <param name="windowCoords">Coordinate relative to the window the GUI element is on.</param>
+        /// <param name="curveCoords">Curve coordinates within the range as specified by <see cref="SetRange"/>. Only
+        ///                           Valid when function returns true.</param>
+        /// <returns>True if the window coordinates were within the curve area, false otherwise.</returns>
         public bool GetCurveCoordinates(Vector2I windowCoords, out Vector2 curveCoords)
         {
             Rect2I bounds = canvas.Bounds;
 
-            if (windowCoords.x < (bounds.x + GUITimeline.PADDING) || windowCoords.x >= (bounds.x + bounds.width - GUITimeline.PADDING) ||
+            if (windowCoords.x < (bounds.x + GUIGraphTime.PADDING) || windowCoords.x >= (bounds.x + bounds.width - GUIGraphTime.PADDING) ||
                 windowCoords.y < bounds.y || windowCoords.y >= (bounds.y + bounds.height))
             {
                 curveCoords = new Vector2();
                 return false;
             }
 
-            Vector2I relativeCoords = windowCoords - new Vector2I(bounds.x + GUITimeline.PADDING, bounds.y);
+            Vector2I relativeCoords = windowCoords - new Vector2I(bounds.x + GUIGraphTime.PADDING, bounds.y);
 
             float lengthPerPixel = xRange / drawableWidth;
             float heightPerPixel = yRange / height;
@@ -115,9 +154,14 @@ namespace BansheeEditor
             return true;
         }
 
+        /// <summary>
+        /// Draws a vertical frame marker on the curve area.
+        /// </summary>
+        /// <param name="t">Time at which to draw the marker.</param>
+        /// <param name="color">Color with which to draw the marker.</param>
         private void DrawFrameMarker(float t, Color color)
         {
-            int xPos = (int)((t / GetRange()) * drawableWidth) + GUITimeline.PADDING;
+            int xPos = (int)((t / GetRange()) * drawableWidth) + GUIGraphTime.PADDING;
 
             Vector2I start = new Vector2I(xPos, 0);
             Vector2I end = new Vector2I(xPos, height);
@@ -125,6 +169,9 @@ namespace BansheeEditor
             canvas.DrawLine(start, end, color);
         }
 
+        /// <summary>
+        /// Draws a horizontal line representing the line at y = 0.
+        /// </summary>
         private void DrawCenterLine()
         {
             int heightOffset = height / 2; // So that y = 0 is at center of canvas
@@ -135,7 +182,10 @@ namespace BansheeEditor
             canvas.DrawLine(start, end, COLOR_DARK_GRAY);
         }
 
-        // Returns range rounded to the nearest multiple of FPS
+        /// <summary>
+        /// Returns the range of times displayed by the timeline rounded to the multiple of FPS.
+        /// </summary>
+        /// <returns>Time range rounded to a multiple of FPS.</returns>
         private float GetRange()
         {
             float spf = 1.0f / fps;
@@ -143,6 +193,9 @@ namespace BansheeEditor
             return ((int)xRange / spf) * spf;
         }
 
+        /// <summary>
+        /// Rebuilds the internal GUI elements. Should be called whenever timeline properties change.
+        /// </summary>
         private void Rebuild()
         {
             canvas.Clear();
@@ -160,7 +213,7 @@ namespace BansheeEditor
                 for (int j = 0; j < ticks.Length; j++)
                 {
                     Color color = COLOR_DARK_GRAY;
-                    color.a *= MathEx.Clamp01(strength);
+                    color.a *= strength;
 
                     DrawFrameMarker(ticks[j], color);
                 }
@@ -189,6 +242,12 @@ namespace BansheeEditor
             }
         }
 
+        /// <summary>
+        /// Generates a unique color based on the provided index.
+        /// </summary>
+        /// <param name="idx">Index to use for generating a color. Should be less than 30 in order to guarantee reasonably
+        /// different colors.</param>
+        /// <returns>Unique color.</returns>
         private Color GetUniqueColor(int idx)
         {
             const int COLOR_SPACING = 359 / 15;
@@ -197,6 +256,11 @@ namespace BansheeEditor
             return Color.HSV2RGB(new Color(hue, 175.0f / 255.0f, 175.0f / 255.0f));
         }
 
+        /// <summary>
+        /// Draws the curve using the provided color.
+        /// </summary>
+        /// <param name="curve">Curve to draw within the currently set range. </param>
+        /// <param name="color">Color to draw the curve with.</param>
         private void DrawCurve(EdAnimationCurve curve, Color color)
         {
             float lengthPerPixel = xRange/drawableWidth;
@@ -214,7 +278,7 @@ namespace BansheeEditor
                 int startPixel = (int)(start / lengthPerPixel);
 
                 int xPosStart = 0;
-                int xPosEnd = GUITimeline.PADDING + startPixel;
+                int xPosEnd = GUIGraphTime.PADDING + startPixel;
 
                 int yPos = (int)(curve.Native.Evaluate(0.0f, false) * pixelsPerHeight);
                 yPos = heightOffset - yPos; // Offset and flip height (canvas Y goes down)
@@ -247,16 +311,16 @@ namespace BansheeEditor
                     int yPosStart = (int)(curve.Native.Evaluate(start, false) * pixelsPerHeight);
                     yPosStart = heightOffset - yPosStart; // Offset and flip height (canvas Y goes down)
 
-                    linePoints.Add(new Vector2I(GUITimeline.PADDING + xPos, yPosStart));
+                    linePoints.Add(new Vector2I(GUIGraphTime.PADDING + xPos, yPosStart));
 
                     xPos = endPixel;
-                    linePoints.Add(new Vector2I(GUITimeline.PADDING + xPos, yPosStart));
+                    linePoints.Add(new Vector2I(GUIGraphTime.PADDING + xPos, yPosStart));
 
                     // Line representing the step
                     int yPosEnd = (int)(curve.Native.Evaluate(end, false) * pixelsPerHeight);
                     yPosEnd = heightOffset - yPosEnd; // Offset and flip height (canvas Y goes down)
 
-                    linePoints.Add(new Vector2I(GUITimeline.PADDING + xPos, yPosEnd));
+                    linePoints.Add(new Vector2I(GUIGraphTime.PADDING + xPos, yPosEnd));
                 }
                 else // Draw normally
                 {
@@ -288,7 +352,7 @@ namespace BansheeEditor
                         int yPos = (int)(curve.Native.Evaluate(t, false) * pixelsPerHeight);
                         yPos = heightOffset - yPos; // Offset and flip height (canvas Y goes down)
 
-                        linePoints.Add(new Vector2I(GUITimeline.PADDING + xPos, yPos));
+                        linePoints.Add(new Vector2I(GUIGraphTime.PADDING + xPos, yPos));
                     }
                 }
             }
@@ -300,7 +364,7 @@ namespace BansheeEditor
                 float end = MathEx.Clamp(keyframes[keyframes.Length - 1].time, 0.0f, xRange);
                 int endPixel = (int)(end / lengthPerPixel);
 
-                int xPosStart = GUITimeline.PADDING + endPixel;
+                int xPosStart = GUIGraphTime.PADDING + endPixel;
                 int xPosEnd = width;
 
                 int yPos = (int)(curve.Native.Evaluate(xRange, false) * pixelsPerHeight);

+ 58 - 4
Source/MBansheeEditor/Windows/Animation/GUITicks.cs → Source/MBansheeEditor/Windows/Animation/GUIGraphTicks.cs

@@ -9,14 +9,28 @@ namespace BansheeEditor
      *  @{
      */
 
+    /// <summary>
+    /// Determines how should ticks reported by <see cref="GUIGraphTicks"/> be distributed. 
+    /// </summary>
     internal enum GUITickStepType
     {
+        /// <summary>
+        /// Ticks represent time values (Multiples of 60).
+        /// </summary>
         Time,
+        /// <summary>
+        /// Ticks represent generic values (Multiples of 10).
+        /// </summary>
         Generic
     }
 
-    // TODO DOC
-    internal class GUITicks
+    /// <summary>
+    /// Generates a set of locations that can be used for rendering ticks on a graph. As input the class takes valid range,
+    /// size of the area the ticks will be displayed on, type of ticks and minimum/maximum spacing and outputs a set of
+    /// coordinates along which ticks should be positioned. Ticks are reported as multiple separate levels with different
+    /// strengths, depending on how close their distribution is to the upper valid range.
+    /// </summary>
+    internal class GUIGraphTicks
     {
         private int pixelRange = 100;
         private float valueRangeStart = 0.0f;
@@ -32,7 +46,11 @@ namespace BansheeEditor
 
         public int NumLevels { get { return numLevels; } }
 
-        internal GUITicks(GUITickStepType stepType = GUITickStepType.Generic)
+        /// <summary>
+        /// Contructs a new tick generating object.
+        /// </summary>
+        /// <param name="stepType">Determines how will ticks be distributed.</param>
+        internal GUIGraphTicks(GUITickStepType stepType = GUITickStepType.Generic)
         {
             if(stepType == GUITickStepType.Generic)
                 SetGenericSteps();
@@ -42,6 +60,12 @@ namespace BansheeEditor
             Rebuild();
         }
 
+        /// <summary>
+        /// Sets the range which ticks are to be displayed for, and the range along which the ticks will be displayed.
+        /// </summary>
+        /// <param name="valueRangeStart">Start of the range the ticks are to display.</param>
+        /// <param name="valueRangeEnd">End of the range the ticks are to display.</param>
+        /// <param name="pixelRange">Width or height on which the ticks will be rendered. In pixels.</param>
         internal void SetRange(float valueRangeStart, float valueRangeEnd, int pixelRange)
         {
             this.valueRangeStart = valueRangeStart;
@@ -51,6 +75,12 @@ namespace BansheeEditor
             Rebuild();
         }
 
+        /// <summary>
+        /// Sets valid spacing between two ticks. Tick strength will be determined by how far away are they from either
+        /// end of this range.
+        /// </summary>
+        /// <param name="minPx">Minimum spacing between two ticks, in pixels.</param>
+        /// <param name="maxPx">Maximum spacing between two ticks, in pixels.</param>
         internal void SetTickSpacing(int minPx, int maxPx)
         {
             minTickSpacingPx = minPx;
@@ -59,14 +89,28 @@ namespace BansheeEditor
             Rebuild();
         }
 
+        /// <summary>
+        /// Returns the strength of a particular tick level. Levels are ordered in descending order of strength (level 0 is
+        /// the strongest).
+        /// </summary>
+        /// <param name="level">Level for which to retrieve the strength. Must not be larger than 
+        ///                     <see cref="NumLevels"/> - 1.</param>
+        /// <returns>Strength of the ticks at this level, in range [0, 1].</returns>
         internal float GetLevelStrength(int level)
         {
             if (level < 0 || level >= numLevels)
                 return 0.0f;
 
-            return levelStrengths[maxLevel + level];
+            return MathEx.Clamp01(levelStrengths[maxLevel + level]);
         }
 
+        /// <summary>
+        /// Returns positions of all ticks of the provided level. The ticks will be within the range provided to
+        /// <see cref="SetRange"/>.
+        /// </summary>
+        /// <param name="level">Level for which to retrieve the positions. Must not be larger than 
+        ///                     <see cref="NumLevels"/> - 1.</param>
+        /// <returns>Positions of all ticks of the provided level.</returns>
         internal float[] GetTicks(int level)
         {
             if (level < 0 || level >= numLevels)
@@ -89,6 +133,9 @@ namespace BansheeEditor
             return ticks;
         }
 
+        /// <summary>
+        /// Rebuilds the tick positions and strengths after some relevant parameter changes.
+        /// </summary>
         private void Rebuild()
         {
             levelStrengths = new float[validSteps.Length];
@@ -114,6 +161,10 @@ namespace BansheeEditor
                 numLevels = 0;
         }
 
+        /// <summary>
+        /// Sets tick steps corresponding to time values. This will split the ticks into intervals relevant for displaying
+        /// times.
+        /// </summary>
         private void SetTimeSteps()
         {
             validSteps = new float[]
@@ -124,6 +175,9 @@ namespace BansheeEditor
             };
         }
 
+        /// <summary>
+        /// Sets tick steps corresponding to generic values (as opposed to displaying time values).
+        /// </summary>
         private void SetGenericSteps()
         {
             float minStep = 0.0000001f;

+ 61 - 9
Source/MBansheeEditor/Windows/Animation/GUITimeline.cs → Source/MBansheeEditor/Windows/Animation/GUIGraphTime.cs

@@ -9,8 +9,11 @@ namespace BansheeEditor
      *  @{
      */
 
-    // TODO DOC
-    public class GUITimeline
+    /// <summary>
+    /// Renders a timeline that may be used as a header for a graph display. User can set the range of the times to display,
+    /// as well as its physical dimensions.
+    /// </summary>
+    public class GUIGraphTime
     {
         public const int PADDING = 30;
 
@@ -22,22 +25,33 @@ namespace BansheeEditor
         private float rangeLength = 60.0f;
 
         private GUICanvas canvas;
-        private GUITicks tickHandler;
+        private GUIGraphTicks tickHandler;
         private int width;
         private int height;
         private int fps = 1;
         private int markedFrameIdx = -1;
 
-        public GUITimeline(GUILayout layout, int width, int height)
+        /// <summary>
+        /// Constructs a new timeline and adds it to the specified layout.
+        /// </summary>
+        /// <param name="layout">Layout to add the timeline GUI to.</param>
+        /// <param name="width">Width of the timeline in pixels.</param>
+        /// <param name="height">Height of the timeline in pixels.</param>
+        public GUIGraphTime(GUILayout layout, int width, int height)
         {
             canvas = new GUICanvas();
             layout.AddElement(canvas);
 
-            tickHandler = new GUITicks(GUITickStepType.Time);
+            tickHandler = new GUIGraphTicks(GUITickStepType.Time);
 
             SetSize(width, height);
         }
 
+        /// <summary>
+        /// Uses the assigned FPS, range and physical size to calculate the frame that is under the provided coordinates.
+        /// </summary>
+        /// <param name="windowCoords">Coordinate relative to the window the GUI element is on.</param>
+        /// <returns>Frame that was clicked on, or -1 if the coordinates are outside of valid bounds. </returns>
         public int GetFrame(Vector2I windowCoords)
         {
             Rect2I bounds = canvas.Bounds;
@@ -56,7 +70,10 @@ namespace BansheeEditor
             return (int)(time * fps);
         }
 
-        // Set to -1 to clear it
+        /// <summary>
+        /// Sets the frame at which to display the frame marker.
+        /// </summary>
+        /// <param name="frameIdx">Index of the frame to display the marker on, or -1 to clear the marker.</param>
         public void SetMarkedFrame(int frameIdx)
         {
             markedFrameIdx = frameIdx;
@@ -64,6 +81,11 @@ namespace BansheeEditor
             Rebuild();
         }
 
+        /// <summary>
+        /// Sets the physical size onto which to draw the timeline.
+        /// </summary>
+        /// <param name="width">Width in pixels.</param>
+        /// <param name="height">Height in pixels.</param>
         public void SetSize(int width, int height)
         {
             this.width = width;
@@ -80,6 +102,10 @@ namespace BansheeEditor
             Rebuild();
         }
 
+        /// <summary>
+        /// Sets the range of values to display on the timeline.
+        /// </summary>
+        /// <param name="length">Amount of time to display, in seconds.</param>
         public void SetRange(float length)
         {
             rangeLength = Math.Max(0.0f, length);
@@ -89,6 +115,10 @@ namespace BansheeEditor
             Rebuild();
         }
 
+        /// <summary>
+        /// Number of frames per second, used for frame selection and marking.
+        /// </summary>
+        /// <param name="fps">Number of prames per second.</param>
         public void SetFPS(int fps)
         {
             this.fps = Math.Max(1, fps);
@@ -98,6 +128,12 @@ namespace BansheeEditor
             Rebuild();
         }
         
+        /// <summary>
+        /// Draws text displaying the time at the provided position.
+        /// </summary>
+        /// <param name="xPos">Position to draw the text at.</param>
+        /// <param name="seconds">Time to display, in seconds.</param>
+        /// <param name="minutes">If true the time will be displayed in minutes, otherwise in seconds.</param>
         private void DrawTime(int xPos, float seconds, bool minutes)
         {
             TimeSpan timeSpan = TimeSpan.FromSeconds(seconds);
@@ -119,12 +155,18 @@ namespace BansheeEditor
                 EditorStyles.DefaultFontSize);
         }
 
+        /// <summary>
+        /// Draws one tick of the timeline, at the specified time.
+        /// </summary>
+        /// <param name="t">Time at which to draw the tick.</param>
+        /// <param name="strength">Strength of the tick (determines size and color), in range [0, 1].</param>
+        /// <param name="drawText">If true the text displaying the time will be drawn above this tick.</param>
+        /// <param name="displayAsMinutes">Should the text drawn be displayed as minutes (if true), or seconds (false).
+        ///                                Ignored if no text is drawn.</param>
         private void DrawTick(float t, float strength, bool drawText, bool displayAsMinutes)
         {
             int xPos = (int)((t / GetRange()) * drawableWidth) + PADDING;
 
-            strength = MathEx.Clamp01(strength);
-
             // Draw tick
             Vector2I start = new Vector2I(xPos, height - (int)(tickHeight * strength));
             Vector2I end = new Vector2I(xPos, height);
@@ -139,6 +181,10 @@ namespace BansheeEditor
                 DrawTime(xPos, t, displayAsMinutes);
         }
 
+        /// <summary>
+        /// Draws a vertical frame marker at the specified time.
+        /// </summary>
+        /// <param name="t">Time at which to draw the marker.</param>
         private void DrawFrameMarker(float t)
         {
             int xPos = (int)((t / GetRange()) * drawableWidth) + PADDING;
@@ -149,7 +195,10 @@ namespace BansheeEditor
             canvas.DrawLine(start, end, Color.BansheeOrange);
         }
 
-        // Returns range rounded to the nearest multiple of FPS
+        /// <summary>
+        /// Returns the range of times displayed by the timeline rounded to the multiple of FPS.
+        /// </summary>
+        /// <returns>Time range rounded to a multiple of FPS.</returns>
         private float GetRange()
         {
             float spf = 1.0f/fps;
@@ -157,6 +206,9 @@ namespace BansheeEditor
             return ((int)rangeLength/spf) * spf;
         }
 
+        /// <summary>
+        /// Rebuilds the internal GUI elements. Should be called whenever timeline properties change.
+        /// </summary>
         private void Rebuild()
         {
             canvas.Clear();

+ 33 - 4
Source/MBansheeEditor/Windows/Animation/GUIGraphValues.cs

@@ -9,13 +9,16 @@ namespace BansheeEditor
      *  @{
      */
 
-    // TODO DOC
+    /// <summary>
+    /// Renders a vertical value display that may be used as a side-bar for a graph display. User can set the range of the
+    /// values to display, as well as its physical dimensions.
+    /// </summary>
     internal class GUIGraphValues
     {
         private static readonly Color COLOR_TRANSPARENT_LIGHT_GRAY = 
             new Color(200.0f / 255.0f, 200.0f / 255.0f, 200.0f / 255.0f, 0.5f);
 
-        private GUITicks tickHandler;
+        private GUIGraphTicks tickHandler;
         private GUICanvas canvas;
 
         private int width = 20;
@@ -23,16 +26,27 @@ namespace BansheeEditor
         private float rangeStart = -1.0f;
         private float rangeEnd = 1.0f;
 
+        /// <summary>
+        /// Constructs a new value display and adds it to the specified layout.
+        /// </summary>
+        /// <param name="layout">Layout to add the GUI element to.</param>
+        /// <param name="width">Width of the timeline in pixels.</param>
+        /// <param name="height">Height of the timeline in pixels.</param>
         public GUIGraphValues(GUILayout layout, int width, int height)
         {
             canvas = new GUICanvas();
             layout.AddElement(canvas);
 
-            tickHandler = new GUITicks();
+            tickHandler = new GUIGraphTicks();
 
             SetSize(width, height);
         }
 
+        /// <summary>
+        /// Sets the physical size onto which to draw the value display.
+        /// </summary>
+        /// <param name="width">Width in pixels.</param>
+        /// <param name="height">Height in pixels.</param>
         public void SetSize(int width, int height)
         {
             this.width = width;
@@ -46,6 +60,11 @@ namespace BansheeEditor
             Rebuild();
         }
 
+        /// <summary>
+        /// Sets the range of values to display.
+        /// </summary>
+        /// <param name="start">Minimum value to display.</param>
+        /// <param name="end">Maximum value to display.</param>
         public void SetRange(float start, float end)
         {
             if (start > end)
@@ -63,6 +82,13 @@ namespace BansheeEditor
             Rebuild();
         }
 
+        /// <summary>
+        /// Draws text displaying the time at the provided position.
+        /// </summary>
+        /// <param name="yPos">Position to draw the text at.</param>
+        /// <param name="seconds">Time to display, in seconds.</param>
+        /// <param name="minutes">If true the time will be displayed in minutes, otherwise in seconds.</param>
+        /// <param name="above">If true the text will be displayed above the provided position, otherwise below.</param>
         private void DrawTime(int yPos, float seconds, bool minutes, bool above)
         {
             TimeSpan timeSpan = TimeSpan.FromSeconds(seconds);
@@ -90,6 +116,9 @@ namespace BansheeEditor
                 EditorStyles.DefaultFontSize);
         }
 
+        /// <summary>
+        /// Rebuilds the internal GUI elements. Should be called whenever timeline properties change.
+        /// </summary>
         private void Rebuild()
         {
             canvas.Clear();
@@ -122,7 +151,7 @@ namespace BansheeEditor
                         Vector2I end = new Vector2I((int) (width*strength), yPos);
 
                         Color color = COLOR_TRANSPARENT_LIGHT_GRAY;
-                        color.a *= MathEx.Clamp01(strength);
+                        color.a *= strength;
 
                         canvas.DrawLine(start, end, color);
 

+ 2 - 2
Source/MBansheeEditor/Windows/AnimationWindow.cs

@@ -13,7 +13,7 @@ namespace BansheeEditor
     /// </summary>
     internal class AnimationWindow : EditorWindow
     {
-        private GUITimeline timeline;
+        private GUIGraphTime timeline;
         private GUICurveDrawing curveDrawing;
         private GUIGraphValues sidebar;
 
@@ -75,7 +75,7 @@ namespace BansheeEditor
             buttonLayout.AddElement(fpsField);
             buttonLayout.AddSpace(5);
 
-            timeline = new GUITimeline(mainLayout, Width, 20);
+            timeline = new GUIGraphTime(mainLayout, Width, 20);
 
             EdAnimationCurve[] curves = CreateDummyCurves();
             curveDrawing = new GUICurveDrawing(mainLayout, Width, Height - 20, curves);