Graph Editor: Attempts at Improving Curve Drawing
authorJoshua Leung <aligorith@gmail.com>
Mon, 18 May 2009 02:23:20 +0000 (02:23 +0000)
committerJoshua Leung <aligorith@gmail.com>
Mon, 18 May 2009 02:23:20 +0000 (02:23 +0000)
* Trying a slightly different approach with curve drawing. Now curves aren't drawn darker down the list, as that approach proved to have massive contrast issues all around. However, it's not completely back to the old rainbow style, as the colours are still grouped in 3's and 4's, only that they now use hue offsets...

* Unselected curves are now drawn less opaque. However, selected curves still leave some brightness to be desired...

* Bugfix - Deselecting keyframes in graph view now deselects the curves too.

source/blender/editors/animation/anim_ipo_utils.c
source/blender/editors/space_graph/graph_draw.c
source/blender/editors/space_graph/graph_select.c

index 14780ebb7942e1c38aa70c53f3b163005b89df39..c2a1199f6c69029b58c624c2800e07292642da2a 100644 (file)
@@ -242,14 +242,17 @@ void ipo_rainbow (int cur, int tot, float *out)
         * with some other stuff 
         */
        fac = ((float)cur / (float)tot) * 0.7f;
-       val = 1.0f - fac;
        
        /* the base color can get offset a bit so that the colors aren't so identical */
        hue += fac * HSV_BANDWIDTH; 
        if (hue > 1.0f) hue= fmod(hue, 1.0f);
        
-       /* saturation fluctuates between 0.5 and 1.0 */
-       sat = ((cur / grouping) % 2) ? 0.61f : 0.96f;
+       /* saturation adjustments for more visible range */
+       if ((hue > 0.5f) && (hue < 0.8f)) sat= 0.5f;
+       else sat= 0.6f;
+       
+       /* value is fixed at 1.0f, otherwise we cannot clearly see the curves... */
+       val= 1.0f;
        
        /* finally, conver this to RGB colors */
        hsv_to_rgb(hue, sat, val, out, out+1, out+2); 
index e3a6d5023326d302a8805f1f6fd7032f29d3ed45..f6d9406e7da13aedc921f1e4a9acd2cd4fc43aa9 100644 (file)
@@ -782,11 +782,20 @@ static short fcurve_needs_draw_fmodifier_controls (FCurve *fcu, FModifier *fcm)
        if (fcu->modifiers.first == NULL) 
                return 0;
        
-       /* if there's an active modifier - don't draw if it is cycles modifier, since
-        * that basically still shows the original points
+       /* if there's an active modifier - don't draw if it doesn't drastically
+        * alter the curve...
         */
-       if ((fcm) && (fcm->type == FMODIFIER_TYPE_CYCLES))
-               return 0;
+       if (fcm) {
+               switch (fcm->type) {
+                       /* clearly harmless */
+                       case FMODIFIER_TYPE_CYCLES:
+                               return 0;
+                               
+                       /* borderline... */
+                       case FMODIFIER_TYPE_NOISE:
+                               return 0;
+               }
+       }
        
        /* if only one modifier - don't draw if it is muted or disabled */
        if (fcu->modifiers.first == fcu->modifiers.last) {
@@ -853,8 +862,10 @@ void graph_draw_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGri
                                UI_ThemeColorShade(TH_HEADER, 50);
                        }
                        else {
-                               /* set whatever color the curve has set */
-                               glColor3fv(fcu->color);
+                               /* set whatever color the curve has set 
+                                *      - unselected curves draw less opaque to help distinguish the selected ones
+                                */
+                               glColor4f(fcu->color[0], fcu->color[1], fcu->color[2], ((sel) ? 1.0f : 0.5f));
                        }
                        
                        /* anti-aliased lines for less jagged appearance */
index 27009ab56a43ecb80d5870054575834653c002b4..bb923ca6f95bcb0886e0287f46214823a4f815d2 100644 (file)
@@ -141,7 +141,9 @@ static void deselect_graph_keys (bAnimContext *ac, short test, short sel)
                /* Keyframes First */
                ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, NULL, sel_cb, NULL);
                
-               /* deactivate the F-Curve */
+               /* deactivate the F-Curve, and deselect if deselecting keyframes */
+               if (sel == SELECT_SUBTRACT) 
+                       fcu->flag &= ~FCURVE_SELECTED;
                fcu->flag &= ~FCURVE_ACTIVE;
        }