[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [12132] trunk/blender/source/blender: == NLA Editor ==

Joshua Leung aligorith at gmail.com
Mon Sep 24 14:14:36 CEST 2007


Revision: 12132
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=12132
Author:   aligorith
Date:     2007-09-24 14:14:36 +0200 (Mon, 24 Sep 2007)

Log Message:
-----------
== NLA Editor ==

Added some features to the NLA Editor that had previously only been added for the Action Editor.

* It is now possible to choose whether timing is displayed in Frames or Seconds like in many of the other Animation Editors. Use Ctrl-T or the View menu to change this.

* Autosnap behaviour from Action Editor is now also available for the NLA Editor. It was partially done in the previous commit (for transform). Use the new combo-box on the NLA Editor header (like the one on the Action Editor header) to set this.


* editaction.c: silenced a compiler warning from the previous commit related to a function which is no longer needed.

Modified Paths:
--------------
    trunk/blender/source/blender/makesdna/DNA_action_types.h
    trunk/blender/source/blender/makesdna/DNA_space_types.h
    trunk/blender/source/blender/src/drawipo.c
    trunk/blender/source/blender/src/editaction.c
    trunk/blender/source/blender/src/editnla.c
    trunk/blender/source/blender/src/header_nla.c
    trunk/blender/source/blender/src/transform.c

Modified: trunk/blender/source/blender/makesdna/DNA_action_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_action_types.h	2007-09-24 11:29:25 UTC (rev 12131)
+++ trunk/blender/source/blender/makesdna/DNA_action_types.h	2007-09-24 12:14:36 UTC (rev 12132)
@@ -152,7 +152,7 @@
 #define SACTION_SLIDERS		2	/* show sliders (if relevant) - limited to shape keys for now */
 #define SACTION_DRAWTIME	4	/* draw time in seconds instead of time in frames */
 
-/* SpaceAction AutoSnap Settings */
+/* SpaceAction AutoSnap Settings (also used by SpaceNLA) */
 #define SACTSNAP_OFF	0	/* no auto-snap */
 #define SACTSNAP_STEP	1	/* snap to 1.0 frame/second intervals */
 #define SACTSNAP_FRAME	2	/* snap to actual frames/seconds (nla-action time) */

Modified: trunk/blender/source/blender/makesdna/DNA_space_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_space_types.h	2007-09-24 11:29:25 UTC (rev 12131)
+++ trunk/blender/source/blender/makesdna/DNA_space_types.h	2007-09-24 12:14:36 UTC (rev 12132)
@@ -250,7 +250,7 @@
 	
 } SpaceImage;
 
-typedef struct SpaceNla{
+typedef struct SpaceNla {
 	struct SpaceLink *next, *prev;
 	int spacetype;
 	float blockscale;
@@ -259,7 +259,8 @@
 	short blockhandler[8];
 
 	short menunr, lock;
-	int flag;
+	short autosnap;			/* this uses the same settings as autosnap for Action Editor */
+	short flag;
 	
 	View2D v2d;	
 } SpaceNla;
@@ -580,6 +581,7 @@
 /* nla->flag */
 #define SNLA_ALLKEYED		1
 #define SNLA_ACTIVELAYERS	2
+#define SNLA_DRAWTIME		4
 
 /* time->flag */
 #define TIME_DRAWFRAMES		1

Modified: trunk/blender/source/blender/src/drawipo.c
===================================================================
--- trunk/blender/source/blender/src/drawipo.c	2007-09-24 11:29:25 UTC (rev 12131)
+++ trunk/blender/source/blender/src/drawipo.c	2007-09-24 12:14:36 UTC (rev 12132)
@@ -230,6 +230,14 @@
 		}
 		break;
 	}
+	case SPACE_NLA: {
+		SpaceNla *snla = curarea->spacedata.first;
+		if (snla->flag & SNLA_DRAWTIME) {
+			secondgrid = 1;
+			secondiv = 0.01 * (float)G.scene->r.frs_sec;
+		}
+		break;
+	}
 	default:
 		break;
 	}
@@ -241,7 +249,7 @@
 	step_to_grid(&ipogrid_dx, &ipomachtx);
 	ipogrid_dx*= secondiv;
 	
-	if ELEM4(curarea->spacetype, SPACE_SEQ, SPACE_SOUND, SPACE_TIME, SPACE_ACTION) {
+	if ELEM5(curarea->spacetype, SPACE_SEQ, SPACE_SOUND, SPACE_TIME, SPACE_ACTION, SPACE_NLA) {
 		if(ipogrid_dx < 0.1) ipogrid_dx= 0.1;
 		ipomachtx-= 2;
 		if(ipomachtx<-2) ipomachtx= -2;
@@ -252,7 +260,7 @@
 	ipogrid_dy= IPOSTEP*space/pixels;
 	step_to_grid(&ipogrid_dy, &ipomachty);
 	
-	if ELEM4(curarea->spacetype, SPACE_SEQ, SPACE_SOUND, SPACE_TIME, SPACE_ACTION) {
+	if ELEM5(curarea->spacetype, SPACE_SEQ, SPACE_SOUND, SPACE_TIME, SPACE_ACTION, SPACE_NLA) {
 		if(ipogrid_dy < 1.0) ipogrid_dy= 1.0;
 		if(ipomachty<1) ipomachty= 1;
 	}
@@ -983,6 +991,18 @@
 					scroll_prstr(fac, 3.0+(float)(hor.ymin), val, 'h', disptype);
 				}
 			}
+			else if (curarea->spacetype==SPACE_NLA) {
+				SpaceNla *snla= curarea->spacedata.first;
+				
+				if (snla->flag & SNLA_DRAWTIME) {
+					fac2= val/(float)G.scene->r.frs_sec;
+					scroll_prstr(fac, 3.0+(float)(hor.ymin), fac2, 'h', disptype);
+				}
+				else {
+					ipomachtx= 1;
+					scroll_prstr(fac, 3.0+(float)(hor.ymin), val, 'h', disptype);
+				}
+			}
 			else {
 				scroll_prstr(fac, 3.0+(float)(hor.ymin), val, 'h', disptype);
 			}

Modified: trunk/blender/source/blender/src/editaction.c
===================================================================
--- trunk/blender/source/blender/src/editaction.c	2007-09-24 11:29:25 UTC (rev 12131)
+++ trunk/blender/source/blender/src/editaction.c	2007-09-24 12:14:36 UTC (rev 12132)
@@ -173,21 +173,6 @@
 	synchronize_action_strips();
 }
 
-static void remake_meshaction_ipos (Ipo *ipo)
-{
-	/* this puts the bezier triples in proper
-	 * order and makes sure the bezier handles
-	 * aren't too strange.
-	 */
-	IpoCurve *icu;
-
-	for (icu = ipo->curve.first; icu; icu=icu->next) {
-		sort_time_ipocurve(icu);
-		testhandles_ipocurve(icu);
-	}
-}
-
-
 /* **************************************************** */
 /* FILTER->EDIT STRUCTURES */
 /* 

Modified: trunk/blender/source/blender/src/editnla.c
===================================================================
--- trunk/blender/source/blender/src/editnla.c	2007-09-24 11:29:25 UTC (rev 12131)
+++ trunk/blender/source/blender/src/editnla.c	2007-09-24 12:14:36 UTC (rev 12132)
@@ -427,6 +427,12 @@
 						strip->end += diff;
 					}
 				}
+				else if (snap_mode==3) {
+					/* nearest second */
+					float secf = (float)(G.scene->r.frs_sec);
+					strip->start= (float)(floor(strip->start/secf + 0.5f) * secf);
+					strip->end= (float)(floor(strip->end/secf + 0.5f) * secf);
+				}
 			}
 		}
 		
@@ -1866,8 +1872,11 @@
 						reset_action_strips(2);
 				}
 				else if(G.qual & LR_SHIFTKEY) {
-					val= pupmenu("Snap To%t|Nearest Frame%x1|Current Frame%x2");
-					if (val==1 || val==2)
+					if (snla->flag & SNLA_DRAWTIME)
+						val= pupmenu("Snap To%t|Nearest Second%x3|Current Time%x2");
+					else
+						val= pupmenu("Snap To%t|Nearest Frame%x1|Current Frame%x2");
+					if (ELEM3(val, 1, 2, 3))
 						snap_action_strips(val);
 				}
 				else {
@@ -1877,6 +1886,19 @@
 				}
 				break;
 				
+			case TKEY:
+				if (G.qual & LR_CTRLKEY) {
+					val= pupmenu("Time value%t|Frames %x1|Seconds%x2");
+					
+					if (val > 0) {
+						if (val == 2) snla->flag |= SNLA_DRAWTIME;
+						else snla->flag &= ~SNLA_DRAWTIME;
+						
+						doredraw= 1;
+					}
+				}				
+				break;
+				
 			case DELKEY:
 			case XKEY:
 				if (mval[0]>=NLAWIDTH) {

Modified: trunk/blender/source/blender/src/header_nla.c
===================================================================
--- trunk/blender/source/blender/src/header_nla.c	2007-09-24 11:29:25 UTC (rev 12131)
+++ trunk/blender/source/blender/src/header_nla.c	2007-09-24 12:14:36 UTC (rev 12132)
@@ -122,6 +122,9 @@
 	case 6: /* Show all objects that have keyframes? */
 		G.snla->flag ^= SNLA_ALLKEYED;
 		break;
+	case 7:	/* Show timing in Frames or Seconds */
+		G.snla->flag ^= SNLA_DRAWTIME;
+		break;
 	}
 }
 
@@ -137,6 +140,12 @@
 	uiDefIconTextBut(block, BUTM, 1, (G.snla->flag & SNLA_ALLKEYED)?ICON_CHECKBOX_DEHLT:ICON_CHECKBOX_HLT, 
 					 "Only Objects On Visible Layers|", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
 		
+	if (G.snla->flag & SNLA_DRAWTIME) {
+		uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Frames|Ctrl T", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, "");
+	} else {
+		uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Seconds|Ctrl T", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, "");
+	}
+		
 	uiDefBut(block, SEPR, 0, "",					0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
 		
 	if(BTST(G.snla->lock, 0)) {
@@ -501,6 +510,24 @@
 	uiBlockSetEmboss(block, UI_EMBOSS);
 
 
+	/* draw AUTOSNAP */
+	xco += 8;
+	
+	if (G.snla->flag & SNLA_DRAWTIME) {
+		uiDefButS(block, MENU, B_REDR,
+				"Auto-Snap Strips/Keyframes %t|Off %x0|Second Step %x1|Nearest Second %x2", 
+				xco,0,70,YIC, &(G.snla->autosnap), 0, 1, 0, 0, 
+				"Auto-snapping mode for strips and keyframes when transforming");
+	}
+	else {
+		uiDefButS(block, MENU, B_REDR, 
+				"Auto-Snap Strips/Keyframes %t|Off %x0|Frame Step %x1|Nearest Frame %x2", 
+				xco,0,70,YIC, &(G.snla->autosnap), 0, 1, 0, 0, 
+				"Auto-snapping mode for strips and keyframes when transforming");
+	}
+	
+	xco += (70 + 8);
+	
 	/* FULL WINDOW */
 	
 	

Modified: trunk/blender/source/blender/src/transform.c
===================================================================
--- trunk/blender/source/blender/src/transform.c	2007-09-24 11:29:25 UTC (rev 12131)
+++ trunk/blender/source/blender/src/transform.c	2007-09-24 12:14:36 UTC (rev 12132)
@@ -3249,6 +3249,24 @@
 			break;
 		}
 	}
+	else if (t->spacetype == SPACE_NLA && G.snla) {
+		switch (G.snla->autosnap) {
+		case SACTSNAP_OFF:
+			if (G.qual == LR_CTRLKEY) 
+				autosnap= SACTSNAP_STEP;
+			else if (G.qual == LR_SHIFTKEY)
+				autosnap= SACTSNAP_FRAME;
+			else
+				autosnap= SACTSNAP_OFF;
+			break;
+		case SACTSNAP_STEP:
+			autosnap= (G.qual==LR_CTRLKEY)? SACTSNAP_OFF: SACTSNAP_STEP;
+			break;
+		case SACTSNAP_FRAME:
+			autosnap= (G.qual==LR_SHIFTKEY)? SACTSNAP_OFF: SACTSNAP_FRAME;
+			break;
+		}
+	}
 	else {
 		if (G.qual == LR_CTRLKEY) 
 			autosnap= SACTSNAP_STEP;
@@ -3271,11 +3289,11 @@
 	
 	/* currently, some of these are only for the action editor */
 	if (t->spacetype == SPACE_ACTION && G.saction) {
-		if (G.saction->flag & SACTION_DRAWTIME) 
-			drawtime = 1;
-		else
-			drawtime = 0;
+		drawtime = (G.saction->flag & SACTION_DRAWTIME)? 1 : 0;
 	}
+	else if (t->spacetype == SPACE_NLA && G.snla) {=
+		drawtime = (G.snla->flag & SNLA_DRAWTIME)? 1 : 0;
+	}
 	else {
 		drawtime = 0;
 	}





More information about the Bf-blender-cvs mailing list