[Bf-blender-cvs] [24814a03b73] blender-v3.3-release: Fix: GPencil animated layer transforms evaluate wrong when identity

Philipp Oeser noreply at git.blender.org
Fri Sep 30 15:08:18 CEST 2022


Commit: 24814a03b7345184ba5a87e03015c70eb40c31bf
Author: Philipp Oeser
Date:   Tue Sep 20 12:11:56 2022 +0200
Branches: blender-v3.3-release
https://developer.blender.org/rB24814a03b7345184ba5a87e03015c70eb40c31bf

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

===================================================================

M	source/blender/blenkernel/intern/gpencil.c
M	source/blender/blenkernel/intern/gpencil_modifier.c

===================================================================

diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index 81bca5fc911..4c991897bea 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -2787,11 +2787,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);
     }
 
     /* Continue if no transformations are applied to this layer. */
diff --git a/source/blender/blenkernel/intern/gpencil_modifier.c b/source/blender/blenkernel/intern/gpencil_modifier.c
index 82899b974bc..3f30b8c80af 100644
--- a/source/blender/blenkernel/intern/gpencil_modifier.c
+++ b/source/blender/blenkernel/intern/gpencil_modifier.c
@@ -719,7 +719,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;
     }



More information about the Bf-blender-cvs mailing list