reverse vector multiplication order for some internal functions.
authorCampbell Barton <ideasman42@gmail.com>
Mon, 25 Jul 2011 03:59:01 +0000 (03:59 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 25 Jul 2011 03:59:01 +0000 (03:59 +0000)
release/scripts/modules/bpy_extras/view3d_utils.py
release/scripts/modules/bpy_types.py

index c0c0f9186bd22117dd5623ec54d1de2df517520b..5796abce72cc5d9b7ce6538bd460955a162b3747 100644 (file)
@@ -50,11 +50,11 @@ def region_2d_to_vector_3d(region, rv3d, coord):
                       -0.5
                     ))
 
-        w = (out[0] * persinv[0][3]) + \
-            (out[1] * persinv[1][3]) + \
-            (out[2] * persinv[2][3]) + persinv[3][3]
+        w = ((out[0] * persinv[0][3]) +
+             (out[1] * persinv[1][3]) +
+             (out[2] * persinv[2][3]) + persinv[3][3])
 
-        return ((out * persinv) / w) - rv3d.view_matrix.inverted()[3].xyz
+        return ((persinv * out) / w) - rv3d.view_matrix.inverted()[3].xyz
     else:
         return rv3d.view_matrix.inverted()[2].xyz.normalized()
 
@@ -116,7 +116,7 @@ def location_3d_to_region_2d(region, rv3d, coord):
     """
     from mathutils import Vector
 
-    prj = Vector((coord[0], coord[1], coord[2], 1.0)) * rv3d.perspective_matrix
+    prj = rv3d.perspective_matrix * Vector((coord[0], coord[1], coord[2], 1.0))
     if prj.w > 0.0:
         width_half = region.width / 2.0
         height_half = region.height / 2.0
index f2cd46b20ae7075ede531f6fe9501ff9031a61d8..8766c873dd810bf6265f112b16cbff77f09212db 100644 (file)
@@ -144,21 +144,21 @@ class _GenericBone:
         """ Vector pointing down the x-axis of the bone.
         """
         from mathutils import Vector
-        return Vector((1.0, 0.0, 0.0)) * self.matrix.to_3x3()
+        return self.matrix.to_3x3() * Vector((1.0, 0.0, 0.0))
 
     @property
     def y_axis(self):
         """ Vector pointing down the x-axis of the bone.
         """
         from mathutils import Vector
-        return Vector((0.0, 1.0, 0.0)) * self.matrix.to_3x3()
+        return self.matrix.to_3x3() * Vector((0.0, 1.0, 0.0))
 
     @property
     def z_axis(self):
         """ Vector pointing down the x-axis of the bone.
         """
         from mathutils import Vector
-        return Vector((0.0, 0.0, 1.0)) * self.matrix.to_3x3()
+        return self.matrix.to_3x3() * Vector((0.0, 0.0, 1.0))
 
     @property
     def basename(self):
@@ -294,9 +294,9 @@ class EditBone(StructRNA, _GenericBone, metaclass=StructMetaPropGroup):
         :type roll: bool
         """
         from mathutils import Vector
-        z_vec = Vector((0.0, 0.0, 1.0)) * self.matrix.to_3x3()
-        self.tail = self.tail * matrix
-        self.head = self.head * matrix
+        z_vec = self.matrix.to_3x3() * Vector((0.0, 0.0, 1.0))
+        self.tail = matrix * self.tail
+        self.head = matrix * self.head
 
         if scale:
             scalar = matrix.median_scale
@@ -304,7 +304,7 @@ class EditBone(StructRNA, _GenericBone, metaclass=StructMetaPropGroup):
             self.tail_radius *= scalar
 
         if roll:
-            self.align_roll(z_vec * matrix)
+            self.align_roll(matrix * z_vec)
 
 
 def ord_ind(i1, i2):