[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11533] trunk/blender/source/blender: == Action Editor - Time Display ==

Joshua Leung aligorith at gmail.com
Fri Aug 10 14:10:04 CEST 2007


Revision: 11533
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11533
Author:   aligorith
Date:     2007-08-10 14:10:03 +0200 (Fri, 10 Aug 2007)

Log Message:
-----------
== Action Editor - Time Display ==

The Action Editor can now display timing in seconds too. By default, it still displays timing in frames, but it is possible to switch the time display to seconds.

The hotkey to toggle this is  Ctrl T.

Notes:
- Many of the Action Editor's tools have yet to be made aware of this. Therefore, they will still work as though frames are used. Only Transform, Snap, and Mirror should really be affected. This will be fixed when I wake up.
- Nothing *should* be broken, but I might have missed something.

Modified Paths:
--------------
    trunk/blender/source/blender/makesdna/DNA_action_types.h
    trunk/blender/source/blender/src/drawipo.c
    trunk/blender/source/blender/src/editaction.c
    trunk/blender/source/blender/src/header_action.c

Modified: trunk/blender/source/blender/makesdna/DNA_action_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_action_types.h	2007-08-09 18:17:10 UTC (rev 11532)
+++ trunk/blender/source/blender/makesdna/DNA_action_types.h	2007-08-10 12:10:03 UTC (rev 11533)
@@ -150,6 +150,7 @@
 /* SpaceAction flag */
 #define SACTION_MOVING		1	/* during transform */
 #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 */
 #define SACTSNAP_OFF	0	/* no auto-snap */

Modified: trunk/blender/source/blender/src/drawipo.c
===================================================================
--- trunk/blender/source/blender/src/drawipo.c	2007-08-09 18:17:10 UTC (rev 11532)
+++ trunk/blender/source/blender/src/drawipo.c	2007-08-10 12:10:03 UTC (rev 11533)
@@ -219,7 +219,16 @@
 			secondgrid = 1;
 			secondiv = 0.01 * (float)G.scene->r.frs_sec;
 		}
+		break;
 	}
+	case SPACE_ACTION: {
+		SpaceAction *saction = curarea->spacedata.first;
+		if (saction->flag & SACTION_DRAWTIME) {
+			secondgrid = 1;
+			secondiv = 0.01 * (float)G.scene->r.frs_sec;
+		}
+		break;
+	}
 	default:
 		break;
 	}
@@ -231,7 +240,7 @@
 	step_to_grid(&ipogrid_dx, &ipomachtx);
 	ipogrid_dx*= secondiv;
 	
-	if ELEM3(curarea->spacetype, SPACE_SEQ, SPACE_SOUND, SPACE_TIME) {
+	if ELEM4(curarea->spacetype, SPACE_SEQ, SPACE_SOUND, SPACE_TIME, SPACE_ACTION) {
 		if(ipogrid_dx < 0.1) ipogrid_dx= 0.1;
 		ipomachtx-= 2;
 		if(ipomachtx<-2) ipomachtx= -2;
@@ -242,7 +251,7 @@
 	ipogrid_dy= IPOSTEP*space/pixels;
 	step_to_grid(&ipogrid_dy, &ipomachty);
 	
-	if ELEM3(curarea->spacetype, SPACE_SEQ, SPACE_SOUND, SPACE_TIME) {
+	if ELEM4(curarea->spacetype, SPACE_SEQ, SPACE_SOUND, SPACE_TIME, SPACE_ACTION) {
 		if(ipogrid_dy < 1.0) ipogrid_dy= 1.0;
 		if(ipomachty<1) ipomachty= 1;
 	}
@@ -949,6 +958,18 @@
 				else 
 					scroll_prstr(fac, 3.0+(float)(hor.ymin), val, 'h', disptype);
 			}
+			else if (curarea->spacetype==SPACE_ACTION) {
+				SpaceAction *saction= curarea->spacedata.first;
+				
+				if (saction->flag & SACTION_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-08-09 18:17:10 UTC (rev 11532)
+++ trunk/blender/source/blender/src/editaction.c	2007-08-10 12:10:03 UTC (rev 11533)
@@ -2831,12 +2831,12 @@
 			break;
 		
 		case HKEY:
-			if(G.qual & LR_SHIFTKEY) {
-				if(okee("Set Keys to Auto Handle"))
+			if (G.qual & LR_SHIFTKEY) {
+				if (okee("Set Keys to Auto Handle"))
 					sethandles_action_keys(HD_AUTO);
 			}
 			else {
-				if(okee("Toggle Keys Aligned Handle"))
+				if (okee("Toggle Keys Aligned Handle"))
 					sethandles_action_keys(HD_ALIGN);
 			}
 			break;
@@ -2899,6 +2899,7 @@
 				anim_previewrange_set();
 			else if (G.qual & LR_ALTKEY) /* clear preview range */
 				anim_previewrange_clear();
+				
 			allqueue(REDRAWTIME, 0);
 			allqueue(REDRAWBUTSALL, 0);
 			allqueue(REDRAWACTION, 0);
@@ -2908,7 +2909,7 @@
 			
 		case SKEY: 
 			if (mval[0]>=ACTWIDTH) {
-				if(G.qual & LR_SHIFTKEY) {
+				if (G.qual & LR_SHIFTKEY) {
 					if (data) {
 						val = pupmenu("Snap Keys To%t|Nearest Frame%x1|Current Frame%x2|Nearest Marker %x3");
 						snap_action_keys(val);
@@ -2920,17 +2921,27 @@
 			break;
 		
 		case TKEY:
-			if(G.qual & LR_SHIFTKEY)
+			if (G.qual & LR_SHIFTKEY)
 				action_set_ipo_flags(SET_IPO_POPUP);
+			else if (G.qual & LR_CTRLKEY) {
+				val= pupmenu("Time value%t|Frames %x1|Seconds%x2");
+				
+				if (val > 0) {
+					if (val == 2) saction->flag |= SACTION_DRAWTIME;
+					else saction->flag &= ~SACTION_DRAWTIME;
+					
+					doredraw= 1;
+				}
+			}				
 			else
 				transform_action_keys ('t', 0);
 			break;
-
+		
 		case VKEY:
-			if(okee("Set Keys to Vector Handle"))
+			if (okee("Set Keys to Vector Handle"))
 				sethandles_action_keys(HD_VECT);
 			break;
-
+		
 		case PAGEUPKEY:
 			if (datatype == ACTCONT_ACTION) {
 				if(G.qual & LR_SHIFTKEY)
@@ -3044,7 +3055,7 @@
 			view2d_zoom(G.v2d, 0.1154, sa->winx, sa->winy);
 			test_view2d(G.v2d, sa->winx, sa->winy);
 			view2d_do_locks(curarea, V2D_LOCK_COPY);
-
+			
 			doredraw= 1;
 			break;
 		case PADMINUS:

Modified: trunk/blender/source/blender/src/header_action.c
===================================================================
--- trunk/blender/source/blender/src/header_action.c	2007-08-09 18:17:10 UTC (rev 11532)
+++ trunk/blender/source/blender/src/header_action.c	2007-08-10 12:10:03 UTC (rev 11533)
@@ -89,6 +89,7 @@
 #define ACTMENU_VIEW_SLIDERS	7
 #define ACTMENU_VIEW_NEXTMARKER	8
 #define ACTMENU_VIEW_PREVMARKER	9
+#define ACTMENU_VIEW_TIME		10
 
 #define ACTMENU_SEL_BORDER      		0
 #define ACTMENU_SEL_BORDERM      		1
@@ -255,6 +256,9 @@
 		case ACTMENU_VIEW_PREVMARKER: /* jump to previous marker */
 			nextprev_marker(-1);
 			break;
+		case ACTMENU_VIEW_TIME: /* switch between frames and seconds display */
+			G.saction->flag ^= SACTION_DRAWTIME;
+			break;
 	}
 	allqueue(REDRAWVIEW3D, 0);
 }
@@ -275,7 +279,22 @@
 		
 	uiDefBut(block, SEPR, 0, "", 0, yco-=6, 
 			 menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
+			 
+	if (G.saction->flag & SACTION_DRAWTIME) {
+		uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, 
+						"Show Frames|T", 0, yco-=20, 
+						menuwidth, 19, NULL, 0.0, 0.0, 1, 
+						ACTMENU_VIEW_TIME, "");
+	}
+	else {
+		uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, 
+						"Show Seconds|T", 0, yco-=20, 
+						menuwidth, 19, NULL, 0.0, 0.0, 1, 
+						ACTMENU_VIEW_TIME, "");
+	}
 	
+	uiDefBut(block, SEPR, 0, "",        0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
+	
 	uiDefIconTextBut(block, BUTM, 1, (G.saction->flag & SACTION_SLIDERS)?ICON_CHECKBOX_HLT:ICON_CHECKBOX_DEHLT, 
 					 "Show Sliders|", 0, yco-=20, 
 					 menuwidth, 19, NULL, 0.0, 0.0, 1, 





More information about the Bf-blender-cvs mailing list