[Bf-blender-cvs] [1e55d28a4e2] blender-v2.92-release: Fix T85035: Gpencil render in background render wrong frame

Antonio Vazquez noreply at git.blender.org
Mon Feb 1 10:30:00 CET 2021


Commit: 1e55d28a4e244cd501d9b53f56d535a04ce5eef1
Author: Antonio Vazquez
Date:   Thu Jan 28 10:35:03 2021 +0100
Branches: blender-v2.92-release
https://developer.blender.org/rB1e55d28a4e244cd501d9b53f56d535a04ce5eef1

Fix T85035: Gpencil render in background render wrong frame

Due a thread priority, the calculation of the current frame is not done before the frames are available. This produces wrong render frames.

The solution is verify the current frame before doing the real render. This adds only a few milliseconds, but it assures the frame is correct.

As the problem is only when render in background, the recalculation of the frame is only necessary when do real render and not a viewport render, so there is no impact in the animation FPS.

===================================================================

M	source/blender/draw/engines/gpencil/gpencil_engine.c

===================================================================

diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c b/source/blender/draw/engines/gpencil/gpencil_engine.c
index 20044fbe3ce..153dcfb6ea7 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -618,6 +618,14 @@ void GPENCIL_cache_populate(void *ved, Object *ob)
     bGPdata *gpd = (bGPdata *)ob->data;
     bool do_onion = (!pd->is_render) ? pd->do_onion : (gpd->onion_flag & GP_ONION_GHOST_ALWAYS);
 
+    /* When render in background the active frame could not be properly set due thread priority
+     * better set again. This is not required in viewport. */
+    if (txl->render_depth_tx) {
+      LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
+        gpl->actframe = BKE_gpencil_layer_frame_get(gpl, pd->cfra, GP_GETFRAME_USE_PREV);
+      }
+    }
+
     BKE_gpencil_visible_stroke_iter(is_final_render ? pd->view_layer : NULL,
                                     ob,
                                     gpencil_layer_cache_populate,



More information about the Bf-blender-cvs mailing list