MatrixBlender 2.8+ Matrix multiplication
The question code method was writtenin place for <=2.79.9Blender <=2.79.9. Blender has since adjusted its mathutils
module, replacing the asterisk *
with the at symbol @
, aka the PEP 465 binary operator, whenfor multiplying matrices andwith vectors.
>>> M = Matrix()
>>> v = Vector()
>>> M @ v
Vector((0.0, 0.0, 0.0))
>>> v @ v
0.0
>>> M @ M
Matrix(((1.0, 0.0, 0.0, 0.0),
(0.0, 1.0, 0.0, 0.0),
(0.0, 0.0, 1.0, 0.0),
(0.0, 0.0, 0.0, 1.0)))
Note using @
will throw the "same" error in"same type of error" in <= 2.79.9 and will need to be replacedReplace with *
as in question code.
>>> M = Matrix()
>>> M @ M
Traceback (most recent call last):
File "<blender_console>", line 1, in <module>
TypeError: unsupported operand type(s) for @: 'Matrix' and 'Matrix'