Revision: 16618 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16618 Author: bdiego Date: 2008-09-19 23:57:15 +0200 (Fri, 19 Sep 2008)
Log Message: ----------- == Render == Commit patch #7788, allow to set the render step, so it's possible make render every N frames only. The step is change in Scene buttons (F10), below start and end frame buttons. Also add a command line options (-j), so it's possible to overwrite the file step (useful for renderfarm). [ Brecht, this work with OpenGL renders and simulated the skipped frames, please double check ] Modified Paths: -------------- trunk/blender/source/blender/blenkernel/BKE_blender.h trunk/blender/source/blender/blenloader/intern/readfile.c trunk/blender/source/blender/include/blendef.h trunk/blender/source/blender/makesdna/DNA_scene_types.h trunk/blender/source/blender/python/api2_2x/sceneRender.c trunk/blender/source/blender/render/extern/include/RE_pipeline.h trunk/blender/source/blender/render/intern/source/pipeline.c trunk/blender/source/blender/src/buttons_scene.c trunk/blender/source/blender/src/renderwin.c trunk/blender/source/creator/creator.c Modified: trunk/blender/source/blender/blenkernel/BKE_blender.h =================================================================== --- trunk/blender/source/blender/blenkernel/BKE_blender.h 2008-09-19 21:52:15 UTC (rev 16617) +++ trunk/blender/source/blender/blenkernel/BKE_blender.h 2008-09-19 21:57:15 UTC (rev 16618) @@ -41,7 +41,7 @@ struct MemFile; #define BLENDER_VERSION 247 -#define BLENDER_SUBVERSION 3 +#define BLENDER_SUBVERSION 4 #define BLENDER_MINVERSION 245 #define BLENDER_MINSUBVERSION 15 Modified: trunk/blender/source/blender/blenloader/intern/readfile.c =================================================================== --- trunk/blender/source/blender/blenloader/intern/readfile.c 2008-09-19 21:52:15 UTC (rev 16617) +++ trunk/blender/source/blender/blenloader/intern/readfile.c 2008-09-19 21:57:15 UTC (rev 16618) @@ -7808,6 +7808,16 @@ ob->gameflag &= ~(OB_GHOST|OB_DYNAMIC|OB_RIGID_BODY|OB_SOFT_BODY|OB_COLLISION_RESPONSE); } } + + if (main->versionfile < 247 || (main->versionfile == 247 && main->subversionfile < 4)){ + Scene *sce= main->scene.first; + while(sce) { + if(sce->frame_step==0) + sce->frame_step= 1; + sce= sce->id.next; + } + } + /* WATCH IT!!!: pointers from libdata have not been converted yet here! */ /* WATCH IT 2!: Userdef struct init has to be in src/usiblender.c! */ Modified: trunk/blender/source/blender/include/blendef.h =================================================================== --- trunk/blender/source/blender/include/blendef.h 2008-09-19 21:52:15 UTC (rev 16617) +++ trunk/blender/source/blender/include/blendef.h 2008-09-19 21:57:15 UTC (rev 16618) @@ -113,6 +113,7 @@ #define F_CFRA ((float)(G.scene->r.cfra)) #define SFRA (G.scene->r.sfra) #define EFRA (G.scene->r.efra) +#define STFRA (G.scene->frame_step) #define PSFRA ((G.scene->r.psfra != 0)? (G.scene->r.psfra): (G.scene->r.sfra)) #define PEFRA ((G.scene->r.psfra != 0)? (G.scene->r.pefra): (G.scene->r.efra)) #define FRA2TIME(a) ((((double) G.scene->r.frs_sec_base) * (a)) / G.scene->r.frs_sec) Modified: trunk/blender/source/blender/makesdna/DNA_scene_types.h =================================================================== --- trunk/blender/source/blender/makesdna/DNA_scene_types.h 2008-09-19 21:52:15 UTC (rev 16617) +++ trunk/blender/source/blender/makesdna/DNA_scene_types.h 2008-09-19 21:57:15 UTC (rev 16618) @@ -553,6 +553,10 @@ /* Sculptmode data */ struct SculptData sculptdata; + + /* frame step. */ + int frame_step; + int pad; } Scene; Modified: trunk/blender/source/blender/python/api2_2x/sceneRender.c =================================================================== --- trunk/blender/source/blender/python/api2_2x/sceneRender.c 2008-09-19 21:52:15 UTC (rev 16617) +++ trunk/blender/source/blender/python/api2_2x/sceneRender.c 2008-09-19 21:57:15 UTC (rev 16618) @@ -496,7 +496,7 @@ tstate = PyEval_SaveThread(); - RE_BlenderAnim(re, G.scene, G.scene->r.sfra, G.scene->r.efra); + RE_BlenderAnim(re, G.scene, G.scene->r.sfra, G.scene->r.efra, G.scene->frame_step); BPY_do_all_scripts(SCRIPT_POSTRENDER, 0); @@ -599,7 +599,7 @@ BPY_do_all_scripts(SCRIPT_RENDER, 1); tstate = PyEval_SaveThread(); - RE_BlenderAnim(re, G.scene, G.scene->r.sfra, G.scene->r.efra); + RE_BlenderAnim(re, G.scene, G.scene->r.sfra, G.scene->r.efra, G.scene->frame_step); if (G.f & G_DOSCRIPTLINKS) BPY_do_all_scripts(SCRIPT_POSTRENDER, 1); Modified: trunk/blender/source/blender/render/extern/include/RE_pipeline.h =================================================================== --- trunk/blender/source/blender/render/extern/include/RE_pipeline.h 2008-09-19 21:52:15 UTC (rev 16617) +++ trunk/blender/source/blender/render/extern/include/RE_pipeline.h 2008-09-19 21:57:15 UTC (rev 16618) @@ -185,7 +185,7 @@ /* only RE_NewRender() needed, main Blender render calls */ void RE_BlenderFrame(struct Render *re, struct Scene *scene, int frame); -void RE_BlenderAnim(struct Render *re, struct Scene *scene, int sfra, int efra); +void RE_BlenderAnim(struct Render *re, struct Scene *scene, int sfra, int efra, int tfra); void RE_ReadRenderResult(struct Scene *scene, struct Scene *scenode); void RE_WriteRenderResult(RenderResult *rr, char *filename, int compress); Modified: trunk/blender/source/blender/render/intern/source/pipeline.c =================================================================== --- trunk/blender/source/blender/render/intern/source/pipeline.c 2008-09-19 21:52:15 UTC (rev 16617) +++ trunk/blender/source/blender/render/intern/source/pipeline.c 2008-09-19 21:57:15 UTC (rev 16618) @@ -2559,10 +2559,12 @@ } /* saves images to disk */ -void RE_BlenderAnim(Render *re, Scene *scene, int sfra, int efra) +void RE_BlenderAnim(Render *re, Scene *scene, int sfra, int efra, int tfra) { bMovieHandle *mh= BKE_get_movie_handle(scene->r.imtype); + unsigned int lay; int cfrao= scene->r.cfra; + int nfra; /* do not fully call for each frame, it initializes & pops output window */ if(!render_initialize_from_scene(re, scene, 0)) @@ -2591,12 +2593,27 @@ } } } else { - for(scene->r.cfra= sfra; scene->r.cfra<=efra; scene->r.cfra++) { + for(nfra= sfra, scene->r.cfra= sfra; scene->r.cfra<=efra; scene->r.cfra++) { char name[FILE_MAX]; /* only border now, todo: camera lens. (ton) */ render_initialize_from_scene(re, scene, 1); - + + if(nfra!=scene->r.cfra) { + /* + * Skip this frame, but update for physics and particles system. + * From convertblender.c: + * in localview, lamps are using normal layers, objects only local bits. + */ + if(scene->lay & 0xFF000000) + lay= scene->lay & 0xFF000000; + else + lay= scene->lay; + + scene_update_for_newframe(scene, lay); + continue; + } + if (scene->r.mode & (R_NO_OVERWRITE | R_TOUCH) ) { BKE_makepicstring(name, scene->r.pic, scene->r.cfra, scene->r.imtype); } @@ -2626,6 +2643,7 @@ break; } + nfra+= tfra; } } Modified: trunk/blender/source/blender/src/buttons_scene.c =================================================================== --- trunk/blender/source/blender/src/buttons_scene.c 2008-09-19 21:52:15 UTC (rev 16617) +++ trunk/blender/source/blender/src/buttons_scene.c 2008-09-19 21:57:15 UTC (rev 16618) @@ -2315,12 +2315,13 @@ uiBlockEndAlign(block); uiBlockSetCol(block, TH_AUTO); - uiDefBut(block, BUT,B_PLAYANIM, "PLAY",692,40,94,33, 0, 0, 0, 0, 0, "Play rendered images/avi animation (Ctrl+F11), (Play Hotkeys: A-Noskip, P-PingPong)"); - uiDefButS(block, NUM, B_RTCHANGED, "rt:",789,40,95,33, &G.rt, -1000.0, 1000.0, 0, 0, "General testing/debug button"); + uiDefBut(block, BUT,B_PLAYANIM, "PLAY",692,50,94,33, 0, 0, 0, 0, 0, "Play rendered images/avi animation (Ctrl+F11), (Play Hotkeys: A-Noskip, P-PingPong)"); + uiDefButS(block, NUM, B_RTCHANGED, "rt:",789,50,95,33, &G.rt, -1000.0, 1000.0, 0, 0, "General testing/debug button"); uiBlockBeginAlign(block); - uiDefButI(block, NUM,REDRAWSEQ,"Sta:",692,10,94,24, &G.scene->r.sfra,1.0,MAXFRAMEF, 0, 0, "The start frame of the animation (inclusive)"); - uiDefButI(block, NUM,REDRAWSEQ,"End:",789,10,95,24, &G.scene->r.efra,SFRA,MAXFRAMEF, 0, 0, "The end frame of the animation (inclusive)"); + uiDefButI(block, NUM,REDRAWSEQ,"Sta:",692,20,94,24, &G.scene->r.sfra,1.0,MAXFRAMEF, 0, 0, "The start frame of the animation (inclusive)"); + uiDefButI(block, NUM,REDRAWSEQ,"End:",789,20,95,24, &G.scene->r.efra,SFRA,MAXFRAMEF, 0, 0, "The end frame of the animation (inclusive)"); + uiDefButI(block, NUM,REDRAWSEQ,"Step:",692,0,192,18, &G.scene->frame_step, 1.0, MAXFRAMEF, 0, 0, "Frame Step"); uiBlockEndAlign(block); } Modified: trunk/blender/source/blender/src/renderwin.c =================================================================== --- trunk/blender/source/blender/src/renderwin.c 2008-09-19 21:52:15 UTC (rev 16617) +++ trunk/blender/source/blender/src/renderwin.c 2008-09-19 21:57:15 UTC (rev 16618) @@ -1132,7 +1132,7 @@ } if(anim) - RE_BlenderAnim(re, G.scene, G.scene->r.sfra, G.scene->r.efra); + RE_BlenderAnim(re, G.scene, G.scene->r.sfra, G.scene->r.efra, G.scene->frame_step); else RE_BlenderFrame(re, G.scene, G.scene->r.cfra); @@ -1338,16 +1338,28 @@ if(anim) { bMovieHandle *mh= BKE_get_movie_handle(G.scene->r.imtype); + unsigned int lay; int cfrao= CFRA; + int nfra; if(BKE_imtype_is_movie(G.scene->r.imtype)) mh->start_movie(&G.scene->r, winx, winy); - for(CFRA= SFRA; CFRA<=EFRA; CFRA++) { + for(nfra= SFRA, CFRA= SFRA; CFRA<=EFRA; CFRA++) { /* user event can close window */ if(render_win==NULL) break; + if(nfra!=CFRA) { + if(G.scene->lay & 0xFF000000) + lay= G.scene->lay & 0xFF000000; + else + lay= G.scene->lay; + + scene_update_for_newframe(G.scene, lay); + continue; + } + do_ogl_view3d_render(re, v3d, winx, winy); glReadPixels(0, 0, winx, winy, GL_RGBA, GL_UNSIGNED_BYTE, rr->rect32); if((G.scene->r.scemode & R_STAMP_INFO) && (G.scene->r.stamp & R_STAMP_DRAW)) { @@ -1382,6 +1394,7 @@ printf("\n"); if(test_break()) break; + nfra+= STFRA; } if(BKE_imtype_is_movie(G.scene->r.imtype)) Modified: trunk/blender/source/creator/creator.c =================================================================== --- trunk/blender/source/creator/creator.c 2008-09-19 21:52:15 UTC (rev 16617) +++ trunk/blender/source/creator/creator.c 2008-09-19 21:57:15 UTC (rev 16618) @@ -202,6 +202,7 @@ 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"); + printf (" -j <frame>\tSet frame step to <frame>\n"); printf ("\nWindow options:\n"); printf (" -w\t\tForce opening with borders (default)\n"); @@ -623,7 +624,7 @@ if (G.f & G_DOSCRIPTLINKS) BPY_do_all_scripts(SCRIPT_RENDER, 0); - RE_BlenderAnim(re, G.scene, frame, frame); + RE_BlenderAnim(re, G.scene, frame, frame, G.scene->frame_step); BPY_do_all_scripts(SCRIPT_POSTRENDER, 0); } @@ -638,7 +639,7 @@ if (G.f & G_DOSCRIPTLINKS) BPY_do_all_scripts(SCRIPT_RENDER, 1); - RE_BlenderAnim(re, G.scene, G.scene->r.sfra, G.scene->r.efra); + RE_BlenderAnim(re, G.scene, G.scene->r.sfra, G.scene->r.efra, G.scene->frame_step); if (G.f & G_DOSCRIPTLINKS) @@ Diff output truncated at 10240 characters. @@ _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs