NLA - Quick patch bugfix

When there were no strips but some empty tracks, the active action should be evaluated normally. This is not an optimal solution (more user testing + suggestions regarding the best way to do this is welcome).
This commit is contained in:
Joshua Leung 2009-08-04 10:31:25 +00:00
parent 610d9348f5
commit 2a999890fb

@ -1202,6 +1202,7 @@ static void animsys_evaluate_nla (PointerRNA *ptr, AnimData *adt, float ctime)
NlaTrack *nlt;
short track_index=0;
short has_strips = 0;
ListBase estrips= {NULL, NULL};
ListBase echannels= {NULL, NULL};
@ -1223,6 +1224,12 @@ static void animsys_evaluate_nla (PointerRNA *ptr, AnimData *adt, float ctime)
if (nlt->flag & NLATRACK_MUTED)
continue;
/* if this track has strips (but maybe they won't be suitable), set has_strips
* - used for mainly for still allowing normal action evaluation...
*/
if (nlt->strips.first)
has_strips= 1;
/* otherwise, get strip to evaluate for this channel */
nes= nlastrips_ctime_get_strip(&estrips, &nlt->strips, track_index, ctime);
if (nes) nes->track= nlt;
@ -1232,6 +1239,8 @@ static void animsys_evaluate_nla (PointerRNA *ptr, AnimData *adt, float ctime)
* - only do this if we're not exclusively evaluating the 'solo' NLA-track
*/
if ((adt->action) && !(adt->flag & ADT_NLA_SOLO_TRACK)) {
/* if there are strips, evaluate action as per NLA rules */
if (has_strips) {
/* make dummy NLA strip, and add that to the stack */
memset(&dummy_strip, 0, sizeof(NlaStrip));
dummy_trackslist.first= dummy_trackslist.last= &dummy_strip;
@ -1239,6 +1248,7 @@ static void animsys_evaluate_nla (PointerRNA *ptr, AnimData *adt, float ctime)
dummy_strip.act= adt->action;
dummy_strip.remap= adt->remap;
// FIXME: what happens when we want to included F-Modifier access?
calc_action_range(dummy_strip.act, &dummy_strip.actstart, &dummy_strip.actend, 1);
dummy_strip.start = dummy_strip.actstart;
dummy_strip.end = (IS_EQ(dummy_strip.actstart, dummy_strip.actend)) ? (dummy_strip.actstart + 1.0f): (dummy_strip.actend);
@ -1250,6 +1260,13 @@ static void animsys_evaluate_nla (PointerRNA *ptr, AnimData *adt, float ctime)
/* add this to our list of evaluation strips */
nlastrips_ctime_get_strip(&estrips, &dummy_trackslist, -1, ctime);
}
else {
/* special case - evaluate as if there isn't any NLA data */
// TODO: this is really just a stop-gap measure...
animsys_evaluate_action(ptr, adt->action, adt->remap, ctime);
return;
}
}
/* only continue if there are strips to evaluate */
if (estrips.first == NULL)