From 8b52087d837ac035e2645c09ad780c45fccb9d89 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 5 Feb 2011 07:04:23 +0000 Subject: update for changes in mathutils. --- release/scripts/modules/add_object_utils.py | 6 +++--- release/scripts/modules/bpy_types.py | 8 ++++---- release/scripts/op/nla.py | 10 +++++----- release/scripts/op/object.py | 4 ++-- release/scripts/op/uvcalc_smart_project.py | 6 +++--- 5 files changed, 17 insertions(+), 17 deletions(-) (limited to 'release') diff --git a/release/scripts/modules/add_object_utils.py b/release/scripts/modules/add_object_utils.py index 01a1a73aedf..10707734bc4 100644 --- a/release/scripts/modules/add_object_utils.py +++ b/release/scripts/modules/add_object_utils.py @@ -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() diff --git a/release/scripts/modules/bpy_types.py b/release/scripts/modules/bpy_types.py index 61c3f11ccef..1cb30765bf0 100644 --- a/release/scripts/modules/bpy_types.py +++ b/release/scripts/modules/bpy_types.py @@ -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 diff --git a/release/scripts/op/nla.py b/release/scripts/op/nla.py index acea7d53572..d47668d68e3 100644 --- a/release/scripts/op/nla.py +++ b/release/scripts/op/nla.py @@ -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) diff --git a/release/scripts/op/object.py b/release/scripts/op/object.py index 15da8f107a2..8fee6e2166d 100644 --- a/release/scripts/op/object.py +++ b/release/scripts/op/object.py @@ -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 diff --git a/release/scripts/op/uvcalc_smart_project.py b/release/scripts/op/uvcalc_smart_project.py index 3a835ae671e..8f1c7a27f78 100644 --- a/release/scripts/op/uvcalc_smart_project.py +++ b/release/scripts/op/uvcalc_smart_project.py @@ -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 = [] -- cgit v1.2.3