Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiego Borghetti <bdiego@gmail.com>2008-12-09 07:02:18 +0300
committerDiego Borghetti <bdiego@gmail.com>2008-12-09 07:02:18 +0300
commitcac797eff6c8d618c78ec6d5492c85a7665c37fd (patch)
tree5bc5636f75cf792f47554eaf27d77fdf8f5b0b05
parentcaf58fe4b293d78a0625e3e64032ff3b9b8278c5 (diff)
Commit patch [#18057] by Dalai Felinto (dfelinto)
This implement the option of playback an animation using the step value in the render panel (or -a -j). Tested here and work fine, about the ffmpeg/avi bug it's my fault, I don't think in "step + video format", so now it's in my todo-list :)
-rw-r--r--source/blender/src/buttons_scene.c4
-rw-r--r--source/blender/src/playanim.c43
-rw-r--r--source/creator/creator.c2
3 files changed, 28 insertions, 21 deletions
diff --git a/source/blender/src/buttons_scene.c b/source/blender/src/buttons_scene.c
index 74725b99fea..ea7411af621 100644
--- a/source/blender/src/buttons_scene.c
+++ b/source/blender/src/buttons_scene.c
@@ -1388,9 +1388,9 @@ static void run_playanim(char *file)
calc_renderwin_rectangle((G.scene->r.xsch*G.scene->r.size)/100,
(G.scene->r.ysch*G.scene->r.size)/100, G.winpos, pos, size);
#ifdef WIN32
- sprintf(str, "%s -a -s %d -e %d -p %d %d -f %d %g \"%s\"", bprogname, G.scene->r.sfra, G.scene->r.efra, pos[0], pos[1], G.scene->r.frs_sec, G.scene->r.frs_sec_base, file);
+ sprintf(str, "%s -a -s %d -e %d -p %d %d -f %d %g -j %d \"%s\"", bprogname, G.scene->r.sfra, G.scene->r.efra, pos[0], pos[1], G.scene->r.frs_sec, G.scene->r.frs_sec_base, G.scene->frame_step, file);
#else
- sprintf(str, "\"%s\" -a -s %d -e %d -p %d %d -f %d %g \"%s\"", bprogname, G.scene->r.sfra, G.scene->r.efra, pos[0], pos[1], G.scene->r.frs_sec, G.scene->r.frs_sec_base, file);
+ sprintf(str, "\"%s\" -a -s %d -e %d -p %d %d -f %d %g -j %d \"%s\"", bprogname, G.scene->r.sfra, G.scene->r.efra, pos[0], pos[1], G.scene->r.frs_sec, G.scene->r.frs_sec_base, G.scene->frame_step, file);
#endif
system(str);
}
diff --git a/source/blender/src/playanim.c b/source/blender/src/playanim.c
index 8880380700d..c2040f869e6 100644
--- a/source/blender/src/playanim.c
+++ b/source/blender/src/playanim.c
@@ -169,6 +169,7 @@ typedef struct pict{
static struct ListBase _picsbase = {0,0};
static struct ListBase *picsbase = &_picsbase;
static int fromdisk = FALSE;
+static int fstep = 1;
static float zoomx = 1.0 , zoomy = 1.0;
static double ptottime = 0.0, swaptime = 0.04;
@@ -208,14 +209,14 @@ static void toscreen(Pict *picture, struct ImBuf *ibuf)
char str[512];
cpack(-1);
glRasterPos2f(0.02f, 0.03f);
- sprintf(str, "%s | %.2f frames/s\n", picture->name, 1.0 / swaptime);
+ sprintf(str, "%s | %.2f frames/s\n", picture->name, fstep / swaptime);
BMF_DrawString(G.fonts, str);
}
window_swap_buffers(g_window);
}
-static void build_pict_list(char * first, int totframes)
+static void build_pict_list(char * first, int totframes, int fstep)
{
int size,pic,file;
char *mem, name[512];
@@ -240,7 +241,7 @@ static void build_pict_list(char * first, int totframes)
picture->anim = anim;
picture->frame = pic;
picture->IB_flags = IB_rect;
- sprintf(str, "%s : %d", first, pic + 1);
+ sprintf(str, "%s : %d", first, pic);
picture->name = strdup(str);
BLI_addtail(picsbase, picture);
}
@@ -322,7 +323,7 @@ static void build_pict_list(char * first, int totframes)
ptottime = 0.0;
}
- BLI_newname(name, +1);
+ BLI_newname(name, +fstep);
while(qtest()){
switch(qreadN(&val)){
@@ -396,6 +397,12 @@ void playanim(int argc, char **argv)
argc--;
argv++;
break;
+ case 'j':
+ fstep= MIN2(MAXFRAME, MAX2(1, atoi(argv[2])));
+ swaptime*= fstep;
+ argc--;
+ argv++;
+ break;
default:
printf("unknown option '%c': skipping\n", argv[1][1]);
break;
@@ -486,11 +493,11 @@ void playanim(int argc, char **argv)
efra = MAXFRAME;
}
- build_pict_list(name, (efra - sfra) + 1);
+ build_pict_list(name, (efra - sfra) + 1, fstep);
for (i = 2; i < argc; i++){
strcpy(name, argv[i]);
- build_pict_list(name, (efra - sfra) + 1);
+ build_pict_list(name, (efra - sfra) + 1, fstep);
}
IMB_freeImBuf(ibuf);
@@ -571,9 +578,9 @@ void playanim(int argc, char **argv)
if (val) {
if (qualN & SHIFT) {
if (ibuf)
- printf(" Name: %s | Speed: %.2f frames/s\n", ibuf->name, 1.0 / swaptime);
+ printf(" Name: %s | Speed: %.2f frames/s\n", ibuf->name, fstep / swaptime);
} else {
- swaptime = 1.0 / 5.0;
+ swaptime = fstep / 5.0;
}
}
break;
@@ -688,34 +695,34 @@ void playanim(int argc, char **argv)
}
break;
case PAD1:
- swaptime = 1.0 / 60.0;
+ swaptime = fstep / 60.0;
break;
case PAD2:
- swaptime = 1.0 / 50.0;
+ swaptime = fstep / 50.0;
break;
case PAD3:
- swaptime = 1.0 / 30.0;
+ swaptime = fstep / 30.0;
break;
case PAD4:
if (qualN & SHIFT)
- swaptime = 1.0 / 24.0;
+ swaptime = fstep / 24.0;
else
- swaptime = 1.0 / 25.0;
+ swaptime = fstep / 25.0;
break;
case PAD5:
- swaptime = 1.0 / 20.0;
+ swaptime = fstep / 20.0;
break;
case PAD6:
- swaptime = 1.0 / 15.0;
+ swaptime = fstep / 15.0;
break;
case PAD7:
- swaptime = 1.0 / 12.0;
+ swaptime = fstep / 12.0;
break;
case PAD8:
- swaptime = 1.0 / 10.0;
+ swaptime = fstep / 10.0;
break;
case PAD9:
- swaptime = 1.0 / 6.0;
+ swaptime = fstep / 6.0;
break;
case PADPLUSKEY:
if (val == 0) break;
diff --git a/source/creator/creator.c b/source/creator/creator.c
index 745978e2bb9..a6111210593 100644
--- a/source/creator/creator.c
+++ b/source/creator/creator.c
@@ -208,7 +208,7 @@ static void print_help(void)
printf (" -t <threads>\tUse amount of <threads> for rendering (background mode only).\n");
printf (" [1-8], 0 for systems processor count.\n");
printf ("\nAnimation playback options:\n");
- printf (" -a <file(s)>\tPlayback <file(s)>, only operates this way when -b is not used.\n");
+ printf (" -a <options> <file(s)>\tPlayback <file(s)>, only operates this way when -b is not used.\n");
printf (" -p <sx> <sy>\tOpen with lower left corner at <sx>, <sy>\n");
printf (" -m\t\tRead from disk (Don't buffer)\n");
printf (" -f <fps> <fps-base>\t\tSpecify FPS to start with\n");