update for changes in mathutils.

This commit is contained in:
Campbell Barton
2011-02-05 07:04:23 +00:00
parent dd08305e75
commit 8b52087d83
5 changed files with 17 additions and 17 deletions

View 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()

View 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

View 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)

View 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

View 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 = []