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
This commit is contained in:
Lukas Tönne
2024-04-24 15:31:30 +02:00
parent fd9de3ff7e
commit 3fac9df65f

View File

@@ -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);