Fix #28998: sequence rendering with wrong progress bar
authorSergey Sharybin <sergey.vfx@gmail.com>
Thu, 3 Nov 2011 17:06:12 +0000 (17:06 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Thu, 3 Nov 2011 17:06:12 +0000 (17:06 +0000)
Show overall progress when doing sequence rendering. Nice for cases when
you're using sequencer to combine video strips only, without rendering
scenes and so. If scene strips are used in sequencer, per-frame rendering
would be used (because of scene rendering sets per-frame progress).

source/blender/editors/render/render_internal.c
source/blender/render/extern/include/RE_pipeline.h
source/blender/render/intern/source/pipeline.c

index 9c38b1ce98f8b24fb3a9a96f8c186ffd3ef0dc32..cc1c88430151ca8282947f74df8ddd1d20eb13f3 100644 (file)
@@ -503,6 +503,7 @@ static int screen_render_invoke(bContext *C, wmOperator *op, wmEvent *event)
        const short is_animation= RNA_boolean_get(op->ptr, "animation");
        const short is_write_still= RNA_boolean_get(op->ptr, "write_still");
        struct Object *camera_override= v3d ? V3D_CAMERA_LOCAL(v3d) : NULL;
+       const char *name;
        
        /* only one render job at a time */
        if(WM_jobs_test(CTX_wm_manager(C), scene))
@@ -577,7 +578,10 @@ static int screen_render_invoke(bContext *C, wmOperator *op, wmEvent *event)
        rj->reports= op->reports;
 
        /* setup job */
-       steve= WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, "Render", jobflag);
+       if(RE_seq_render_active(scene, &scene->r)) name= "Sequence Render";
+       else name= "Render";
+
+       steve= WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, name, jobflag);
        WM_jobs_customdata(steve, rj, render_freejob);
        WM_jobs_timer(steve, 0.2, NC_SCENE|ND_RENDER_RESULT, 0);
        WM_jobs_callbacks(steve, render_startjob, NULL, NULL, render_endjob);
index cbb2f17043c5935772179e40334ce40d4a3adf32..fac3329bae09a0cd06772964ffa78d9a045f693a 100644 (file)
@@ -249,6 +249,8 @@ float RE_filter_value(int type, float x);
 /* vector blur zbuffer method */
 void RE_zbuf_accumulate_vecblur(struct NodeBlurData *nbd, int xsize, int ysize, float *newrect, float *imgrect, float *vecbufrect, float *zbufrect);
 
+int RE_seq_render_active(struct Scene *scene, struct RenderData *rd);
+
 /* shaded view or baking options */
 #define RE_BAKE_LIGHT                          0       /* not listed in rna_scene.c -> can't be enabled! */
 #define RE_BAKE_ALL                                    1
index 8d72be1684cee4dd16627614400ab9f8d668b32b..de5d037675ecd3d6100b5fc78ef1b1fc3db379ce 100644 (file)
@@ -2517,14 +2517,14 @@ static void renderresult_stampinfo(Render *re)
        RE_ReleaseResultImage(re);
 }
 
-static int seq_render_active(Render *re)
+int RE_seq_render_active(Scene *scene, RenderData *rd)
 {
        Editing *ed;
        Sequence *seq;
 
-       ed = re->scene->ed;
+       ed = scene->ed;
        
-       if (!(re->r.scemode & R_DOSEQ) || !ed || !ed->seqbase.first)
+       if (!(rd->scemode & R_DOSEQ) || !ed || !ed->seqbase.first)
                return 0;
        
        for (seq= ed->seqbase.first; seq; seq= seq->next) {
@@ -2632,6 +2632,12 @@ static void do_render_seq(Render * re)
 
        /* just in case this flag went missing at some point */
        re->r.scemode |= R_DOSEQ;
+
+       /* set overall progress of sequence rendering */
+       if(re->r.efra!=re->r.sfra)
+               re->progress(re->prh, (float)(cfra-re->r.sfra) / (re->r.efra-re->r.sfra));
+       else
+               re->progress(re->prh, 1.0f);
 }
 
 /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
@@ -2649,7 +2655,7 @@ static void do_render_all_options(Render *re)
        if(RE_engine_render(re, 1)) {
                /* in this case external render overrides all */
        }
-       else if(seq_render_active(re)) {
+       else if(RE_seq_render_active(re->scene, &re->r)) {
                /* note: do_render_seq() frees rect32 when sequencer returns float images */
                if(!re->test_break(re->tbh)) 
                        do_render_seq(re);