[Bf-blender-cvs] [2826c2be545] master: NLA: ignore time range when evaluating a raw action.

Alexander Gavrilov noreply at git.blender.org
Sat Jan 12 12:25:37 CET 2019


Commit: 2826c2be545ee0382ef37da0b0b919757b75f10a
Author: Alexander Gavrilov
Date:   Sat Jan 12 14:10:09 2019 +0300
Branches: master
https://developer.blender.org/rB2826c2be545ee0382ef37da0b0b919757b75f10a

NLA: ignore time range when evaluating a raw action.

When editing an action without a strip, or tweaking a strip without
time mapping enabled or supported, the extents of the virtual strip
can't be controlled and are purely derived from keys in the action.

Thus, cutting off evaluation of the action at these arbitrary points
gets in the way of observing the natural extrapolation of the F-Curves
and thus appears to be a mis-feature.

With this change non-mapped actions are evaluated with infinite
range, exactly like they are handled without NLA, unless extend
mode is set to Nothing.

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

M	source/blender/blenkernel/intern/anim_sys.c
M	source/blender/makesdna/DNA_anim_types.h

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

diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c
index c5a21342dc0..5ec3b931f09 100644
--- a/source/blender/blenkernel/intern/anim_sys.c
+++ b/source/blender/blenkernel/intern/anim_sys.c
@@ -1888,11 +1888,18 @@ static void nlastrip_evaluate_controls(Depsgraph *depsgraph, NlaStrip *strip, fl
 	 * - we do this after the F-Curves have been evaluated to override the effects of those
 	 *   in case the override has been turned off.
 	 */
-	if ((strip->flag & NLASTRIP_FLAG_USR_TIME) == 0)
-		strip->strip_time = nlastrip_get_frame(strip, ctime, NLATIME_CONVERT_EVAL);
 	if ((strip->flag & NLASTRIP_FLAG_USR_INFLUENCE) == 0)
 		strip->influence = nlastrip_get_influence(strip, ctime);
 
+	/* Bypass evaluation time computation if time mapping is disabled. */
+	if ((strip->flag & NLASTRIP_FLAG_NO_TIME_MAP) != 0) {
+		strip->strip_time = ctime;
+		return;
+	}
+
+	if ((strip->flag & NLASTRIP_FLAG_USR_TIME) == 0)
+		strip->strip_time = nlastrip_get_frame(strip, ctime, NLATIME_CONVERT_EVAL);
+
 	/* if user can control the evaluation time (using F-Curves), consider the option which allows this time to be clamped
 	 * to lie within extents of the action-clip, so that a steady changing rate of progress through several cycles of the clip
 	 * can be achieved easily
@@ -1912,7 +1919,7 @@ NlaEvalStrip *nlastrips_ctime_get_strip(Depsgraph *depsgraph, ListBase *list, Li
 	/* loop over strips, checking if they fall within the range */
 	for (strip = strips->first; strip; strip = strip->next) {
 		/* check if current time occurs within this strip  */
-		if (IN_RANGE_INCL(ctime, strip->start, strip->end)) {
+		if (IN_RANGE_INCL(ctime, strip->start, strip->end) || (strip->flag & NLASTRIP_FLAG_NO_TIME_MAP)) {
 			/* this strip is active, so try to use it */
 			estrip = strip;
 			side = NES_TIME_WITHIN;
@@ -2971,13 +2978,18 @@ static bool animsys_evaluate_nla(Depsgraph *depsgraph, NlaEvalData *echannels, P
 				/* Always use the blend mode of the strip in tweak mode, even if not in-place. */
 				if (nlt && adt->actstrip) {
 					dummy_strip->blendmode = adt->actstrip->blendmode;
-					dummy_strip->extendmode = adt->actstrip->extendmode;
+					dummy_strip->extendmode = NLASTRIP_EXTEND_HOLD;
 				}
 				else {
 					dummy_strip->blendmode = adt->act_blendmode;
 					dummy_strip->extendmode = adt->act_extendmode;
 				}
 
+				/* Unless extendmode is Nothing (might be useful for flattening NLA evaluation), disable range. */
+				if (dummy_strip->extendmode != NLASTRIP_EXTEND_NOTHING) {
+					dummy_strip->flag |= NLASTRIP_FLAG_NO_TIME_MAP;
+				}
+
 				dummy_strip->influence = adt->act_influence;
 
 				/* NOTE: must set this, or else the default setting overrides, and this setting doesn't work */
diff --git a/source/blender/makesdna/DNA_anim_types.h b/source/blender/makesdna/DNA_anim_types.h
index 8e89f4a42b7..15203812b2d 100644
--- a/source/blender/makesdna/DNA_anim_types.h
+++ b/source/blender/makesdna/DNA_anim_types.h
@@ -763,6 +763,8 @@ typedef enum eNlaStrip_Flag {
 	NLASTRIP_FLAG_MIRROR        = (1<<13),
 
 	/* temporary editing flags */
+		/* NLA strip should ignore frame range and hold settings, and evaluate at global time. */
+	NLASTRIP_FLAG_NO_TIME_MAP   = (1<<29),
 		/* NLA-Strip is really just a temporary meta used to facilitate easier transform code */
 	NLASTRIP_FLAG_TEMP_META     = (1<<30),
 	NLASTRIP_FLAG_EDIT_TOUCHED  = (1u << 31)



More information about the Bf-blender-cvs mailing list