[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [13134] trunk/blender/source/blender/src/ editaction.c: Action Editor Bugfixes:

Joshua Leung aligorith at gmail.com
Sat Jan 5 05:07:32 CET 2008


Revision: 13134
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=13134
Author:   aligorith
Date:     2008-01-05 05:07:28 +0100 (Sat, 05 Jan 2008)

Log Message:
-----------
Action Editor Bugfixes:
* NKEY popup for renaming channels was not working correctly. A typo meant that it only showed when the mouse was in the timeline area, not when it was over the channel names.

* Added a few safety checks to copy/paste to hopefully prevent crashes. Also, when there's only one channel in the buffer, it now copies all the data from that to all selected channels.

Modified Paths:
--------------
    trunk/blender/source/blender/src/editaction.c

Modified: trunk/blender/source/blender/src/editaction.c
===================================================================
--- trunk/blender/source/blender/src/editaction.c	2008-01-04 23:17:08 UTC (rev 13133)
+++ trunk/blender/source/blender/src/editaction.c	2008-01-05 04:07:28 UTC (rev 13134)
@@ -1179,6 +1179,8 @@
 		
 		BLI_freelinkN(&actcopybuf, achan);
 	}
+	
+	actcopybuf.first= actcopybuf.last= NULL;
 }
 
 /* This function adds data to the copy/paste buffer, freeing existing data first
@@ -1259,7 +1261,7 @@
 	}
 	
 	/* check if anything ended up in the buffer */
-	if (actcopybuf.first==NULL || actcopybuf.last==NULL)
+	if (ELEM(NULL, actcopybuf.first, actcopybuf.last))
 		error("Nothing copied to buffer");
 	
 	/* free temp memory */
@@ -1273,12 +1275,16 @@
 	int filter;
 	void *data;
 	short datatype;
+	short no_name= 0;
 	
 	/* check if buffer is empty */
-	if (actcopybuf.first==NULL || actcopybuf.last==NULL) {
+	if (ELEM(NULL, actcopybuf.first, actcopybuf.last)) {
 		error("No data in buffer to paste");
 		return;
 	}
+	/* check if single channel in buffer (disregard names if so)  */
+	if (actcopybuf.first == actcopybuf.last)
+		no_name= 1;
 	
 	/* get data */
 	data= get_action_context(&datatype);
@@ -1305,7 +1311,7 @@
 				bActionChannel *achant= ale->owner;
 				
 				/* check if we have a corresponding action channel */
-				if (strcmp(achan->name, achant->name)==0) {
+				if ((no_name) || (strcmp(achan->name, achant->name)==0)) {
 					/* check if this is a constraint channel */
 					if (ale->type == ACTTYPE_CONCHAN) {
 						bConstraintChannel *conchant= ale->data;
@@ -1327,13 +1333,17 @@
 			}
 			else if (ale->ownertype == ACTTYPE_SHAPEKEY) {
 				/* check if this action channel is "#ACP_ShapeKey" */
-				if (strcmp(achan->name, "#ACP_ShapeKey")==0) {
+				if ((no_name) || (strcmp(achan->name, "#ACP_ShapeKey")==0)) {
 					ipo_src= achan->ipo;
 					break;
 				}
 			}	
 		}
 		
+		/* this shouldn't happen, but it might */
+		if (ELEM(NULL, ipo_src, ipo_dst))
+			continue;
+		
 		/* loop over curves, pasting keyframes */
 		for (icu= ipo_dst->curve.first; icu; icu= icu->next) {
 			for (ico= ipo_src->curve.first; ico; ico= ico->next) {
@@ -1550,7 +1560,7 @@
 	
 	/* figure out what is under cursor */
 	getmouseco_areawin(mval);
-	if (mval[0] < NAMEWIDTH) 
+	if (mval[0] > NAMEWIDTH) 
 		return;
 	act_channel= get_nearest_act_channel(mval, &chantype);
 	





More information about the Bf-blender-cvs mailing list