diff options
-rw-r--r-- | source/blender/draw/engines/gpencil/gpencil_engine.c | 14 |
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); + } } } |