[Bf-committers] Re: patch to change the step when changing frame with up or down arrow keys.

raphael dwarf at free.fr
Thu Mar 30 13:31:21 CEST 2006


Hi,

There is a misunderstanding due to my poor English skills.
With Up and Donw arrow key, user can go to the next/previous 10 frames.
This "step" is fixed to 10 in blender code ( actually, there are no vars 
for this).

With this pacht, users can change this value. So, it is not related to 
audio sync.

Let's take an example: i want to animate a drummer who plays on
a fixed tempo. If this tempo is equal to 120 bpm, i know that i'll
probably have to place some keys each 12.5 frames ( frames are "int",
so , each 12 frames).

At the present time, and for this beat, i have to use up arrow (+10) and 
2xleft arrow keys to jump to the next frame.... it's faster if i just
have to press up arrow one to go 12 frame further. That why i made this
patch.









-------------- next part --------------
Index: blender/source/blender/makesdna/DNA_userdef_types.h
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/makesdna/DNA_userdef_types.h,v
retrieving revision 1.54
diff -u -p -r1.54 DNA_userdef_types.h
--- blender/source/blender/makesdna/DNA_userdef_types.h	10 Mar 2006 18:51:10 -0000	1.54
+++ blender/source/blender/makesdna/DNA_userdef_types.h	28 Mar 2006 16:44:38 -0000
@@ -157,6 +157,7 @@ typedef struct UserDef {
 	short menuthreshold1, menuthreshold2;
 	char fontname[256];		// FILE_MAXDIR+FILE length
 	struct ListBase themes;
+	//jumpframe raph 2006-03-28
 	short undosteps;
 	short curssize;
 	short tb_leftmouse, tb_rightmouse;
@@ -166,7 +167,8 @@ typedef struct UserDef {
         int memcachelimit;
         short frameserverport;
 	short pad;
-	short obcenter_dia, pad1, pad2, pad3;
+	short obcenter_dia, pad1, pad2;
+	short jumpframe;
 } UserDef;
 
 extern UserDef U; /* from usiblender.c !!!! */
Index: blender/source/blender/src/header_time.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/src/header_time.c,v
retrieving revision 1.15
diff -u -p -r1.15 header_time.c
--- blender/source/blender/src/header_time.c	26 Mar 2006 21:36:42 -0000	1.15
+++ blender/source/blender/src/header_time.c	28 Mar 2006 16:44:39 -0000
@@ -468,6 +468,10 @@ void time_buttons(ScrArea *sa)
 	uiDefIconButBitI(block, TOG, TIME_WITH_SEQ_AUDIO, B_DIFF, ICON_SPEAKER,
 					 xco, 0, XIC, YIC, &(stime->redraws), 0, 0, 0, 0, "Play back and sync with audio from Sequence Editor");
 	
+	//jumpframe
+	xco+= XIC+16;
+	uiDefButS(block, NUMSLI, B_DRAWINFO, "Steps:",xco, 0, 196, YIC,&(U.jumpframe), 1, 100, 1, 100, "Set spacing between frames changes with up and down arrow keys");
+
 	/* always as last  */
 	sa->headbutlen= xco+2*XIC;
 
Index: blender/source/blender/src/toets.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/src/toets.c,v
retrieving revision 1.71
diff -u -p -r1.71 toets.c
--- blender/source/blender/src/toets.c	10 Feb 2006 21:10:58 -0000	1.71
+++ blender/source/blender/src/toets.c	28 Mar 2006 16:44:40 -0000
@@ -544,11 +544,12 @@ int blenderqread(unsigned short event, s
 				if (G.qual==LR_ALTKEY)
 					mainwindow_toggle_fullscreen(0);
 				else if(G.qual==0)
-					CFRA-= 10;
+					//CFRA-= 10;
+					CFRA-= U.jumpframe;
 			}
 #else
 			if((event==DOWNARROWKEY)&&(G.qual==0))
-				CFRA-= 10;
+				CFRA-= U.jumpframe;
 #endif
 			else if((event==LEFTARROWKEY)&&(G.qual==0))
 				CFRA--;
@@ -572,11 +573,12 @@ int blenderqread(unsigned short event, s
 				if(G.qual==LR_ALTKEY)
 					mainwindow_toggle_fullscreen(1);
 				else if(G.qual==0)
-					CFRA+= 10;
+					CFRA+= U.jumpframe;
+					//CFRA+= 10;
 			}
 #else
 			if((event==UPARROWKEY)&&(G.qual==0))
-				CFRA+= 10;
+				CFRA+= U.jumpframe;
 #endif
 			else if((event==RIGHTARROWKEY)&&(G.qual==0))
 				CFRA++;
Index: blender/source/blender/src/usiblender.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/src/usiblender.c,v
retrieving revision 1.103
diff -u -p -r1.103 usiblender.c
--- blender/source/blender/src/usiblender.c	20 Mar 2006 17:25:42 -0000	1.103
+++ blender/source/blender/src/usiblender.c	28 Mar 2006 16:44:41 -0000
@@ -145,6 +145,8 @@ static void init_userdef_file(void)
 	/*  disable autoplay in .B.blend... */
 	G.fileflags &= ~G_FILE_AUTOPLAY;
 	
+	if(U.jumpframe == 0) U.jumpframe = 10;
+	
 	/* the UserDef struct is not corrected with do_versions() .... ugh! */
 	if(U.wheellinescroll == 0) U.wheellinescroll = 3;
 	if(U.menuthreshold1==0) {


More information about the Bf-committers mailing list