[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [1539] trunk/py/scripts/addons: update for changes in mathutuils.

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


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

Modified Paths:
--------------
    trunk/py/scripts/addons/add_curve_aceous_galore.py
    trunk/py/scripts/addons/add_mesh_BoltFactory/Boltfactory.py
    trunk/py/scripts/addons/add_mesh_BoltFactory/createMesh.py
    trunk/py/scripts/addons/curve_simplify.py
    trunk/py/scripts/addons/io_anim_bvh/export_bvh.py
    trunk/py/scripts/addons/io_anim_bvh/import_bvh.py
    trunk/py/scripts/addons/io_anim_camera.py
    trunk/py/scripts/addons/io_export_anim_mesh_xna/export_xna.py
    trunk/py/scripts/addons/io_export_directx_x.py
    trunk/py/scripts/addons/io_export_unreal_psk_psa.py
    trunk/py/scripts/addons/io_import_images_as_planes.py
    trunk/py/scripts/addons/io_import_scene_dxf.py
    trunk/py/scripts/addons/io_import_scene_unreal_psk.py
    trunk/py/scripts/addons/io_scene_3ds/export_3ds.py
    trunk/py/scripts/addons/io_scene_3ds/import_3ds.py
    trunk/py/scripts/addons/io_scene_fbx/export_fbx.py
    trunk/py/scripts/addons/io_scene_obj/export_obj.py
    trunk/py/scripts/addons/io_scene_x3d/export_x3d.py
    trunk/py/scripts/addons/io_scene_x3d/import_x3d.py
    trunk/py/scripts/addons/modules/add_utils.py
    trunk/py/scripts/addons/render_povray/render.py
    trunk/py/scripts/addons/rigify/rigs/misc/delta.py
    trunk/py/scripts/addons/rigify/utils.py
    trunk/py/scripts/addons/space_view3d_copy_attributes.py
    trunk/py/scripts/addons/space_view3d_math_vis/draw.py
    trunk/py/scripts/addons/space_view3d_math_vis/utils.py
    trunk/py/scripts/addons/space_view3d_panel_measure.py

Modified: trunk/py/scripts/addons/add_curve_aceous_galore.py
===================================================================
--- trunk/py/scripts/addons/add_curve_aceous_galore.py	2011-02-05 00:59:31 UTC (rev 1538)
+++ trunk/py/scripts/addons/add_curve_aceous_galore.py	2011-02-05 07:08:34 UTC (rev 1539)
@@ -603,7 +603,7 @@
     obj_align = context.user_preferences.edit.object_align
     if (context.space_data.type == 'VIEW_3D'
         and obj_align == 'VIEW'):
-        rot = context.space_data.region_3d.view_matrix.rotation_part().invert().resize4x4()
+        rot = context.space_data.region_3d.view_matrix.to_3x3().inverted().to_4x4()
     else:
         rot = Matrix()
     align_matrix = loc * rot

Modified: trunk/py/scripts/addons/add_mesh_BoltFactory/Boltfactory.py
===================================================================
--- trunk/py/scripts/addons/add_mesh_BoltFactory/Boltfactory.py	2011-02-05 00:59:31 UTC (rev 1538)
+++ trunk/py/scripts/addons/add_mesh_BoltFactory/Boltfactory.py	2011-02-05 07:08:34 UTC (rev 1539)
@@ -33,7 +33,7 @@
     obj_align = context.user_preferences.edit.object_align
     if (context.space_data.type == 'VIEW_3D'
         and obj_align == 'VIEW'):
-        rot = context.space_data.region_3d.view_matrix.rotation_part().invert().resize4x4()
+        rot = context.space_data.region_3d.view_matrix.to_3x3().inverted().to_4x4()
     else:
         rot = mathutils.Matrix()
     align_matrix = loc * rot

Modified: trunk/py/scripts/addons/add_mesh_BoltFactory/createMesh.py
===================================================================
--- trunk/py/scripts/addons/add_mesh_BoltFactory/createMesh.py	2011-02-05 00:59:31 UTC (rev 1538)
+++ trunk/py/scripts/addons/add_mesh_BoltFactory/createMesh.py	2011-02-05 07:08:34 UTC (rev 1539)
@@ -2064,7 +2064,7 @@
     obj_align = context.user_preferences.edit.object_align
     if (context.space_data.type == 'VIEW_3D'
         and obj_align == 'VIEW'):
-        rot = context.space_data.region_3d.view_matrix.rotation_part().invert().resize4x4()
+        rot = context.space_data.region_3d.view_matrix.to_3x3().inverted().to_4x4()
     else:
         rot = Matrix()
     align_matrix = loc * rot

Modified: trunk/py/scripts/addons/curve_simplify.py
===================================================================
--- trunk/py/scripts/addons/curve_simplify.py	2011-02-05 00:59:31 UTC (rev 1538)
+++ trunk/py/scripts/addons/curve_simplify.py	2011-02-05 07:08:34 UTC (rev 1539)
@@ -254,7 +254,7 @@
                                 for splineVert in spline.bezier_points.values()]
 
             else: # verts from all other types of curves
-                splineVerts = [splineVert.co.copy().resize3D()
+                splineVerts = [splineVert.co.to_3d()
                                 for splineVert in spline.points.values()]
 
             # simplify spline according to mode
@@ -304,7 +304,7 @@
     fcurves = []
     for fc in obj.animation_data.action.fcurves:
         if fc.select:
-            fcVerts = [vcVert.co.copy().resize3D()
+            fcVerts = [vcVert.co.to_3d()
                         for vcVert in fc.keyframe_points.values()]
             fcurves.append(fcVerts)
     return fcurves

Modified: trunk/py/scripts/addons/io_anim_bvh/export_bvh.py
===================================================================
--- trunk/py/scripts/addons/io_anim_bvh/export_bvh.py	2011-02-05 00:59:31 UTC (rev 1538)
+++ trunk/py/scripts/addons/io_anim_bvh/export_bvh.py	2011-02-05 07:08:34 UTC (rev 1539)
@@ -151,9 +151,9 @@
             self.rest_local_mat = self.rest_bone.matrix
 
             # inverted mats
-            self.pose_imat = self.pose_mat.copy().invert()
-            self.rest_arm_imat = self.rest_arm_mat.copy().invert()
-            self.rest_local_imat = self.rest_local_mat.copy().invert()
+            self.pose_imat = self.pose_mat.inverted()
+            self.rest_arm_imat = self.rest_arm_mat.inverted()
+            self.rest_local_imat = self.rest_local_mat.inverted()
 
             self.parent = None
             self.prev_euler = Euler((0.0, 0.0, 0.0))
@@ -161,7 +161,7 @@
 
         def update_posedata(self):
             self.pose_mat = self.pose_bone.matrix
-            self.pose_imat = self.pose_mat.copy().invert()
+            self.pose_imat = self.pose_mat.inverted()
 
         def __repr__(self):
             if self.parent:
@@ -202,14 +202,14 @@
             if  dbone.parent:
                 mat_final = dbone.parent.rest_arm_mat * dbone.parent.pose_imat * dbone.pose_mat * dbone.rest_arm_imat
                 mat_final = itrans * mat_final * trans
-                loc = mat_final.translation_part() + (dbone.rest_bone.head_local - dbone.parent.rest_bone.head_local)
+                loc = mat_final.to_translation() + (dbone.rest_bone.head_local - dbone.parent.rest_bone.head_local)
             else:
                 mat_final = dbone.pose_mat * dbone.rest_arm_imat
                 mat_final = itrans * mat_final * trans
-                loc = mat_final.translation_part() + dbone.rest_bone.head
+                loc = mat_final.to_translation() + dbone.rest_bone.head
 
             # keep eulers compatible, no jumping on interpolation.
-            rot = mat_final.rotation_part().invert().to_euler('XYZ', dbone.prev_euler)
+            rot = mat_final.to_3x3().inverted().to_euler('XYZ', dbone.prev_euler)
 
             if not dbone.connected:
                 file.write("%.6f %.6f %.6f " % (loc * global_scale)[:])

Modified: trunk/py/scripts/addons/io_anim_bvh/import_bvh.py
===================================================================
--- trunk/py/scripts/addons/io_anim_bvh/import_bvh.py	2011-02-05 00:59:31 UTC (rev 1538)
+++ trunk/py/scripts/addons/io_anim_bvh/import_bvh.py	2011-02-05 07:08:34 UTC (rev 1539)
@@ -446,13 +446,13 @@
         bone_name = bvh_node.temp  # may not be the same name as the bvh_node, could have been shortened.
         pose_bone = pose_bones[bone_name]
         rest_bone = arm_data.bones[bone_name]
-        bone_rest_matrix = rest_bone.matrix_local.rotation_part()
+        bone_rest_matrix = rest_bone.matrix_local.to_3x3()
 
         bone_rest_matrix_inv = Matrix(bone_rest_matrix)
         bone_rest_matrix_inv.invert()
 
-        bone_rest_matrix_inv.resize4x4()
-        bone_rest_matrix.resize4x4()
+        bone_rest_matrix_inv.resize_4x4()
+        bone_rest_matrix.resize_4x4()
         bvh_node.temp = (pose_bone, bone, bone_rest_matrix, bone_rest_matrix_inv)
 
     # Make a dict for fast access without rebuilding a list all the time.
@@ -479,18 +479,18 @@
             if bvh_node.has_rot:
                 # apply rotation order and convert to XYZ
                 # note that the rot_order_str is reversed.
-                bone_rotation_matrix = Euler((rx, ry, rz), bvh_node.rot_order_str[::-1]).to_matrix().resize4x4()
+                bone_rotation_matrix = Euler((rx, ry, rz), bvh_node.rot_order_str[::-1]).to_matrix().to_4x4()
                 bone_rotation_matrix = bone_rest_matrix_inv * bone_rotation_matrix * bone_rest_matrix
 
                 if rotate_mode == 'QUATERNION':
-                    pose_bone.rotation_quaternion = bone_rotation_matrix.to_quat()
+                    pose_bone.rotation_quaternion = bone_rotation_matrix.to_quaternion()
                 else:
                     euler = bone_rotation_matrix.to_euler(bvh_node.rot_order_str, prev_euler[i])
                     pose_bone.rotation_euler = euler
                     prev_euler[i] = euler
 
             if bvh_node.has_loc:
-                pose_bone.location = (bone_rest_matrix_inv * Matrix.Translation(Vector((lx, ly, lz)) - bvh_node.rest_head_local)).translation_part()
+                pose_bone.location = (bone_rest_matrix_inv * Matrix.Translation(Vector((lx, ly, lz)) - bvh_node.rest_head_local)).to_translation()
 
             if bvh_node.has_loc:
                 pose_bone.keyframe_insert("location")

Modified: trunk/py/scripts/addons/io_anim_camera.py
===================================================================
--- trunk/py/scripts/addons/io_anim_camera.py	2011-02-05 00:59:31 UTC (rev 1538)
+++ trunk/py/scripts/addons/io_anim_camera.py	2011-02-05 07:08:34 UTC (rev 1539)
@@ -87,9 +87,9 @@
             fw("obj = cameras['%s']\n" % obj.name)
 
             matrix = obj.matrix_world.copy()
-            fw("obj.location = %s\n" % repr(tuple(matrix.translation_part())))
-            fw("obj.scale = %s\n" % repr(tuple(matrix.scale_part())))
-            fw("obj.rotation_euler = %s\n" % repr(tuple(matrix.to_euler())))
+            fw("obj.location = %r\n" % matrix.to_translation()[:])
+            fw("obj.scale = %r\n" % matrix.to_scale()[:])
+            fw("obj.rotation_euler = %r\n" % matrix.to_euler()[:])
 
             fw("obj.keyframe_insert('location')\n")
             fw("obj.keyframe_insert('scale')\n")

Modified: trunk/py/scripts/addons/io_export_anim_mesh_xna/export_xna.py
===================================================================
--- trunk/py/scripts/addons/io_export_anim_mesh_xna/export_xna.py	2011-02-05 00:59:31 UTC (rev 1538)
+++ trunk/py/scripts/addons/io_export_anim_mesh_xna/export_xna.py	2011-02-05 07:08:34 UTC (rev 1539)
@@ -252,7 +252,7 @@
 # 			self.restMatrix =		blenBone.matrix['ARMATURESPACE']
 
             # not used yet
-            #self.restMatrixInv =	self.restMatrix.copy().invert()
+            #self.restMatrixInv =	self.restMatrix.inverted()
             #self.restMatrixLocal =	None # set later, need parent matrix
 
             self.parent =			None
@@ -309,7 +309,7 @@
 
         def parRelMatrix(self):
             if self.fbxParent:
-                return self.fbxParent.matrixWorld.copy().invert() * self.matrixWorld
+                return self.fbxParent.matrixWorld.inverted() * self.matrixWorld
             else:
                 return self.matrixWorld
 
@@ -325,9 +325,9 @@
         def getAnimParRelMatrixRot(self, frame):
             obj_type = self.blenObject.type
             if self.fbxParent:
-                matrix_rot = ((GLOBAL_MATRIX * self.fbxParent.__anim_poselist[frame]).invert() * (GLOBAL_MATRIX * self.__anim_poselist[frame])).rotation_part()
+                matrix_rot = ((GLOBAL_MATRIX * self.fbxParent.__anim_poselist[frame]).invert() * (GLOBAL_MATRIX * self.__anim_poselist[frame])).to_3x3()
             else:

@@ Diff output truncated at 10240 characters. @@


More information about the Bf-extensions-cvs mailing list