Revision: 17752
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=17752
Author:   bdiego
Date:     2008-12-09 05:02:18 +0100 (Tue, 09 Dec 2008)

Log Message:
-----------
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 :)

Modified Paths:
--------------
    trunk/blender/source/blender/src/buttons_scene.c
    trunk/blender/source/blender/src/playanim.c
    trunk/blender/source/creator/creator.c

Modified: trunk/blender/source/blender/src/buttons_scene.c
===================================================================
--- trunk/blender/source/blender/src/buttons_scene.c    2008-12-09 00:46:05 UTC 
(rev 17751)
+++ trunk/blender/source/blender/src/buttons_scene.c    2008-12-09 04:02:18 UTC 
(rev 17752)
@@ -1388,9 +1388,9 @@
        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);
 }

Modified: trunk/blender/source/blender/src/playanim.c
===================================================================
--- trunk/blender/source/blender/src/playanim.c 2008-12-09 00:46:05 UTC (rev 
17751)
+++ trunk/blender/source/blender/src/playanim.c 2008-12-09 04:02:18 UTC (rev 
17752)
@@ -169,6 +169,7 @@
 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 @@
                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 @@
                                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 @@
                                ptottime = 0.0;
                        }
                        
-                       BLI_newname(name, +1);
+                       BLI_newname(name, +fstep);
                        
                        while(qtest()){
                                switch(qreadN(&val)){
@@ -396,6 +397,12 @@
                                        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 @@
                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 @@
                                        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 @@
                                        }
                                        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;

Modified: trunk/blender/source/creator/creator.c
===================================================================
--- trunk/blender/source/creator/creator.c      2008-12-09 00:46:05 UTC (rev 
17751)
+++ trunk/blender/source/creator/creator.c      2008-12-09 04:02:18 UTC (rev 
17752)
@@ -208,7 +208,7 @@
        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");


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to