diff options
author | Andrew Hale <TrumanBlending@gmail.com> | 2012-01-02 16:05:05 +0400 |
---|---|---|
committer | Andrew Hale <TrumanBlending@gmail.com> | 2012-01-02 16:05:05 +0400 |
commit | d78f02ec2677993c24fe8604356ca1b9b5be3345 (patch) | |
tree | 125d611965acb3924b369b1177d868e87484c37a /io_import_scene_dxf.py | |
parent | c8dae7e6602da884f319dd8ffc1499a34c9bd94e (diff) |
Fix for recent changes to matrix indexing;
- Explicit construction of matrices is now via a list of rows not of columns
- Use Matrix.Rotation() instead of manual creation of the rotation matrix
- Use Matrix() instead of manual creation of 4x4 identity matrix
Diffstat (limited to 'io_import_scene_dxf.py')
-rw-r--r-- | io_import_scene_dxf.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/io_import_scene_dxf.py b/io_import_scene_dxf.py index 3fe3e1fd..32fc40d4 100644 --- a/io_import_scene_dxf.py +++ b/io_import_scene_dxf.py @@ -1412,14 +1412,15 @@ def getOCS(az): #-------------------------------------------------------------- ax.normalize() ay = az.cross(ax) ay.normalize() - return Matrix((ax, ay, az)) + # Matrices are now constructed from rows, transpose to make the rows into cols + return Matrix((ax, ay, az)).transposed() def transform(normal, rotation, obj): #-------------------------------------------- """Use the calculated ocs to determine the objects location/orientation in space. """ - ma = Matrix(((1,0,0,0),(0,1,0,0),(0,0,1,0),(0,0,0,1))) + ma = Matrix() o = Vector(obj.location) ma_new = getOCS(normal) if ma_new: @@ -1428,8 +1429,8 @@ def transform(normal, rotation, obj): #---------------------------------------- o = ma * o if rotation != 0: - g = radians(-rotation) - rmat = Matrix(((cos(g), -sin(g), 0), (sin(g), cos(g), 0), (0, 0, 1))) + g = radians(rotation) + rmat = Matrix.Rotation(g, 3, 'Z') ma = ma * rmat.to_4x4() obj.matrix_world = ma #must be matrix4x4 |