Commit: d411de96f7d979209b4be6379836314aafc8aeba
Author: Sergey Sharybin
Date:   Tue Jan 17 17:08:30 2023 +0100
Branches: master
https://developer.blender.org/rBd411de96f7d979209b4be6379836314aafc8aeba

Fix T103936: Regression: Track To constraint broken

Caused by 6769acbbba7f.

Some of the matrix variants are rather obscure from the
semantic: they don't really fully initialize the output:
as in, they only write to an upper-left 3x3 block.

A quick solution to fix the very commonly used constraint.
It feels that it is possible to minimize about of copy
operations.

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

M       source/blender/blenlib/intern/math_matrix.c

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

diff --git a/source/blender/blenlib/intern/math_matrix.c 
b/source/blender/blenlib/intern/math_matrix.c
index 7322a9facec..b8eaeb5c654 100644
--- a/source/blender/blenlib/intern/math_matrix.c
+++ b/source/blender/blenlib/intern/math_matrix.c
@@ -382,6 +382,12 @@ void mul_m4_m4m3(float R[4][4], const float A[4][4], const 
float B[3][3])
 {
   if (R == A) {
     float T[4][4];
+    /* The mul_m4_m4m3 only writes to the upper-left 3x3 block, so make it so 
the rest of the
+     * matrix is copied from the input to the output.
+     *
+     * TODO(sergey): It does sound a bit redundant from the number of copy 
operations, so there is
+     * a potential for optimization. */
+    copy_m4_m4(T, A);
     mul_m4_m4m3(T, A, B);
     copy_m4_m4(R, T);
     return;
@@ -450,6 +456,12 @@ void mul_m4_m3m4(float R[4][4], const float A[3][3], const 
float B[4][4])
 {
   if (R == B) {
     float T[4][4];
+    /* The mul_m4_m4m3 only writes to the upper-left 3x3 block, so make it so 
the rest of the
+     * matrix is copied from the input to the output.
+     *
+     * TODO(sergey): It does sound a bit redundant from the number of copy 
operations, so there is
+     * a potential for optimization. */
+    copy_m4_m4(T, B);
     mul_m4_m3m4(T, A, B);
     copy_m4_m4(R, T);
     return;

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to