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
This commit is contained in:
5
doc/python_api/examples/mathutils.Matrix.LocRotScale.py
Normal file
5
doc/python_api/examples/mathutils.Matrix.LocRotScale.py
Normal file
@@ -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)
|
||||
Reference in New Issue
Block a user