Keyframe-related bugfixes:
authorJoshua Leung <aligorith@gmail.com>
Mon, 9 Feb 2009 11:05:34 +0000 (11:05 +0000)
committerJoshua Leung <aligorith@gmail.com>
Mon, 9 Feb 2009 11:05:34 +0000 (11:05 +0000)
* Deleting keyframes should be safer now
* Graph Editor no longer crashes on F-Curves with no keyframes/samples
* Silenced console prints that occurred when an F-Curve had now keyframes.

source/blender/blenkernel/intern/action.c
source/blender/editors/animation/keyframes_general.c
source/blender/editors/animation/keyframing.c
source/blender/editors/space_graph/graph_draw.c

index 4e66d5f0ab89bf93ee4e6eedfd18ec0b1eefb451..9ed469c9028fc5764b625e100dd2ac8a6faede0b 100644 (file)
@@ -313,10 +313,14 @@ void action_groups_add_channel (bAction *act, bActionGroup *agrp, FCurve *fcurve
        }
        
        /* only if added, set channel as belonging to this group */
-       if (done)
+       if (done) {
+               //printf("FCurve added to group \n");
                fcurve->grp= agrp;
-       else 
+       }
+       else {
                printf("Error: FCurve '%s' couldn't be added to Group '%s' \n", fcurve->rna_path, agrp->name);
+               BLI_addtail(&act->curves, fcurve);
+       }
 }      
 
 /* Remove the given channel from all groups */
index 30d05b915827e3cbb106e74e1fdf564067bf85d8..cf7d56da5d9485f68e47b51fac1e667e18e57399 100644 (file)
@@ -103,6 +103,13 @@ void delete_fcurve_keys(FCurve *fcu)
                }
        }
        
+       /* Free the array of BezTriples if there are not keyframes */
+       if (fcu->totvert == 0) {
+               if (fcu->bezt) 
+                       MEM_freeN(fcu->bezt);
+               fcu->bezt= NULL;
+       }
+       
 #if 0 // XXX for now, we don't get rid of empty curves...
        /* Only delete if there isn't an ipo-driver still hanging around on an empty curve */
        if ((icu->totvert==0) && (icu->driver==NULL)) {
index 110fd84a630e8015b742cf9085e7284ea8a5690d..df3a7b85a45b0ed8ddf62c838f6ae9f8d73344f7 100644 (file)
@@ -2267,7 +2267,7 @@ short action_frame_has_keyframe (bAction *act, float frame, short filter)
         */
        for (fcu= act->curves.first; fcu; fcu= fcu->next) {
                /* only check if there are keyframes (currently only of type BezTriple) */
-               if (fcu->bezt) {
+               if (fcu->bezt && fcu->totvert) {
                        /* we either include all regardless of muting, or only non-muted  */
                        if ((filter & ANIMFILTER_KEYS_MUTED) || (fcu->flag & FCURVE_MUTED)==0) {
                                short replace = -1;
index f05606fbfa6a3e1299aabf1bbf352e62aa1dd1a8..8de273c942835f89d8b34cce0736ed9a53937f94 100644 (file)
@@ -632,14 +632,16 @@ void graph_draw_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar)
                        ANIM_nla_mapping_apply_fcurve(nob, ale->key_data, 0, 0); 
                
                /* draw curve - we currently calculate colour on the fly, but that should probably be done in advance instead */
-               col= ipo_rainbow(i, items);
-               cpack(col);
-               
-               draw_fcurve_repeat(fcu, &ar->v2d, 0, 0, &fac); // XXX this call still needs a lot more work
-               
-               /* draw handles and vertices as appropriate */
-               draw_fcurve_handles(sipo, ar, fcu);
-               draw_fcurve_vertices(sipo, ar, fcu);
+               if ( ((fcu->bezt) || (fcu->fpt)) && (fcu->totvert) ) { 
+                       col= ipo_rainbow(i, items);
+                       cpack(col);
+                       
+                       draw_fcurve_repeat(fcu, &ar->v2d, 0, 0, &fac); // XXX this call still needs a lot more work
+                       
+                       /* draw handles and vertices as appropriate */
+                       draw_fcurve_handles(sipo, ar, fcu);
+                       draw_fcurve_vertices(sipo, ar, fcu);
+               }
                
                /* undo mapping of keyframes for drawing if scaled F-Curve */
                if (nob)