[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [33937] trunk/blender/source/blender/ editors: DopeSheet Drawing Tweak:

Joshua Leung aligorith at gmail.com
Wed Dec 29 13:52:06 CET 2010


Revision: 33937
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=33937
Author:   aligorith
Date:     2010-12-29 13:52:06 +0100 (Wed, 29 Dec 2010)

Log Message:
-----------
DopeSheet Drawing Tweak:

Keyframes for locked channels are now shown faintly so that it is
possible to easily distinguish between keyframes for locked channels
and unlocked channels. Hopefully this solves the problem where you
have some keyframes selected, and try to move them but forget that
those channels are locked (without any feedback other than a single
icon).

Thanks for pointing out this problem Ronan Zeegers!

Modified Paths:
--------------
    trunk/blender/source/blender/editors/animation/keyframes_draw.c
    trunk/blender/source/blender/editors/include/ED_keyframes_draw.h
    trunk/blender/source/blender/editors/space_nla/nla_draw.c

Modified: trunk/blender/source/blender/editors/animation/keyframes_draw.c
===================================================================
--- trunk/blender/source/blender/editors/animation/keyframes_draw.c	2010-12-29 12:27:03 UTC (rev 33936)
+++ trunk/blender/source/blender/editors/animation/keyframes_draw.c	2010-12-29 12:52:06 UTC (rev 33937)
@@ -392,7 +392,7 @@
 }; 
 
 /* draw a simple diamond shape with OpenGL */
-void draw_keyframe_shape (float x, float y, float xscale, float hsize, short sel, short key_type, short mode)
+void draw_keyframe_shape (float x, float y, float xscale, float hsize, short sel, short key_type, short mode, float alpha)
 {
 	static GLuint displist1=0;
 	static GLuint displist2=0;
@@ -441,23 +441,23 @@
 		switch (key_type) {
 			case BEZT_KEYTYPE_BREAKDOWN: /* bluish frames for now */
 			{
-				if (sel) glColor3f(0.33f, 0.75f, 0.93f);
-				else glColor3f(0.70f, 0.86f, 0.91f);
+				if (sel) glColor4f(0.33f, 0.75f, 0.93f, alpha);
+				else glColor4f(0.70f, 0.86f, 0.91f, alpha);
 			}
 				break;
 				
 			case BEZT_KEYTYPE_EXTREME: /* redish frames for now */
 			{
-				if (sel) glColor3f(95.0f, 0.5f, 0.5f);
-				else glColor3f(0.91f, 0.70f, 0.80f);
+				if (sel) glColor4f(95.0f, 0.5f, 0.5f, alpha);
+				else glColor4f(0.91f, 0.70f, 0.80f, alpha);
 			}
 				break;
 				
 			case BEZT_KEYTYPE_KEYFRAME: /* traditional yellowish frames for now */
 			default:
 			{
-				if (sel) UI_ThemeColorShade(TH_STRIP_SELECT, 50);
-				else glColor3f(0.91f, 0.91f, 0.91f);
+				if (sel) UI_ThemeColorShadeAlpha(TH_STRIP_SELECT, 50, -255*(1.0f-alpha));
+				else glColor4f(0.91f, 0.91f, 0.91f, alpha);
 			}
 				break;
 		}
@@ -467,7 +467,7 @@
 	
 	if ELEM(mode, KEYFRAME_SHAPE_FRAME, KEYFRAME_SHAPE_BOTH) {
 		/* exterior - black frame */
-		glColor3ub(0, 0, 0);
+		glColor4f(0.0f, 0.0f, 0.0f, alpha);
 		
 		glCallList(displist1);
 	}
@@ -479,7 +479,7 @@
 	glTranslatef(-x, -y, 0.0f);
 }
 
-static void draw_keylist(View2D *v2d, DLRBT_Tree *keys, DLRBT_Tree *blocks, float ypos)
+static void draw_keylist(View2D *v2d, DLRBT_Tree *keys, DLRBT_Tree *blocks, float ypos, short channelLocked)
 {
 	ActKeyColumn *ak;
 	ActKeyBlock *ab;
@@ -522,6 +522,10 @@
 	
 	/* draw keys */
 	if (keys) {
+		/* locked channels are less strongly shown, as feedback for locked channels in DopeSheet */
+		// TODO: allow this opacity factor to be themed?
+		float kalpha = (channelLocked)? 0.35f : 1.0f;
+		
 		for (ak= keys->first; ak; ak= ak->next) {
 			/* optimisation: if keyframe doesn't appear within 5 units (screenspace) in visible area, don't draw 
 			 *	- this might give some improvements, since we current have to flip between view/region matrices
@@ -532,7 +536,7 @@
 			/* draw using OpenGL - uglier but faster */
 			// NOTE1: a previous version of this didn't work nice for some intel cards
 			// NOTE2: if we wanted to go back to icons, these are  icon = (ak->sel & SELECT) ? ICON_SPACE2 : ICON_SPACE3;
-			draw_keyframe_shape(ak->cfra, ypos, xscale, 5.0f, (ak->sel & SELECT), ak->key_type, KEYFRAME_SHAPE_BOTH);
+			draw_keyframe_shape(ak->cfra, ypos, xscale, 5.0f, (ak->sel & SELECT), ak->key_type, KEYFRAME_SHAPE_BOTH, kalpha);
 		}	
 	}
 	
@@ -553,7 +557,7 @@
 	BLI_dlrbTree_linkedlist_sync(&keys);
 	BLI_dlrbTree_linkedlist_sync(&blocks);
 	
-		draw_keylist(v2d, &keys, &blocks, ypos);
+		draw_keylist(v2d, &keys, &blocks, ypos, 0);
 	
 	BLI_dlrbTree_free(&keys);
 	BLI_dlrbTree_free(&blocks);
@@ -571,7 +575,7 @@
 	BLI_dlrbTree_linkedlist_sync(&keys);
 	BLI_dlrbTree_linkedlist_sync(&blocks);
 	
-		draw_keylist(v2d, &keys, &blocks, ypos);
+		draw_keylist(v2d, &keys, &blocks, ypos, 0);
 	
 	BLI_dlrbTree_free(&keys);
 	BLI_dlrbTree_free(&blocks);
@@ -589,7 +593,7 @@
 	BLI_dlrbTree_linkedlist_sync(&keys);
 	BLI_dlrbTree_linkedlist_sync(&blocks);
 	
-		draw_keylist(v2d, &keys, &blocks, ypos);
+		draw_keylist(v2d, &keys, &blocks, ypos, 0);
 	
 	BLI_dlrbTree_free(&keys);
 	BLI_dlrbTree_free(&blocks);
@@ -607,7 +611,7 @@
 	BLI_dlrbTree_linkedlist_sync(&keys);
 	BLI_dlrbTree_linkedlist_sync(&blocks);
 	
-		draw_keylist(v2d, &keys, &blocks, ypos);
+		draw_keylist(v2d, &keys, &blocks, ypos, (fcu->flag & FCURVE_PROTECTED));
 	
 	BLI_dlrbTree_free(&keys);
 	BLI_dlrbTree_free(&blocks);
@@ -625,7 +629,7 @@
 	BLI_dlrbTree_linkedlist_sync(&keys);
 	BLI_dlrbTree_linkedlist_sync(&blocks);
 	
-		draw_keylist(v2d, &keys, &blocks, ypos);
+		draw_keylist(v2d, &keys, &blocks, ypos, (agrp->flag & AGRP_PROTECTED));
 	
 	BLI_dlrbTree_free(&keys);
 	BLI_dlrbTree_free(&blocks);
@@ -643,7 +647,7 @@
 	BLI_dlrbTree_linkedlist_sync(&keys);
 	BLI_dlrbTree_linkedlist_sync(&blocks);
 	
-		draw_keylist(v2d, &keys, &blocks, ypos);
+		draw_keylist(v2d, &keys, &blocks, ypos, 0);
 	
 	BLI_dlrbTree_free(&keys);
 	BLI_dlrbTree_free(&blocks);
@@ -659,7 +663,7 @@
 	
 	BLI_dlrbTree_linkedlist_sync(&keys);
 	
-		draw_keylist(v2d, &keys, NULL, ypos);
+		draw_keylist(v2d, &keys, NULL, ypos, (gpl->flag & GP_LAYER_LOCKED));
 	
 	BLI_dlrbTree_free(&keys);
 }

Modified: trunk/blender/source/blender/editors/include/ED_keyframes_draw.h
===================================================================
--- trunk/blender/source/blender/editors/include/ED_keyframes_draw.h	2010-12-29 12:27:03 UTC (rev 33936)
+++ trunk/blender/source/blender/editors/include/ED_keyframes_draw.h	2010-12-29 12:52:06 UTC (rev 33937)
@@ -100,7 +100,7 @@
 } eKeyframeShapeDrawOpts;
 
 /* draw simple diamond-shape keyframe (with OpenGL) */
-void draw_keyframe_shape(float x, float y, float xscale, float hsize, short sel, short key_type, short mode);
+void draw_keyframe_shape(float x, float y, float xscale, float hsize, short sel, short key_type, short mode, float alpha);
 
 /* ******************************* Methods ****************************** */
 

Modified: trunk/blender/source/blender/editors/space_nla/nla_draw.c
===================================================================
--- trunk/blender/source/blender/editors/space_nla/nla_draw.c	2010-12-29 12:27:03 UTC (rev 33936)
+++ trunk/blender/source/blender/editors/space_nla/nla_draw.c	2010-12-29 12:52:06 UTC (rev 33937)
@@ -141,7 +141,7 @@
 	 *	- size is 3.0f which is smaller than the editable keyframes, so that there is a distinction
 	 */
 	for (ak= keys.first; ak; ak= ak->next)
-		draw_keyframe_shape(ak->cfra, y, xscale, 3.0f, 0, ak->key_type, KEYFRAME_SHAPE_FRAME);
+		draw_keyframe_shape(ak->cfra, y, xscale, 3.0f, 0, ak->key_type, KEYFRAME_SHAPE_FRAME, 1.0f);
 	
 	/* free icons */
 	BLI_dlrbTree_free(&keys);





More information about the Bf-blender-cvs mailing list