[Bf-blender-cvs] [2b4ff14] master: Fix T36385: Animated Strip-Time doesnt update

Joshua Leung noreply at git.blender.org
Sat Mar 28 15:07:59 CET 2015


Commit: 2b4ff142ab542b3ef689e73e18b06f8bfaedf89f
Author: Joshua Leung
Date:   Fri Jan 24 15:48:36 2014 +1300
Branches: master
https://developer.blender.org/rB2b4ff142ab542b3ef689e73e18b06f8bfaedf89f

Fix T36385: Animated Strip-Time doesnt update

This commit implements proper evaluation + keyframing support for animating influence
and time on NLA Strips (among other properties) by resolving a few long standing issues
which prevented the original design for this from working.

The original design for animating these properties (and/or some of the other settings
on NLA Strips) is that NLA Strips actually have some of their own F-Curves that are
used for animating settings which will affect how they are evaluated. As seen in this
bug report, the alternative of having these animated as part of the stack (which the
strips work above/outside/on-top of) means that glitches can occur.

Although one of the original considerations for why this wasn't implemented earlier
was that introducing keyframes there isn't so clean cut, and causes UI design issues
for how we expose these via the animation editors for editing (NOTE: support for that
is still to come). Another concern is that this sets a precedent for how FModifiers
might get evaluated.

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

M	source/blender/blenkernel/intern/anim_sys.c
M	source/blender/editors/animation/keyframing.c

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

diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c
index effe32a..59cc23a 100644
--- a/source/blender/blenkernel/intern/anim_sys.c
+++ b/source/blender/blenkernel/intern/anim_sys.c
@@ -1496,8 +1496,11 @@ static bool animsys_write_rna_setting(PointerRNA *ptr, char *path, int array_ind
 	
 	/* get property to write to */
 	if (RNA_path_resolve_property(ptr, path, &new_ptr, &prop)) {
-		/* set value - only for animatable numerical values */
-		if (RNA_property_animateable(&new_ptr, prop)) {
+		/* set value for animatable numerical values only
+		 * HACK: some local F-Curves (e.g. those on NLA Strips) are evaluated
+		 *       without an ID provided, which causes the animateable test to fail!
+		 */
+		if (RNA_property_animateable(&new_ptr, prop) || (ptr->id.data == NULL)) {
 			int array_len = RNA_property_array_length(&new_ptr, prop);
 			bool written = false;
 			
diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c
index 7e2ce4c..68ef704 100644
--- a/source/blender/editors/animation/keyframing.c
+++ b/source/blender/editors/animation/keyframing.c
@@ -1707,33 +1707,39 @@ static int insert_key_button_exec(bContext *C, wmOperator *op)
 	UI_context_active_but_prop_get(C, &ptr, &prop, &index);
 	
 	if ((ptr.id.data && ptr.data && prop) && RNA_property_animateable(&ptr, prop)) {
-		path = RNA_path_from_ID_to_property(&ptr, prop);
-		
-		if (path) {
-			if (all) {
-				length = RNA_property_array_length(&ptr, prop);
-				
-				if (length) index = 0;
-				else length = 1;
-			}
-			else
-				length = 1;
-			
-			for (a = 0; a < length; a++)
-				success += insert_keyframe(op->reports, ptr.id.data, NULL, NULL, path, index + a, cfra, flag);
-			
-			MEM_freeN(path);
-		}
-		else if (ptr.type == &RNA_NlaStrip) {
-			/* handle special vars for NLA-strips */
+		if (ptr.type == &RNA_NlaStrip) {
+			/* Handle special properties for NLA Strips, whose F-Curves are stored on the
+			 * strips themselves. These are stored separately or else the properties will
+			 * not have any effect.
+			 */
 			NlaStrip *strip = (NlaStrip *)ptr.data;
 			FCurve *fcu = list_find_fcurve(&strip->fcurves, RNA_property_identifier(prop), flag);
 			
 			success += insert_keyframe_direct(op->reports, ptr, prop, fcu, cfra, 0);
 		}
 		else {
-			BKE_report(op->reports, RPT_WARNING, 
-			           "Failed to resolve path to property, try manually specifying this using a Keying Set instead");
+			/* standard properties */
+			path = RNA_path_from_ID_to_property(&ptr, prop);
+			
+			if (path) {
+				if (all) {
+					length = RNA_property_array_length(&ptr, prop);
+					
+					if (length) index = 0;
+					else length = 1;
+				}
+				else
+					length = 1;
+				
+				for (a = 0; a < length; a++)
+					success += insert_keyframe(op->reports, ptr.id.data, NULL, NULL, path, index + a, cfra, flag);
+				
+				MEM_freeN(path);
+			}
+			else {
+				BKE_report(op->reports, RPT_WARNING, 
+						   "Failed to resolve path to property, try manually specifying this using a Keying Set instead");
+			}
 		}
 	}
 	else {




More information about the Bf-blender-cvs mailing list