diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-12-11 19:30:27 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-12-11 19:30:27 +0300 |
commit | 026364dcca6539c4e3ad6a5010cba81e61638ef2 (patch) | |
tree | 54488973264d95add2fd491735076d82b4427a1e /release/scripts/modules/rigify/palm_curl.py | |
parent | ab18fe02c458a88b4a010c23f0703ab999b5a9f8 (diff) |
rigify
* optional default blend argument, use for better leg & arm defaults
* way to define arbitrary options for bones that can then be passed to the generator function, only used to set elbow target parent at the moment.
Diffstat (limited to 'release/scripts/modules/rigify/palm_curl.py')
-rw-r--r-- | release/scripts/modules/rigify/palm_curl.py | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/release/scripts/modules/rigify/palm_curl.py b/release/scripts/modules/rigify/palm_curl.py index 867889b0084..4ad0cfe3675 100644 --- a/release/scripts/modules/rigify/palm_curl.py +++ b/release/scripts/modules/rigify/palm_curl.py @@ -96,7 +96,7 @@ def metarig_definition(obj, orig_bone_name): return [palm_parent.name] + bone_definition -def main(obj, bone_definition, base_names): +def main(obj, bone_definition, base_names, options): arm = obj.data children = bone_definition[1:] @@ -163,22 +163,6 @@ def main(obj, bone_definition, base_names): driver = driver_fcurves[2].driver driver.expression = "(1.0-cos(x))-s" - def x_direction(): - # 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 math import degrees - child_pbone_01 = obj.pose.bones[children[0]] - child_pbone_02 = obj.pose.bones[children[1]] - - rel_vec = child_pbone_01.head - child_pbone_02.head - x_vec = child_pbone_01.matrix.rotationPart() * Vector(1.0, 0.0, 0.0) - return degrees(AngleBetweenVecs(rel_vec, x_vec)) > 90.0 - - if x_direction(): # flip - driver.expression = "-(%s)" % driver.expression - for fcurve in driver_fcurves: fcurve.modifiers.remove(0) # grr dont need a modifier @@ -229,5 +213,23 @@ def main(obj, bone_definition, base_names): child_pbone = obj.pose.bones[children[-1]] child_pbone.rotation_mode = 'QUATERNION' + # fix at the end since there is some trouble with tx info not being updated otherwise + def x_direction(): + # 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 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) + print(rel_vec, x_vec) + return degrees(AngleBetweenVecs(rel_vec, x_vec)) > 90.0 + + if x_direction(): # flip + driver.expression = "-(%s)" % driver.expression + # no blending the result of this return None |