Revision: 44836
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=44836
Author:   nazgul
Date:     2012-03-12 14:55:56 +0000 (Mon, 12 Mar 2012)
Log Message:
-----------
Fix #30406: Hooks ignore Automatic handles setting in curves

Update handles positions after applying modifiers which seems to be expected 
behavior.
The only currently unsolved issue is about updating aligned handles because 
this needs
to determine in which order handles need to be recalculated which currently 
depends on
selection flags and which is quite tricky to do when running modifiers and 
animation data,
so currently just not update their positions for now.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/curve.c

Modified: trunk/blender/source/blender/blenkernel/intern/curve.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/curve.c      2012-03-12 
14:39:37 UTC (rev 44835)
+++ trunk/blender/source/blender/blenkernel/intern/curve.c      2012-03-12 
14:55:56 UTC (rev 44836)
@@ -2480,7 +2480,7 @@
  */
 
 /* mode: is not zero when FCurve, is 2 when forced horizontal for autohandles 
*/
-void calchandleNurb(BezTriple *bezt, BezTriple *prev, BezTriple *next, int 
mode)
+static void calchandleNurb_intern(BezTriple *bezt, BezTriple *prev, BezTriple 
*next, int mode, int skip_align)
 {
        float *p1,*p2,*p3, pt[3];
        float dvec_a[3], dvec_b[3];
@@ -2627,6 +2627,13 @@
                madd_v3_v3v3fl(p2+3, p2, dvec_b,  1.0f/3.0f);
        }
 
+       if(skip_align) {
+               /* handles need to be updated during animation and applying 
stuff like hooks,
+                * but in such situatios it's quite difficult to distinguish in 
which order
+                * align handles should be aligned so skip them for now */
+               return;
+       }
+
        len_b= len_v3v3(p2, p2+3);
        len_a= len_v3v3(p2, p2-3);
        if(len_a==0.0f) len_a= 1.0f;
@@ -2670,7 +2677,7 @@
        }
 }
 
-void calchandlesNurb(Nurb *nu) /* first, if needed, set handle flags */
+static void calchandlesNurb_intern(Nurb *nu, int skip_align)
 {
        BezTriple *bezt, *prev, *next;
        short a;
@@ -2685,7 +2692,7 @@
        next= bezt+1;
 
        while(a--) {
-               calchandleNurb(bezt, prev, next, 0);
+               calchandleNurb_intern(bezt, prev, next, 0, skip_align);
                prev= bezt;
                if(a==1) {
                        if(nu->flagu & CU_NURB_CYCLIC) next= nu->bezt;
@@ -2697,7 +2704,17 @@
        }
 }
 
+void calchandleNurb(BezTriple *bezt, BezTriple *prev, BezTriple *next, int 
mode)
+{
+       calchandleNurb_intern(bezt, prev, next, mode, FALSE);
+}
 
+void calchandlesNurb(Nurb *nu) /* first, if needed, set handle flags */
+{
+       calchandlesNurb_intern(nu, FALSE);
+}
+
+
 void testhandlesNurb(Nurb *nu)
 {
        /* use when something has changed with handles.
@@ -3080,6 +3097,8 @@
                                copy_v3_v3(bp->vec, co); co+=3;
                        }
                }
+
+               calchandlesNurb_intern(nu, TRUE);
        }
 }
 

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

Reply via email to