[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [10890] trunk/blender/source/blender/src: == Action/NLA ==

Joshua Leung aligorith at gmail.com
Fri Jun 8 09:31:04 CEST 2007


Revision: 10890
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=10890
Author:   aligorith
Date:     2007-06-08 09:31:03 +0200 (Fri, 08 Jun 2007)

Log Message:
-----------
== Action/NLA ==

* Snap and Mirror tools for the Action Editor, now respect NLA scaling again. I accidentally omitted the relevant code when recoding.

* Snap tool in the NLA Editor, now works for the keyframes displayed for each object too. There's one case I've to check up on later, as there might be interesting conflicts.

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

Modified: trunk/blender/source/blender/src/editaction.c
===================================================================
--- trunk/blender/source/blender/src/editaction.c	2007-06-07 02:00:11 UTC (rev 10889)
+++ trunk/blender/source/blender/src/editaction.c	2007-06-08 07:31:03 UTC (rev 10890)
@@ -481,7 +481,7 @@
 	 * x coordinate.
 	 */
     int num;
-    float ybase, y;
+    float y;
 
     areamouseco_to_ipoco(G.v2d, mval, x, &y);
     num = (int) ((CHANNELHEIGHT/2 - y) / (CHANNELHEIGHT+CHANNELSKIP));
@@ -1174,7 +1174,13 @@
 	
 	/* snap to frame */
 	for (ale= act_data.first; ale; ale= ale->next) {
-		snap_ipo_keys(ale->key_data, mode);
+		if (datatype==ACTCONT_ACTION && G.saction->pin==0 && OBACT) {
+			actstrip_map_ipo_keys(OBACT, ale->key_data, 0, 1); 
+			snap_ipo_keys(ale->key_data, mode);
+			actstrip_map_ipo_keys(OBACT, ale->key_data, 1, 1);
+		}
+		else 
+			snap_ipo_keys(ale->key_data, mode);
 	}
 	BLI_freelistN(&act_data);
 	
@@ -1226,7 +1232,13 @@
 	
 	/* mirror */
 	for (ale= act_data.first; ale; ale= ale->next) {
-		mirror_ipo_keys(ale->key_data, mode);
+		if (datatype==ACTCONT_ACTION && G.saction->pin==0 && OBACT) {
+			actstrip_map_ipo_keys(OBACT, ale->key_data, 0, 1); 
+			mirror_ipo_keys(ale->key_data, mode);
+			actstrip_map_ipo_keys(OBACT, ale->key_data, 1, 1);
+		}
+		else 
+			mirror_ipo_keys(ale->key_data, mode);
 	}
 	BLI_freelistN(&act_data);
 	
@@ -2319,18 +2331,19 @@
 {
 	void *data;
 	short datatype;
-	bAction	*act;
-	bActionChannel *achan;
+	bAction	*act= NULL;
+	bActionChannel *achan= NULL;
 	bConstraintChannel *conchan= NULL;
 	IpoCurve *icu= NULL;
 	TimeMarker *marker;
 	void *act_channel;
 	short sel, act_type;
-	float	selx;
+	float selx;
 	
 	/* determine what type of data we are operating on */
 	data = get_action_context(&datatype);
 	if (data == NULL) return;
+	if (datatype == ACTCONT_ACTION) act= (bAction *)data;
 
 	act_channel= get_nearest_action_key(&selx, &sel, &act_type, &achan);
 	marker=find_nearest_marker(1);

Modified: trunk/blender/source/blender/src/editnla.c
===================================================================
--- trunk/blender/source/blender/src/editnla.c	2007-06-07 02:00:11 UTC (rev 10889)
+++ trunk/blender/source/blender/src/editnla.c	2007-06-08 07:31:03 UTC (rev 10890)
@@ -78,6 +78,7 @@
 #include "BSE_editnla_types.h"
 #include "BSE_headerbuttons.h"
 #include "BSE_drawipo.h"
+#include "BSE_editaction_types.h"
 #include "BSE_trans_types.h"
 #include "BSE_edit.h"
 #include "BSE_filesel.h"
@@ -420,6 +421,36 @@
 				}
 			}
 		}
+		
+		/* object has action */
+		if (base->object->action) {
+			ListBase act_data = {NULL, NULL};
+			bActListElem *ale;
+			int filter;
+			
+			/* filter action data */
+			filter= (ACTFILTER_VISIBLE | ACTFILTER_FOREDIT | ACTFILTER_IPOKEYS);
+			actdata_filter(&act_data, filter, base->object->action, ACTCONT_ACTION);
+			
+			/* snap to frame */
+			for (ale= act_data.first; ale; ale= ale->next) {
+				actstrip_map_ipo_keys(base->object, ale->key_data, 0, 1); 
+				snap_ipo_keys(ale->key_data, snap_mode);
+				actstrip_map_ipo_keys(base->object, ale->key_data, 1, 1);
+			}
+			BLI_freelistN(&act_data);
+			
+			// err
+			remake_action_ipos(base->object->action);
+		}
+		
+		/* object has ipo */
+		/* for now, this is done regardless of whether there is an action. However, 
+		 * there may be errors later on... this needs further testing. Until then, this code stays.
+		 */
+		if (base->object->ipo) {
+			snap_ipo_keys(base->object->ipo, snap_mode);
+		}
 	}
 	BIF_undo_push("Snap NLA strips");
 	allqueue (REDRAWVIEW3D, 0);





More information about the Bf-blender-cvs mailing list