diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-08-11 20:40:36 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-08-11 20:40:36 +0400 |
commit | 556b615cf8eae8c656f2d2a0905564e5c0de98cc (patch) | |
tree | b95388a46c9e9692c92638747f5abc84d66fa6bf /release/scripts | |
parent | ab8ccaa7098f6fee887f2a249fddada7864cd6c5 (diff) |
mathutils module methods only contained matrix constructors, move these to matrix class methods since this is acceptable in python. eg: dict.fromkeys() and groups them more logically.
mathutils.RotationMatrix -> mathutils.Matrix.Rotation
mathutils.ScaleMatrix -> mathutils.Matrix.Scale
mathutils.ShearMatrix -> mathutils.Matrix.Shear
mathutils.TranslationMatrix -> mathutils.Matrix.Translation
mathutils.OrthoProjectionMatrix -> mathutils.Matrix.OrthoProjection
Diffstat (limited to 'release/scripts')
-rw-r--r-- | release/scripts/io/export_fbx.py | 32 | ||||
-rw-r--r-- | release/scripts/io/export_obj.py | 2 | ||||
-rw-r--r-- | release/scripts/io/export_x3d.py | 2 | ||||
-rw-r--r-- | release/scripts/io/import_anim_bvh.py | 6 | ||||
-rw-r--r-- | release/scripts/io/import_scene_3ds.py | 2 | ||||
-rw-r--r-- | release/scripts/modules/add_object_utils.py | 4 | ||||
-rw-r--r-- | release/scripts/modules/rigify/spine_pivot_flex.py | 4 | ||||
-rw-r--r-- | release/scripts/modules/rigify/tail_control.py | 2 | ||||
-rw-r--r-- | release/scripts/op/uvcalc_smart_project.py | 10 | ||||
-rw-r--r-- | release/scripts/templates/gamelogic.py | 2 |
10 files changed, 33 insertions, 33 deletions
diff --git a/release/scripts/io/export_fbx.py b/release/scripts/io/export_fbx.py index 5c2e0cb5f95..c040861941a 100644 --- a/release/scripts/io/export_fbx.py +++ b/release/scripts/io/export_fbx.py @@ -55,7 +55,7 @@ import math # math.pi import shutil # for file copying import bpy -from mathutils import Vector, Euler, Matrix, RotationMatrix +from mathutils import Vector, Euler, Matrix def copy_file(source, dest): # XXX - remove, can use shutil @@ -107,19 +107,19 @@ def eulerRadToDeg(eul): mtx4_identity = Matrix() # testing -mtx_x90 = RotationMatrix( math.pi/2, 3, 'X') # used -#mtx_x90n = RotationMatrix(-90, 3, 'x') -#mtx_y90 = RotationMatrix( 90, 3, 'y') -#mtx_y90n = RotationMatrix(-90, 3, 'y') -#mtx_z90 = RotationMatrix( 90, 3, 'z') -#mtx_z90n = RotationMatrix(-90, 3, 'z') - -#mtx4_x90 = RotationMatrix( 90, 4, 'x') -mtx4_x90n = RotationMatrix(-math.pi/2, 4, 'X') # used -#mtx4_y90 = RotationMatrix( 90, 4, 'y') -mtx4_y90n = RotationMatrix(-math.pi/2, 4, 'Y') # used -mtx4_z90 = RotationMatrix( math.pi/2, 4, 'Z') # used -mtx4_z90n = RotationMatrix(-math.pi/2, 4, 'Z') # used +mtx_x90 = Matrix.Rotation( math.pi/2, 3, 'X') # used +#mtx_x90n = Matrix.Rotation(-90, 3, 'x') +#mtx_y90 = Matrix.Rotation( 90, 3, 'y') +#mtx_y90n = Matrix.Rotation(-90, 3, 'y') +#mtx_z90 = Matrix.Rotation( 90, 3, 'z') +#mtx_z90n = Matrix.Rotation(-90, 3, 'z') + +#mtx4_x90 = Matrix.Rotation( 90, 4, 'x') +mtx4_x90n = Matrix.Rotation(-math.pi/2, 4, 'X') # used +#mtx4_y90 = Matrix.Rotation( 90, 4, 'y') +mtx4_y90n = Matrix.Rotation(-math.pi/2, 4, 'Y') # used +mtx4_z90 = Matrix.Rotation( math.pi/2, 4, 'Z') # used +mtx4_z90n = Matrix.Rotation(-math.pi/2, 4, 'Z') # used # def strip_path(p): # return p.split('\\')[-1].split('/')[-1] @@ -562,7 +562,7 @@ def write(filename, batch_objects = None, \ elif type =='CAMERA': # elif ob and type =='Camera': y = matrix_rot * Vector((0.0, 1.0, 0.0)) - matrix_rot = RotationMatrix(math.pi/2, 3, y) * matrix_rot + matrix_rot = Matrix.Rotation(math.pi/2, 3, y) * matrix_rot return matrix_rot @@ -664,7 +664,7 @@ def write(filename, batch_objects = None, \ rot = tuple(matrix_rot.to_euler()) elif ob and ob.type =='Camera': y = matrix_rot * Vector((0.0, 1.0, 0.0)) - matrix_rot = RotationMatrix(math.pi/2, 3, y) * matrix_rot + matrix_rot = Matrix.Rotation(math.pi/2, 3, y) * matrix_rot rot = tuple(matrix_rot.to_euler()) else: rot = tuple(matrix_rot.to_euler()) diff --git a/release/scripts/io/export_obj.py b/release/scripts/io/export_obj.py index 5603f52d1a4..5e951f06406 100644 --- a/release/scripts/io/export_obj.py +++ b/release/scripts/io/export_obj.py @@ -363,7 +363,7 @@ def write_file(filepath, objects, scene, file.write('mtllib %s\n' % ( mtlfilepath.split('\\')[-1].split('/')[-1] )) if EXPORT_ROTX90: - mat_xrot90= mathutils.RotationMatrix(-math.pi/2, 4, 'X') + mat_xrot90= mathutils.Matrix.Rotation(-math.pi/2, 4, 'X') # Initialize totals, these are updated each object totverts = totuvco = totno = 1 diff --git a/release/scripts/io/export_x3d.py b/release/scripts/io/export_x3d.py index 5fe48a2550a..607f38be6f7 100644 --- a/release/scripts/io/export_x3d.py +++ b/release/scripts/io/export_x3d.py @@ -81,7 +81,7 @@ from export_3ds import create_derived_objects, free_derived_objects # DEG2RAD=0.017453292519943295 -MATWORLD= mathutils.RotationMatrix(-90, 4, 'X') +MATWORLD= mathutils.Matrix.Rotation(-90, 4, 'X') #################################### # Global Variables diff --git a/release/scripts/io/import_anim_bvh.py b/release/scripts/io/import_anim_bvh.py index ba9b8a1f91d..3a807680700 100644 --- a/release/scripts/io/import_anim_bvh.py +++ b/release/scripts/io/import_anim_bvh.py @@ -23,7 +23,7 @@ from math import radians import bpy import mathutils -from mathutils import Vector, Euler, Matrix, RotationMatrix, TranslationMatrix +from mathutils import Vector, Euler, Matrix class bvh_node_class(object): @@ -78,7 +78,7 @@ MATRIX_IDENTITY_4x4 = Matrix([1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, def eulerRotate(x, y, z, rot_order): # Clamp all values between 0 and 360, values outside this raise an error. - mats = [RotationMatrix(x, 3, 'X'), RotationMatrix(y, 3, 'Y'), RotationMatrix(z, 3, 'Z')] + mats = [Matrix.Rotation(x, 3, 'X'), Matrix.Rotation(y, 3, 'Y'), Matrix.Rotation(z, 3, 'Z')] return (MATRIX_IDENTITY_3x3 * mats[rot_order[0]] * (mats[rot_order[1]] * (mats[rot_order[2]]))).to_euler() # Should work but doesnt! @@ -529,7 +529,7 @@ def bvh_node_dict2armature(context, bvh_nodes, ROT_MODE='XYZ', IMPORT_START_FRAM prev_euler[i] = euler if bvh_node.has_loc: - pose_bone.location = (bone_rest_matrix_inv * TranslationMatrix(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)).translation_part() if bvh_node.has_loc: pose_bone.keyframe_insert("location") diff --git a/release/scripts/io/import_scene_3ds.py b/release/scripts/io/import_scene_3ds.py index fe242ca1f29..12c99c0ff46 100644 --- a/release/scripts/io/import_scene_3ds.py +++ b/release/scripts/io/import_scene_3ds.py @@ -771,7 +771,7 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH): #print contextMatrix_rot contextMatrix_rot.invert() #print contextMatrix_rot - #contextMatrix_tx = Blender.mathutils.TranslationMatrix(0.5 * Blender.mathutils.Vector(data[9:])) + #contextMatrix_tx = mathutils.Matrix.Translation(0.5 * Blender.mathutils.Vector(data[9:])) #contextMatrix_tx.invert() #tx.invert() diff --git a/release/scripts/modules/add_object_utils.py b/release/scripts/modules/add_object_utils.py index 9031121060a..41c05ce9d8a 100644 --- a/release/scripts/modules/add_object_utils.py +++ b/release/scripts/modules/add_object_utils.py @@ -25,11 +25,11 @@ import mathutils def add_object_align_init(context, operator): if operator and operator.properties.is_property_set("location") and operator.properties.is_property_set("rotation"): - location = mathutils.TranslationMatrix(mathutils.Vector(operator.properties.location)) + location = mathutils.Matrix.Translation(mathutils.Vector(operator.properties.location)) rotation = mathutils.Euler(operator.properties.rotation).to_matrix().resize4x4() else: # TODO, local view cursor! - location = mathutils.TranslationMatrix(context.scene.cursor_location) + location = mathutils.Matrix.Translation(context.scene.cursor_location) if context.user_preferences.edit.object_align == 'VIEW' and context.space_data.type == 'VIEW_3D': rotation = context.space_data.region_3d.view_matrix.rotation_part().invert().resize4x4() diff --git a/release/scripts/modules/rigify/spine_pivot_flex.py b/release/scripts/modules/rigify/spine_pivot_flex.py index 86f2399f7ff..c4c9886e2e2 100644 --- a/release/scripts/modules/rigify/spine_pivot_flex.py +++ b/release/scripts/modules/rigify/spine_pivot_flex.py @@ -147,7 +147,7 @@ def deform(obj, definitions, base_names, options): def main(obj, bone_definition, base_names, options): - from mathutils import Vector, RotationMatrix + from mathutils import Vector, Matrix from math import radians, pi arm = obj.data @@ -264,7 +264,7 @@ def main(obj, bone_definition, base_names, options): # Rotate the rev chain 180 about the by the first bones center point pivot = (rv_chain.spine_01_e.head + rv_chain.spine_01_e.tail) * 0.5 - matrix = RotationMatrix(radians(180), 3, 'X') + matrix = Matrix.Rotation(radians(180), 3, 'X') for i, attr in enumerate(rv_chain.attr_names): # similar to neck spine_e = getattr(rv_chain, attr + "_e") # use the first bone as the pivot diff --git a/release/scripts/modules/rigify/tail_control.py b/release/scripts/modules/rigify/tail_control.py index f34bde92dee..a629487c0c8 100644 --- a/release/scripts/modules/rigify/tail_control.py +++ b/release/scripts/modules/rigify/tail_control.py @@ -22,7 +22,7 @@ import bpy from rigify import RigifyError from rigify_utils import bone_class_instance, copy_bone_simple from rna_prop_ui import rna_idprop_ui_prop_get -from mathutils import Vector, RotationMatrix +from mathutils import Vector, Matrix from math import radians, pi # not used, defined for completeness diff --git a/release/scripts/op/uvcalc_smart_project.py b/release/scripts/op/uvcalc_smart_project.py index fbda1955013..bbd0102fc61 100644 --- a/release/scripts/op/uvcalc_smart_project.py +++ b/release/scripts/op/uvcalc_smart_project.py @@ -22,7 +22,7 @@ # <pep8 compliant> -from mathutils import Matrix, Vector, RotationMatrix +from mathutils import Matrix, Vector import time import geometry import bpy @@ -275,15 +275,15 @@ def testNewVecLs2DRotIsBetter(vecs, mat=-1, bestAreaSoFar = -1): # Takes a list of faces that make up a UV island and rotate # until they optimally fit inside a square. -ROTMAT_2D_POS_90D = RotationMatrix( radians(90.0), 2) -ROTMAT_2D_POS_45D = RotationMatrix( radians(45.0), 2) +ROTMAT_2D_POS_90D = Matrix.Rotation( radians(90.0), 2) +ROTMAT_2D_POS_45D = Matrix.Rotation( radians(45.0), 2) RotMatStepRotation = [] rot_angle = 22.5 #45.0/2 while rot_angle > 0.1: RotMatStepRotation.append([\ - RotationMatrix( radians(rot_angle), 2),\ - RotationMatrix( radians(-rot_angle), 2)]) + Matrix.Rotation( radians(rot_angle), 2),\ + Matrix.Rotation( radians(-rot_angle), 2)]) rot_angle = rot_angle/2.0 diff --git a/release/scripts/templates/gamelogic.py b/release/scripts/templates/gamelogic.py index b31d5d95987..21a901c091b 100644 --- a/release/scripts/templates/gamelogic.py +++ b/release/scripts/templates/gamelogic.py @@ -6,7 +6,7 @@ # for keyboard event comparison # import GameKeys -# support for Vector(), Matrix() types and advanced functions like ScaleMatrix(...) and RotationMatrix(...) +# support for Vector(), Matrix() types and advanced functions like Matrix.Scale(...) and Matrix.Rotation(...) # import mathutils # for functions like getWindowWidth(), getWindowHeight() |