From d78f02ec2677993c24fe8604356ca1b9b5be3345 Mon Sep 17 00:00:00 2001 From: Andrew Hale <TrumanBlending@gmail.com> Date: Mon, 2 Jan 2012 12:05:05 +0000 Subject: [PATCH] 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 --- io_import_scene_dxf.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/io_import_scene_dxf.py b/io_import_scene_dxf.py index 3fe3e1fd7..32fc40d45 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 -- GitLab