From eb6de2d4fcd6df0555a46fdca546f94bb5c799e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Mon, 2 Dec 2024 13:21:04 +0100 Subject: [PATCH] Fix #131239: Grease Pencil: Last stroke in drawing uses wrong layer opacity Flush was being done on the wrong pass. It was also creating errors. --- source/blender/draw/engines/gpencil/gpencil_engine_c.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/blender/draw/engines/gpencil/gpencil_engine_c.cc b/source/blender/draw/engines/gpencil/gpencil_engine_c.cc index 01e7b318c60..6600828cb4e 100644 --- a/source/blender/draw/engines/gpencil/gpencil_engine_c.cc +++ b/source/blender/draw/engines/gpencil/gpencil_engine_c.cc @@ -483,13 +483,15 @@ static GPENCIL_tObject *grease_pencil_object_cache_populate( continue; } + if (last_pass) { + drawcall_flush(*last_pass); + } + GPENCIL_tLayer *tgp_layer = grease_pencil_layer_cache_add( pd, ob, layer, info.onion_id, is_layer_used_as_mask, tgp_ob); PassSimple &pass = *tgp_layer->geom_ps; last_pass = &pass; - drawcall_flush(pass); - const bool use_lights = pd->use_lighting && ((layer.base.flag & GP_LAYER_TREE_NODE_USE_LIGHTS) != 0) && (ob->dtx & OB_USE_GPENCIL_LIGHTS);