瀏覽代碼

Curve drawing now uses a different color for each curve

BearishSun 9 年之前
父節點
當前提交
582649ad3d
共有 1 個文件被更改,包括 12 次插入4 次删除
  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
             // Draw center line
             DrawCenterLine();
             DrawCenterLine();
 
 
-            // TODO - Draw horizontal value markers with text
-
+            int idx = 0;
             foreach (var curve in curves)
             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
             // Draw selected frame marker
@@ -176,6 +176,14 @@ namespace BansheeEditor
                 DrawFrameMarker(markedFrameIdx * timePerFrame, Color.Red);
                 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)
         private void DrawCurve(EdAnimationCurve curve, Color color)
         {
         {
             float lengthPerPixel = xRange/drawableWidth;
             float lengthPerPixel = xRange/drawableWidth;