Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2009-12-09 17:25:56 +0300
committerCampbell Barton <ideasman42@gmail.com>2009-12-09 17:25:56 +0300
commita41131db24cd063f770b22bfdfa452511560c4ac (patch)
tree126daebe383911f01ea22f2cfd3b33366fd380df /release
parentd6c583cc540257aeb516471fd724d79efc63ad11 (diff)
- added editbone.matrix, readonly, utility property that calculates the matrix from the bone roll
- spine fixes - arm now uses the average Z axis to place the poll target
Diffstat (limited to 'release')
-rw-r--r--release/scripts/modules/rigify/__init__.py9
-rw-r--r--release/scripts/modules/rigify/arm.py2
-rw-r--r--release/scripts/modules/rigify/spine.py16
3 files changed, 18 insertions, 9 deletions
diff --git a/release/scripts/modules/rigify/__init__.py b/release/scripts/modules/rigify/__init__.py
index d4c0169bfbd..c40efce3d75 100644
--- a/release/scripts/modules/rigify/__init__.py
+++ b/release/scripts/modules/rigify/__init__.py
@@ -359,11 +359,18 @@ def add_pole_target_bone(obj, base_name, name, mode='CROSS'):
parent_dir = parent_head - parent_tail
distance = (base_dir.length + parent_dir.length)
-
+
if mode == 'CROSS':
+ # direction from the angle of the joint
offset = base_dir.copy().normalize() - parent_dir.copy().normalize()
offset.length = distance
+ elif mode == 'ZAVERAGE':
+ # between both bones Z axis
+ z_axis_a = base_ebone.matrix.copy().rotationPart() * Vector(0.0, 0.0, -1.0)
+ z_axis_b = parent_ebone.matrix.copy().rotationPart() * Vector(0.0, 0.0, -1.0)
+ offset = (z_axis_a + z_axis_b).normalize() * distance
else:
+ # preset axis
offset = Vector(0, 0, 0)
if mode[0] == "+":
val = distance
diff --git a/release/scripts/modules/rigify/arm.py b/release/scripts/modules/rigify/arm.py
index d3cdd22dc4a..66797ddc312 100644
--- a/release/scripts/modules/rigify/arm.py
+++ b/release/scripts/modules/rigify/arm.py
@@ -111,7 +111,7 @@ def ik(obj, definitions, base_names):
ik_chain.arm_e.parent = mt.shoulder_e
# Add the bone used for the arms poll target
- ik.pole = add_pole_target_bone(obj, mt.forearm, "elbow_poll", mode='+Z')
+ ik.pole = add_pole_target_bone(obj, mt.forearm, "elbow_poll", mode='ZAVERAGE')
# update bones after this!
ik.hand_vis = add_stretch_to(obj, mt.hand, ik_chain.hand, "VIS-%s_ik" % base_names[mt.hand])
diff --git a/release/scripts/modules/rigify/spine.py b/release/scripts/modules/rigify/spine.py
index 6ebf167cb5c..2ccc10350b1 100644
--- a/release/scripts/modules/rigify/spine.py
+++ b/release/scripts/modules/rigify/spine.py
@@ -178,16 +178,16 @@ def main(obj, bone_definition, base_names):
df.ribcage_e = copy_bone_simple(arm, child.name, "DEF-wgt_%s" % base_names[mt.ribcage])
df.ribcage = df.ribcage_e.name
df.ribcage_e.translate(Vector(spine_chain_segment_length * 2.0, - df.ribcage_e.length / 2.0, 0.0))
+
+ ex.ribcage_copy_e = copy_bone_simple(arm, mt.ribcage, base_names[mt.ribcage])
+ ex.ribcage_copy = ex.ribcage_copy_e.name
+ ex.ribcage_copy_e.connected = False
+ ex.ribcage_copy_e.parent = ex.ribcage_hinge_e
ex.ribcage_e = copy_bone_simple(arm, child.name, "MCH-wgt_%s" % base_names[mt.ribcage])
ex.ribcage = ex.ribcage_e.name
ex.ribcage_e.translate(Vector(0.0, - ex.ribcage_e.length / 2.0, 0.0))
- ex.ribcage_e.parent = mt.ribcage_e
-
- ex.ribcage_copy_e = copy_bone_simple(arm, child.name, base_names[mt.ribcage])
- ex.ribcage_copy = ex.ribcage_copy_e.name
- ex.ribcage_copy_e.connected = False
- ex.ribcage_copy_e.parent = ex.ribcage_hinge_e
+ ex.ribcage_e.parent = ex.ribcage_copy_e
spine_chain = [child.name for child in spine_chain]
@@ -294,6 +294,8 @@ def main(obj, bone_definition, base_names):
con.target_space = 'LOCAL'
# df.ribcage_p / DEF-wgt_rib_cage
+ df.ribcage_p.lock_location = True, True, True
+
con = df.ribcage_p.constraints.new('COPY_ROTATION')
con.target = obj
con.subtarget = ex.ribcage
@@ -329,7 +331,7 @@ def main(obj, bone_definition, base_names):
con = ex.spine_rotate_p.constraints.new('COPY_ROTATION')
con.target = obj
- con.subtarget = mt.ribcage
+ con.subtarget = ex.ribcage_copy
# ex.pelvis_p / MCH-wgt_pelvis