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

raphael dwarf at free.fr
Thu Mar 30 10:33:11 CEST 2006


Hi all,

I posted this message 2 days ago on this list, but i wasn't a member.
I subscribed to the mailing list this morning, so i can post it now.
I hope this message  will not appear twice.

I'm a cg artist and i needed to be able to change the step of the frame 
change with up or down arrow keys. I don't know anything to C, but with
the help of some cool guys on #blendercoder (and a good C book) i added
a new button in the timeline window.

it's very usefull for animation job, if you need to fit with the tempo 
of the music. In the timeline window, there's a new slider named 
"steps", so you can specify a new step (from 1 to 100) for the frame change.

Here's a screenshot
http://dwarf.free.fr/wip/anima_steps.jpg

As i said, i don't know anything about C or C++, and i probably made
some horrible mistakes. I submited my patch on the patchtracker, and
i 'm posting it here.

Regards,
raphael
-------------- 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-docboard mailing list