[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [47331] trunk/blender/source/blender/ editors: Tweaks for Pasting Keyframes in DopeSheet/Graph Editors

Joshua Leung aligorith at gmail.com
Fri Jun 1 17:00:28 CEST 2012


Revision: 47331
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=47331
Author:   aligorith
Date:     2012-06-01 15:00:28 +0000 (Fri, 01 Jun 2012)
Log Message:
-----------
Tweaks for Pasting Keyframes in DopeSheet/Graph Editors

In response to [#31670], I've reviewed the way that the Paste Keyframes tool for
the DopeSheet and Graph Editors works. Previously, it required you to always
select the F-Curves to paste the keyframes into before allowing you to paste
keyframes. This was because it is quite difficult to infer which ID-block's set
of curves is intended if more than one ID-block has similar curves (e.g. a scene
with two materials, and both have their diffuse color animated). The underlying
assumption and intention of the feature here was that the copy+paste were only
being used by animators to copy animation between similar curves, to transfer
and offset animation across block boundaries.

However, it turns out that many people were by far more familiar with the
simpler copy/paste paradigm from everywhere else (i.e. instead of trying to use
duplicate to copy keyframes around within their respective F-Curves).
Furthermore, in most cases there is only going to be a single character being
animated at a time (vs multiple), which means that most of the time the matching
problem is much simpler.

Hence, the Paste now works as follows:
- If there are selected F-Curves, we limit the paste-matching to only consider
those in the selected F-Curves. This makes it possible to still explicitly
specify where to paste.
- In the more general case (no prior selections), pasting will try to match
anything relevant it finds.

TODO:
- Check on whether the strictest matching level needs adjustments to limit the
number of false positives
- Testing and feedback of the new behaviour needed <--- ANIMATORS! PLEASE TEST

Modified Paths:
--------------
    trunk/blender/source/blender/editors/space_action/action_edit.c
    trunk/blender/source/blender/editors/space_graph/graph_edit.c

Modified: trunk/blender/source/blender/editors/space_action/action_edit.c
===================================================================
--- trunk/blender/source/blender/editors/space_action/action_edit.c	2012-06-01 14:59:06 UTC (rev 47330)
+++ trunk/blender/source/blender/editors/space_action/action_edit.c	2012-06-01 15:00:28 UTC (rev 47331)
@@ -445,10 +445,17 @@
 	ListBase anim_data = {NULL, NULL};
 	int filter, ok = 0;
 	
-	/* filter data */
-	filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS);
-	ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
+	/* filter data 
+	 * - First time we try to filter more strictly, allowing only selected channels 
+	 *   to allow copying animation between channels
+	 * - Second time, we loosen things up if nothing was found the first time, allowing
+	 *   users to just paste keyframes back into the original curve again [#31670]
+	 */
+	filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS);
 	
+	if (ANIM_animdata_filter(ac, &anim_data, filter | ANIMFILTER_SEL, ac->data, ac->datatype) == 0)
+		ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
+	
 	/* paste keyframes */
 	ok = paste_animedit_keys(ac, &anim_data, offset_mode, merge_mode);
 	

Modified: trunk/blender/source/blender/editors/space_graph/graph_edit.c
===================================================================
--- trunk/blender/source/blender/editors/space_graph/graph_edit.c	2012-06-01 14:59:06 UTC (rev 47330)
+++ trunk/blender/source/blender/editors/space_graph/graph_edit.c	2012-06-01 15:00:28 UTC (rev 47331)
@@ -684,10 +684,17 @@
 	ListBase anim_data = {NULL, NULL};
 	int filter, ok = 0;
 	
-	/* filter data */
-	filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
-	ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
+	/* filter data 
+	 * - First time we try to filter more strictly, allowing only selected channels 
+	 *   to allow copying animation between channels
+	 * - Second time, we loosen things up if nothing was found the first time, allowing
+	 *   users to just paste keyframes back into the original curve again [#31670]
+	 */
+	filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
 	
+	if (ANIM_animdata_filter(ac, &anim_data, filter | ANIMFILTER_SEL, ac->data, ac->datatype) == 0)
+		ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
+	
 	/* paste keyframes */
 	ok = paste_animedit_keys(ac, &anim_data, offset_mode, merge_mode);
 	
@@ -776,7 +783,8 @@
 	
 	/* flags */
 	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
+	
+	/* props */
 	RNA_def_enum(ot->srna, "offset", keyframe_paste_offset_items, KEYFRAME_PASTE_OFFSET_CFRA_START, "Offset", "Paste time offset of keys");
 	RNA_def_enum(ot->srna, "merge", keyframe_paste_merge_items, KEYFRAME_PASTE_MERGE_MIX, "Type", "Method of merging pasted keys and existing");
 }




More information about the Bf-blender-cvs mailing list