From 4e501fa153573a81dc2e69a1e9d6d4387baf4a9e Mon Sep 17 00:00:00 2001 From: Campbell Barton <ideasman42@gmail.com> Date: Wed, 11 Aug 2010 16:42:22 +0000 Subject: [PATCH] updates for changes in mathutils --- add_curve_aceous_galore.py | 2 +- add_curve_torus_knots.py | 2 +- add_mesh_3d_function_surface.py | 2 +- add_mesh_BoltFactory/Boltfactory.py | 2 +- add_mesh_ant_landscape.py | 2 +- add_mesh_extras.py | 4 ++-- add_mesh_gears.py | 2 +- add_mesh_gemstones.py | 2 +- add_mesh_pipe_joint.py | 4 ++-- add_mesh_twisted_torus.py | 2 +- io_export_directx_x.py | 24 ++++++++++++------------ io_import_scene_mhx.py | 2 +- 12 files changed, 25 insertions(+), 25 deletions(-) diff --git a/add_curve_aceous_galore.py b/add_curve_aceous_galore.py index b7283e26a..fe8cefa1b 100644 --- a/add_curve_aceous_galore.py +++ b/add_curve_aceous_galore.py @@ -576,7 +576,7 @@ def CycloidCurve( number=24, length=2.0, type=0, a=1.0, b=1.0, startangle=0.0, e # calculates the matrix for the new object # depending on user pref def align_matrix(context): - loc = TranslationMatrix(context.scene.cursor_location) + loc = Matrix.Translation(context.scene.cursor_location) obj_align = context.user_preferences.edit.object_align if (context.space_data.type == 'VIEW_3D' and obj_align == 'VIEW'): diff --git a/add_curve_torus_knots.py b/add_curve_torus_knots.py index fd90cd551..7a28edc2b 100644 --- a/add_curve_torus_knots.py +++ b/add_curve_torus_knots.py @@ -41,7 +41,7 @@ from math import * # calculates the matrix for the new object # depending on user pref def align_matrix(context): - loc = TranslationMatrix(context.scene.cursor_location) + loc = Matrix.Translation(context.scene.cursor_location) obj_align = context.user_preferences.edit.object_align if (context.space_data.type == 'VIEW_3D' and obj_align == 'VIEW'): diff --git a/add_mesh_3d_function_surface.py b/add_mesh_3d_function_surface.py index e6fa89a8e..ea7cbfefe 100644 --- a/add_mesh_3d_function_surface.py +++ b/add_mesh_3d_function_surface.py @@ -124,7 +124,7 @@ safe_dict = dict([(k, globals().get(k, None)) for k in safe_list]) # calculates the matrix for the new object # depending on user pref def align_matrix(context): - loc = TranslationMatrix(context.scene.cursor_location) + loc = Matrix.Translation(context.scene.cursor_location) obj_align = context.user_preferences.edit.object_align if (context.space_data.type == 'VIEW_3D' and obj_align == 'VIEW'): diff --git a/add_mesh_BoltFactory/Boltfactory.py b/add_mesh_BoltFactory/Boltfactory.py index 3bc201854..4ba11db07 100644 --- a/add_mesh_BoltFactory/Boltfactory.py +++ b/add_mesh_BoltFactory/Boltfactory.py @@ -29,7 +29,7 @@ from add_mesh_BoltFactory.preset_utils import * # calculates the matrix for the new object # depending on user pref def align_matrix(context): - loc = mathutils.TranslationMatrix(context.scene.cursor_location) + loc = mathutils.Matrix.Translation(context.scene.cursor_location) obj_align = context.user_preferences.edit.object_align if (context.space_data.type == 'VIEW_3D' and obj_align == 'VIEW'): diff --git a/add_mesh_ant_landscape.py b/add_mesh_ant_landscape.py index 5f4cc8ec3..b720a626f 100644 --- a/add_mesh_ant_landscape.py +++ b/add_mesh_ant_landscape.py @@ -38,7 +38,7 @@ from math import * ###------------------------------------------------------------ # calculates the matrix for the new object depending on user pref def align_matrix(context): - loc = TranslationMatrix(context.scene.cursor_location) + loc = Matrix.Translation(context.scene.cursor_location) obj_align = context.user_preferences.edit.object_align if (context.space_data.type == 'VIEW_3D' and obj_align == 'VIEW'): diff --git a/add_mesh_extras.py b/add_mesh_extras.py index c76cfce0f..a109f3e69 100644 --- a/add_mesh_extras.py +++ b/add_mesh_extras.py @@ -36,7 +36,7 @@ from bpy.props import * # calculates the matrix for the new object # depending on user pref def align_matrix(context): - loc = TranslationMatrix(context.scene.cursor_location) + loc = Matrix.Translation(context.scene.cursor_location) obj_align = context.user_preferences.edit.object_align if (context.space_data.type == 'VIEW_3D' and obj_align == 'VIEW'): @@ -386,7 +386,7 @@ def add_spindle(segments, radius, height, cap_height): upper_edgeloop = [] lower_edgeloop = [] for index in range(segments): - mtx = RotationMatrix(2.0 * pi * float(index) / segments, 3, 'Z') + mtx = Matrix.Rotation(2.0 * pi * float(index) / segments, 3, 'Z') # Calculate index & location of upper verte4x tip. idx_up = len(verts) diff --git a/add_mesh_gears.py b/add_mesh_gears.py index 3b3b2106e..2ff134452 100644 --- a/add_mesh_gears.py +++ b/add_mesh_gears.py @@ -70,7 +70,7 @@ from bpy.props import * # calculates the matrix for the new object # depending on user pref def align_matrix(context): - loc = mathutils.TranslationMatrix(context.scene.cursor_location) + loc = mathutils.Matrix.Translation(context.scene.cursor_location) obj_align = context.user_preferences.edit.object_align if (context.space_data.type == 'VIEW_3D' and obj_align == 'VIEW'): diff --git a/add_mesh_gemstones.py b/add_mesh_gemstones.py index 645f509d1..8d53c4d8a 100644 --- a/add_mesh_gemstones.py +++ b/add_mesh_gemstones.py @@ -36,7 +36,7 @@ from bpy.props import * # calculates the matrix for the new object # depending on user pref def align_matrix(context): - loc = TranslationMatrix(context.scene.cursor_location) + loc = Matrix.Translation(context.scene.cursor_location) obj_align = context.user_preferences.edit.object_align if (context.space_data.type == 'VIEW_3D' and obj_align == 'VIEW'): diff --git a/add_mesh_pipe_joint.py b/add_mesh_pipe_joint.py index 3ebbf5d11..129acb2b9 100644 --- a/add_mesh_pipe_joint.py +++ b/add_mesh_pipe_joint.py @@ -113,7 +113,7 @@ http://blenderartists.org/forum/showthread.php?t=154394 TODO: Use a rotation matrix for rotating the circle vertices: -rotation_matrix = mathutils.RotationMatrix(-math.pi/2, 4, 'x') +rotation_matrix = mathutils.Matrix.Rotation(-math.pi/2, 4, 'x') mesh.transform(rotation_matrix) """ @@ -129,7 +129,7 @@ from bpy.props import * # calculates the matrix for the new object # depending on user pref def align_matrix(context): - loc = mathutils.TranslationMatrix(context.scene.cursor_location) + loc = mathutils.Matrix.Translation(context.scene.cursor_location) obj_align = context.user_preferences.edit.object_align if (context.space_data.type == 'VIEW_3D' and obj_align == 'VIEW'): diff --git a/add_mesh_twisted_torus.py b/add_mesh_twisted_torus.py index 094692f0e..66fbe9a6f 100644 --- a/add_mesh_twisted_torus.py +++ b/add_mesh_twisted_torus.py @@ -51,7 +51,7 @@ from math import cos, sin, pi # calculates the matrix for the new object # depending on user pref def align_matrix(context): - loc = TranslationMatrix(context.scene.cursor_location) + loc = Matrix.Translation(context.scene.cursor_location) obj_align = context.user_preferences.edit.object_align if (context.space_data.type == 'VIEW_3D' and obj_align == 'VIEW'): diff --git a/io_export_directx_x.py b/io_export_directx_x.py index 986dfa4d5..bf4551232 100644 --- a/io_export_directx_x.py +++ b/io_export_directx_x.py @@ -111,15 +111,15 @@ def ExportDirectX(Config): print("Setting up...", end=" ") Config.SystemMatrix = Matrix() if Config.RotateX: - Config.SystemMatrix *= RotationMatrix(radians(-90), 4, "X") + Config.SystemMatrix *= Matrix.Rotation(radians(-90), 4, "X") if Config.CoordinateSystem == 1: - Config.SystemMatrix *= ScaleMatrix(-1, 4, Vector((0, 1, 0))) + Config.SystemMatrix *= Matrix.Scale(-1, 4, Vector((0, 1, 0))) Config.InverseSystemMatrix = Config.SystemMatrix.copy().invert() #Used for animating rotations Config.SystemQuaternion = Quaternion((1,0,0,0)) if Config.RotateX: - Config.SystemQuaternion = RotationMatrix(radians(-90), 3, "X").to_quat() + Config.SystemQuaternion = Matrix.Rotation(radians(-90), 3, "X").to_quat() Config.InverseSystemQuaternion = Config.SystemQuaternion.copy().inverse() Config.FlipZ = -1 if Config.CoordinateSystem == 1 else 1 @@ -297,11 +297,11 @@ def WriteArmatureBones(Config, Object, ChildList): if Bone.parent: BoneMatrix = (PoseBone.parent.matrix * - RotationMatrix(radians(-90), 4, "X")).invert() + Matrix.Rotation(radians(-90), 4, "X")).invert() else: BoneMatrix = Matrix() - BoneMatrix *= PoseBone.matrix * RotationMatrix(radians(-90), 4, "X") + BoneMatrix *= PoseBone.matrix * Matrix.Rotation(radians(-90), 4, "X") BoneMatrix = Config.SystemMatrix * BoneMatrix * Config.InverseSystemMatrix Config.File.write("{}FrameTransformMatrix {{\n".format(" " * Config.Whitespace)) @@ -611,7 +611,7 @@ def WriteMeshSkinWeights(Config, Object, Mesh): # - Armature Space to Bone Space (The bone matrix needs to be rotated 90 degrees to align with Blender's world axes) #This way, when BoneMatrix is transformed by the bone's Frame matrix, the vertices will be in their final world position. - BoneMatrix = (RestBone.matrix_local * RotationMatrix(radians(-90), 4, "X")).invert() + BoneMatrix = (RestBone.matrix_local * Matrix.Rotation(radians(-90), 4, "X")).invert() BoneMatrix *= ArmatureObject.matrix_world.copy().invert() BoneMatrix *= Object.matrix_world @@ -807,10 +807,10 @@ def WriteKeyedAnimationSet(Config): bpy.context.scene.set_frame(Keyframe) if Bone.parent: - PoseMatrix = (Bone.parent.matrix * RotationMatrix(radians(-90), 4, "X")).invert() + PoseMatrix = (Bone.parent.matrix * Matrix.Rotation(radians(-90), 4, "X")).invert() else: PoseMatrix = Matrix() - PoseMatrix *= Bone.matrix * RotationMatrix(radians(-90), 4, "X") + PoseMatrix *= Bone.matrix * Matrix.Rotation(radians(-90), 4, "X") PoseMatrix = Config.SystemMatrix * PoseMatrix * Config.InverseSystemMatrix @@ -843,10 +843,10 @@ def WriteKeyedAnimationSet(Config): bpy.context.scene.set_frame(Keyframe) if Bone.parent: - PoseMatrix = (Bone.parent.matrix * RotationMatrix(radians(-90), 4, "X")).invert() + PoseMatrix = (Bone.parent.matrix * Matrix.Rotation(radians(-90), 4, "X")).invert() else: PoseMatrix = Matrix() - PoseMatrix *= Bone.matrix * RotationMatrix(radians(-90), 4, "X") + PoseMatrix *= Bone.matrix * Matrix.Rotation(radians(-90), 4, "X") PoseMatrix = Config.SystemMatrix * PoseMatrix * Config.InverseSystemMatrix @@ -879,10 +879,10 @@ def WriteKeyedAnimationSet(Config): bpy.context.scene.set_frame(Keyframe) if Bone.parent: - PoseMatrix = (Bone.parent.matrix * RotationMatrix(radians(-90), 4, "X")).invert() + PoseMatrix = (Bone.parent.matrix * Matrix.Rotation(radians(-90), 4, "X")).invert() else: PoseMatrix = Matrix() - PoseMatrix *= Bone.matrix * RotationMatrix(radians(-90), 4, "X") + PoseMatrix *= Bone.matrix * Matrix.Rotation(radians(-90), 4, "X") PoseMatrix = Config.SystemMatrix * PoseMatrix * Config.InverseSystemMatrix diff --git a/io_import_scene_mhx.py b/io_import_scene_mhx.py index f2a3934e8..4ea15e914 100644 --- a/io_import_scene_mhx.py +++ b/io_import_scene_mhx.py @@ -1805,7 +1805,7 @@ def parseProcess(args, tokens): print(val) axis = val[1] angle = float(val[2]) - mat = mathutils.RotationMatrix(angle, 4, axis) + mat = mathutils.Matrix.Rotation(angle, 4, axis) try: pb = pbones[val[0]] prod = pb.matrix_local * mat -- GitLab