[Bf-blender-cvs] [d2202117fe2] master: T50354: Action length calculation added unnecessary padding if some F-Curves only contained a single key (on the last real frame of the action).

Joshua Leung noreply at git.blender.org
Tue Sep 12 14:55:29 CEST 2017


Commit: d2202117fe2cb596e4a6d817300e8f46428ee956
Author: Joshua Leung
Date:   Tue Sep 12 12:35:04 2017 +1200
Branches: master
https://developer.blender.org/rBd2202117fe2cb596e4a6d817300e8f46428ee956

T50354: Action length calculation added unnecessary padding if some F-Curves
only contained a single key (on the last real frame of the action).

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

M	source/blender/blenkernel/intern/action.c

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

diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c
index bb4e09364d4..5bd6085c8f5 100644
--- a/source/blender/blenkernel/intern/action.c
+++ b/source/blender/blenkernel/intern/action.c
@@ -1129,9 +1129,13 @@ void calc_action_range(const bAction *act, float *start, float *end, short incl_
 			if (fcu->totvert) {
 				float nmin, nmax;
 				
-				/* get extents for this curve */
-				/* TODO: allow enabling/disabling this? */
-				calc_fcurve_range(fcu, &nmin, &nmax, false, true);
+				/* get extents for this curve
+				 * - no "selected only", since this is often used in the backend
+				 * - no "minimum length" (we will apply this later), otherwise
+				 *   single-keyframe curves will increase the overall length by
+				 *   a phantom frame (T50354)
+				 */
+				calc_fcurve_range(fcu, &nmin, &nmax, false, false);
 				
 				/* compare to the running tally */
 				min = min_ff(min, nmin);
@@ -1184,7 +1188,9 @@ void calc_action_range(const bAction *act, float *start, float *end, short incl_
 	}
 	
 	if (foundvert || foundmod) {
+		/* ensure that action is at least 1 frame long (for NLA strips to have a valid length) */
 		if (min == max) max += 1.0f;
+		
 		*start = min;
 		*end = max;
 	}



More information about the Bf-blender-cvs mailing list