diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-01-10 21:53:15 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-01-10 21:53:15 +0300 |
commit | 57e96e4472464f4bc091ba9e7e8130bca7334b3f (patch) | |
tree | 1fd27e919061459be90c915d33afd0e68e5b0222 /release/scripts/modules/rigify/arm_biped_generic.py | |
parent | c8966e53732a43b00516b7680c59586b874b5f1e (diff) |
patch from Cessen, update to metarigs and some changes to the rigging main loop.
- property names dont need the bone type prefix anymore
- always add a root bone that all non parented bones are parented to
- x/y/z axis properties for bones.
Diffstat (limited to 'release/scripts/modules/rigify/arm_biped_generic.py')
-rw-r--r-- | release/scripts/modules/rigify/arm_biped_generic.py | 41 |
1 files changed, 19 insertions, 22 deletions
diff --git a/release/scripts/modules/rigify/arm_biped_generic.py b/release/scripts/modules/rigify/arm_biped_generic.py index 0974b1b8010..52e6c3e3355 100644 --- a/release/scripts/modules/rigify/arm_biped_generic.py +++ b/release/scripts/modules/rigify/arm_biped_generic.py @@ -20,7 +20,7 @@ import bpy from math import radians -from rigify import RigifyError, get_layer_dict +from rigify import RigifyError, get_layer_dict, ORG_PREFIX from rigify_utils import bone_class_instance, copy_bone_simple, add_pole_target_bone, add_stretch_to, blend_bone_list, get_side_name, get_base_name from rna_prop_ui import rna_idprop_ui_prop_get from Mathutils import Vector @@ -126,7 +126,7 @@ def ik(obj, definitions, base_names, options): if elbow_parent_name: try: - elbow_parent_e = arm.edit_bones[elbow_parent_name] + elbow_parent_e = arm.edit_bones[ORG_PREFIX + elbow_parent_name] except: # TODO, old/new parent mapping raise RigifyError("parent bone from property 'arm_biped_generic.elbow_parent' not found '%s'" % elbow_parent_name) @@ -165,13 +165,14 @@ def ik(obj, definitions, base_names, options): con.pole_angle = -90.0 # XXX, RAD2DEG # last step setup layers - layers = get_layer_dict(options) - lay = layers["ik"] - for attr in ik_chain.attr_names: - getattr(ik_chain, attr + "_b").layer = lay - for attr in ik.attr_names: - getattr(ik, attr + "_b").layer = lay - + if "ik_layer" in options: + layer = [n==options["ik_layer"] for n in range(0,32)] + else: + layer = list(mt.arm_b.layer) + ik_chain.hand_b.layer = layer + ik.hand_vis_b.layer = layer + ik.pole_b.layer = layer + ik.pole_vis_b.layer = layer bpy.ops.object.mode_set(mode='EDIT') # don't blend the shoulder @@ -200,9 +201,9 @@ def fk(obj, definitions, base_names, options): ex.socket_e.parent = mt.shoulder_e ex.socket_e.length *= 0.5 - # insert the 'DLT-hand', between the forearm and the hand + # insert the 'MCH-delta_hand', between the forearm and the hand # copies forarm rotation - ex.hand_delta_e = copy_bone_simple(arm, fk_chain.hand, "DLT-%s" % base_names[mt.hand], parent=True) + ex.hand_delta_e = copy_bone_simple(arm, fk_chain.hand, "MCH-delta_%s" % base_names[mt.hand], parent=True) ex.hand_delta = ex.hand_delta_e.name ex.hand_delta_e.length *= 0.5 ex.hand_delta_e.connected = False @@ -267,17 +268,14 @@ def fk(obj, definitions, base_names, options): hinge_setup() - # last step setup layers - layers = get_layer_dict(options) - lay = layers["fk"] - for attr in fk_chain.attr_names: - getattr(fk_chain, attr + "_b").layer = lay - - lay = layers["extra"] - for attr in ex.attr_names: - getattr(ex, attr + "_b").layer = lay - + if "fk_layer" in options: + layer = [n==options["fk_layer"] for n in range(0,32)] + else: + layer = list(mt.arm_b.layer) + fk_chain.arm_b.layer = layer + fk_chain.forearm_b.layer = layer + fk_chain.hand_b.layer = layer bpy.ops.object.mode_set(mode='EDIT') return None, fk_chain.arm, fk_chain.forearm, fk_chain.hand @@ -378,4 +376,3 @@ def main(obj, bone_definition, base_names, options): bpy.ops.object.mode_set(mode='OBJECT') blend_bone_list(obj, bone_definition, bones_fk, bones_ik, target_bone=bones_ik[3], target_prop="ik", blend_default=0.0) - |