Bugfix: Inserting keyframes from the buttons now ensures that the Graph Editor is...
authorJoshua Leung <aligorith@gmail.com>
Tue, 9 Feb 2010 00:02:22 +0000 (00:02 +0000)
committerJoshua Leung <aligorith@gmail.com>
Tue, 9 Feb 2010 00:02:22 +0000 (00:02 +0000)
source/blender/blenkernel/intern/constraint.c
source/blender/editors/animation/keyframes_edit.c
source/blender/editors/animation/keyframing.c

index 4f4c1959f342ac934d3f406e692b95206b8bae33..f0a2120f0a77bf679d36c228f8b959d7802bbad5 100644 (file)
@@ -4041,9 +4041,10 @@ void id_loop_constraints (ListBase *conlist, ConstraintIDFunc func, void *userda
 
 /* ......... */
 
+/* helper for copy_constraints(), to be used for making sure that ID's are valid */
 static void con_extern_cb(bConstraint *con, ID **idpoin, void *userdata)
 {
-       if(idpoin && (*idpoin)->lib)
+       if (idpoin && (*idpoin)->lib)
                id_lib_extern(*idpoin);
 }
 
@@ -4066,13 +4067,13 @@ void copy_constraints (ListBase *dst, const ListBase *src)
                
                /* only do specific constraints if required */
                if (cti) {
-                       if (cti->copy_data) {
+                       /* perform custom copying operations if needed */
+                       if (cti->copy_data)
                                cti->copy_data(con, srccon);
-                       }
-
-                       if(cti->id_looper) {
+                       
+                       /* go over used ID-links for this constraint to ensure that they are valid for proxies */
+                       if (cti->id_looper)
                                cti->id_looper(con, con_extern_cb, NULL);
-                       }
                }
        }
 }
index 718286b4ba411e94996196a8d79a84a6132a2988..6957f4e572d30026cf9322bbb684fe0694653ec5 100644 (file)
@@ -97,7 +97,7 @@ short ANIM_fcurve_keys_bezier_loop(BeztEditData *bed, FCurve *fcu, BeztEditFunc
                return 0;
        
        /* set the F-Curve into the editdata so that it can be accessed */
-       if(bed) {
+       if (bed) {
                bed->fcu= fcu;
                bed->curIndex= 0;
        }
@@ -109,8 +109,9 @@ short ANIM_fcurve_keys_bezier_loop(BeztEditData *bed, FCurve *fcu, BeztEditFunc
                 */
                if (bezt_ok) {
                        for (bezt=fcu->bezt, i=0; i < fcu->totvert; bezt++, i++) {
+                               if (bed) bed->curIndex= i;
+                               
                                /* Only operate on this BezTriple if it fullfills the criteria of the validation func */
-                               if(bed) bed->curIndex= i;
                                if (bezt_ok(bed, bezt)) {
                                        /* Exit with return-code '1' if function returns positive
                                         * This is useful if finding if some BezTriple satisfies a condition.
@@ -121,17 +122,18 @@ short ANIM_fcurve_keys_bezier_loop(BeztEditData *bed, FCurve *fcu, BeztEditFunc
                }
                else {
                        for (bezt=fcu->bezt, i=0; i < fcu->totvert; bezt++, i++) {
+                               if (bed) bed->curIndex= i;
+                               
                                /* Exit with return-code '1' if function returns positive
                                 * This is useful if finding if some BezTriple satisfies a condition.
                                 */
-                               if(bed) bed->curIndex= i;
                                if (bezt_cb(bed, bezt)) return 1;
                        }
                }
         }
        
        /* unset the F-Curve from the editdata now that it's done */
-       if(bed) {
+       if (bed) {
                bed->fcu= NULL;
                bed->curIndex= 0;
        }
index 7a3e6dc5814abcc38a9526184b6594ccddd4ad78..f44b45baf50fc74e2b6bcc65df80084d3b89f5c3 100644 (file)
@@ -1427,8 +1427,8 @@ static int insert_key_button_exec (bContext *C, wmOperator *op)
                /* send updates */
                DAG_ids_flush_update(0);
                
-               /* for now, only send ND_KEYS for KeyingSets */
-               WM_event_add_notifier(C, ND_KEYS, NULL);
+               /* send notifiers that keyframes have been changed */
+               WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME_EDIT, NULL);
        }
        
        return (success)? OPERATOR_FINISHED: OPERATOR_CANCELLED;
@@ -1493,12 +1493,12 @@ static int delete_key_button_exec (bContext *C, wmOperator *op)
        }
        
        
-       if(success) {
+       if (success) {
                /* send updates */
                DAG_ids_flush_update(0);
                
-               /* for now, only send ND_KEYS for KeyingSets */
-               WM_event_add_notifier(C, ND_KEYS, NULL);
+               /* send notifiers that keyframes have been changed */
+               WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME_EDIT, NULL);
        }
        
        return (success)? OPERATOR_FINISHED: OPERATOR_CANCELLED;