[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [20246] branches/blender2.5/blender/source /blender/editors: Graph Editor: Attempts at Improving Curve Drawing

Joshua Leung aligorith at gmail.com
Mon May 18 04:23:21 CEST 2009


Revision: 20246
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=20246
Author:   aligorith
Date:     2009-05-18 04:23:20 +0200 (Mon, 18 May 2009)

Log Message:
-----------
Graph Editor: Attempts at Improving Curve Drawing

* 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.

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/editors/animation/anim_ipo_utils.c
    branches/blender2.5/blender/source/blender/editors/space_graph/graph_draw.c
    branches/blender2.5/blender/source/blender/editors/space_graph/graph_select.c

Modified: branches/blender2.5/blender/source/blender/editors/animation/anim_ipo_utils.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/animation/anim_ipo_utils.c	2009-05-17 21:50:31 UTC (rev 20245)
+++ branches/blender2.5/blender/source/blender/editors/animation/anim_ipo_utils.c	2009-05-18 02:23:20 UTC (rev 20246)
@@ -242,15 +242,18 @@
 	 * 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); 
 }

Modified: branches/blender2.5/blender/source/blender/editors/space_graph/graph_draw.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_graph/graph_draw.c	2009-05-17 21:50:31 UTC (rev 20245)
+++ branches/blender2.5/blender/source/blender/editors/space_graph/graph_draw.c	2009-05-18 02:23:20 UTC (rev 20246)
@@ -782,11 +782,20 @@
 	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 @@
 				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 */

Modified: branches/blender2.5/blender/source/blender/editors/space_graph/graph_select.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_graph/graph_select.c	2009-05-17 21:50:31 UTC (rev 20245)
+++ branches/blender2.5/blender/source/blender/editors/space_graph/graph_select.c	2009-05-18 02:23:20 UTC (rev 20246)
@@ -141,7 +141,9 @@
 		/* 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;
 	}
 	





More information about the Bf-blender-cvs mailing list