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>2021-05-14 19:46:19 +0300
committerAlexander Gavrilov <angavrilov@gmail.com>2021-05-17 19:12:40 +0300
commita86e815dd86fb77d910bbc857106bedb4b691874 (patch)
tree5f62c14896e7e5cc71c679d30d35f45f427acf4f /doc/python_api/examples/mathutils.Matrix.LocRotScale.py
parentf09606cc68bd28abb8229d1e5c1ad6fe351cf4f7 (diff)
Mathutils: add a Matrix.LocRotScale constructor for combining channels.
Combining location, rotation and scale channels into a matrix is a standard task, so while it is easily accomplished by constructing and multiplying 3 matrices, having a standard utility allows for more clear code. The new constructor builds a 4x4 matrix from separate location, rotation and scale values. Rotation can be represented as a 3x3 Matrix, Quaternion or Euler value, while the other two inputs are vectors. Unneeded inputs can be replaced with None. Differential Revision: https://developer.blender.org/D11264
Diffstat (limited to 'doc/python_api/examples/mathutils.Matrix.LocRotScale.py')
-rw-r--r--doc/python_api/examples/mathutils.Matrix.LocRotScale.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/doc/python_api/examples/mathutils.Matrix.LocRotScale.py b/doc/python_api/examples/mathutils.Matrix.LocRotScale.py
new file mode 100644
index 00000000000..016a5002e82
--- /dev/null
+++ b/doc/python_api/examples/mathutils.Matrix.LocRotScale.py
@@ -0,0 +1,5 @@
+# Compute local object transformation matrix:
+if obj.rotation_mode == 'QUATERNION':
+ matrix = mathutils.Matrix.LocRotScale(obj.location, obj.rotation_quaternion, obj.scale)
+else:
+ matrix = mathutils.Matrix.LocRotScale(obj.location, obj.rotation_euler, obj.scale)