[#20892] Locking animation curves with Tab Key don't hide the curves handles
authorCampbell Barton <ideasman42@gmail.com>
Sat, 30 Jan 2010 17:17:23 +0000 (17:17 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sat, 30 Jan 2010 17:17:23 +0000 (17:17 +0000)
drawing handles for fcurves wasnt checking ((fcu->grp) && (fcu->grp->flag & AGRP_PROTECTED))

source/blender/editors/space_graph/graph_draw.c

index 8642c2d15c52ffb47bcf486b2e0938daf39d2b1a..753aeb78ddef1dbd729e566098e571cba7baa1c5 100644 (file)
@@ -300,7 +300,7 @@ static void set_fcurve_vertex_color (SpaceIpo *sipo, FCurve *fcu, short sel)
 }
 
 
-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 @@ void draw_fcurve_vertices (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, FCurve
        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 @@ void draw_fcurve_vertices (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, FCurve
 
 /* 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 @@ void graph_draw_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGri
                                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 */