== 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 ]
This commit is contained in:
@@ -41,7 +41,7 @@ struct ListBase;
|
||||
struct MemFile;
|
||||
|
||||
#define BLENDER_VERSION 247
|
||||
#define BLENDER_SUBVERSION 3
|
||||
#define BLENDER_SUBVERSION 4
|
||||
|
||||
#define BLENDER_MINVERSION 245
|
||||
#define BLENDER_MINSUBVERSION 15
|
||||
|
@@ -7808,6 +7808,16 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
|
||||
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! */
|
||||
|
||||
|
@@ -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)
|
||||
|
@@ -553,6 +553,10 @@ typedef struct Scene {
|
||||
|
||||
/* Sculptmode data */
|
||||
struct SculptData sculptdata;
|
||||
|
||||
/* frame step. */
|
||||
int frame_step;
|
||||
int pad;
|
||||
} Scene;
|
||||
|
||||
|
||||
|
@@ -496,7 +496,7 @@ PyObject *RenderData_Render( BPy_RenderData * self )
|
||||
|
||||
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 @@ PyObject *RenderData_RenderAnim( BPy_RenderData * self )
|
||||
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);
|
||||
|
@@ -185,7 +185,7 @@ void RE_TileProcessor(struct Render *re, int firsttile, int threaded);
|
||||
|
||||
/* 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);
|
||||
|
@@ -2559,10 +2559,12 @@ static void do_write_image_or_movie(Render *re, Scene *scene, bMovieHandle *mh)
|
||||
}
|
||||
|
||||
/* 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 @@ void RE_BlenderAnim(Render *re, Scene *scene, int sfra, int efra)
|
||||
}
|
||||
}
|
||||
} 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 @@ void RE_BlenderAnim(Render *re, Scene *scene, int sfra, int efra)
|
||||
|
||||
break;
|
||||
}
|
||||
nfra+= tfra;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -2315,12 +2315,13 @@ static void render_panel_anim(void)
|
||||
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);
|
||||
}
|
||||
|
||||
|
@@ -1132,7 +1132,7 @@ static void do_render(int anim)
|
||||
}
|
||||
|
||||
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 @@ void BIF_do_ogl_render(View3D *v3d, int anim)
|
||||
|
||||
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 @@ void BIF_do_ogl_render(View3D *v3d, int anim)
|
||||
printf("\n");
|
||||
|
||||
if(test_break()) break;
|
||||
nfra+= STFRA;
|
||||
}
|
||||
|
||||
if(BKE_imtype_is_movie(G.scene->r.imtype))
|
||||
|
@@ -202,6 +202,7 @@ static void print_help(void)
|
||||
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 @@ int main(int argc, char **argv)
|
||||
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 @@ int main(int argc, char **argv)
|
||||
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)
|
||||
BPY_do_all_scripts(SCRIPT_POSTRENDER, 1);
|
||||
@@ -669,6 +670,15 @@ int main(int argc, char **argv)
|
||||
printf("\nError: no blend loaded. cannot use '-e'.\n");
|
||||
}
|
||||
break;
|
||||
case 'j':
|
||||
a++;
|
||||
if(G.scene) {
|
||||
int fstep= MIN2(MAXFRAME, MAX2(1, atoi(argv[a])));
|
||||
if (a < argc) (G.scene->frame_step) = fstep;
|
||||
} else {
|
||||
printf("\nError: no blend loaded. cannot use '-j'.\n");
|
||||
}
|
||||
break;
|
||||
case 'P':
|
||||
a++;
|
||||
if (a < argc) {
|
||||
|
Reference in New Issue
Block a user