Revision: 32632
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=32632
Author:   aligorith
Date:     2010-10-21 12:28:06 +0200 (Thu, 21 Oct 2010)

Log Message:
-----------
Changes to "evaluation time" for Curves:

After discussions with Campbell regarding #24336 and #24309, we've decided to 
make this property for curves to only get set when an F-Curve explicitly 
animates it. 

As a consequence...
- ALL OLD FILES using follow-path constraints that depended on this changed 
behaviour will currently need manual patching to add an appropriate F-Curve
- Ctrl-P (Parenting to Curves -> Follow Path option) will now automatically 
create such F-Curves mimicking the old behaviour so that creating 
camera-following-path setups still works smoothly.
- Directly adding a Follow Path constraint bypasses this, so you'll need to 
manually add such F-Curves if you need them.

The main problem with the old approach was that there were many cases in which 
curve data could get added but the ctime would be incorrect until a frame 
change (i.e. on render) flushed this.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/anim_sys.c
    trunk/blender/source/blender/editors/curve/editcurve.c
    trunk/blender/source/blender/editors/object/object_relations.c

Modified: trunk/blender/source/blender/blenkernel/intern/anim_sys.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/anim_sys.c   2010-10-21 
09:19:52 UTC (rev 32631)
+++ trunk/blender/source/blender/blenkernel/intern/anim_sys.c   2010-10-21 
10:28:06 UTC (rev 32632)
@@ -1872,22 +1872,7 @@
        EVAL_ANIM_IDS(main->mball.first, ADT_RECALC_ANIM);
        
        /* curves */
-               /* we need to perform a special hack here to ensure that the 
ctime 
-                * value of the curve gets set in case there's no animation for 
that
-                *      - it needs to be set before animation is evaluated just 
so that 
-                *        animation can successfully override...
-                *      - it shouldn't get set when calculating drivers...
-                */
-       for (id= main->curve.first; id; id= id->next) {
-               AnimData *adt= BKE_animdata_from_id(id);
-               Curve *cu= (Curve *)id;
-               
-               /* set ctime variable for curve */
-               cu->ctime= ctime;
-               
-               /* now execute animation data on top of this as per normal */
-               BKE_animsys_evaluate_animdata(id, adt, ctime, ADT_RECALC_ANIM);
-       }
+       EVAL_ANIM_IDS(main->curve.first, ADT_RECALC_ANIM);
        
        /* armatures */
        EVAL_ANIM_IDS(main->armature.first, ADT_RECALC_ANIM);

Modified: trunk/blender/source/blender/editors/curve/editcurve.c
===================================================================
--- trunk/blender/source/blender/editors/curve/editcurve.c      2010-10-21 
09:19:52 UTC (rev 32631)
+++ trunk/blender/source/blender/editors/curve/editcurve.c      2010-10-21 
10:28:06 UTC (rev 32632)
@@ -6018,7 +6018,6 @@
 
                        cu= (Curve*)obedit->data;
                        cu->flag |= CU_DEFORM_FILL;
-                       cu->ctime= CFRA;
                        if(type & CU_PRIM_PATH)
                                cu->flag |= CU_PATH|CU_3D;
                } else DAG_id_flush_update(&obedit->id, OB_RECALC_DATA);

Modified: trunk/blender/source/blender/editors/object/object_relations.c
===================================================================
--- trunk/blender/source/blender/editors/object/object_relations.c      
2010-10-21 09:19:52 UTC (rev 32631)
+++ trunk/blender/source/blender/editors/object/object_relations.c      
2010-10-21 10:28:06 UTC (rev 32632)
@@ -57,6 +57,7 @@
 #include "BKE_depsgraph.h"
 #include "BKE_displist.h"
 #include "BKE_global.h"
+#include "BKE_fcurve.h"
 #include "BKE_lattice.h"
 #include "BKE_library.h"
 #include "BKE_main.h"
@@ -82,6 +83,7 @@
 
 #include "ED_armature.h"
 #include "ED_curve.h"
+#include "ED_keyframing.h"
 #include "ED_object.h"
 #include "ED_screen.h"
 #include "ED_view3d.h"
@@ -546,6 +548,17 @@
                        }
                        else cu->flag |= CU_FOLLOW;
                        
+                       /* if follow, add F-Curve for ctime (i.e. "eval_time") 
so that path-follow works */
+                       if(partype == PAR_FOLLOW) {
+                               /* get or create F-Curve */
+                               bAction *act = verify_adt_action(&cu->id, 1);
+                               FCurve *fcu = verify_fcurve(act, NULL, 
"eval_time", 0, 1);
+                               
+                               /* setup dummy 'generator' modifier here to get 
1-1 correspondance still working */
+                               if (!fcu->bezt && !fcu->fpt && 
!fcu->modifiers.first)
+                                       add_fmodifier(&fcu->modifiers, 
FMODIFIER_TYPE_GENERATOR);
+                       }
+                       
                        /* fall back on regular parenting now (for follow only) 
*/
                        if(partype == PAR_FOLLOW)
                                partype= PAR_OBJECT;


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

Reply via email to