Error in commit from Jason for new action sub-channels: selecting keys did
authorTon Roosendaal <ton@blender.org>
Fri, 13 Apr 2007 19:14:20 +0000 (19:14 +0000)
committerTon Roosendaal <ton@blender.org>
Fri, 13 Apr 2007 19:14:20 +0000 (19:14 +0000)
not work anymore (mouse, bkey).

Fix provided by Diego from Plumifiros.

Important note: get_nearest_icu_key() requires to get an array as arg.
Doing it like:

float min, max; get_nearest_icu_key( , , , &min);

is not reliable or correct.

source/blender/src/editaction.c

index e88a234cc46b9ea04f27cd997d4df025b5ee7e08..0a812c3cd2c30eccfa5d37b7f95b712471ba0500 100644 (file)
@@ -303,6 +303,7 @@ static void *get_nearest_actionchannel_key (float *selx, short *sel, short *ret_
        IpoCurve *icu;
        rctf rectf;
        float xmin, xmax, x, y;
+       float xrange[2];
        int clickmin, clickmax;
        int     wsize;
        short mval[2];
@@ -348,6 +349,8 @@ static void *get_nearest_actionchannel_key (float *selx, short *sel, short *ret_
                return NULL;
        }
        
+       xrange[0]= xmin;
+       xrange[1]= xmax;
        /* try in action channels */
        for (achan = act->chanbase.first; achan; achan=achan->next) {
                if(VISIBLE_ACHAN(achan)) {
@@ -355,7 +358,7 @@ static void *get_nearest_actionchannel_key (float *selx, short *sel, short *ret_
                                break;
                        if (clickmin <= 0) {
                                /* found level - action channel */
-                               icu= get_nearest_icu_key(achan->ipo->curve.first, selx, sel, &xmin);
+                               icu= get_nearest_icu_key(achan->ipo->curve.first, selx, sel, xrange);
                                
                                *ret_type= ACTTYPE_ACHAN;
                                return achan;
@@ -389,7 +392,7 @@ static void *get_nearest_actionchannel_key (float *selx, short *sel, short *ret_
                                                break;
                                        if (clickmin <= 0) {
                                                /* found level - ipo-curve channel */
-                                               icu= get_nearest_icu_key (icu, selx, sel, &xmin);
+                                               icu= get_nearest_icu_key (icu, selx, sel, xrange);
                                
                                                *ret_type= ACTTYPE_ICU;
                                                *par= achan;
@@ -421,7 +424,7 @@ static void *get_nearest_actionchannel_key (float *selx, short *sel, short *ret_
                                                break;
                                        if (clickmin <= 0) {
                                                /* found match - constraint channel */
-                                               icu= get_nearest_icu_key(conchan->ipo->curve.first, selx, sel, &xmin);
+                                               icu= get_nearest_icu_key(conchan->ipo->curve.first, selx, sel, xrange);
                                                
                                                *ret_type= ACTTYPE_CONCHAN;
                                                *par= achan;