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:
authorPhilipp Oeser <info@graphics-engineer.com>2022-09-20 13:11:56 +0300
committerPhilipp Oeser <info@graphics-engineer.com>2022-10-03 22:19:04 +0300
commitdfcc8086fb29745fe533088452797fd2ef39df25 (patch)
tree27949055d07ca4239f90b11679457f3fcd6751e8
parent1e7e1b151c469c2f20c7666ef9def499d2a71967 (diff)
Fix: GPencil animated layer transforms evaluate wrong when identity
Due to (optimization) checks in in `BKE_gpencil_prepare_eval_data` & `BKE_gpencil_update_layer_transforms`, updates were skipped if animation reached exact identity transforms. Now check if the matrix has changed additionally to gain proper updates. Unsure if this is the cheapest way to check for the animated state of layer transforms tbh, but I see similar checks elsewhere. Fixes T101164. Maniphest Tasks: T101164 Differential Revision: https://developer.blender.org/D16018
-rw-r--r--source/blender/blenkernel/intern/gpencil.c7
-rw-r--r--source/blender/blenkernel/intern/gpencil_modifier.c9
2 files changed, 13 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index 13cee6d9e6a..ec1818ce260 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -2991,11 +2991,14 @@ void BKE_gpencil_update_layer_transforms(const Depsgraph *depsgraph, Object *ob)
changed = !equals_m4m4(gpl->inverse, cur_mat);
}
- /* Calc local layer transform. */
+ /* Calc local layer transform. Early out if we have non-animated zero transforms. */
bool transformed = ((!is_zero_v3(gpl->location)) || (!is_zero_v3(gpl->rotation)) ||
(!is_one_v3(gpl->scale)));
+ float tmp_mat[4][4];
+ loc_eul_size_to_mat4(tmp_mat, gpl->location, gpl->rotation, gpl->scale);
+ transformed |= !equals_m4m4(gpl->layer_mat, tmp_mat);
if (transformed) {
- loc_eul_size_to_mat4(gpl->layer_mat, gpl->location, gpl->rotation, gpl->scale);
+ copy_m4_m4(gpl->layer_mat, tmp_mat);
}
/* only redo if any change */
diff --git a/source/blender/blenkernel/intern/gpencil_modifier.c b/source/blender/blenkernel/intern/gpencil_modifier.c
index 3222689ef57..af8f2b8d92d 100644
--- a/source/blender/blenkernel/intern/gpencil_modifier.c
+++ b/source/blender/blenkernel/intern/gpencil_modifier.c
@@ -712,7 +712,14 @@ void BKE_gpencil_prepare_eval_data(Depsgraph *depsgraph, Scene *scene, Object *o
do_parent = true;
break;
}
- if ((!is_zero_v3(gpl->location)) || (!is_zero_v3(gpl->rotation)) || (!is_one_v3(gpl->scale))) {
+
+ /* Only do layer transformations for non-zero or animated transforms. */
+ bool transformed = ((!is_zero_v3(gpl->location)) || (!is_zero_v3(gpl->rotation)) ||
+ (!is_one_v3(gpl->scale)));
+ float tmp_mat[4][4];
+ loc_eul_size_to_mat4(tmp_mat, gpl->location, gpl->rotation, gpl->scale);
+ transformed |= !equals_m4m4(gpl->layer_mat, tmp_mat);
+ if (transformed) {
do_transform = true;
break;
}