diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-08-28 04:07:41 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-08-28 04:28:01 +0300 |
commit | 6bdf1d6ddebbbb6ef4ae58aae26f35ea0643f086 (patch) | |
tree | bc7a6dc0623683635d4c677b40043527fbf8b448 /source | |
parent | 43a4aaf8e6f0ccbd9ef63c44861206024f71590b (diff) |
Sequence/Scene render fixes
- wasn't checking subframe to see if the scene needed to be re-evaluated.
- unneeded int/float conversion storing original frame.
- moved cleanup block into one place to avoid confusion.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/sequencer.c | 55 |
1 files changed, 32 insertions, 23 deletions
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 08e73b6bf55..f0e59eda321 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -3084,9 +3084,16 @@ static ImBuf *seq_render_scene_strip(const SeqRenderData *context, Sequence *seq { ImBuf *ibuf = NULL; double frame; - float oldcfra, oldsubframe; Object *camera; - ListBase oldmarkers; + + struct { + int scemode; + int cfra; + float subframe; +#ifdef DURIAN_CAMERA_SWITCH + ListBase markers; +#endif + } orig_data; /* Old info: * Hack! This function can be called from do_render_seq(), in that case @@ -3124,10 +3131,11 @@ static ImBuf *seq_render_scene_strip(const SeqRenderData *context, Sequence *seq const bool do_seq_gl = is_rendering ? 0 /* (context->scene->r.seq_flag & R_SEQ_GL_REND) */ : (context->scene->r.seq_flag & R_SEQ_GL_PREV) != 0; - int do_seq; // bool have_seq = false; /* UNUSED */ bool have_comp = false; bool use_gpencil = true; + /* do we need to re-evaluate the frame after rendering? */ + bool is_frame_update = false; Scene *scene; int is_thread_main = BLI_thread_is_main(); @@ -3142,8 +3150,12 @@ static ImBuf *seq_render_scene_strip(const SeqRenderData *context, Sequence *seq // have_seq = (scene->r.scemode & R_DOSEQ) && scene->ed && scene->ed->seqbase.first); /* UNUSED */ have_comp = (scene->r.scemode & R_DOCOMP) && scene->use_nodes && scene->nodetree; - oldcfra = scene->r.cfra; - oldsubframe = scene->r.subframe; + orig_data.scemode = scene->r.scemode; + orig_data.cfra = scene->r.cfra; + orig_data.subframe = scene->r.subframe; +#ifdef DURIAN_CAMERA_SWITCH + orig_data.markers = scene->markers; +#endif BKE_scene_frame_set(scene, frame); @@ -3155,28 +3167,24 @@ static ImBuf *seq_render_scene_strip(const SeqRenderData *context, Sequence *seq camera = scene->camera; } - if (seq->flag & SEQ_SCENE_NO_GPENCIL) { - use_gpencil = false; + if (have_comp == false && camera == NULL) { + goto finally; } - if (have_comp == false && camera == NULL) { - scene->r.cfra = oldcfra; - scene->r.subframe = oldsubframe; - return NULL; + if (seq->flag & SEQ_SCENE_NO_GPENCIL) { + use_gpencil = false; } /* prevent eternal loop */ - do_seq = scene->r.scemode & R_DOSEQ; scene->r.scemode &= ~R_DOSEQ; #ifdef DURIAN_CAMERA_SWITCH /* stooping to new low's in hackyness :( */ - oldmarkers = scene->markers; BLI_listbase_clear(&scene->markers); -#else - (void)oldmarkers; #endif + is_frame_update = (orig_data.cfra != scene->r.cfra) || (orig_data.subframe != scene->r.subframe); + if ((sequencer_view3d_cb && do_seq_gl && camera) && is_thread_main) { char err_out[256] = "unknown"; int width = (scene->r.xsch * scene->r.size) / 100; @@ -3271,20 +3279,21 @@ static ImBuf *seq_render_scene_strip(const SeqRenderData *context, Sequence *seq // BIF_end_render_callbacks(); } - + + +finally: /* restore */ - scene->r.scemode |= do_seq; - - scene->r.cfra = oldcfra; - scene->r.subframe = oldsubframe; + scene->r.scemode = orig_data.scemode; + scene->r.cfra = orig_data.cfra; + scene->r.subframe = orig_data.subframe; - if (frame != oldcfra) { + if (is_frame_update) { BKE_scene_update_for_newframe(context->eval_ctx, context->bmain, scene, scene->lay); } - + #ifdef DURIAN_CAMERA_SWITCH /* stooping to new low's in hackyness :( */ - scene->markers = oldmarkers; + scene->markers = orig_data.markers; #endif return ibuf; |