Bugfix [#28468] Cannot enter "Tweak mode" on mutiple objects at the same time,

though it initially works

Problem was that in the past it was possible to have multiple strips/tracks
tagged as "active", but now after getting a correct implementation, we can no
longer have that, and thus entering Tweak Mode only works on the last selected
strip.

However this is problematic in cases when you want to tweak the keyframes of
several objects (which may only have a single strip each) in order to get them
to line up with each other. This hack caters for this case (selecting multiple
strips from the same AnimData block is still impossible and insane/illogical and
is not allowed).

This may have implications for some future tools which make assumptions about
certain aspects of NLA state. However, it shouldn't cause too many problems
(hopefully ;)
This commit is contained in:
Joshua Leung 2012-01-22 04:30:52 +00:00
parent af9ac97b2e
commit 7d13619990

@ -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");