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:
authorAlexander Gavrilov <angavrilov@gmail.com>2019-09-04 12:06:59 +0300
committerAlexander Gavrilov <angavrilov@gmail.com>2019-09-06 07:57:16 +0300
commitf4056e9ec3a89afbc592af3e3d169d2d584a9937 (patch)
treeb100222f89ce3dfbc723e7f0a975b30019c76427 /source/blender/blenlib
parent9972d6c3062010bea514c9e382b0a99275d63a89 (diff)
Copy Rotation: implement new mixing modes that actually work.
Upon close inspection, the way the Offset mode works in the Copy Rotation constraint makes no sense, and in fact, destroys the rotation of its owner unless either it's single axis, or the order is set specifically to `ZYX Euler`. Since it can't simply be changed because of backward compatibility concerns, replace the checkbox with a dropdown that provides a set of new modes that actually make sense. Specifically, add a mode that simply adds Euler components together, and two options that use matrix multiplication in different order. The Python use_offset property is replaced with compatibility stubs. Reviewers: brecht Differential Revision: https://developer.blender.org/D5640
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r--source/blender/blenlib/BLI_math_matrix.h6
-rw-r--r--source/blender/blenlib/intern/math_matrix.c16
2 files changed, 20 insertions, 2 deletions
diff --git a/source/blender/blenlib/BLI_math_matrix.h b/source/blender/blenlib/BLI_math_matrix.h
index 00c301a01bc..814b13fa47f 100644
--- a/source/blender/blenlib/BLI_math_matrix.h
+++ b/source/blender/blenlib/BLI_math_matrix.h
@@ -310,7 +310,7 @@ void mat4_to_size_fix_shear(float r[3], const float M[4][4]);
void translate_m4(float mat[4][4], float tx, float ty, float tz);
void rotate_m4(float mat[4][4], const char axis, const float angle);
-void rescale_m4(float mat[4][4], float scale[3]);
+void rescale_m4(float mat[4][4], const float scale[3]);
void transform_pivot_set_m4(float mat[4][4], const float pivot[3]);
void mat3_to_rot_size(float rot[3][3], float size[3], const float mat3[3][3]);
@@ -320,6 +320,10 @@ void mat4_decompose(float loc[3], float quat[4], float size[3], const float wmat
void mat3_polar_decompose(const float mat3[3][3], float r_U[3][3], float r_P[3][3]);
+void loc_rot_size_to_mat4(float R[4][4],
+ const float loc[3],
+ const float rot[3][3],
+ const float size[3]);
void loc_eul_size_to_mat4(float R[4][4],
const float loc[3],
const float eul[3],
diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c
index 7c1b44978e2..e9d196ccdbb 100644
--- a/source/blender/blenlib/intern/math_matrix.c
+++ b/source/blender/blenlib/intern/math_matrix.c
@@ -2164,7 +2164,7 @@ void rotate_m4(float mat[4][4], const char axis, const float angle)
}
/** Scale a matrix in-place. */
-void rescale_m4(float mat[4][4], float scale[3])
+void rescale_m4(float mat[4][4], const float scale[3])
{
mul_v3_fl(mat[0], scale[0]);
mul_v3_fl(mat[1], scale[1]);
@@ -2359,6 +2359,20 @@ bool equals_m4m4(const float mat1[4][4], const float mat2[4][4])
/**
* Make a 4x4 matrix out of 3 transform components.
* Matrices are made in the order: `scale * rot * loc`
+ */
+void loc_rot_size_to_mat4(float mat[4][4],
+ const float loc[3],
+ const float rot[3][3],
+ const float size[3])
+{
+ copy_m4_m3(mat, rot);
+ rescale_m4(mat, size);
+ copy_v3_v3(mat[3], loc);
+}
+
+/**
+ * Make a 4x4 matrix out of 3 transform components.
+ * Matrices are made in the order: `scale * rot * loc`
*
* TODO: need to have a version that allows for rotation order...
*/