[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [41304] trunk/blender/source/blender/ editors: Bugfix [#29015] Copy n Paste keyframes and poses broken?

Joshua Leung aligorith at gmail.com
Thu Oct 27 03:55:13 CEST 2011


Revision: 41304
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=41304
Author:   aligorith
Date:     2011-10-27 01:55:10 +0000 (Thu, 27 Oct 2011)
Log Message:
-----------
Bugfix [#29015] Copy n Paste keyframes and poses broken?

Improved error messages presented when trying to paste keyframes.
Previously, "No keyframes to paste" would always be displayed, even if
the copy/paste buffer had some contents but couldn't be pasted if
there weren't any F-Curves selected to paste to.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/animation/keyframes_general.c
    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/animation/keyframes_general.c
===================================================================
--- trunk/blender/source/blender/editors/animation/keyframes_general.c	2011-10-27 01:25:07 UTC (rev 41303)
+++ trunk/blender/source/blender/editors/animation/keyframes_general.c	2011-10-27 01:55:10 UTC (rev 41304)
@@ -757,7 +757,9 @@
 	{0, NULL, 0, NULL, NULL}};
 
 
-/* This function pastes data from the keyframes copy/paste buffer */
+/* This function pastes data from the keyframes copy/paste buffer 
+ * > return status code is whether the method FAILED to do anything
+ */
 short paste_animedit_keys (bAnimContext *ac, ListBase *anim_data,
 			const eKeyPasteOffset offset_mode, const eKeyMergeMode merge_mode)
 {
@@ -773,17 +775,17 @@
 
 	/* check if buffer is empty */
 	if (animcopybuf.first == NULL) {
-		BKE_report(ac->reports, RPT_WARNING, "No data in buffer to paste");
+		BKE_report(ac->reports, RPT_ERROR, "No animation data in buffer to paste");
 		return -1;
 	}
 
 	if (anim_data->first == NULL) {
-		BKE_report(ac->reports, RPT_WARNING, "No FCurves to paste into");
+		BKE_report(ac->reports, RPT_ERROR, "No selected F-Curves to paste into");
 		return -1;
 	}
 	
 	/* mathods of offset */
-	switch(offset_mode) {
+	switch (offset_mode) {
 		case KEYFRAME_PASTE_OFFSET_CFRA_START:
 			offset= (float)(CFRA - animcopy_firstframe);
 			break;

Modified: trunk/blender/source/blender/editors/space_action/action_edit.c
===================================================================
--- trunk/blender/source/blender/editors/space_action/action_edit.c	2011-10-27 01:25:07 UTC (rev 41303)
+++ trunk/blender/source/blender/editors/space_action/action_edit.c	2011-10-27 01:55:10 UTC (rev 41304)
@@ -492,7 +492,6 @@
 	ot->description= "Copy selected keyframes to the copy/paste buffer";
 	
 	/* api callbacks */
-//	ot->invoke= WM_operator_props_popup; // better wait for graph redo panel
 	ot->exec= actkeys_copy_exec;
 	ot->poll= ED_operator_action_active;
 
@@ -510,11 +509,10 @@
 	/* get editor data */
 	if (ANIM_animdata_get_context(C, &ac) == 0)
 		return OPERATOR_CANCELLED;
+		
+	/* ac.reports by default will be the global reports list, which won't show warnings */
+	ac.reports= op->reports;
 	
-	if (ac.reports==NULL) {
-		ac.reports= op->reports;
-	}
-	
 	/* paste keyframes */
 	if (ac.datatype == ANIMCONT_GPENCIL) {
 		// FIXME...
@@ -522,8 +520,8 @@
 		return OPERATOR_CANCELLED;
 	}
 	else {
+		/* non-zero return means an error occurred while trying to paste */
 		if (paste_action_keys(&ac, offset_mode, merge_mode)) {
-			BKE_report(op->reports, RPT_ERROR, "No keyframes to paste");
 			return OPERATOR_CANCELLED;
 		}
 	}
@@ -545,12 +543,14 @@
 	ot->description= "Paste keyframes from copy/paste buffer for the selected channels, starting on the current frame";
 	
 	/* api callbacks */
+//	ot->invoke= WM_operator_props_popup; // better wait for action redo panel
 	ot->exec= actkeys_paste_exec;
 	ot->poll= ED_operator_action_active;
 	
 	/* 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");
 }

Modified: trunk/blender/source/blender/editors/space_graph/graph_edit.c
===================================================================
--- trunk/blender/source/blender/editors/space_graph/graph_edit.c	2011-10-27 01:25:07 UTC (rev 41303)
+++ trunk/blender/source/blender/editors/space_graph/graph_edit.c	2011-10-27 01:55:10 UTC (rev 41304)
@@ -727,11 +727,10 @@
 	if (ANIM_animdata_get_context(C, &ac) == 0)
 		return OPERATOR_CANCELLED;
 	
-	if(ac.reports==NULL) {
-		ac.reports= op->reports;
-	}
+	/* ac.reports by default will be the global reports list, which won't show warnings */
+	ac.reports= op->reports;
 
-	/* paste keyframes */
+	/* paste keyframes - non-zero return means an error occurred while trying to paste */
 	if (paste_graph_keys(&ac, offset_mode, merge_mode)) {
 		return OPERATOR_CANCELLED;
 	}




More information about the Bf-blender-cvs mailing list