Explorar o código

Curve drawing now uses a different color for each curve

BearishSun %!s(int64=9) %!d(string=hai) anos
pai
achega
582649ad3d
Modificáronse 1 ficheiros con 12 adicións e 4 borrados
  1. 12 4
      Source/MBansheeEditor/Windows/Animation/GUICurveDrawing.cs

+ 12 - 4
Source/MBansheeEditor/Windows/Animation/GUICurveDrawing.cs

@@ -163,12 +163,12 @@ namespace BansheeEditor
             // Draw center line
             DrawCenterLine();
 
-            // TODO - Draw horizontal value markers with text
-
+            int idx = 0;
             foreach (var curve in curves)
             {
-                // TODO - Pick unique color for each curve
-                DrawCurve(curve, Color.Red);
+                Color color = GetUniqueColor(idx);
+                DrawCurve(curve, color);
+                idx++;
             }
 
             // Draw selected frame marker
@@ -176,6 +176,14 @@ namespace BansheeEditor
                 DrawFrameMarker(markedFrameIdx * timePerFrame, Color.Red);
         }
 
+        private Color GetUniqueColor(int idx)
+        {
+            const int COLOR_SPACING = 359 / 15;
+
+            float hue = ((idx * COLOR_SPACING) % 359) / 359.0f;
+            return Color.HSV2RGB(new Color(hue, 175.0f / 255.0f, 175.0f / 255.0f));
+        }
+
         private void DrawCurve(EdAnimationCurve curve, Color color)
         {
             float lengthPerPixel = xRange/drawableWidth;