[Bf-blender-cvs] [dc4f3080fde] tmp-T82230-nla_remove_hold_reset_behavior: NLA: Strip Evaluate Held Strips Even When Not First Strip

Wayde Moss noreply at git.blender.org
Wed Dec 30 20:33:10 CET 2020


Commit: dc4f3080fde5803e358e51e44668417291c1a3f5
Author: Wayde Moss
Date:   Wed Dec 30 14:29:12 2020 -0500
Branches: tmp-T82230-nla_remove_hold_reset_behavior
https://developer.blender.org/rBdc4f3080fde5803e358e51e44668417291c1a3f5

NLA: Strip Evaluate Held Strips Even When Not First Strip

Changes NLA strip evaluation.

A visual example of the change (with current frame between both strips):

**Before**:
| First strip extrapolation | Next strip extrapolation | Evaluated Strip
| None | Hold | Neither
| Hold or Hold_Forward| Hold | First

**Now**:
| First strip extrapolation | Next strip extrapolation | Evaluated Strip
| None | Hold | Next
| Hold or Hold_Forward | Hold | First

There isn't a concrete use-case for this new behavior. It's more to avoid the case of [None | Hold | Neither] which appears buggy.

UI-wise, the case of `Hold`/`Hold_Forward` leading to a `Hold` will draw with a slightly darker extrapolation area overlay.  Pre-extrapolation and post-extrapolation alpha is changed to the same value now too.

Part of {T82230}
This patch functionally depends on {D9942} to sanely test this patch.

Differential Revision: https://developer.blender.org/D9943

===================================================================

M	source/blender/blenkernel/intern/anim_sys.c
M	source/blender/editors/space_nla/nla_draw.c

===================================================================

diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c
index 20956d6eb18..cef82ade906 100644
--- a/source/blender/blenkernel/intern/anim_sys.c
+++ b/source/blender/blenkernel/intern/anim_sys.c
@@ -877,17 +877,19 @@ NlaEvalStrip *nlastrips_ctime_get_strip(ListBase *list,
         side = NES_TIME_BEFORE;
       }
       else {
-        /* before next strip - previous strip has ended, but next hasn't begun,
-         * so blending mode depends on whether strip is being held or not...
-         * - only occurs when no transition strip added, otherwise the transition would have
-         *   been picked up above...
-         */
-        strip = strip->prev;
+        /* Before current strip - previous strip has ended, but current hasn't begun. */
 
-        if (strip->extendmode != NLASTRIP_EXTEND_NOTHING) {
+        /* Order of branch important to give previous strip extrapolation higher priority.*/
+        if (strip->prev->extendmode != NLASTRIP_EXTEND_NOTHING) {
+          /* Previous strip extrapolates forward. */
+          estrip = strip->prev;
+          side = NES_TIME_AFTER;
+        }
+        else if (strip->extendmode == NLASTRIP_EXTEND_HOLD) {
+          /* Let current strip extrapolates backward. */
           estrip = strip;
+          side = NES_TIME_BEFORE;
         }
-        side = NES_TIME_AFTER;
       }
       break;
     }
diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c
index 6fe980cf657..0ff656f340a 100644
--- a/source/blender/editors/space_nla/nla_draw.c
+++ b/source/blender/editors/space_nla/nla_draw.c
@@ -463,11 +463,17 @@ static void nla_draw_strip(SpaceNla *snla,
          */
         if (strip->prev == NULL) {
           /* set the drawing color to the color of the strip, but with very faint alpha */
-          immUniformColor3fvAlpha(color, 0.15f);
+          immUniformColor3fvAlpha(color, 0.30f);
 
           /* draw the rect to the edge of the screen */
           immRectf(shdr_pos, v2d->cur.xmin, yminc, strip->start, ymaxc);
         }
+        else {
+          immUniformColor3fvAlpha(color, 0.30f);
+          /* Draw the rect to the prev strip. This will overlap with previous strip's Hold_Forward
+           * which is OK. */
+          immRectf(shdr_pos, strip->prev->end, yminc, strip->start, ymaxc);
+        }
         ATTR_FALLTHROUGH;
 
       /* this only draws after the strip */



More information about the Bf-blender-cvs mailing list