Revision: 22752
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=22752
Author:   aligorith
Date:     2009-08-25 02:12:11 +0200 (Tue, 25 Aug 2009)

Log Message:
-----------
2.5 - Assorted Bugfixes for Animation Editing

* Inserting keyframes now takes into account whether the F-Curve was editable 
or not.

* Editing keyframes in animation editors now sends proper depsgraph updates 
instead of just tagging the relevant objects. 

Thanks JiriH for reporting these bugs.

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/editors/animation/keyframing.c
    
branches/blender2.5/blender/source/blender/editors/space_action/action_header.c
    
branches/blender2.5/blender/source/blender/editors/transform/transform_generics.c

Modified: 
branches/blender2.5/blender/source/blender/editors/animation/keyframing.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/animation/keyframing.c   
2009-08-24 23:27:07 UTC (rev 22751)
+++ branches/blender2.5/blender/source/blender/editors/animation/keyframing.c   
2009-08-25 00:12:11 UTC (rev 22752)
@@ -740,6 +740,12 @@
                printf("ERROR: no F-Curve to add keyframes to \n");
                return 0;
        }
+       /* F-Curve not editable? */
+       if ( (fcu->flag & FCURVE_PROTECTED) || ((fcu->grp) && (fcu->grp->flag & 
AGRP_PROTECTED)) ) {
+               if (G.f & G_DEBUG)
+                       printf("WARNING: not inserting keyframe for locked 
F-Curve \n");
+               return 0;
+       }
        
        /* if no property given yet, try to validate from F-Curve info */
        if ((ptr.id.data == NULL) && (ptr.data==NULL)) {
@@ -911,8 +917,19 @@
        /* we don't check the validity of the path here yet, but it should be 
ok... */
        fcu= verify_fcurve(act, group, rna_path, array_index, 0);
        
-       /* only continue if we have an F-Curve to remove keyframes from */
-       if (act && fcu) {
+       /* check if F-Curve exists and/or whether it can be edited */
+       if ELEM(NULL, act, fcu) {
+               printf("ERROR: no F-Curve and/or Action to delete keyframe from 
\n");
+               return 0;
+       }
+       if ( (fcu->flag & FCURVE_PROTECTED) || ((fcu->grp) && (fcu->grp->flag & 
AGRP_PROTECTED)) ) {
+               if (G.f & G_DEBUG)
+                       printf("WARNING: not inserting keyframe for locked 
F-Curve \n");
+               return 0;
+       }
+       
+       /* it should be fine to continue now... */
+       {
                short found = -1;
                int i;
                

Modified: 
branches/blender2.5/blender/source/blender/editors/space_action/action_header.c
===================================================================
--- 
branches/blender2.5/blender/source/blender/editors/space_action/action_header.c 
    2009-08-24 23:27:07 UTC (rev 22751)
+++ 
branches/blender2.5/blender/source/blender/editors/space_action/action_header.c 
    2009-08-25 00:12:11 UTC (rev 22752)
@@ -404,13 +404,13 @@
                        if (saction->flag & SACTION_DRAWTIME) {
                                uiDefButC(block, MENU, B_REDR,
                                                "Auto-Snap Keyframes %t|No Snap 
%x0|Second Step %x1|Nearest Second %x2|Nearest Marker %x3", 
-                                               xco,yco,70,YIC, 
&(saction->autosnap), 0, 1, 0, 0, 
+                                               xco,yco,90,YIC, 
&(saction->autosnap), 0, 1, 0, 0, 
                                                "Auto-snapping mode for 
keyframes when transforming");
                        }
                        else {
                                uiDefButC(block, MENU, B_REDR, 
                                                "Auto-Snap Keyframes %t|No Snap 
%x0|Frame Step %x1|Nearest Frame %x2|Nearest Marker %x3", 
-                                               xco,yco,70,YIC, 
&(saction->autosnap), 0, 1, 0, 0, 
+                                               xco,yco,90,YIC, 
&(saction->autosnap), 0, 1, 0, 0, 
                                                "Auto-snapping mode for 
keyframes when transforming");
                        }
                        

Modified: 
branches/blender2.5/blender/source/blender/editors/transform/transform_generics.c
===================================================================
--- 
branches/blender2.5/blender/source/blender/editors/transform/transform_generics.c
   2009-08-24 23:27:07 UTC (rev 22751)
+++ 
branches/blender2.5/blender/source/blender/editors/transform/transform_generics.c
   2009-08-25 00:12:11 UTC (rev 22752)
@@ -269,7 +269,7 @@
 /* tags the given ID block for refreshes (if applicable) due to 
  * Animation Editor editing
  */
-static void animedit_refresh_id_tags (ID *id)
+static void animedit_refresh_id_tags (Scene *scene, ID *id)
 {
        if (id) {
                AnimData *adt= BKE_animdata_from_id(id);
@@ -279,12 +279,11 @@
                        adt->recalc |= ADT_RECALC_ANIM;
                        
                /* if ID-block is Object, set recalc flags */
-               // TODO: this should probably go through the depsgraph 
instead... but for now, let's be lazy
                switch (GS(id->name)) {
                        case ID_OB:
                        {
                                Object *ob= (Object *)id;
-                               ob->recalc |= OB_RECALC;
+                               DAG_object_flush_update(scene, ob, 
OB_RECALC_DATA);  /* sets recalc flags */
                        }
                                break;
                }
@@ -384,7 +383,7 @@
                /* just tag these animdata-blocks to recalc, assuming that some 
data there changed */
                for (ale= anim_data.first; ale; ale= ale->next) {
                        /* set refresh tags for objects using this animation */
-                       animedit_refresh_id_tags(ale->id);
+                       animedit_refresh_id_tags(t->scene, ale->id);
                }
                
                /* now free temp channels */
@@ -432,7 +431,7 @@
                                calchandles_fcurve(fcu);
                                
                        /* set refresh tags for objects using this animation */
-                       animedit_refresh_id_tags(ale->id);
+                       animedit_refresh_id_tags(t->scene, ale->id);
                }
                
                /* do resort and other updates? */
@@ -463,7 +462,7 @@
                                continue;
                        
                        /* set refresh tags for objects using this animation */
-                       animedit_refresh_id_tags(tdn->id);
+                       animedit_refresh_id_tags(t->scene, tdn->id);
                        
                        /* if cancelling transform, just write the values 
without validating, then move on */
                        if (t->state == TRANS_CANCEL) {


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to