[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [26439] trunk/blender/source/blender/ editors/space_graph/graph_draw.c: [#20892] Locking animation curves with Tab Key don't hide the curves handles

Campbell Barton ideasman42 at gmail.com
Sat Jan 30 18:17:23 CET 2010


Revision: 26439
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=26439
Author:   campbellbarton
Date:     2010-01-30 18:17:23 +0100 (Sat, 30 Jan 2010)

Log Message:
-----------
[#20892] Locking animation curves with Tab Key don't hide the curves handles
drawing handles for fcurves wasnt checking ((fcu->grp) && (fcu->grp->flag & AGRP_PROTECTED))

Modified Paths:
--------------
    trunk/blender/source/blender/editors/space_graph/graph_draw.c

Modified: trunk/blender/source/blender/editors/space_graph/graph_draw.c
===================================================================
--- trunk/blender/source/blender/editors/space_graph/graph_draw.c	2010-01-30 16:09:56 UTC (rev 26438)
+++ trunk/blender/source/blender/editors/space_graph/graph_draw.c	2010-01-30 17:17:23 UTC (rev 26439)
@@ -300,7 +300,7 @@
 }
 
 
-void draw_fcurve_vertices (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, FCurve *fcu)
+static void draw_fcurve_vertices (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, FCurve *fcu, int do_handles)
 {
 	View2D *v2d= &ar->v2d;
 	
@@ -314,8 +314,7 @@
 	glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE));
 	
 	/* draw the two handles first (if they're shown, the curve doesn't have just a single keyframe, and the curve is being edited) */
-	if ((fcu->flag & FCURVE_PROTECTED)==0 && (fcu->flag & FCURVE_INT_VALUES)==0 && 
-		(sipo->flag & SIPO_NOHANDLES)==0 && (fcu->totvert > 1)) 
+	if (do_handles)
 	{
 		set_fcurve_vertex_color(sipo, fcu, 0);
 		draw_fcurve_vertices_handles(ac, sipo, fcu, v2d, 0);
@@ -336,16 +335,28 @@
 
 /* Handles ---------------- */
 
-/* draw lines for F-Curve handles only (this is only done in EditMode) */
+static int draw_fcurve_handles_check(SpaceIpo *sipo, FCurve *fcu)
+{
+	/* don't draw handle lines if handles are not shown */
+	if (	(sipo->flag & SIPO_NOHANDLES) ||
+			(fcu->flag & FCURVE_PROTECTED) ||
+			(fcu->flag & FCURVE_INT_VALUES) ||
+			((fcu->grp) && (fcu->grp->flag & AGRP_PROTECTED))
+			/* || (fcu->totvert <= 1) */
+	) {
+		return 0;
+	} else {
+		return 1;
+	}
+}
+
+/* draw lines for F-Curve handles only (this is only done in EditMode)
+ * note: draw_fcurve_handles_check must be checked before running this. */
 static void draw_fcurve_handles (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, FCurve *fcu)
 {
 	extern unsigned int nurbcol[];
 	int sel, b;
 	
-	/* don't draw handle lines if handles are not shown */
-	if ((sipo->flag & SIPO_NOHANDLES) || (fcu->flag & FCURVE_PROTECTED) || (fcu->flag & FCURVE_INT_VALUES))
-		return;
-	
 	/* a single call to GL_LINES here around these calls should be sufficient to still
 	 * get separate line segments, but which aren't wrapped with GL_LINE_STRIP everytime we
 	 * want a single line
@@ -910,12 +921,16 @@
 				ANIM_unit_mapping_apply_fcurve(ac->scene, ale->id, fcu, 0);
 				
 				if (fcu->bezt) {
-					/* only draw handles/vertices on keyframes */
-					glEnable(GL_BLEND);
+					int do_handles = draw_fcurve_handles_check(sipo, fcu);
+
+					if(do_handles) {
+						/* only draw handles/vertices on keyframes */
+						glEnable(GL_BLEND);
 						draw_fcurve_handles(ac, sipo, ar, fcu);
-					glDisable(GL_BLEND);
-					
-					draw_fcurve_vertices(ac, sipo, ar, fcu);
+						glDisable(GL_BLEND);
+					}
+
+					draw_fcurve_vertices(ac, sipo, ar, fcu, do_handles);
 				}
 				else {
 					/* samples: only draw two indicators at either end as indicators */





More information about the Bf-blender-cvs mailing list