diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c index fd184b9def4..147f39b6728 100644 --- a/source/blender/blenkernel/intern/nla.c +++ b/source/blender/blenkernel/intern/nla.c @@ -1542,6 +1542,34 @@ short BKE_nla_tweakmode_enter (AnimData *adt) break; } } + + /* There are situations where we may have multiple strips selected and we want to enter tweakmode on all + * of those at once. Usually in those cases, it will usually just be a single strip per AnimData. + * In such cases, compromise and take the last selected track and/or last selected strip [#28468] + */ + if (activeTrack == NULL) { + /* try last selected track for active strip */ + for (nlt = adt->nla_tracks.last; nlt; nlt = nlt->prev) { + if (nlt->flag & NLATRACK_SELECTED) { + /* assume this is the active track */ + activeTrack= nlt; + + /* try to find active strip */ + activeStrip= BKE_nlastrip_find_active(nlt); + break; + } + } + } + if ((activeTrack) && (activeStrip == NULL)) { + /* no active strip in active or last selected track; compromise for first selected (assuming only single)... */ + for (strip = activeTrack->strips.first; strip; strip= strip->next) { + if (strip->flag & (NLASTRIP_FLAG_SELECT|NLASTRIP_FLAG_ACTIVE)) { + activeStrip = strip; + break; + } + } + } + if ELEM3(NULL, activeTrack, activeStrip, activeStrip->act) { if (G.f & G_DEBUG) { printf("NLA tweakmode enter - neither active requirement found \n");