diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-01-25 12:44:04 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-01-25 12:44:04 +0300 |
commit | 0a0f4c9d81cfa2a4b4a9999e1dc976bc417d7d54 (patch) | |
tree | 367f259b695955a514530d125ab495344724eafb /release/scripts/modules/rigify | |
parent | eed13d859b67185996569178ede9241a5695f215 (diff) |
Mathutils refactor & include in sphinx generated docs, (TODO, include getset'ers in docs)
- Mathutils.MidpointVecs --> vector.lerp(other, fac)
- Mathutils.AngleBetweenVecs --> vector.angle(other)
- Mathutils.ProjectVecs --> vector.project(other)
- Mathutils.DifferenceQuats --> quat.difference(other)
- Mathutils.Slerp --> quat.slerp(other, fac)
- Mathutils.Rand: removed, use pythons random module
- Mathutils.RotationMatrix(angle, size, axis_flag, axis) --> Mathutils.RotationMatrix(angle, size, axis); merge axis & axis_flag args
- Matrix.scalePart --> Matrix.scale_part
- Matrix.translationPart --> Matrix.translation_part
- Matrix.rotationPart --> Matrix.rotation_part
- toMatrix --> to_matrix
- toEuler --> to_euler
- toQuat --> to_quat
- Vector.toTrackQuat --> Vector.to_track_quat
Diffstat (limited to 'release/scripts/modules/rigify')
-rw-r--r-- | release/scripts/modules/rigify/delta.py | 6 | ||||
-rw-r--r-- | release/scripts/modules/rigify/leg_quadruped.py | 2 | ||||
-rw-r--r-- | release/scripts/modules/rigify/mouth.py | 4 | ||||
-rw-r--r-- | release/scripts/modules/rigify/palm_curl.py | 6 | ||||
-rw-r--r-- | release/scripts/modules/rigify/shape_key_rotdiff.py | 2 |
5 files changed, 10 insertions, 10 deletions
diff --git a/release/scripts/modules/rigify/delta.py b/release/scripts/modules/rigify/delta.py index 475c64ab317..3376348c0af 100644 --- a/release/scripts/modules/rigify/delta.py +++ b/release/scripts/modules/rigify/delta.py @@ -127,8 +127,8 @@ def main(obj, bone_definition, base_names, options): delta_pbone.rotation_mode = 'XYZ' - rot = delta_pmatrix.invert().rotationPart() * child_pmatrix.rotationPart() - rot = rot.invert().toEuler() + rot = delta_pmatrix.invert().rotation_part() * child_pmatrix.rotation_part() + rot = rot.invert().to_euler() fcurve_drivers = delta_pbone.driver_add("rotation_euler", -1) for i, fcurve_driver in enumerate(fcurve_drivers): @@ -141,7 +141,7 @@ def main(obj, bone_definition, base_names, options): mod.coefficients[1] = 0.0 # tricky, find the transform to drive the bone to this location. - delta_head_offset = child_pmatrix.rotationPart() * (delta_phead - child_phead) + delta_head_offset = child_pmatrix.rotation_part() * (delta_phead - child_phead) fcurve_drivers = delta_pbone.driver_add("location", -1) for i, fcurve_driver in enumerate(fcurve_drivers): diff --git a/release/scripts/modules/rigify/leg_quadruped.py b/release/scripts/modules/rigify/leg_quadruped.py index d1f74ca28bf..524450d0d24 100644 --- a/release/scripts/modules/rigify/leg_quadruped.py +++ b/release/scripts/modules/rigify/leg_quadruped.py @@ -157,7 +157,7 @@ def ik(obj, bone_definition, base_names, options): ik.foot_roll_e.parent = ik_chain.foot_e ik.foot_roll_e.head -= mt_chain.toe_e.vector.normalize() * mt_chain.foot_e.length ik.foot_roll_e.tail = ik.foot_roll_e.head - (mt_chain.foot_e.vector.normalize() * mt_chain.toe_e.length) - ik.foot_roll_e.align_roll(mt_chain.foot_e.matrix.rotationPart() * Vector(0.0, 0.0, -1.0)) + ik.foot_roll_e.align_roll(mt_chain.foot_e.matrix.rotation_part() * Vector(0.0, 0.0, -1.0)) # MCH-foot ik.foot_roll_01_e = copy_bone_simple(arm, mt_chain.foot, "MCH-" + base_names[mt_chain.foot]) diff --git a/release/scripts/modules/rigify/mouth.py b/release/scripts/modules/rigify/mouth.py index e2ca1ab4d0c..77545bc09fd 100644 --- a/release/scripts/modules/rigify/mouth.py +++ b/release/scripts/modules/rigify/mouth.py @@ -255,8 +255,8 @@ def deform(obj, definitions, base_names, options): bpy.ops.object.mode_set(mode='EDIT') # Calculate the rotation difference between the bones - rotdiff_r = acos(eb[lip1].matrix.toQuat() * eb[lip8].matrix.toQuat()) * 2 - rotdiff_l = acos(eb[lip4].matrix.toQuat() * eb[lip5].matrix.toQuat()) * 2 + rotdiff_r = acos(eb[lip1].matrix.to_quat() * eb[lip8].matrix.to_quat()) * 2 + rotdiff_l = acos(eb[lip4].matrix.to_quat() * eb[lip5].matrix.to_quat()) * 2 print (rotdiff_l) diff --git a/release/scripts/modules/rigify/palm_curl.py b/release/scripts/modules/rigify/palm_curl.py index b231919823b..82010552ea7 100644 --- a/release/scripts/modules/rigify/palm_curl.py +++ b/release/scripts/modules/rigify/palm_curl.py @@ -249,15 +249,15 @@ def main(obj, bone_definition, base_names, options): # NOTE: the direction of the Z rotation depends on which side the palm is on. # we could do a simple side-of-x test but better to work out the direction # the hand is facing. - from Mathutils import Vector, AngleBetweenVecs + from Mathutils import Vector from math import degrees child_pbone_01 = obj.pose.bones[children[0]].bone child_pbone_02 = obj.pose.bones[children[1]].bone rel_vec = child_pbone_01.head - child_pbone_02.head - x_vec = child_pbone_01.matrix.rotationPart() * Vector(1.0, 0.0, 0.0) + x_vec = child_pbone_01.matrix.rotation_part() * Vector(1.0, 0.0, 0.0) - return degrees(AngleBetweenVecs(rel_vec, x_vec)) > 90.0 + return degrees(rel_vec.angle(x_vec)) > 90.0 if x_direction(): # flip driver.expression = "-(%s)" % driver.expression diff --git a/release/scripts/modules/rigify/shape_key_rotdiff.py b/release/scripts/modules/rigify/shape_key_rotdiff.py index 98ab1bd16b7..265a2fe368a 100644 --- a/release/scripts/modules/rigify/shape_key_rotdiff.py +++ b/release/scripts/modules/rigify/shape_key_rotdiff.py @@ -111,7 +111,7 @@ def deform(obj, definitions, base_names, options): # Calculate the rotation difference between the bones - rotdiff = (eb[bone_from].matrix.toQuat() * eb[bone_to].matrix.toQuat()) * 2 + rotdiff = (eb[bone_from].matrix.to_quat() * eb[bone_to].matrix.to_quat()) * 2 bpy.ops.object.mode_set(mode='OBJECT') |