Fix NLA liboverride issues re tracks handling.
From original rBc0bd240ad0a1 commit, issues reported with suggested fixes by Wayde Moss (@GuiltyGhost), thx.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user