Revision: 20149
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=20149
Author:   aligorith
Date:     2009-05-11 13:51:30 +0200 (Mon, 11 May 2009)

Log Message:
-----------
Graph Editor Bugfix: 'HomeKey' (View All) wasn't correctly calculating y-extents

It was only using the y-extents of the last F-Curve it encountered

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/blenkernel/intern/fcurve.c
    branches/blender2.5/blender/source/blender/editors/space_graph/graph_edit.c

Modified: branches/blender2.5/blender/source/blender/blenkernel/intern/fcurve.c
===================================================================
--- branches/blender2.5/blender/source/blender/blenkernel/intern/fcurve.c       
2009-05-11 11:41:08 UTC (rev 20148)
+++ branches/blender2.5/blender/source/blender/blenkernel/intern/fcurve.c       
2009-05-11 11:51:30 UTC (rev 20149)
@@ -210,8 +210,10 @@
                                BezTriple *bezt;
                                
                                for (bezt=fcu->bezt, i=0; i < fcu->totvert; 
bezt++, i++) {
-                                       yminv= MIN2(yminv, bezt->vec[1][1]);
-                                       ymaxv= MAX2(ymaxv, bezt->vec[1][1]);
+                                       if (bezt->vec[1][1] < yminv)
+                                               yminv= bezt->vec[1][1];
+                                       if (bezt->vec[1][1] > ymaxv)
+                                               ymaxv= bezt->vec[1][1];
                                }
                        }
                }
@@ -227,8 +229,10 @@
                                FPoint *fpt;
                                
                                for (fpt=fcu->fpt, i=0; i < fcu->totvert; 
fpt++, i++) {
-                                       yminv= MIN2(yminv, fpt->vec[1]);
-                                       ymaxv= MAX2(ymaxv, fpt->vec[1]);
+                                       if (fpt->vec[1] < yminv)
+                                               yminv= fpt->vec[1];
+                                       if (fpt->vec[1] > ymaxv)
+                                               ymaxv= fpt->vec[1];
                                }
                        }
                }

Modified: 
branches/blender2.5/blender/source/blender/editors/space_graph/graph_edit.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_graph/graph_edit.c 
2009-05-11 11:41:08 UTC (rev 20148)
+++ branches/blender2.5/blender/source/blender/editors/space_graph/graph_edit.c 
2009-05-11 11:51:30 UTC (rev 20149)
@@ -116,19 +116,21 @@
                for (ale= anim_data.first; ale; ale= ale->next) {
                        Object *nob= NULL; //ANIM_nla_mapping_get(ac, ale);
                        FCurve *fcu= (FCurve *)ale->key_data;
-                       float tmin, tmax;
+                       float txmin, txmax, tymin, tymax;
                        
                        /* get range and apply necessary scaling before */
-                       calc_fcurve_bounds(fcu, &tmin, &tmax, ymin, ymax);
+                       calc_fcurve_bounds(fcu, &txmin, &txmax, &tymin, &tymax);
                        
                        if (nob) {
-                               tmin= get_action_frame_inv(nob, tmin);
-                               tmax= get_action_frame_inv(nob, tmax);
+                               txmin= get_action_frame_inv(nob, txmin);
+                               txmax= get_action_frame_inv(nob, txmax);
                        }
                        
                        /* try to set cur using these values, if they're more 
extreme than previously set values */
-                       if (xmin) *xmin= MIN2(*xmin, tmin);
-                       if (xmax) *xmax= MAX2(*xmax, tmax);
+                       if ((xmin) && (txmin < *xmin))          *xmin= txmin;
+                       if ((xmax) && (txmax > *xmax))          *xmax= txmax;
+                       if ((ymin) && (tymin < *ymin))          *ymin= tymin;
+                       if ((ymax) && (tymax > *ymax))          *ymax= tymax;
                }
                
                /* free memory */


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

Reply via email to