diff options
author | Bastien Montagne <bastien@blender.org> | 2021-01-12 13:30:08 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2021-01-12 13:32:17 +0300 |
commit | 89ae4a7a2a9a067dd425d9ae5c63aabcc60a986e (patch) | |
tree | b4fa85da3916f14aa7a7c8729a267bd1a3c02d5a /source/blender/blenkernel/intern | |
parent | 401279253ea6109cec9ccfd1d94ba0ab9fdbf7bc (diff) |
Fix NLA liboverride issues re tracks handling.
From original rBc0bd240ad0a1 commit, issues reported with suggested
fixes by Wayde Moss (@GuiltyGhost), thx.
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/nla.c | 11 |
1 files changed, 8 insertions, 3 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); } |