From 91f90f61d39f261b9984d3305566f53fc06984dd Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Sat, 3 May 2014 22:08:35 +1200 Subject: [PATCH] NLA Eval Bugfix: Influence settings on active action didn't work * The automatically calculated influence was overriding the value we were passing into the dummy strip, making this seem like it doesn't work * Made some tweaks to prevent some potential memory-related bugs - nlastrips_ctime_get_strip() actually saves off references to the list of strips it gets, so declaring dummy_strip in an inner scope like this could potentially be quite dangerous - Prevented a potential memory leak for the early abort when there are no strips for whatever reason (it shouldn't occur though) --- source/blender/blenkernel/intern/anim_sys.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index ae4580bfdfe..00faa1cb5bf 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -2249,6 +2249,9 @@ static void animsys_evaluate_nla(ListBase *echannels, PointerRNA *ptr, AnimData ListBase estrips = {NULL, NULL}; NlaEvalStrip *nes; + NlaStrip dummy_strip = {NULL}; /* dummy strip for active action */ + + /* 1. get the stack of strips to evaluate at current time (influence calculated here) */ for (nlt = adt->nla_tracks.first; nlt; nlt = nlt->next, track_index++) { /* stop here if tweaking is on and this strip is the tweaking track (it will be the first one that's 'disabled')... */ @@ -2282,7 +2285,6 @@ static void animsys_evaluate_nla(ListBase *echannels, PointerRNA *ptr, AnimData /* if there are strips, evaluate action as per NLA rules */ if ((has_strips) || (adt->actstrip)) { /* make dummy NLA strip, and add that to the stack */ - NlaStrip dummy_strip = {NULL}; ListBase dummy_trackslist; dummy_trackslist.first = dummy_trackslist.last = &dummy_strip; @@ -2305,6 +2307,9 @@ static void animsys_evaluate_nla(ListBase *echannels, PointerRNA *ptr, AnimData dummy_strip.blendmode = adt->act_blendmode; dummy_strip.extendmode = adt->act_extendmode; dummy_strip.influence = adt->act_influence; + + /* NOTE: must set this, or else the default setting overrides, and this setting doesn't work */ + dummy_strip.flag |= NLASTRIP_FLAG_USR_INFLUENCE; } /* add this to our list of evaluation strips */ @@ -2313,7 +2318,10 @@ static void animsys_evaluate_nla(ListBase *echannels, PointerRNA *ptr, AnimData else { /* special case - evaluate as if there isn't any NLA data */ /* TODO: this is really just a stop-gap measure... */ + if (G.debug & G_DEBUG) printf("NLA Eval: Stopgap for active action on NLA Stack - no strips case\n"); + animsys_evaluate_action(ptr, adt->action, adt->remap, ctime); + BLI_freelistN(&estrips); return; } }