[Bf-blender-cvs] [0c5d042] master: NLA Strip Keyframes: Insert keyframe tools in Anim Editors work now

Joshua Leung noreply at git.blender.org
Sat Mar 28 15:08:14 CET 2015


Commit: 0c5d0422b4fb8b058826db9a7b0f11868aedaa0d
Author: Joshua Leung
Date:   Sun Mar 29 02:20:57 2015 +1300
Branches: master
https://developer.blender.org/rB0c5d0422b4fb8b058826db9a7b0f11868aedaa0d

NLA Strip Keyframes: Insert keyframe tools in Anim Editors work now

* Insert Keyframe tool for Dopesheet/Graph Editors needed to be modified to
  not try to resolve the paths for NLA Control Curves
* For now, the poll callback to get the "Active FCurve" also works when given
  a NLA control curve. They're really the same in most cases, and this should
  be fine until one of the channels does something funky.

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

M	source/blender/editors/space_action/action_edit.c
M	source/blender/editors/space_graph/graph_edit.c
M	source/blender/editors/space_graph/graph_utils.c

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

diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c
index 0c2575e..740992a 100644
--- a/source/blender/editors/space_action/action_edit.c
+++ b/source/blender/editors/space_action/action_edit.c
@@ -1082,8 +1082,13 @@ static void insert_action_keys(bAnimContext *ac, short mode)
 		else 
 			cfra = (float)CFRA;
 			
-		/* if there's an id */
-		if (ale->id)
+		/* read value from property the F-Curve represents, or from the curve only?
+		 * - ale->id != NULL:    Typically, this means that we have enough info to try resolving the path
+		 * - ale->owner != NULL: If this is set, then the path may not be resolvable from the ID alone,
+		 *                       so it's easier for now to just read the F-Curve directly.
+		 *                       (TODO: add the full-blown PointerRNA relative parsing case here...)
+		 */
+		if (ale->id && !ale->owner)
 			insert_keyframe(reports, ale->id, NULL, ((fcu->grp) ? (fcu->grp->name) : (NULL)), fcu->rna_path, fcu->array_index, cfra, flag);
 		else
 			insert_vert_fcurve(fcu, cfra, fcu->curval, 0);
diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c
index 2944901..559eec8 100644
--- a/source/blender/editors/space_graph/graph_edit.c
+++ b/source/blender/editors/space_graph/graph_edit.c
@@ -498,12 +498,17 @@ static void insert_graph_keys(bAnimContext *ac, short mode)
 		else 
 			cfra = (float)CFRA;
 			
-		/* if there's an id */
-		if (ale->id)
+		/* read value from property the F-Curve represents, or from the curve only?
+		 * - ale->id != NULL:    Typically, this means that we have enough info to try resolving the path
+		 * - ale->owner != NULL: If this is set, then the path may not be resolvable from the ID alone,
+		 *                       so it's easier for now to just read the F-Curve directly.
+		 *                       (TODO: add the full-blown PointerRNA relative parsing case here...)
+		 */
+		if (ale->id && !ale->owner)
 			insert_keyframe(reports, ale->id, NULL, ((fcu->grp) ? (fcu->grp->name) : (NULL)), fcu->rna_path, fcu->array_index, cfra, flag);
 		else
 			insert_vert_fcurve(fcu, cfra, fcu->curval, 0);
-
+		
 		ale->update |= ANIM_UPDATE_DEFAULT;
 	}
 	
@@ -596,12 +601,12 @@ static int graphkeys_click_insert_exec(bContext *C, wmOperator *op)
 		
 		/* insert keyframe on the specified frame + value */
 		insert_vert_fcurve(fcu, frame, val, 0);
-
+		
 		ale->update |= ANIM_UPDATE_DEPS;
-
+		
 		BLI_listbase_clear(&anim_data);
 		BLI_addtail(&anim_data, ale);
-
+		
 		ANIM_animdata_update(&ac, &anim_data);
 	}
 	else {
diff --git a/source/blender/editors/space_graph/graph_utils.c b/source/blender/editors/space_graph/graph_utils.c
index eea360c..0e56dc8 100644
--- a/source/blender/editors/space_graph/graph_utils.c
+++ b/source/blender/editors/space_graph/graph_utils.c
@@ -210,13 +210,18 @@ int graphop_active_fcurve_poll(bContext *C)
 	if (ale == NULL)
 		return 0;
 		
-	/* free temp data... */
-	has_fcurve = ((ale->data) && (ale->type == ANIMTYPE_FCURVE));
+	/* do we have a suitable F-Curves?
+	 * - For most cases, NLA Control Curves are sufficiently similar to NLA curves to serve this role too.
+	 *   Under the hood, they are F-Curves too. The only problems which will arise here are if these need to be
+	 *   in an Action too (but drivers would then also be affected!)
+	 */
+	has_fcurve = ((ale->data) && ELEM(ale->type, ANIMTYPE_FCURVE, ANIMTYPE_NLACURVE));
 	if (has_fcurve) {
 		FCurve *fcu = (FCurve *)ale->data;
 		has_fcurve = (fcu->flag & FCURVE_VISIBLE) != 0;
 	}
 	
+	/* free temp data... */
 	MEM_freeN(ale);
 	
 	/* return success */




More information about the Bf-blender-cvs mailing list