The variable matrix contains 16 float values and I want to create an instance of Matrix

 m = Matrix( matrix[0:4],matrix[4:8],matrix[8:12],matrix[12:16] )
 qr = m.to_quaternion()

This leads to:

TypeError: Matrix(): expects no args or 2-4 numeric sequences

I tried to put parthesises around each expression like (matrix[0:4]) What is meant by numeric sequence when neither way works?


mathutils.Matrix behavior changed so that it expects a single argument, but the error message wasn't updated (now done)

This works as expected:

m = Matrix((matrix[0:4], matrix[4:8], matrix[8:12], matrix[12:16]))
qr = m.to_quaternion()

Mailing list thread as to why the changes was made

| improve this answer | |
  • $\begingroup$ Note the parenthesis around the argument -> numeric sequence in the form of a tuple (am I right ?) :P $\endgroup$ – Polosson Nov 29 '13 at 0:26
  • $\begingroup$ it is, but a list will work as well. $\endgroup$ – ideasman42 Nov 29 '13 at 2:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.