I recently faced an issue with mathutils.Matrix subclassing that seems to be beyond my Python competence, so I’m looking for a little help here. What is weird is that I believe this code already worked previously (ie. in a Blender release older than 2.65), but now I just can’t understand why it fails… I tried to have a look at “mathutils_Matrix.c” but it didn’t help.
In fact it seems impossible to pass a default matrix as a parameter when calling the superclass Matrix.
My code is:
from mathutils import Matrix class Mat(Matrix): """3x3 Matrix""" def __init__(self, matrix=((0,0,0),(0,0,0),(0,0,0))): Matrix.__init__(self, matrix) Mat()
Calling it leads to the error message:
Traceback (most recent call last): File "<blender_console>", line 1, in <module> File "<blender_console>", line 4, in __init__ TypeError: object.__init__() takes no parameters
But it IS possible to pass a parameter when creating a new Matrix instance directly though:
Matrix(((0.0, 0.0, 0.0), (0.0, 0.0, 0.0), (0.0, 0.0, 0.0)))
Does anyone has an idea about what could be wrong here?