[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [34648] trunk/blender/release/scripts: update for changes in mathutils.

Campbell Barton ideasman42 at gmail.com
Sat Feb 5 08:04:25 CET 2011


Revision: 34648
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=34648
Author:   campbellbarton
Date:     2011-02-05 07:04:23 +0000 (Sat, 05 Feb 2011)
Log Message:
-----------
update for changes in mathutils.

Modified Paths:
--------------
    trunk/blender/release/scripts/modules/add_object_utils.py
    trunk/blender/release/scripts/modules/bpy_types.py
    trunk/blender/release/scripts/op/nla.py
    trunk/blender/release/scripts/op/object.py
    trunk/blender/release/scripts/op/uvcalc_smart_project.py

Modified: trunk/blender/release/scripts/modules/add_object_utils.py
===================================================================
--- trunk/blender/release/scripts/modules/add_object_utils.py	2011-02-05 06:14:50 UTC (rev 34647)
+++ trunk/blender/release/scripts/modules/add_object_utils.py	2011-02-05 07:04:23 UTC (rev 34648)
@@ -37,7 +37,7 @@
             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 @@
             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()
 

Modified: trunk/blender/release/scripts/modules/bpy_types.py
===================================================================
--- trunk/blender/release/scripts/modules/bpy_types.py	2011-02-05 06:14:50 UTC (rev 34647)
+++ trunk/blender/release/scripts/modules/bpy_types.py	2011-02-05 07:04:23 UTC (rev 34648)
@@ -142,19 +142,19 @@
     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 @@
         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

Modified: trunk/blender/release/scripts/op/nla.py
===================================================================
--- trunk/blender/release/scripts/op/nla.py	2011-02-05 06:14:50 UTC (rev 34647)
+++ trunk/blender/release/scripts/op/nla.py	2011-02-05 07:04:23 UTC (rev 34648)
@@ -40,14 +40,14 @@
         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 @@
             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 @@
         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)

Modified: trunk/blender/release/scripts/op/object.py
===================================================================
--- trunk/blender/release/scripts/op/object.py	2011-02-05 06:14:50 UTC (rev 34647)
+++ trunk/blender/release/scripts/op/object.py	2011-02-05 07:04:23 UTC (rev 34648)
@@ -484,8 +484,8 @@
 
         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

Modified: trunk/blender/release/scripts/op/uvcalc_smart_project.py
===================================================================
--- trunk/blender/release/scripts/op/uvcalc_smart_project.py	2011-02-05 06:14:50 UTC (rev 34647)
+++ trunk/blender/release/scripts/op/uvcalc_smart_project.py	2011-02-05 07:04:23 UTC (rev 34648)
@@ -168,7 +168,7 @@
     #	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 @@
                 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 @@
         # 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 = []
 




More information about the Bf-blender-cvs mailing list