Skip to content

Commit

Permalink
updates for changes in mathutils
Browse files Browse the repository at this point in the history
  • Loading branch information
ideasman42 committed Aug 11, 2010
1 parent 4b29a21 commit 4e501fa
Show file tree
Hide file tree
Showing 12 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion add_curve_aceous_galore.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'):
Expand Down
2 changes: 1 addition & 1 deletion add_curve_torus_knots.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
# 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'):
Expand Down
2 changes: 1 addition & 1 deletion add_mesh_3d_function_surface.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
# 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'):
Expand Down
2 changes: 1 addition & 1 deletion add_mesh_BoltFactory/Boltfactory.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
# 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'):
Expand Down
2 changes: 1 addition & 1 deletion add_mesh_ant_landscape.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
###------------------------------------------------------------
# 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'):
Expand Down
4 changes: 2 additions & 2 deletions add_mesh_extras.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
# 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'):
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion add_mesh_gears.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
# 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'):
Expand Down
2 changes: 1 addition & 1 deletion add_mesh_gemstones.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
# 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'):
Expand Down
4 changes: 2 additions & 2 deletions add_mesh_pipe_joint.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
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)
"""

Expand All @@ -129,7 +129,7 @@
# 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'):
Expand Down
2 changes: 1 addition & 1 deletion add_mesh_twisted_torus.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
# 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'):
Expand Down
24 changes: 12 additions & 12 deletions io_export_directx_x.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion io_import_scene_mhx.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4e501fa

Please sign in to comment.