[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [2860] trunk/py/scripts/addons/ io_import_scene_dxf.py: Fix for recent changes to matrix indexing;
Andrew Hale
TrumanBlending at gmail.com
Mon Jan 2 13:05:11 CET 2012
Revision: 2860
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=2860
Author: trumanblending
Date: 2012-01-02 12:05:05 +0000 (Mon, 02 Jan 2012)
Log Message:
-----------
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
Modified Paths:
--------------
trunk/py/scripts/addons/io_import_scene_dxf.py
Modified: trunk/py/scripts/addons/io_import_scene_dxf.py
===================================================================
--- trunk/py/scripts/addons/io_import_scene_dxf.py 2012-01-02 10:53:05 UTC (rev 2859)
+++ trunk/py/scripts/addons/io_import_scene_dxf.py 2012-01-02 12:05:05 UTC (rev 2860)
@@ -1412,14 +1412,15 @@
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 @@
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
More information about the Bf-extensions-cvs
mailing list