update for changes in mathutils.
authorCampbell Barton <ideasman42@gmail.com>
Sat, 5 Feb 2011 07:04:23 +0000 (07:04 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sat, 5 Feb 2011 07:04:23 +0000 (07:04 +0000)
release/scripts/modules/add_object_utils.py
release/scripts/modules/bpy_types.py
release/scripts/op/nla.py
release/scripts/op/object.py
release/scripts/op/uvcalc_smart_project.py

index 01a1a73aedfa2d21a2df14b7261817b047c5d3de..10707734bc40cd497b3586b1dfaa1aaf4c62aa37 100644 (file)
@@ -37,7 +37,7 @@ def add_object_align_init(context, operator):
             location = mathutils.Matrix.Translation(context.scene.cursor_location)
 
         if operator:
-            operator.properties.location = location.translation_part()
+            operator.properties.location = location.to_translation()
 
     # rotation
     view_align = (context.user_preferences.edit.object_align == 'VIEW')
@@ -49,10 +49,10 @@ def add_object_align_init(context, operator):
             operator.properties.view_align = view_align
 
     if operator and operator.properties.is_property_set("rotation") and not view_align_force:
-        rotation = mathutils.Euler(operator.properties.rotation).to_matrix().resize4x4()
+        rotation = mathutils.Euler(operator.properties.rotation).to_matrix().to_4x4()
     else:
         if view_align and space_data:
-            rotation = space_data.region_3d.view_matrix.rotation_part().invert().resize4x4()
+            rotation = space_data.region_3d.view_matrix.to_3x3().inverted().to_4x4()
         else:
             rotation = mathutils.Matrix()
 
index 61c3f11ccef025fa9f07274327e2fce70a1d1951..1cb30765bf013603bdaa1f6c81f292fba4a40974 100644 (file)
@@ -142,19 +142,19 @@ class _GenericBone:
     def x_axis(self):
         """ Vector pointing down the x-axis of the bone.
         """
-        return Vector((1.0, 0.0, 0.0)) * self.matrix.rotation_part()
+        return Vector((1.0, 0.0, 0.0)) * self.matrix.to_3x3()
 
     @property
     def y_axis(self):
         """ Vector pointing down the x-axis of the bone.
         """
-        return Vector((0.0, 1.0, 0.0)) * self.matrix.rotation_part()
+        return Vector((0.0, 1.0, 0.0)) * self.matrix.to_3x3()
 
     @property
     def z_axis(self):
         """ Vector pointing down the x-axis of the bone.
         """
-        return Vector((0.0, 0.0, 1.0)) * self.matrix.rotation_part()
+        return Vector((0.0, 0.0, 1.0)) * self.matrix.to_3x3()
 
     @property
     def basename(self):
@@ -284,7 +284,7 @@ class EditBone(StructRNA, _GenericBone, metaclass=StructMetaIDProp):
         Expects a 4x4 or 3x3 matrix.
         """
         from mathutils import Vector
-        z_vec = Vector((0.0, 0.0, 1.0)) * self.matrix.rotation_part()
+        z_vec = Vector((0.0, 0.0, 1.0)) * self.matrix.to_3x3()
         self.tail = self.tail * matrix
         self.head = self.head * matrix
         scalar = matrix.median_scale
index acea7d53572d3b31f5c18d781acd85f6119d94fb..d47668d68e3a85d4732dbc328fcdd2d26f5f25a2 100644 (file)
@@ -40,14 +40,14 @@ def pose_info():
         binfo["pbone"] = pbone
         binfo["matrix_local"] = bone.matrix_local.copy()
         try:
-            binfo["matrix_local_inv"] = binfo["matrix_local"].copy().invert()
+            binfo["matrix_local_inv"] = binfo["matrix_local"].inverted()
         except:
             binfo["matrix_local_inv"] = Matrix()
 
         binfo["matrix"] = bone.matrix.copy()
         binfo["matrix_pose"] = pbone.matrix.copy()
         try:
-            binfo["matrix_pose_inv"] = binfo["matrix_pose"].copy().invert()
+            binfo["matrix_pose_inv"] = binfo["matrix_pose"].inverted()
         except:
             binfo["matrix_pose_inv"] = Matrix()
 
@@ -67,7 +67,7 @@ def pose_info():
             matrix = binfo_parent["matrix_pose_inv"] * matrix
             rest_matrix = binfo_parent["matrix_local_inv"] * rest_matrix
 
-        matrix = rest_matrix.copy().invert() * matrix
+        matrix = rest_matrix.inverted() * matrix
 
         binfo["matrix_key"] = matrix.copy()
 
@@ -104,8 +104,8 @@ def bake(frame_start, frame_end, step=1, only_selected=False):
         for f in frame_range:
             matrix = info_ls[int((f - frame_start) / step)][name]["matrix_key"]
 
-            #pbone.location = matrix.translation_part()
-            #pbone.rotation_quaternion = matrix.to_quat()
+            #pbone.location = matrix.to_translation()
+            #pbone.rotation_quaternion = matrix.to_quaternion()
             pbone.matrix_basis = matrix
 
             pbone.keyframe_insert("location", -1, f, name)
index 15da8f107a246f4919d33e0c2770c9ffabbb6d8c..8fee6e2166d0d31805ce4b058a63dbd74066e9ff 100644 (file)
@@ -484,8 +484,8 @@ class MakeDupliFace(bpy.types.Operator):
 
         def matrix_to_quat(matrix):
             # scale = matrix.median_scale
-            trans = matrix.translation_part()
-            rot = matrix.rotation_part()  # also contains scale
+            trans = matrix.to_translation()
+            rot = matrix.to_3x3()  # also contains scale
 
             return [(b * rot) + trans for b in base_tri]
         scene = bpy.context.scene
index 3a835ae671eb2b4000fbce9b0bd89fcc9f07b8cf..8f1c7a27f786082553d6836ff7d954c9c027ecf4 100644 (file)
@@ -168,7 +168,7 @@ def island2Edge(island):
     #  e.pop(2)
 
     # return edges and unique points
-    return length_sorted_edges, [v.__copy__().resize3D() for v in unique_points.values()]
+    return length_sorted_edges, [v.to_3d() for v in unique_points.values()]
 
 # ========================= NOT WORKING????
 # Find if a points inside an edge loop, un-orderd.
@@ -227,7 +227,7 @@ def islandIntersectUvIsland(source, target, SourceOffset):
                 return 1 # LINE INTERSECTION
 
     # 1 test for source being totally inside target
-    SourceOffset.resize3D()
+    SourceOffset.resize_3d()
     for pv in source[7]:
         if pointInIsland(pv+SourceOffset, target[0]):
             return 2 # SOURCE INSIDE TARGET
@@ -926,7 +926,7 @@ def main(context, island_margin, projection_limit):
         # Initialize projectVecs
         if USER_VIEW_INIT:
             # Generate Projection
-            projectVecs = [Vector(Window.GetViewVector()) * ob.matrix_world.copy().invert().rotation_part()] # We add to this allong the way
+            projectVecs = [Vector(Window.GetViewVector()) * ob.matrix_world.inverted().to_3x3()] # We add to this allong the way
         else:
             projectVecs = []