diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/nla.c | 12 | ||||
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 3 | ||||
-rw-r--r-- | source/blender/editors/animation/anim_filter.c | 18 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_anim_types.h | 2 |
4 files changed, 15 insertions, 20 deletions
diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c index eaa4460ce70..650efea2e96 100644 --- a/source/blender/blenkernel/intern/nla.c +++ b/source/blender/blenkernel/intern/nla.c @@ -535,9 +535,14 @@ float BKE_nla_tweakedit_remap(AnimData *adt, float cframe, short mode) /* if the active-strip info has been stored already, access this, otherwise look this up * and store for (very probable) future usage */ + if (adt->act_track == NULL) { + if (adt->actstrip) + adt->act_track = BKE_nlatrack_find_tweaked(adt); + else + adt->act_track = BKE_nlatrack_find_active(&adt->nla_tracks); + } if (adt->actstrip == NULL) { - NlaTrack *nlt = BKE_nlatrack_find_active(&adt->nla_tracks); - adt->actstrip = BKE_nlastrip_find_active(nlt); + adt->actstrip = BKE_nlastrip_find_active(adt->act_track); } strip = adt->actstrip; @@ -931,7 +936,6 @@ NlaTrack *BKE_nlatrack_find_active(ListBase *tracks) * as just using the active track, since multiple tracks may have been * entered at the same time. */ -// TODO: Store this info in AnimData... Old files would still need to use this function for version patching though NlaTrack *BKE_nlatrack_find_tweaked(AnimData *adt) { NlaTrack *nlt; @@ -1796,6 +1800,7 @@ bool BKE_nla_tweakmode_enter(AnimData *adt) */ adt->tmpact = adt->action; adt->action = activeStrip->act; + adt->act_track = activeTrack; adt->actstrip = activeStrip; id_us_plus(&activeStrip->act->id); adt->flag |= ADT_NLA_EDIT_ON; @@ -1855,6 +1860,7 @@ void BKE_nla_tweakmode_exit(AnimData *adt) if (adt->action) adt->action->id.us--; adt->action = adt->tmpact; adt->tmpact = NULL; + adt->act_track = NULL; adt->actstrip = NULL; adt->flag &= ~ADT_NLA_EDIT_ON; } diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 9a269cad756..9dd5245dcbf 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -2431,12 +2431,13 @@ static void direct_link_animdata(FileData *fd, AnimData *adt) link_list(fd, &adt->nla_tracks); direct_link_nladata(fd, &adt->nla_tracks); - /* relink active strip - even though strictly speaking this should only be used + /* relink active track/strip - even though strictly speaking this should only be used * if we're in 'tweaking mode', we need to be able to have this loaded back for * undo, but also since users may not exit tweakmode before saving (#24535) */ // TODO: it's not really nice that anyone should be able to save the file in this // state, but it's going to be too hard to enforce this single case... + adt->act_track = newdataadr(fd, adt->act_track); adt->actstrip = newdataadr(fd, adt->actstrip); } diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index 25f2b0b43af..f575326083a 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -1301,22 +1301,8 @@ static size_t animfilter_nla(bAnimContext *UNUSED(ac), ListBase *anim_data, bDop * - active track should still get shown though (even though it has disabled flag set) */ // FIXME: the channels after should still get drawn, just 'differently', and after an active-action channel - if ((adt->flag & ADT_NLA_EDIT_ON) && (nlt->flag & NLATRACK_DISABLED)) { - /* NOTE: The tweaking track may not be active, if strips from different AnimData blocks - * entered tweakmode at the same time. Since this loop works both ways, we can't - * just stop on the first disabled track we encounter... - */ - if (nlt->flag & NLATRACK_ACTIVE) { - /* OK = "the" active track */ - } - else if (BLI_findindex(&nlt->strips, adt->actstrip) != -1) { - /* OK = this is the one containing the active strip */ - } - else { - /* Not OK - neither of the previous two were met, so it must be one of the "later" ones */ - continue; - } - } + if ((adt->flag & ADT_NLA_EDIT_ON) && (nlt->flag & NLATRACK_DISABLED) && (adt->act_track != nlt)) + continue; /* only work with this channel and its subchannels if it is editable */ if (!(filter_mode & ANIMFILTER_FOREDIT) || EDITABLE_NLT(nlt)) { diff --git a/source/blender/makesdna/DNA_anim_types.h b/source/blender/makesdna/DNA_anim_types.h index 693e0fc1293..68f80cb27d8 100644 --- a/source/blender/makesdna/DNA_anim_types.h +++ b/source/blender/makesdna/DNA_anim_types.h @@ -853,6 +853,8 @@ typedef struct AnimData { /* nla-tracks */ ListBase nla_tracks; + /* active NLA-track (only set/used during tweaking, so no need to worry about dangling pointers) */ + NlaTrack *act_track; /* active NLA-strip (only set/used during tweaking, so no need to worry about dangling pointers) */ NlaStrip *actstrip; |