diff options
-rw-r--r-- | source/blender/blenkernel/intern/nla.c | 11 | ||||
-rw-r--r-- | source/blender/editors/transform/transform_convert_nla.c | 4 |
2 files changed, 10 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c index 75230f9045c..ecafc76c84d 100644 --- a/source/blender/blenkernel/intern/nla.c +++ b/source/blender/blenkernel/intern/nla.c @@ -296,11 +296,16 @@ NlaTrack *BKE_nlatrack_add(AnimData *adt, NlaTrack *prev, const bool is_liboverr nlt->flag = NLATRACK_SELECTED | NLATRACK_OVERRIDELIBRARY_LOCAL; nlt->index = BLI_listbase_count(&adt->nla_tracks); - /* add track to stack, and make it the active one */ - if (is_liboverride) { - for (; prev != NULL && (prev->flag & NLATRACK_OVERRIDELIBRARY_LOCAL) == 0; prev = prev->next) { + /* In liboverride case, we only add local tracks after all those comming from the linked data, so + * we need to find the first local track. */ + if (is_liboverride && prev != NULL && (prev->flag & NLATRACK_OVERRIDELIBRARY_LOCAL) == 0) { + NlaTrack *first_local = prev->next; + for (; first_local != NULL && (first_local->flag & NLATRACK_OVERRIDELIBRARY_LOCAL) == 0; + first_local = first_local->next) { } + prev = first_local != NULL ? first_local->prev : NULL; } + /* Add track to stack, and make it the active one. */ if (prev != NULL) { BLI_insertlinkafter(&adt->nla_tracks, prev, nlt); } diff --git a/source/blender/editors/transform/transform_convert_nla.c b/source/blender/editors/transform/transform_convert_nla.c index fa60a88a45b..ada668bcd04 100644 --- a/source/blender/editors/transform/transform_convert_nla.c +++ b/source/blender/editors/transform/transform_convert_nla.c @@ -484,7 +484,7 @@ void recalcData_nla(TransInfo *t) for (track = tdn->nlt->next, n = 0; (track) && (n < delta); track = track->next, n++) { /* check if space in this track for the strip */ if (BKE_nlatrack_has_space(track, strip->start, strip->end) && - !BKE_nlatrack_is_nonlocal_in_liboverride(tdn->id, tdn->nlt)) { + !BKE_nlatrack_is_nonlocal_in_liboverride(tdn->id, track)) { /* move strip to this track */ BLI_remlink(&tdn->nlt->strips, strip); BKE_nlatrack_add_strip(track, strip, is_liboverride); @@ -504,7 +504,7 @@ void recalcData_nla(TransInfo *t) for (track = tdn->nlt->prev, n = 0; (track) && (n < delta); track = track->prev, n++) { /* check if space in this track for the strip */ if (BKE_nlatrack_has_space(track, strip->start, strip->end) && - !BKE_nlatrack_is_nonlocal_in_liboverride(tdn->id, tdn->nlt)) { + !BKE_nlatrack_is_nonlocal_in_liboverride(tdn->id, track)) { /* move strip to this track */ BLI_remlink(&tdn->nlt->strips, strip); BKE_nlatrack_add_strip(track, strip, is_liboverride); |