Bugfix #24621: NLA strips move insensitively across tracks
authorJoshua Leung <aligorith@gmail.com>
Thu, 11 Nov 2010 10:27:24 +0000 (10:27 +0000)
committerJoshua Leung <aligorith@gmail.com>
Thu, 11 Nov 2010 10:27:24 +0000 (10:27 +0000)
This was a 2-part bug:
1) "Track index" (i.e. "index of NLA track within NLA Stack") was calculated incorrectly when the transform data is created. A typo meant that this was actually "index of strip within original track"

2) Strips were flying around madly vertically (especially for downward movements, and with extreme difficulty for upwards) as the track index was being updated incorrectly. I suspect at the time I was misreading it as trackIndex = ... vs trackIndex += ..., though it obviously looked wrong looking at it now!

source/blender/editors/transform/transform_conversions.c
source/blender/editors/transform/transform_generics.c

index da68f7abc4ecaec30108bccd96e360827c7f46c7..e0324ae60bd307a48b748a8c0d852fd26f22ff28 100644 (file)
@@ -2662,6 +2662,7 @@ static void createTransNlaData(bContext *C, TransInfo *t)
        for (ale= anim_data.first; ale; ale= ale->next) {
                /* only if a real NLA-track */
                if (ale->type == ANIMTYPE_NLATRACK) {
+                       AnimData *adt = ale->adt;
                        NlaTrack *nlt= (NlaTrack *)ale->data;
                        NlaStrip *strip;
                        
@@ -2686,7 +2687,7 @@ static void createTransNlaData(bContext *C, TransInfo *t)
                                                tdn->id= ale->id;
                                                tdn->oldTrack= tdn->nlt= nlt;
                                                tdn->strip= strip;
-                                               tdn->trackIndex= BLI_findindex(&nlt->strips, strip);
+                                               tdn->trackIndex= BLI_findindex(&adt->nla_tracks, nlt);
                                                
                                                yval= (float)(tdn->trackIndex * NLACHANNEL_STEP);
                                                
index 22888a6b0079fb021cb7c3ffebc9c2888c0ac26d..dd3e4698ef50ee9dafe4a1266a1ff134c560b15a 100644 (file)
@@ -582,7 +582,7 @@ void recalcData(TransInfo *t)
                                                        BKE_nlatrack_add_strip(track, strip);
                                                        
                                                        tdn->nlt= track;
-                                                       tdn->trackIndex += (n + 1); /* + 1, since n==0 would mean that we didn't change track */
+                                                       tdn->trackIndex++;
                                                }
                                                else /* can't move any further */
                                                        break;
@@ -600,7 +600,7 @@ void recalcData(TransInfo *t)
                                                        BKE_nlatrack_add_strip(track, strip);
                                                        
                                                        tdn->nlt= track;
-                                                       tdn->trackIndex -= (n - 1); /* - 1, since n==0 would mean that we didn't change track */
+                                                       tdn->trackIndex--;
                                                }
                                                else /* can't move any further */
                                                        break;