From 3fac9df65f05bde130ef8dbe508892ea76dc74ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20T=C3=B6nne?= Date: Wed, 24 Apr 2024 15:31:30 +0200 Subject: [PATCH] Fix #113925: GPv3: eval_frame needs to be updated for modifier result Grease pencil runtime data stores the "current" frame in the `eval_frame` property. This is updated before modifier evaluation, but also used after modifiers, e.g. by the spreadsheet. If the GeometrySet that is returned by the nodes modifier is created during the nodes evaluation (as is the case with the Delete node) then the resulting geometry set has `eval_frame == 0`. To fix this the `eval_frame` is now also update _after_ modifier evaluation. This will only set the correct `eval_frame` for the __top level__ geometry set. Other GeometrySets like instances may not have the correct frame value. This is a more general problem with the design that is out of scope here. Pull Request: https://projects.blender.org/blender/blender/pulls/121022 --- source/blender/blenkernel/intern/grease_pencil.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/source/blender/blenkernel/intern/grease_pencil.cc b/source/blender/blenkernel/intern/grease_pencil.cc index 4682e9154c4..ad42aa2aa83 100644 --- a/source/blender/blenkernel/intern/grease_pencil.cc +++ b/source/blender/blenkernel/intern/grease_pencil.cc @@ -1742,7 +1742,12 @@ void BKE_grease_pencil_data_update(Depsgraph *depsgraph, Scene *scene, Object *o } grease_pencil_evaluate_modifiers(depsgraph, scene, object, geometry_set); - if (!geometry_set.has_grease_pencil()) { + if (geometry_set.has_grease_pencil()) { + /* Output geometry set may be different from the input, + * set the frame again to ensure a correct value. */ + geometry_set.get_grease_pencil()->runtime->eval_frame = int(DEG_get_ctime(depsgraph)); + } + else { GreasePencil *empty_grease_pencil = BKE_grease_pencil_new_nomain(); empty_grease_pencil->runtime->eval_frame = int(DEG_get_ctime(depsgraph)); geometry_set.replace_grease_pencil(empty_grease_pencil);