Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonio Vazquez <blendergit@gmail.com>2021-02-19 18:18:09 +0300
committerAntonio Vazquez <blendergit@gmail.com>2021-02-19 18:18:36 +0300
commit0d94695cc458b1f7666104314b57b174f0ee93d1 (patch)
treee5807b07312e3492e75bc2a5c623bc5bd6330a81 /source/blender/draw/engines/gpencil/gpencil_engine.c
parent2b8c2438e4248b0fbacffc57649d39fa35ba6d0e (diff)
Fix T85745: Render grease pencil with time offset modifier fails
The problem was introduced fixing task T85035. As the frame was set again when render, if there was a time modifier, the frame was not remaped to the right frame number.
Diffstat (limited to 'source/blender/draw/engines/gpencil/gpencil_engine.c')
-rw-r--r--source/blender/draw/engines/gpencil/gpencil_engine.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c b/source/blender/draw/engines/gpencil/gpencil_engine.c
index 4f8f1f7a456..5eaeeca8bab 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -23,6 +23,7 @@
#include "DRW_render.h"
#include "BKE_gpencil.h"
+#include "BKE_gpencil_modifier.h"
#include "BKE_lib_id.h"
#include "BKE_main.h"
#include "BKE_object.h"
@@ -621,11 +622,20 @@ void GPENCIL_cache_populate(void *ved, Object *ob)
bool do_onion = (!pd->is_render) ? pd->do_onion : (gpd->onion_flag & GP_ONION_GHOST_ALWAYS);
gpd->runtime.playing = (short)pd->playing;
- /* When render in background the active frame could not be properly set due thread priority
+ /* 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) {
+ const bool time_remap = BKE_gpencil_has_time_modifiers(ob);
+ const DRWContextState *draw_ctx = DRW_context_state_get();
+
LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
- gpl->actframe = BKE_gpencil_layer_frame_get(gpl, pd->cfra, GP_GETFRAME_USE_PREV);
+ /* If there is a time modifier, need remap the time before. */
+ if (time_remap) {
+ gpl->actframe = BKE_gpencil_frame_retime_get(draw_ctx->depsgraph, pd->scene, ob, gpl);
+ }
+ else {
+ gpl->actframe = BKE_gpencil_layer_frame_get(gpl, pd->cfra, GP_GETFRAME_USE_PREV);
+ }
}
}