Revision: 17524
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=17524
Author:   aligorith
Date:     2008-11-21 02:54:00 +0100 (Fri, 21 Nov 2008)

Log Message:
-----------
AnimSys2: Two Bugfixes for IPO Editor

* Fixed the long-standing problem where a selected Beztriple's handles would 
not be able to be scaled when if one of the handles wasn't moved first. The 
cause of this was that auto-handles will keep handles clamped in place.
To solve this, I've added a special hack, which will result in auto-handles 
being converted to aligned handles whe rotating/scaling BezTriples that have 
all its points selected. This should behave more in line with expected 
behaviour.

* Setting per-segment interpolation in curve EditMode was broken. Was a 
misplaced check that I forgot to move.

Modified Paths:
--------------
    branches/animsys2/source/blender/src/editipo.c
    branches/animsys2/source/blender/src/editipo_mods.c

Modified: branches/animsys2/source/blender/src/editipo.c
===================================================================
--- branches/animsys2/source/blender/src/editipo.c      2008-11-20 22:58:27 UTC 
(rev 17523)
+++ branches/animsys2/source/blender/src/editipo.c      2008-11-21 01:54:00 UTC 
(rev 17524)
@@ -3918,8 +3918,8 @@
                                                if (icu->ipo == IPO_MIXED) {
                                                        bezt= icu->bezt;
                                                        for (b=0; b < 
icu->totvert; b++, bezt++) {
-                                                               if (bezt->ipo 
== IPO_BEZ) count += 3;
-                                                               else count ++;
+                                                               if (bezt->ipo 
== IPO_BEZ) count += 3; // err...
+                                                               else count++;
                                                        }
                                                }
                                                else if (icu->ipo == IPO_BEZ)
@@ -3967,6 +3967,7 @@
                                                
                                                for (b=0; b < icu->totvert; 
b++, prevbezt=bezt, bezt++) {
                                                        
TransDataCurveHandleFlags *hdata = NULL;
+                                                       short h1=1, h2=1;
                                                        
                                                        /* only include handles 
if selected, and interpolaton mode uses beztriples */
                                                        if ( (!prevbezt && 
(bezt->ipo==IPO_BEZ)) || (prevbezt && (prevbezt->ipo==IPO_BEZ)) ) {
@@ -3974,16 +3975,31 @@
                                                                        hdata = 
initTransDataCurveHandes(td, bezt);
                                                                        
bezt_to_transdata(td++, td2d++, bezt->vec[0], bezt->vec[1], 1, onlytime);
                                                                }
+                                                               else
+                                                                       h1= 0;
                                                        }
                                                        if (bezt->ipo==IPO_BEZ) 
{
                                                                if (bezt->f3 & 
SELECT) {
-                                                                       if 
(hdata==NULL) {
+                                                                       if 
(hdata==NULL)
                                                                                
hdata = initTransDataCurveHandes(td, bezt);
-                                                                       }
                                                                        
bezt_to_transdata(td++, td2d++, bezt->vec[2], bezt->vec[1], 1, onlytime);
                                                                }
+                                                               else
+                                                                       h2= 0;
                                                        }
                                                        
+                                                       /* special hack (must 
be done after initTransDataCurveHandes(), as that stores handle settings to 
restore...): 
+                                                        *      - Check if 
we've got entire BezTriple selected and we're scaling/rotating that point, 
+                                                        *        then check if 
we're using auto-handles. 
+                                                        *      - If so, change 
them auto-handles to aligned handles so that handles get affected too
+                                                        */
+                                                       if ((bezt->h1 == 
HD_AUTO) && (bezt->h2 == HD_AUTO) && ELEM(t->mode, TFM_ROTATION, TFM_RESIZE)) {
+                                                               if ((h1 && h2) 
&& (bezt->f2 & SELECT)) {
+                                                                       
bezt->h1= HD_ALIGN;
+                                                                       
bezt->h2= HD_ALIGN;
+                                                               }
+                                                       }
+                                                       
                                                        /* only include main 
vert if selected */
                                                        if (bezt->f2 & SELECT) {
                                                                /* if handles 
were not selected, store their selection status */

Modified: branches/animsys2/source/blender/src/editipo_mods.c
===================================================================
--- branches/animsys2/source/blender/src/editipo_mods.c 2008-11-20 22:58:27 UTC 
(rev 17523)
+++ branches/animsys2/source/blender/src/editipo_mods.c 2008-11-21 01:54:00 UTC 
(rev 17524)
@@ -978,12 +978,12 @@
                
                ei= G.sipo->editipo;
                for(a=0; a<G.sipo->totipo; a++, ei++) {
-                       if (ISPOIN3(ei, flag & IPO_VISIBLE, flag & IPO_SELECT, 
icu)) {
+                       if (ISPOIN(ei, flag & IPO_VISIBLE, icu)) {
                                if (ei->flag & IPO_EDIT) {
                                        /* set mode for selected points only */
                                        icu_keys_bezier_loop(ei->icu, 
bezier_function, set_ipocurve_mixed);
                                }
-                               else {
+                               else if (ei->flag & IPO_SELECT) {
                                        /* if curve is not in editmode, set 
mode for entire curve */
                                        set_interpolation_ipocurve(ei->icu, 
event-1);
                                }


_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to