From ec7fe7686766052aaa42b0cdff72d30e565e7785 Mon Sep 17 00:00:00 2001 From: Kfir Date: Sun, 3 Mar 2013 11:47:59 +0200 Subject: [PATCH] updating to latest rigify --- generate.py | 1 - metarigs/human_pose_a.py | 1201 ++++++++++++++++++++++++++++++++++++ metarigs/human_pose_t.py | 1201 ++++++++++++++++++++++++++++++++++++ rig_lists.py | 2 - rig_ui_template.py | 98 +-- rigs/biped/arm/__init__.py | 24 +- rigs/biped/arm/deform.py | 7 +- rigs/biped/arm/fk.py | 15 +- rigs/biped/arm/ik.py | 19 +- rigs/biped/leg/__init__.py | 20 +- rigs/biped/leg/deform.py | 18 +- rigs/biped/leg/fk.py | 12 +- rigs/biped/leg/ik.py | 34 +- rigs/biped/limb_common.py | 425 ++++++++----- rigs/misc/delta.py | 2 - rigs/neck_short.py | 6 +- rigs/spine.py | 11 +- utils.py | 39 +- 18 files changed, 2838 insertions(+), 297 deletions(-) create mode 100644 metarigs/human_pose_a.py create mode 100644 metarigs/human_pose_t.py diff --git a/generate.py b/generate.py index 0e529a1..5e9feaf 100644 --- a/generate.py +++ b/generate.py @@ -265,7 +265,6 @@ def generate_rig(context, metarig): try: # Collect/initialize all the rigs. rigs = [] - deformation_rigs = [] for bone in bones_sorted: bpy.ops.object.mode_set(mode='EDIT') rigs += get_bone_rigs(obj, bone) diff --git a/metarigs/human_pose_a.py b/metarigs/human_pose_a.py new file mode 100644 index 0000000..b1675e3 --- /dev/null +++ b/metarigs/human_pose_a.py @@ -0,0 +1,1201 @@ +# ##### BEGIN GPL LICENSE BLOCK ##### +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# ##### END GPL LICENSE BLOCK ##### + +# + +import bpy + + +def create(obj): + # generated by rigify.utils.write_metarig + bpy.ops.object.mode_set(mode='EDIT') + arm = obj.data + + for i in range(28): + arm.rigify_layers.add() + + arm.rigify_layers[0].name = "head" + arm.rigify_layers[0].row = 1 + arm.rigify_layers[1].name = " " + arm.rigify_layers[1].row = 1 + arm.rigify_layers[2].name = "Torso" + arm.rigify_layers[2].row = 2 + arm.rigify_layers[3].name = " " + arm.rigify_layers[3].row = 1 + arm.rigify_layers[4].name = "Fingers" + arm.rigify_layers[4].row = 3 + arm.rigify_layers[5].name = "(Tweak)" + arm.rigify_layers[5].row = 3 + arm.rigify_layers[6].name = "Arm.L (FK)" + arm.rigify_layers[6].row = 4 + arm.rigify_layers[7].name = "Arm.L (IK)" + arm.rigify_layers[7].row = 5 + arm.rigify_layers[8].name = "Arm.L (Tweak)" + arm.rigify_layers[8].row = 6 + arm.rigify_layers[9].name = "Arm.R (FK)" + arm.rigify_layers[9].row = 4 + arm.rigify_layers[10].name = "Arm.R (IK)" + arm.rigify_layers[10].row = 5 + arm.rigify_layers[11].name = "Arm.R (Tweak)" + arm.rigify_layers[11].row = 6 + arm.rigify_layers[12].name = "Leg.L (FK)" + arm.rigify_layers[12].row = 7 + arm.rigify_layers[13].name = "Leg.L (IK)" + arm.rigify_layers[13].row = 8 + arm.rigify_layers[14].name = "Leg.L (Tweak)" + arm.rigify_layers[14].row = 9 + arm.rigify_layers[15].name = "Leg.R (FK)" + arm.rigify_layers[15].row = 7 + arm.rigify_layers[16].name = "Leg.R (IK)" + arm.rigify_layers[16].row = 8 + arm.rigify_layers[17].name = "Leg.R (Tweak)" + arm.rigify_layers[17].row = 9 + arm.rigify_layers[18].name = " " + arm.rigify_layers[18].row = 1 + arm.rigify_layers[19].name = " " + arm.rigify_layers[19].row = 1 + arm.rigify_layers[20].name = " " + arm.rigify_layers[20].row = 1 + arm.rigify_layers[21].name = " " + arm.rigify_layers[21].row = 1 + arm.rigify_layers[22].name = " " + arm.rigify_layers[22].row = 1 + arm.rigify_layers[23].name = " " + arm.rigify_layers[23].row = 1 + arm.rigify_layers[24].name = " " + arm.rigify_layers[24].row = 1 + arm.rigify_layers[25].name = " " + arm.rigify_layers[25].row = 1 + arm.rigify_layers[26].name = " " + arm.rigify_layers[26].row = 1 + arm.rigify_layers[27].name = " " + arm.rigify_layers[27].row = 1 + + bones = {} + + bone = arm.edit_bones.new('hips') + bone.head[:] = 0.0000, 0.0552, 1.0099 + bone.tail[:] = 0.0000, 0.0172, 1.1837 + bone.roll = 0.0000 + bone.use_connect = False + bones['hips'] = bone.name + bone = arm.edit_bones.new('spine') + bone.head[:] = 0.0000, 0.0172, 1.1837 + bone.tail[:] = 0.0000, 0.0004, 1.3418 + bone.roll = 0.0000 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['hips']] + bones['spine'] = bone.name + bone = arm.edit_bones.new('thigh.L') + bone.head[:] = 0.0980, 0.0124, 1.0720 + bone.tail[:] = 0.0980, -0.0286, 0.5372 + bone.roll = 0.0000 + bone.use_connect = False + bone.parent = arm.edit_bones[bones['hips']] + bones['thigh.L'] = bone.name + bone = arm.edit_bones.new('thigh.R') + bone.head[:] = -0.0980, 0.0124, 1.0720 + bone.tail[:] = -0.0980, -0.0286, 0.5372 + bone.roll = 0.0000 + bone.use_connect = False + bone.parent = arm.edit_bones[bones['hips']] + bones['thigh.R'] = bone.name + bone = arm.edit_bones.new('chest') + bone.head[:] = 0.0000, 0.0004, 1.3418 + bone.tail[:] = 0.0000, 0.0114, 1.6582 + bone.roll = 0.0000 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['spine']] + bones['chest'] = bone.name + bone = arm.edit_bones.new('shin.L') + bone.head[:] = 0.0980, -0.0286, 0.5372 + bone.tail[:] = 0.0980, 0.0162, 0.0852 + bone.roll = 0.0000 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['thigh.L']] + bones['shin.L'] = bone.name + bone = arm.edit_bones.new('shin.R') + bone.head[:] = -0.0980, -0.0286, 0.5372 + bone.tail[:] = -0.0980, 0.0162, 0.0852 + bone.roll = 0.0000 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['thigh.R']] + bones['shin.R'] = bone.name + bone = arm.edit_bones.new('neck') + bone.head[:] = 0.0000, 0.0114, 1.6582 + bone.tail[:] = 0.0000, -0.0247, 1.7813 + bone.roll = 0.0000 + bone.use_connect = False + bone.parent = arm.edit_bones[bones['chest']] + bones['neck'] = bone.name + bone = arm.edit_bones.new('shoulder.L') + bone.head[:] = 0.0183, -0.0684, 1.6051 + bone.tail[:] = 0.1694, 0.0205, 1.6050 + bone.roll = 0.0004 + bone.use_connect = False + bone.parent = arm.edit_bones[bones['chest']] + bones['shoulder.L'] = bone.name + bone = arm.edit_bones.new('shoulder.R') + bone.head[:] = -0.0183, -0.0684, 1.6051 + bone.tail[:] = -0.1694, 0.0205, 1.6050 + bone.roll = -0.0004 + bone.use_connect = False + bone.parent = arm.edit_bones[bones['chest']] + bones['shoulder.R'] = bone.name + bone = arm.edit_bones.new('foot.L') + bone.head[:] = 0.0980, 0.0162, 0.0852 + bone.tail[:] = 0.0980, -0.0934, 0.0167 + bone.roll = 0.0000 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['shin.L']] + bones['foot.L'] = bone.name + bone = arm.edit_bones.new('heel.L') + bone.head[:] = 0.0980, 0.0162, 0.0852 + bone.tail[:] = 0.0980, 0.0882, -0.0000 + bone.roll = -3.1416 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['shin.L']] + bones['heel.L'] = bone.name + bone = arm.edit_bones.new('foot.R') + bone.head[:] = -0.0980, 0.0162, 0.0852 + bone.tail[:] = -0.0980, -0.0934, 0.0167 + bone.roll = -0.0000 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['shin.R']] + bones['foot.R'] = bone.name + bone = arm.edit_bones.new('heel.R') + bone.head[:] = -0.0980, 0.0162, 0.0852 + bone.tail[:] = -0.0980, 0.0882, -0.0000 + bone.roll = 3.1416 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['shin.R']] + bones['heel.R'] = bone.name + bone = arm.edit_bones.new('head') + bone.head[:] = 0.0000, -0.0247, 1.7813 + bone.tail[:] = 0.0000, -0.0247, 1.9347 + bone.roll = 0.0000 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['neck']] + bones['head'] = bone.name + bone = arm.edit_bones.new('upper_arm.L') + bone.head[:] = 0.1953, 0.0267, 1.5846 + bone.tail[:] = 0.4424, 0.0885, 1.4491 + bone.roll = 2.0691 + bone.use_connect = False + bone.parent = arm.edit_bones[bones['shoulder.L']] + bones['upper_arm.L'] = bone.name + bone = arm.edit_bones.new('upper_arm.R') + bone.head[:] = -0.1953, 0.0267, 1.5846 + bone.tail[:] = -0.4424, 0.0885, 1.4491 + bone.roll = -2.0691 + bone.use_connect = False + bone.parent = arm.edit_bones[bones['shoulder.R']] + bones['upper_arm.R'] = bone.name + bone = arm.edit_bones.new('toe.L') + bone.head[:] = 0.0980, -0.0934, 0.0167 + bone.tail[:] = 0.0980, -0.1606, 0.0167 + bone.roll = -0.0000 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['foot.L']] + bones['toe.L'] = bone.name + bone = arm.edit_bones.new('heel.02.L') + bone.head[:] = 0.0600, 0.0000, 0.0000 + bone.tail[:] = 0.1400, 0.0000, 0.0000 + bone.roll = 0.0000 + bone.use_connect = False + bone.parent = arm.edit_bones[bones['heel.L']] + bones['heel.02.L'] = bone.name + bone = arm.edit_bones.new('toe.R') + bone.head[:] = -0.0980, -0.0934, 0.0167 + bone.tail[:] = -0.0980, -0.1606, 0.0167 + bone.roll = 0.0000 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['foot.R']] + bones['toe.R'] = bone.name + bone = arm.edit_bones.new('heel.02.R') + bone.head[:] = -0.0600, 0.0000, 0.0000 + bone.tail[:] = -0.1400, 0.0000, 0.0000 + bone.roll = 0.0000 + bone.use_connect = False + bone.parent = arm.edit_bones[bones['heel.R']] + bones['heel.02.R'] = bone.name + bone = arm.edit_bones.new('forearm.L') + bone.head[:] = 0.4424, 0.0885, 1.4491 + bone.tail[:] = 0.6594, 0.0492, 1.3061 + bone.roll = 2.1459 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['upper_arm.L']] + bones['forearm.L'] = bone.name + bone = arm.edit_bones.new('forearm.R') + bone.head[:] = -0.4424, 0.0885, 1.4491 + bone.tail[:] = -0.6594, 0.0492, 1.3061 + bone.roll = -2.1459 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['upper_arm.R']] + bones['forearm.R'] = bone.name + bone = arm.edit_bones.new('hand.L') + bone.head[:] = 0.6594, 0.0492, 1.3061 + bone.tail[:] = 0.7234, 0.0412, 1.2585 + bone.roll = -2.4946 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['forearm.L']] + bones['hand.L'] = bone.name + bone = arm.edit_bones.new('hand.R') + bone.head[:] = -0.6594, 0.0492, 1.3061 + bone.tail[:] = -0.7234, 0.0412, 1.2585 + bone.roll = 2.4946 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['forearm.R']] + bones['hand.R'] = bone.name + bone = arm.edit_bones.new('palm.01.L') + bone.head[:] = 0.6921, 0.0224, 1.2882 + bone.tail[:] = 0.7464, 0.0051, 1.2482 + bone.roll = -2.4928 + bone.use_connect = False + bone.parent = arm.edit_bones[bones['hand.L']] + bones['palm.01.L'] = bone.name + bone = arm.edit_bones.new('palm.02.L') + bone.head[:] = 0.6970, 0.0389, 1.2877 + bone.tail[:] = 0.7518, 0.0277, 1.2487 + bone.roll = -2.5274 + bone.use_connect = False + bone.parent = arm.edit_bones[bones['hand.L']] + bones['palm.02.L'] = bone.name + bone = arm.edit_bones.new('palm.03.L') + bone.head[:] = 0.6963, 0.0545, 1.2874 + bone.tail[:] = 0.7540, 0.0521, 1.2482 + bone.roll = -2.5843 + bone.use_connect = False + bone.parent = arm.edit_bones[bones['hand.L']] + bones['palm.03.L'] = bone.name + bone = arm.edit_bones.new('palm.04.L') + bone.head[:] = 0.6929, 0.0696, 1.2871 + bone.tail[:] = 0.7528, 0.0763, 1.2428 + bone.roll = -2.5155 + bone.use_connect = False + bone.parent = arm.edit_bones[bones['hand.L']] + bones['palm.04.L'] = bone.name + bone = arm.edit_bones.new('palm.01.R') + bone.head[:] = -0.6921, 0.0224, 1.2882 + bone.tail[:] = -0.7464, 0.0051, 1.2482 + bone.roll = 2.4928 + bone.use_connect = False + bone.parent = arm.edit_bones[bones['hand.R']] + bones['palm.01.R'] = bone.name + bone = arm.edit_bones.new('palm.02.R') + bone.head[:] = -0.6970, 0.0389, 1.2877 + bone.tail[:] = -0.7518, 0.0277, 1.2487 + bone.roll = 2.5274 + bone.use_connect = False + bone.parent = arm.edit_bones[bones['hand.R']] + bones['palm.02.R'] = bone.name + bone = arm.edit_bones.new('palm.03.R') + bone.head[:] = -0.6963, 0.0544, 1.2874 + bone.tail[:] = -0.7540, 0.0521, 1.2482 + bone.roll = 2.5843 + bone.use_connect = False + bone.parent = arm.edit_bones[bones['hand.R']] + bones['palm.03.R'] = bone.name + bone = arm.edit_bones.new('palm.04.R') + bone.head[:] = -0.6929, 0.0696, 1.2871 + bone.tail[:] = -0.7528, 0.0763, 1.2428 + bone.roll = 2.5155 + bone.use_connect = False + bone.parent = arm.edit_bones[bones['hand.R']] + bones['palm.04.R'] = bone.name + bone = arm.edit_bones.new('f_index.01.L') + bone.head[:] = 0.7464, 0.0051, 1.2482 + bone.tail[:] = 0.7718, 0.0013, 1.2112 + bone.roll = -2.0315 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['palm.01.L']] + bones['f_index.01.L'] = bone.name + bone = arm.edit_bones.new('thumb.01.L') + bone.head[:] = 0.6705, 0.0214, 1.2738 + bone.tail[:] = 0.6857, 0.0015, 1.2404 + bone.roll = -0.1587 + bone.use_connect = False + bone.parent = arm.edit_bones[bones['palm.01.L']] + bones['thumb.01.L'] = bone.name + bone = arm.edit_bones.new('f_middle.01.L') + bone.head[:] = 0.7518, 0.0277, 1.2487 + bone.tail[:] = 0.7762, 0.0234, 1.2058 + bone.roll = -2.0067 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['palm.02.L']] + bones['f_middle.01.L'] = bone.name + bone = arm.edit_bones.new('f_ring.01.L') + bone.head[:] = 0.7540, 0.0521, 1.2482 + bone.tail[:] = 0.7715, 0.0499, 1.2070 + bone.roll = -2.0082 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['palm.03.L']] + bones['f_ring.01.L'] = bone.name + bone = arm.edit_bones.new('f_pinky.01.L') + bone.head[:] = 0.7528, 0.0763, 1.2428 + bone.tail[:] = 0.7589, 0.0765, 1.2156 + bone.roll = -1.9749 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['palm.04.L']] + bones['f_pinky.01.L'] = bone.name + bone = arm.edit_bones.new('f_index.01.R') + bone.head[:] = -0.7464, 0.0051, 1.2482 + bone.tail[:] = -0.7718, 0.0012, 1.2112 + bone.roll = 2.0315 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['palm.01.R']] + bones['f_index.01.R'] = bone.name + bone = arm.edit_bones.new('thumb.01.R') + bone.head[:] = -0.6705, 0.0214, 1.2738 + bone.tail[:] = -0.6857, 0.0015, 1.2404 + bone.roll = 0.1587 + bone.use_connect = False + bone.parent = arm.edit_bones[bones['palm.01.R']] + bones['thumb.01.R'] = bone.name + bone = arm.edit_bones.new('f_middle.01.R') + bone.head[:] = -0.7518, 0.0277, 1.2487 + bone.tail[:] = -0.7762, 0.0233, 1.2058 + bone.roll = 2.0067 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['palm.02.R']] + bones['f_middle.01.R'] = bone.name + bone = arm.edit_bones.new('f_ring.01.R') + bone.head[:] = -0.7540, 0.0521, 1.2482 + bone.tail[:] = -0.7715, 0.0499, 1.2070 + bone.roll = 2.0082 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['palm.03.R']] + bones['f_ring.01.R'] = bone.name + bone = arm.edit_bones.new('f_pinky.01.R') + bone.head[:] = -0.7528, 0.0763, 1.2428 + bone.tail[:] = -0.7589, 0.0765, 1.2156 + bone.roll = 1.9749 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['palm.04.R']] + bones['f_pinky.01.R'] = bone.name + bone = arm.edit_bones.new('f_index.02.L') + bone.head[:] = 0.7718, 0.0013, 1.2112 + bone.tail[:] = 0.7840, -0.0003, 1.1858 + bone.roll = -1.8799 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['f_index.01.L']] + bones['f_index.02.L'] = bone.name + bone = arm.edit_bones.new('thumb.02.L') + bone.head[:] = 0.6857, 0.0015, 1.2404 + bone.tail[:] = 0.7056, -0.0057, 1.2145 + bone.roll = -0.4798 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['thumb.01.L']] + bones['thumb.02.L'] = bone.name + bone = arm.edit_bones.new('f_middle.02.L') + bone.head[:] = 0.7762, 0.0234, 1.2058 + bone.tail[:] = 0.7851, 0.0218, 1.1749 + bone.roll = -1.8283 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['f_middle.01.L']] + bones['f_middle.02.L'] = bone.name + bone = arm.edit_bones.new('f_ring.02.L') + bone.head[:] = 0.7715, 0.0499, 1.2070 + bone.tail[:] = 0.7794, 0.0494, 1.1762 + bone.roll = -1.8946 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['f_ring.01.L']] + bones['f_ring.02.L'] = bone.name + bone = arm.edit_bones.new('f_pinky.02.L') + bone.head[:] = 0.7589, 0.0765, 1.2156 + bone.tail[:] = 0.7618, 0.0770, 1.1932 + bone.roll = -1.9059 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['f_pinky.01.L']] + bones['f_pinky.02.L'] = bone.name + bone = arm.edit_bones.new('f_index.02.R') + bone.head[:] = -0.7718, 0.0012, 1.2112 + bone.tail[:] = -0.7840, -0.0003, 1.1858 + bone.roll = 1.8799 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['f_index.01.R']] + bones['f_index.02.R'] = bone.name + bone = arm.edit_bones.new('thumb.02.R') + bone.head[:] = -0.6857, 0.0015, 1.2404 + bone.tail[:] = -0.7056, -0.0057, 1.2145 + bone.roll = 0.4798 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['thumb.01.R']] + bones['thumb.02.R'] = bone.name + bone = arm.edit_bones.new('f_middle.02.R') + bone.head[:] = -0.7762, 0.0233, 1.2058 + bone.tail[:] = -0.7851, 0.0218, 1.1749 + bone.roll = 1.8283 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['f_middle.01.R']] + bones['f_middle.02.R'] = bone.name + bone = arm.edit_bones.new('f_ring.02.R') + bone.head[:] = -0.7715, 0.0499, 1.2070 + bone.tail[:] = -0.7794, 0.0494, 1.1762 + bone.roll = 1.8946 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['f_ring.01.R']] + bones['f_ring.02.R'] = bone.name + bone = arm.edit_bones.new('f_pinky.02.R') + bone.head[:] = -0.7589, 0.0765, 1.2156 + bone.tail[:] = -0.7618, 0.0770, 1.1932 + bone.roll = 1.9059 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['f_pinky.01.R']] + bones['f_pinky.02.R'] = bone.name + bone = arm.edit_bones.new('f_index.03.L') + bone.head[:] = 0.7840, -0.0003, 1.1858 + bone.tail[:] = 0.7892, 0.0006, 1.1636 + bone.roll = -1.6760 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['f_index.02.L']] + bones['f_index.03.L'] = bone.name + bone = arm.edit_bones.new('thumb.03.L') + bone.head[:] = 0.7056, -0.0057, 1.2145 + bone.tail[:] = 0.7194, -0.0098, 1.1995 + bone.roll = -0.5826 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['thumb.02.L']] + bones['thumb.03.L'] = bone.name + bone = arm.edit_bones.new('f_middle.03.L') + bone.head[:] = 0.7851, 0.0218, 1.1749 + bone.tail[:] = 0.7888, 0.0216, 1.1525 + bone.roll = -1.7483 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['f_middle.02.L']] + bones['f_middle.03.L'] = bone.name + bone = arm.edit_bones.new('f_ring.03.L') + bone.head[:] = 0.7794, 0.0494, 1.1762 + bone.tail[:] = 0.7781, 0.0498, 1.1577 + bone.roll = -1.6582 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['f_ring.02.L']] + bones['f_ring.03.L'] = bone.name + bone = arm.edit_bones.new('f_pinky.03.L') + bone.head[:] = 0.7618, 0.0770, 1.1932 + bone.tail[:] = 0.7611, 0.0772, 1.1782 + bone.roll = -1.7639 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['f_pinky.02.L']] + bones['f_pinky.03.L'] = bone.name + bone = arm.edit_bones.new('f_index.03.R') + bone.head[:] = -0.7840, -0.0003, 1.1858 + bone.tail[:] = -0.7892, 0.0006, 1.1636 + bone.roll = 1.6760 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['f_index.02.R']] + bones['f_index.03.R'] = bone.name + bone = arm.edit_bones.new('thumb.03.R') + bone.head[:] = -0.7056, -0.0057, 1.2145 + bone.tail[:] = -0.7194, -0.0098, 1.1995 + bone.roll = 0.5826 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['thumb.02.R']] + bones['thumb.03.R'] = bone.name + bone = arm.edit_bones.new('f_middle.03.R') + bone.head[:] = -0.7851, 0.0218, 1.1749 + bone.tail[:] = -0.7888, 0.0216, 1.1525 + bone.roll = 1.7483 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['f_middle.02.R']] + bones['f_middle.03.R'] = bone.name + bone = arm.edit_bones.new('f_ring.03.R') + bone.head[:] = -0.7794, 0.0494, 1.1762 + bone.tail[:] = -0.7781, 0.0498, 1.1577 + bone.roll = 1.6582 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['f_ring.02.R']] + bones['f_ring.03.R'] = bone.name + bone = arm.edit_bones.new('f_pinky.03.R') + bone.head[:] = -0.7618, 0.0770, 1.1932 + bone.tail[:] = -0.7611, 0.0772, 1.1782 + bone.roll = 1.7639 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['f_pinky.02.R']] + bones['f_pinky.03.R'] = bone.name + + bpy.ops.object.mode_set(mode='OBJECT') + pbone = obj.pose.bones[bones['hips']] + pbone.rigify_type = 'spine' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + try: + pbone.rigify_parameters.chain_bone_controls = "1, 2, 3" + except AttributeError: + pass + pbone = obj.pose.bones[bones['spine']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['thigh.L']] + pbone.rigify_type = 'biped.leg' + pbone.lock_location = (True, True, True) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, False, False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + try: + pbone.rigify_parameters.separate_ik_layers = True + except AttributeError: + pass + try: + pbone.rigify_parameters.ik_layers = [False, False, False, False, False, False, False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + except AttributeError: + pass + try: + pbone.rigify_parameters.separate_hose_layers = True + except AttributeError: + pass + try: + pbone.rigify_parameters.hose_layers = [False, False, False, False, False, False, False, False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + except AttributeError: + pass + pbone = obj.pose.bones[bones['thigh.R']] + pbone.rigify_type = 'biped.leg' + pbone.lock_location = (True, True, True) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + try: + pbone.rigify_parameters.separate_ik_layers = True + except AttributeError: + pass + try: + pbone.rigify_parameters.ik_layers = [False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + except AttributeError: + pass + try: + pbone.rigify_parameters.separate_hose_layers = True + except AttributeError: + pass + try: + pbone.rigify_parameters.hose_layers = [False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + except AttributeError: + pass + pbone = obj.pose.bones[bones['chest']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['shin.L']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, False, False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['shin.R']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['neck']] + pbone.rigify_type = 'neck_short' + pbone.lock_location = (True, True, True) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['shoulder.L']] + pbone.rigify_type = 'basic.copy' + pbone.lock_location = (True, True, True) + pbone.lock_rotation = (False, True, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'YXZ' + pbone.bone.layers = [False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['shoulder.R']] + pbone.rigify_type = 'basic.copy' + pbone.lock_location = (True, True, True) + pbone.lock_rotation = (False, True, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'YXZ' + pbone.bone.layers = [False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['foot.L']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, False, False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['heel.L']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, False, False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['foot.R']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['heel.R']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['head']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['upper_arm.L']] + pbone.rigify_type = 'biped.arm' + pbone.lock_location = (True, True, True) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + try: + pbone.rigify_parameters.separate_ik_layers = True + except AttributeError: + pass + try: + pbone.rigify_parameters.ik_layers = [False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + except AttributeError: + pass + try: + pbone.rigify_parameters.separate_hose_layers = True + except AttributeError: + pass + try: + pbone.rigify_parameters.hose_layers = [False, False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + except AttributeError: + pass + pbone = obj.pose.bones[bones['upper_arm.R']] + pbone.rigify_type = 'biped.arm' + pbone.lock_location = (True, True, True) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + try: + pbone.rigify_parameters.separate_ik_layers = True + except AttributeError: + pass + try: + pbone.rigify_parameters.ik_layers = [False, False, False, False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + except AttributeError: + pass + try: + pbone.rigify_parameters.separate_hose_layers = True + except AttributeError: + pass + try: + pbone.rigify_parameters.hose_layers = [False, False, False, False, False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + except AttributeError: + pass + pbone = obj.pose.bones[bones['toe.L']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, False, False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['heel.02.L']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, False, False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['toe.R']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['heel.02.R']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['forearm.L']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['forearm.R']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['hand.L']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['hand.R']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['palm.01.L']] + pbone.rigify_type = 'palm' + pbone.lock_location = (True, True, True) + pbone.lock_rotation = (False, True, True) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'YXZ' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['palm.02.L']] + pbone.rigify_type = '' + pbone.lock_location = (True, True, True) + pbone.lock_rotation = (False, True, True) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'YXZ' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['palm.03.L']] + pbone.rigify_type = '' + pbone.lock_location = (True, True, True) + pbone.lock_rotation = (False, True, True) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'YXZ' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['palm.04.L']] + pbone.rigify_type = '' + pbone.lock_location = (True, True, True) + pbone.lock_rotation = (False, True, True) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'YXZ' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['palm.01.R']] + pbone.rigify_type = 'palm' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, True, True) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'YXZ' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['palm.02.R']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, True, True) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'YXZ' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['palm.03.R']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, True, True) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'YXZ' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['palm.04.R']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, True, True) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'YXZ' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['f_index.01.L']] + pbone.rigify_type = 'finger' + pbone.lock_location = (True, True, True) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + try: + pbone.rigify_parameters.separate_extra_layers = True + except AttributeError: + pass + try: + pbone.rigify_parameters.extra_layers = [False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + except AttributeError: + pass + pbone = obj.pose.bones[bones['thumb.01.L']] + pbone.rigify_type = 'finger' + pbone.lock_location = (True, True, True) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + try: + pbone.rigify_parameters.extra_layers = [False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + except AttributeError: + pass + try: + pbone.rigify_parameters.separate_extra_layers = True + except AttributeError: + pass + pbone = obj.pose.bones[bones['f_middle.01.L']] + pbone.rigify_type = 'finger' + pbone.lock_location = (True, True, True) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + try: + pbone.rigify_parameters.separate_extra_layers = True + except AttributeError: + pass + try: + pbone.rigify_parameters.extra_layers = [False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + except AttributeError: + pass + pbone = obj.pose.bones[bones['f_ring.01.L']] + pbone.rigify_type = 'finger' + pbone.lock_location = (True, True, True) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + try: + pbone.rigify_parameters.separate_extra_layers = True + except AttributeError: + pass + try: + pbone.rigify_parameters.extra_layers = [False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + except AttributeError: + pass + pbone = obj.pose.bones[bones['f_pinky.01.L']] + pbone.rigify_type = 'finger' + pbone.lock_location = (True, True, True) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + try: + pbone.rigify_parameters.separate_extra_layers = True + except AttributeError: + pass + try: + pbone.rigify_parameters.extra_layers = [False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + except AttributeError: + pass + pbone = obj.pose.bones[bones['f_index.01.R']] + pbone.rigify_type = 'finger' + pbone.lock_location = (True, True, True) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + try: + pbone.rigify_parameters.extra_layers = [False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + except AttributeError: + pass + try: + pbone.rigify_parameters.separate_extra_layers = True + except AttributeError: + pass + pbone = obj.pose.bones[bones['thumb.01.R']] + pbone.rigify_type = 'finger' + pbone.lock_location = (True, True, True) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + try: + pbone.rigify_parameters.separate_extra_layers = True + except AttributeError: + pass + try: + pbone.rigify_parameters.extra_layers = [False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + except AttributeError: + pass + pbone = obj.pose.bones[bones['f_middle.01.R']] + pbone.rigify_type = 'finger' + pbone.lock_location = (True, True, True) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + try: + pbone.rigify_parameters.separate_extra_layers = True + except AttributeError: + pass + try: + pbone.rigify_parameters.extra_layers = [False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + except AttributeError: + pass + pbone = obj.pose.bones[bones['f_ring.01.R']] + pbone.rigify_type = 'finger' + pbone.lock_location = (True, True, True) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + try: + pbone.rigify_parameters.separate_extra_layers = True + except AttributeError: + pass + try: + pbone.rigify_parameters.extra_layers = [False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + except AttributeError: + pass + pbone = obj.pose.bones[bones['f_pinky.01.R']] + pbone.rigify_type = 'finger' + pbone.lock_location = (True, True, True) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + try: + pbone.rigify_parameters.separate_extra_layers = True + except AttributeError: + pass + try: + pbone.rigify_parameters.extra_layers = [False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + except AttributeError: + pass + pbone = obj.pose.bones[bones['f_index.02.L']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['thumb.02.L']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['f_middle.02.L']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['f_ring.02.L']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['f_pinky.02.L']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['f_index.02.R']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['thumb.02.R']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['f_middle.02.R']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['f_ring.02.R']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['f_pinky.02.R']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['f_index.03.L']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['thumb.03.L']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['f_middle.03.L']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['f_ring.03.L']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['f_pinky.03.L']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['f_index.03.R']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['thumb.03.R']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['f_middle.03.R']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['f_ring.03.R']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['f_pinky.03.R']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + + bpy.ops.object.mode_set(mode='EDIT') + for bone in arm.edit_bones: + bone.select = False + bone.select_head = False + bone.select_tail = False + for b in bones: + bone = arm.edit_bones[bones[b]] + bone.select = True + bone.select_head = True + bone.select_tail = True + arm.edit_bones.active = bone + + arm.layers = [(x in [0, 2, 4, 6, 9, 12, 15]) for x in range(32)] + +if __name__ == "__main__": + create(bpy.context.active_object) diff --git a/metarigs/human_pose_t.py b/metarigs/human_pose_t.py new file mode 100644 index 0000000..cd83917 --- /dev/null +++ b/metarigs/human_pose_t.py @@ -0,0 +1,1201 @@ +# ##### BEGIN GPL LICENSE BLOCK ##### +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# ##### END GPL LICENSE BLOCK ##### + +# + +import bpy + + +def create(obj): + # generated by rigify.utils.write_metarig + bpy.ops.object.mode_set(mode='EDIT') + arm = obj.data + + for i in range(28): + arm.rigify_layers.add() + + arm.rigify_layers[0].name = "head" + arm.rigify_layers[0].row = 1 + arm.rigify_layers[1].name = " " + arm.rigify_layers[1].row = 1 + arm.rigify_layers[2].name = "Torso" + arm.rigify_layers[2].row = 2 + arm.rigify_layers[3].name = " " + arm.rigify_layers[3].row = 1 + arm.rigify_layers[4].name = "Fingers" + arm.rigify_layers[4].row = 3 + arm.rigify_layers[5].name = "(Tweak)" + arm.rigify_layers[5].row = 3 + arm.rigify_layers[6].name = "Arm.L (FK)" + arm.rigify_layers[6].row = 4 + arm.rigify_layers[7].name = "Arm.L (IK)" + arm.rigify_layers[7].row = 5 + arm.rigify_layers[8].name = "Arm.L (Tweak)" + arm.rigify_layers[8].row = 6 + arm.rigify_layers[9].name = "Arm.R (FK)" + arm.rigify_layers[9].row = 4 + arm.rigify_layers[10].name = "Arm.R (IK)" + arm.rigify_layers[10].row = 5 + arm.rigify_layers[11].name = "Arm.R (Tweak)" + arm.rigify_layers[11].row = 6 + arm.rigify_layers[12].name = "Leg.L (FK)" + arm.rigify_layers[12].row = 7 + arm.rigify_layers[13].name = "Leg.L (IK)" + arm.rigify_layers[13].row = 8 + arm.rigify_layers[14].name = "Leg.L (Tweak)" + arm.rigify_layers[14].row = 9 + arm.rigify_layers[15].name = "Leg.R (FK)" + arm.rigify_layers[15].row = 7 + arm.rigify_layers[16].name = "Leg.R (IK)" + arm.rigify_layers[16].row = 8 + arm.rigify_layers[17].name = "Leg.R (Tweak)" + arm.rigify_layers[17].row = 9 + arm.rigify_layers[18].name = " " + arm.rigify_layers[18].row = 1 + arm.rigify_layers[19].name = " " + arm.rigify_layers[19].row = 1 + arm.rigify_layers[20].name = " " + arm.rigify_layers[20].row = 1 + arm.rigify_layers[21].name = " " + arm.rigify_layers[21].row = 1 + arm.rigify_layers[22].name = " " + arm.rigify_layers[22].row = 1 + arm.rigify_layers[23].name = " " + arm.rigify_layers[23].row = 1 + arm.rigify_layers[24].name = " " + arm.rigify_layers[24].row = 1 + arm.rigify_layers[25].name = " " + arm.rigify_layers[25].row = 1 + arm.rigify_layers[26].name = " " + arm.rigify_layers[26].row = 1 + arm.rigify_layers[27].name = " " + arm.rigify_layers[27].row = 1 + + bones = {} + + bone = arm.edit_bones.new('hips') + bone.head[:] = 0.0000, 0.0000, 1.0000 + bone.tail[:] = 0.0000, 0.0000, 1.2000 + bone.roll = 0.0000 + bone.use_connect = False + bones['hips'] = bone.name + bone = arm.edit_bones.new('spine') + bone.head[:] = 0.0000, 0.0000, 1.2000 + bone.tail[:] = 0.0000, 0.0000, 1.3500 + bone.roll = 0.0000 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['hips']] + bones['spine'] = bone.name + bone = arm.edit_bones.new('thigh.L') + bone.head[:] = 0.1000, 0.0000, 1.1000 + bone.tail[:] = 0.1000, 0.0000, 0.6000 + bone.roll = 0.0000 + bone.use_connect = False + bone.parent = arm.edit_bones[bones['hips']] + bones['thigh.L'] = bone.name + bone = arm.edit_bones.new('thigh.R') + bone.head[:] = -0.1000, 0.0000, 1.1000 + bone.tail[:] = -0.1000, 0.0000, 0.6000 + bone.roll = -0.0000 + bone.use_connect = False + bone.parent = arm.edit_bones[bones['hips']] + bones['thigh.R'] = bone.name + bone = arm.edit_bones.new('chest') + bone.head[:] = 0.0000, 0.0000, 1.3500 + bone.tail[:] = 0.0000, 0.0000, 1.6200 + bone.roll = 0.0000 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['spine']] + bones['chest'] = bone.name + bone = arm.edit_bones.new('shin.L') + bone.head[:] = 0.1000, 0.0000, 0.6000 + bone.tail[:] = 0.1000, 0.0000, 0.1000 + bone.roll = 0.0000 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['thigh.L']] + bones['shin.L'] = bone.name + bone = arm.edit_bones.new('shin.R') + bone.head[:] = -0.1000, 0.0000, 0.6000 + bone.tail[:] = -0.1000, 0.0000, 0.1000 + bone.roll = -0.0000 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['thigh.R']] + bones['shin.R'] = bone.name + bone = arm.edit_bones.new('neck') + bone.head[:] = 0.0000, 0.0000, 1.6200 + bone.tail[:] = 0.0000, 0.0000, 1.7567 + bone.roll = 0.0000 + bone.use_connect = False + bone.parent = arm.edit_bones[bones['chest']] + bones['neck'] = bone.name + bone = arm.edit_bones.new('shoulder.L') + bone.head[:] = 0.0200, -0.0300, 1.6200 + bone.tail[:] = 0.1800, -0.0300, 1.6200 + bone.roll = 0.0000 + bone.use_connect = False + bone.parent = arm.edit_bones[bones['chest']] + bones['shoulder.L'] = bone.name + bone = arm.edit_bones.new('shoulder.R') + bone.head[:] = -0.0200, -0.0300, 1.6200 + bone.tail[:] = -0.1800, -0.0300, 1.6200 + bone.roll = -0.0000 + bone.use_connect = False + bone.parent = arm.edit_bones[bones['chest']] + bones['shoulder.R'] = bone.name + bone = arm.edit_bones.new('foot.L') + bone.head[:] = 0.1000, 0.0000, 0.1000 + bone.tail[:] = 0.1000, -0.0800, 0.0200 + bone.roll = 0.0000 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['shin.L']] + bones['foot.L'] = bone.name + bone = arm.edit_bones.new('heel.L') + bone.head[:] = 0.1000, 0.0000, 0.1000 + bone.tail[:] = 0.1000, 0.1000, 0.0000 + bone.roll = 0.0000 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['shin.L']] + bones['heel.L'] = bone.name + bone = arm.edit_bones.new('foot.R') + bone.head[:] = -0.1000, 0.0000, 0.1000 + bone.tail[:] = -0.1000, -0.0800, 0.0200 + bone.roll = -0.0000 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['shin.R']] + bones['foot.R'] = bone.name + bone = arm.edit_bones.new('heel.R') + bone.head[:] = -0.1000, 0.0000, 0.1000 + bone.tail[:] = -0.1000, 0.1000, 0.0000 + bone.roll = -0.0000 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['shin.R']] + bones['heel.R'] = bone.name + bone = arm.edit_bones.new('head') + bone.head[:] = 0.0000, 0.0000, 1.7567 + bone.tail[:] = 0.0000, 0.0000, 2.0000 + bone.roll = 0.0000 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['neck']] + bones['head'] = bone.name + bone = arm.edit_bones.new('upper_arm.L') + bone.head[:] = 0.1800, 0.0000, 1.6200 + bone.tail[:] = 0.5000, 0.0000, 1.6200 + bone.roll = 1.5708 + bone.use_connect = False + bone.parent = arm.edit_bones[bones['shoulder.L']] + bones['upper_arm.L'] = bone.name + bone = arm.edit_bones.new('upper_arm.R') + bone.head[:] = -0.1800, 0.0000, 1.6200 + bone.tail[:] = -0.5000, 0.0000, 1.6200 + bone.roll = -1.5708 + bone.use_connect = False + bone.parent = arm.edit_bones[bones['shoulder.R']] + bones['upper_arm.R'] = bone.name + bone = arm.edit_bones.new('toe.L') + bone.head[:] = 0.1000, -0.0800, 0.0200 + bone.tail[:] = 0.1000, -0.1800, 0.0200 + bone.roll = 3.1416 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['foot.L']] + bones['toe.L'] = bone.name + bone = arm.edit_bones.new('heel.02.L') + bone.head[:] = 0.0500, 0.0000, 0.0000 + bone.tail[:] = 0.1500, 0.0000, 0.0000 + bone.roll = 0.0000 + bone.use_connect = False + bone.parent = arm.edit_bones[bones['heel.L']] + bones['heel.02.L'] = bone.name + bone = arm.edit_bones.new('toe.R') + bone.head[:] = -0.1000, -0.0800, 0.0200 + bone.tail[:] = -0.1000, -0.1800, 0.0200 + bone.roll = -3.1416 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['foot.R']] + bones['toe.R'] = bone.name + bone = arm.edit_bones.new('heel.02.R') + bone.head[:] = -0.0500, 0.0000, 0.0000 + bone.tail[:] = -0.1500, 0.0000, 0.0000 + bone.roll = -0.0000 + bone.use_connect = False + bone.parent = arm.edit_bones[bones['heel.R']] + bones['heel.02.R'] = bone.name + bone = arm.edit_bones.new('forearm.L') + bone.head[:] = 0.5000, 0.0000, 1.6200 + bone.tail[:] = 0.8200, 0.0000, 1.6200 + bone.roll = 1.5708 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['upper_arm.L']] + bones['forearm.L'] = bone.name + bone = arm.edit_bones.new('forearm.R') + bone.head[:] = -0.5000, 0.0000, 1.6200 + bone.tail[:] = -0.8200, 0.0000, 1.6200 + bone.roll = -1.5708 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['upper_arm.R']] + bones['forearm.R'] = bone.name + bone = arm.edit_bones.new('hand.L') + bone.head[:] = 0.8200, 0.0000, 1.6200 + bone.tail[:] = 0.9100, 0.0000, 1.6200 + bone.roll = -3.1416 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['forearm.L']] + bones['hand.L'] = bone.name + bone = arm.edit_bones.new('hand.R') + bone.head[:] = -0.8200, 0.0000, 1.6200 + bone.tail[:] = -0.9100, 0.0000, 1.6200 + bone.roll = 3.1416 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['forearm.R']] + bones['hand.R'] = bone.name + bone = arm.edit_bones.new('palm.01.L') + bone.head[:] = 0.8400, -0.0150, 1.6200 + bone.tail[:] = 0.9100, -0.0360, 1.6200 + bone.roll = -3.1416 + bone.use_connect = False + bone.parent = arm.edit_bones[bones['hand.L']] + bones['palm.01.L'] = bone.name + bone = arm.edit_bones.new('palm.02.L') + bone.head[:] = 0.8400, -0.0050, 1.6200 + bone.tail[:] = 0.9100, -0.0120, 1.6200 + bone.roll = -3.1416 + bone.use_connect = False + bone.parent = arm.edit_bones[bones['hand.L']] + bones['palm.02.L'] = bone.name + bone = arm.edit_bones.new('palm.03.L') + bone.head[:] = 0.8400, 0.0050, 1.6200 + bone.tail[:] = 0.9100, 0.0120, 1.6200 + bone.roll = -3.1416 + bone.use_connect = False + bone.parent = arm.edit_bones[bones['hand.L']] + bones['palm.03.L'] = bone.name + bone = arm.edit_bones.new('palm.04.L') + bone.head[:] = 0.8400, 0.0150, 1.6200 + bone.tail[:] = 0.9100, 0.0360, 1.6200 + bone.roll = -3.1416 + bone.use_connect = False + bone.parent = arm.edit_bones[bones['hand.L']] + bones['palm.04.L'] = bone.name + bone = arm.edit_bones.new('palm.01.R') + bone.head[:] = -0.8400, -0.0150, 1.6200 + bone.tail[:] = -0.9100, -0.0360, 1.6200 + bone.roll = 3.1416 + bone.use_connect = False + bone.parent = arm.edit_bones[bones['hand.R']] + bones['palm.01.R'] = bone.name + bone = arm.edit_bones.new('palm.02.R') + bone.head[:] = -0.8400, -0.0050, 1.6200 + bone.tail[:] = -0.9100, -0.0120, 1.6200 + bone.roll = 3.1416 + bone.use_connect = False + bone.parent = arm.edit_bones[bones['hand.R']] + bones['palm.02.R'] = bone.name + bone = arm.edit_bones.new('palm.03.R') + bone.head[:] = -0.8400, 0.0050, 1.6200 + bone.tail[:] = -0.9100, 0.0120, 1.6200 + bone.roll = 3.1416 + bone.use_connect = False + bone.parent = arm.edit_bones[bones['hand.R']] + bones['palm.03.R'] = bone.name + bone = arm.edit_bones.new('palm.04.R') + bone.head[:] = -0.8400, 0.0150, 1.6200 + bone.tail[:] = -0.9100, 0.0360, 1.6200 + bone.roll = 3.1416 + bone.use_connect = False + bone.parent = arm.edit_bones[bones['hand.R']] + bones['palm.04.R'] = bone.name + bone = arm.edit_bones.new('f_index.01.L') + bone.head[:] = 0.9100, -0.0360, 1.6200 + bone.tail[:] = 0.9550, -0.0360, 1.6200 + bone.roll = -3.1416 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['palm.01.L']] + bones['f_index.01.L'] = bone.name + bone = arm.edit_bones.new('thumb.01.L') + bone.head[:] = 0.8300, -0.0300, 1.6100 + bone.tail[:] = 0.8700, -0.0700, 1.6100 + bone.roll = -1.5708 + bone.use_connect = False + bone.parent = arm.edit_bones[bones['palm.01.L']] + bones['thumb.01.L'] = bone.name + bone = arm.edit_bones.new('f_middle.01.L') + bone.head[:] = 0.9100, -0.0120, 1.6200 + bone.tail[:] = 0.9550, -0.0120, 1.6200 + bone.roll = -3.1416 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['palm.02.L']] + bones['f_middle.01.L'] = bone.name + bone = arm.edit_bones.new('f_ring.01.L') + bone.head[:] = 0.9100, 0.0120, 1.6200 + bone.tail[:] = 0.9550, 0.0120, 1.6200 + bone.roll = -3.1416 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['palm.03.L']] + bones['f_ring.01.L'] = bone.name + bone = arm.edit_bones.new('f_pinky.01.L') + bone.head[:] = 0.9100, 0.0360, 1.6200 + bone.tail[:] = 0.9550, 0.0360, 1.6200 + bone.roll = -3.1416 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['palm.04.L']] + bones['f_pinky.01.L'] = bone.name + bone = arm.edit_bones.new('f_index.01.R') + bone.head[:] = -0.9100, -0.0360, 1.6200 + bone.tail[:] = -0.9550, -0.0360, 1.6200 + bone.roll = 3.1416 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['palm.01.R']] + bones['f_index.01.R'] = bone.name + bone = arm.edit_bones.new('thumb.01.R') + bone.head[:] = -0.8300, -0.0300, 1.6100 + bone.tail[:] = -0.8700, -0.0700, 1.6100 + bone.roll = 1.5708 + bone.use_connect = False + bone.parent = arm.edit_bones[bones['palm.01.R']] + bones['thumb.01.R'] = bone.name + bone = arm.edit_bones.new('f_middle.01.R') + bone.head[:] = -0.9100, -0.0120, 1.6200 + bone.tail[:] = -0.9550, -0.0120, 1.6200 + bone.roll = 3.1416 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['palm.02.R']] + bones['f_middle.01.R'] = bone.name + bone = arm.edit_bones.new('f_ring.01.R') + bone.head[:] = -0.9100, 0.0120, 1.6200 + bone.tail[:] = -0.9550, 0.0120, 1.6200 + bone.roll = 3.1416 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['palm.03.R']] + bones['f_ring.01.R'] = bone.name + bone = arm.edit_bones.new('f_pinky.01.R') + bone.head[:] = -0.9100, 0.0360, 1.6200 + bone.tail[:] = -0.9550, 0.0360, 1.6200 + bone.roll = 3.1416 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['palm.04.R']] + bones['f_pinky.01.R'] = bone.name + bone = arm.edit_bones.new('f_index.02.L') + bone.head[:] = 0.9550, -0.0360, 1.6200 + bone.tail[:] = 0.9830, -0.0360, 1.6200 + bone.roll = -3.1416 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['f_index.01.L']] + bones['f_index.02.L'] = bone.name + bone = arm.edit_bones.new('thumb.02.L') + bone.head[:] = 0.8700, -0.0700, 1.6100 + bone.tail[:] = 0.9000, -0.1000, 1.6100 + bone.roll = -1.5708 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['thumb.01.L']] + bones['thumb.02.L'] = bone.name + bone = arm.edit_bones.new('f_middle.02.L') + bone.head[:] = 0.9550, -0.0120, 1.6200 + bone.tail[:] = 0.9830, -0.0120, 1.6200 + bone.roll = -3.1416 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['f_middle.01.L']] + bones['f_middle.02.L'] = bone.name + bone = arm.edit_bones.new('f_ring.02.L') + bone.head[:] = 0.9550, 0.0120, 1.6200 + bone.tail[:] = 0.9830, 0.0120, 1.6200 + bone.roll = -3.1416 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['f_ring.01.L']] + bones['f_ring.02.L'] = bone.name + bone = arm.edit_bones.new('f_pinky.02.L') + bone.head[:] = 0.9550, 0.0360, 1.6200 + bone.tail[:] = 0.9830, 0.0360, 1.6200 + bone.roll = -3.1416 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['f_pinky.01.L']] + bones['f_pinky.02.L'] = bone.name + bone = arm.edit_bones.new('f_index.02.R') + bone.head[:] = -0.9550, -0.0360, 1.6200 + bone.tail[:] = -0.9830, -0.0360, 1.6200 + bone.roll = 3.1416 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['f_index.01.R']] + bones['f_index.02.R'] = bone.name + bone = arm.edit_bones.new('thumb.02.R') + bone.head[:] = -0.8700, -0.0700, 1.6100 + bone.tail[:] = -0.9000, -0.1000, 1.6100 + bone.roll = 1.5708 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['thumb.01.R']] + bones['thumb.02.R'] = bone.name + bone = arm.edit_bones.new('f_middle.02.R') + bone.head[:] = -0.9550, -0.0120, 1.6200 + bone.tail[:] = -0.9830, -0.0120, 1.6200 + bone.roll = 3.1416 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['f_middle.01.R']] + bones['f_middle.02.R'] = bone.name + bone = arm.edit_bones.new('f_ring.02.R') + bone.head[:] = -0.9550, 0.0120, 1.6200 + bone.tail[:] = -0.9830, 0.0120, 1.6200 + bone.roll = 3.1416 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['f_ring.01.R']] + bones['f_ring.02.R'] = bone.name + bone = arm.edit_bones.new('f_pinky.02.R') + bone.head[:] = -0.9550, 0.0360, 1.6200 + bone.tail[:] = -0.9830, 0.0360, 1.6200 + bone.roll = 3.1416 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['f_pinky.01.R']] + bones['f_pinky.02.R'] = bone.name + bone = arm.edit_bones.new('f_index.03.L') + bone.head[:] = 0.9830, -0.0360, 1.6200 + bone.tail[:] = 1.0000, -0.0360, 1.6200 + bone.roll = -3.1416 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['f_index.02.L']] + bones['f_index.03.L'] = bone.name + bone = arm.edit_bones.new('thumb.03.L') + bone.head[:] = 0.9000, -0.1000, 1.6100 + bone.tail[:] = 0.9200, -0.1200, 1.6100 + bone.roll = -1.5708 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['thumb.02.L']] + bones['thumb.03.L'] = bone.name + bone = arm.edit_bones.new('f_middle.03.L') + bone.head[:] = 0.9830, -0.0120, 1.6200 + bone.tail[:] = 1.0000, -0.0120, 1.6200 + bone.roll = -3.1416 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['f_middle.02.L']] + bones['f_middle.03.L'] = bone.name + bone = arm.edit_bones.new('f_ring.03.L') + bone.head[:] = 0.9830, 0.0120, 1.6200 + bone.tail[:] = 1.0000, 0.0120, 1.6200 + bone.roll = -3.1416 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['f_ring.02.L']] + bones['f_ring.03.L'] = bone.name + bone = arm.edit_bones.new('f_pinky.03.L') + bone.head[:] = 0.9830, 0.0360, 1.6200 + bone.tail[:] = 1.0000, 0.0360, 1.6200 + bone.roll = -3.1416 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['f_pinky.02.L']] + bones['f_pinky.03.L'] = bone.name + bone = arm.edit_bones.new('f_index.03.R') + bone.head[:] = -0.9830, -0.0360, 1.6200 + bone.tail[:] = -1.0000, -0.0360, 1.6200 + bone.roll = 3.1416 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['f_index.02.R']] + bones['f_index.03.R'] = bone.name + bone = arm.edit_bones.new('thumb.03.R') + bone.head[:] = -0.9000, -0.1000, 1.6100 + bone.tail[:] = -0.9200, -0.1200, 1.6100 + bone.roll = 1.5708 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['thumb.02.R']] + bones['thumb.03.R'] = bone.name + bone = arm.edit_bones.new('f_middle.03.R') + bone.head[:] = -0.9830, -0.0120, 1.6200 + bone.tail[:] = -1.0000, -0.0120, 1.6200 + bone.roll = 3.1416 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['f_middle.02.R']] + bones['f_middle.03.R'] = bone.name + bone = arm.edit_bones.new('f_ring.03.R') + bone.head[:] = -0.9830, 0.0120, 1.6200 + bone.tail[:] = -1.0000, 0.0120, 1.6200 + bone.roll = 3.1416 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['f_ring.02.R']] + bones['f_ring.03.R'] = bone.name + bone = arm.edit_bones.new('f_pinky.03.R') + bone.head[:] = -0.9830, 0.0360, 1.6200 + bone.tail[:] = -1.0000, 0.0360, 1.6200 + bone.roll = 3.1416 + bone.use_connect = True + bone.parent = arm.edit_bones[bones['f_pinky.02.R']] + bones['f_pinky.03.R'] = bone.name + + bpy.ops.object.mode_set(mode='OBJECT') + pbone = obj.pose.bones[bones['hips']] + pbone.rigify_type = 'spine' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + try: + pbone.rigify_parameters.chain_bone_controls = "1, 2, 3" + except AttributeError: + pass + pbone = obj.pose.bones[bones['spine']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['thigh.L']] + pbone.rigify_type = 'biped.leg' + pbone.lock_location = (True, True, True) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, False, False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + try: + pbone.rigify_parameters.separate_ik_layers = True + except AttributeError: + pass + try: + pbone.rigify_parameters.ik_layers = [False, False, False, False, False, False, False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + except AttributeError: + pass + try: + pbone.rigify_parameters.separate_hose_layers = True + except AttributeError: + pass + try: + pbone.rigify_parameters.hose_layers = [False, False, False, False, False, False, False, False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + except AttributeError: + pass + pbone = obj.pose.bones[bones['thigh.R']] + pbone.rigify_type = 'biped.leg' + pbone.lock_location = (True, True, True) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + try: + pbone.rigify_parameters.separate_ik_layers = True + except AttributeError: + pass + try: + pbone.rigify_parameters.ik_layers = [False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + except AttributeError: + pass + try: + pbone.rigify_parameters.separate_hose_layers = True + except AttributeError: + pass + try: + pbone.rigify_parameters.hose_layers = [False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + except AttributeError: + pass + pbone = obj.pose.bones[bones['chest']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['shin.L']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, False, False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['shin.R']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['neck']] + pbone.rigify_type = 'neck_short' + pbone.lock_location = (True, True, True) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['shoulder.L']] + pbone.rigify_type = 'basic.copy' + pbone.lock_location = (True, True, True) + pbone.lock_rotation = (False, True, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'YXZ' + pbone.bone.layers = [False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['shoulder.R']] + pbone.rigify_type = 'basic.copy' + pbone.lock_location = (True, True, True) + pbone.lock_rotation = (False, True, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'YXZ' + pbone.bone.layers = [False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['foot.L']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, False, False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['heel.L']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, False, False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['foot.R']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['heel.R']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['head']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['upper_arm.L']] + pbone.rigify_type = 'biped.arm' + pbone.lock_location = (True, True, True) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + try: + pbone.rigify_parameters.separate_ik_layers = True + except AttributeError: + pass + try: + pbone.rigify_parameters.ik_layers = [False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + except AttributeError: + pass + try: + pbone.rigify_parameters.separate_hose_layers = True + except AttributeError: + pass + try: + pbone.rigify_parameters.hose_layers = [False, False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + except AttributeError: + pass + pbone = obj.pose.bones[bones['upper_arm.R']] + pbone.rigify_type = 'biped.arm' + pbone.lock_location = (True, True, True) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + try: + pbone.rigify_parameters.separate_ik_layers = True + except AttributeError: + pass + try: + pbone.rigify_parameters.ik_layers = [False, False, False, False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + except AttributeError: + pass + try: + pbone.rigify_parameters.separate_hose_layers = True + except AttributeError: + pass + try: + pbone.rigify_parameters.hose_layers = [False, False, False, False, False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + except AttributeError: + pass + pbone = obj.pose.bones[bones['toe.L']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, False, False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['heel.02.L']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [True, False, True, False, True, False, True, False, False, True, False, False, True, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['toe.R']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['heel.02.R']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [True, False, True, False, True, False, True, False, False, True, False, False, True, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['forearm.L']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['forearm.R']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['hand.L']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['hand.R']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['palm.01.L']] + pbone.rigify_type = 'palm' + pbone.lock_location = (True, True, True) + pbone.lock_rotation = (False, True, True) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'YXZ' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['palm.02.L']] + pbone.rigify_type = '' + pbone.lock_location = (True, True, True) + pbone.lock_rotation = (False, True, True) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'YXZ' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['palm.03.L']] + pbone.rigify_type = '' + pbone.lock_location = (True, True, True) + pbone.lock_rotation = (False, True, True) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'YXZ' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['palm.04.L']] + pbone.rigify_type = '' + pbone.lock_location = (True, True, True) + pbone.lock_rotation = (False, True, True) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'YXZ' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['palm.01.R']] + pbone.rigify_type = 'palm' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, True, True) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'YXZ' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['palm.02.R']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, True, True) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'YXZ' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['palm.03.R']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, True, True) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'YXZ' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['palm.04.R']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, True, True) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'YXZ' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['f_index.01.L']] + pbone.rigify_type = 'finger' + pbone.lock_location = (True, True, True) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + try: + pbone.rigify_parameters.separate_extra_layers = True + except AttributeError: + pass + try: + pbone.rigify_parameters.extra_layers = [False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + except AttributeError: + pass + pbone = obj.pose.bones[bones['thumb.01.L']] + pbone.rigify_type = 'finger' + pbone.lock_location = (True, True, True) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + try: + pbone.rigify_parameters.extra_layers = [False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + except AttributeError: + pass + try: + pbone.rigify_parameters.separate_extra_layers = True + except AttributeError: + pass + pbone = obj.pose.bones[bones['f_middle.01.L']] + pbone.rigify_type = 'finger' + pbone.lock_location = (True, True, True) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + try: + pbone.rigify_parameters.separate_extra_layers = True + except AttributeError: + pass + try: + pbone.rigify_parameters.extra_layers = [False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + except AttributeError: + pass + pbone = obj.pose.bones[bones['f_ring.01.L']] + pbone.rigify_type = 'finger' + pbone.lock_location = (True, True, True) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + try: + pbone.rigify_parameters.separate_extra_layers = True + except AttributeError: + pass + try: + pbone.rigify_parameters.extra_layers = [False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + except AttributeError: + pass + pbone = obj.pose.bones[bones['f_pinky.01.L']] + pbone.rigify_type = 'finger' + pbone.lock_location = (True, True, True) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + try: + pbone.rigify_parameters.separate_extra_layers = True + except AttributeError: + pass + try: + pbone.rigify_parameters.extra_layers = [False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + except AttributeError: + pass + pbone = obj.pose.bones[bones['f_index.01.R']] + pbone.rigify_type = 'finger' + pbone.lock_location = (True, True, True) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + try: + pbone.rigify_parameters.extra_layers = [False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + except AttributeError: + pass + try: + pbone.rigify_parameters.separate_extra_layers = True + except AttributeError: + pass + pbone = obj.pose.bones[bones['thumb.01.R']] + pbone.rigify_type = 'finger' + pbone.lock_location = (True, True, True) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + try: + pbone.rigify_parameters.separate_extra_layers = True + except AttributeError: + pass + try: + pbone.rigify_parameters.extra_layers = [False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + except AttributeError: + pass + pbone = obj.pose.bones[bones['f_middle.01.R']] + pbone.rigify_type = 'finger' + pbone.lock_location = (True, True, True) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + try: + pbone.rigify_parameters.separate_extra_layers = True + except AttributeError: + pass + try: + pbone.rigify_parameters.extra_layers = [False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + except AttributeError: + pass + pbone = obj.pose.bones[bones['f_ring.01.R']] + pbone.rigify_type = 'finger' + pbone.lock_location = (True, True, True) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + try: + pbone.rigify_parameters.separate_extra_layers = True + except AttributeError: + pass + try: + pbone.rigify_parameters.extra_layers = [False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + except AttributeError: + pass + pbone = obj.pose.bones[bones['f_pinky.01.R']] + pbone.rigify_type = 'finger' + pbone.lock_location = (True, True, True) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + try: + pbone.rigify_parameters.separate_extra_layers = True + except AttributeError: + pass + try: + pbone.rigify_parameters.extra_layers = [False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + except AttributeError: + pass + pbone = obj.pose.bones[bones['f_index.02.L']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['thumb.02.L']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['f_middle.02.L']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['f_ring.02.L']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['f_pinky.02.L']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['f_index.02.R']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['thumb.02.R']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['f_middle.02.R']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['f_ring.02.R']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['f_pinky.02.R']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['f_index.03.L']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['thumb.03.L']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['f_middle.03.L']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['f_ring.03.L']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['f_pinky.03.L']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['f_index.03.R']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['thumb.03.R']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['f_middle.03.R']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['f_ring.03.R']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + pbone = obj.pose.bones[bones['f_pinky.03.R']] + pbone.rigify_type = '' + pbone.lock_location = (False, False, False) + pbone.lock_rotation = (False, False, False) + pbone.lock_rotation_w = False + pbone.lock_scale = (False, False, False) + pbone.rotation_mode = 'QUATERNION' + pbone.bone.layers = [False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] + + bpy.ops.object.mode_set(mode='EDIT') + for bone in arm.edit_bones: + bone.select = False + bone.select_head = False + bone.select_tail = False + for b in bones: + bone = arm.edit_bones[bones[b]] + bone.select = True + bone.select_head = True + bone.select_tail = True + arm.edit_bones.active = bone + + arm.layers = [(x in [0, 2, 4, 6, 9, 12, 15]) for x in range(32)] + +if __name__ == "__main__": + create(bpy.context.active_object) diff --git a/rig_lists.py b/rig_lists.py index 66f0a33..8de8528 100644 --- a/rig_lists.py +++ b/rig_lists.py @@ -17,8 +17,6 @@ #======================= END GPL LICENSE BLOCK ======================== import os -import traceback -import logging from . import utils diff --git a/rig_ui_template.py b/rig_ui_template.py index 5b8c150..9e755bb 100644 --- a/rig_ui_template.py +++ b/rig_ui_template.py @@ -21,11 +21,45 @@ UI_SLIDERS = ''' import bpy from mathutils import Matrix, Vector -from math import acos +from math import acos, pi rig_id = "%s" +############################ +## Math utility functions ## +############################ + +def perpendicular_vector(v): + """ Returns a vector that is perpendicular to the one given. + The returned vector is _not_ guaranteed to be normalized. + """ + # Create a vector that is not aligned with v. + # It doesn't matter what vector. Just any vector + # that's guaranteed to not be pointing in the same + # direction. + if abs(v[0]) < abs(v[1]): + tv = Vector((1,0,0)) + else: + tv = Vector((0,1,0)) + + # Use cross prouct to generate a vector perpendicular to + # both tv and (more importantly) v. + return v.cross(tv) + + +def rotation_difference(mat1, mat2): + """ Returns the shortest-path rotational difference between two + matrices. + """ + q1 = mat1.to_quaternion() + q2 = mat2.to_quaternion() + angle = acos(min(1,max(-1,q1.dot(q2)))) * 2 + if angle > pi: + angle = -angle + (2*pi) + return angle + + ######################################### ## "Visual Transform" helper functions ## ######################################### @@ -162,20 +196,8 @@ def match_pole_target(ik_first, ik_last, pole, match_bone, length): # tip of ik_last ikv = b - a - # Create a vector that is not aligned with ikv. - # It doesn't matter what vector. Just any vector - # that's guaranteed to not be pointing in the same - # direction. In this case, we create a unit vector - # on the axis of the smallest component of ikv. - if abs(ikv[0]) < abs(ikv[1]) and abs(ikv[0]) < abs(ikv[2]): - v = Vector((1,0,0)) - elif abs(ikv[1]) < abs(ikv[2]): - v = Vector((0,1,0)) - else: - v = Vector((0,0,1)) - # Get a vector perpendicular to ikv - pv = v.cross(ikv).normalized() * length + pv = perpendicular_vector(ikv).normalized() * length def set_pole(pvi): """ Set pole target's position based on a vector @@ -194,24 +216,20 @@ def set_pole(pvi): set_pole(pv) # Get the rotation difference between ik_first and match_bone - q1 = ik_first.matrix.to_quaternion() - q2 = match_bone.matrix.to_quaternion() - angle = acos(min(1,max(-1,q1.dot(q2)))) * 2 + angle = rotation_difference(ik_first.matrix, match_bone.matrix) + + # Try compensating for the rotation difference in both directions + pv1 = Matrix.Rotation(angle, 4, ikv) * pv + set_pole(pv1) + ang1 = rotation_difference(ik_first.matrix, match_bone.matrix) - # Compensate for the rotation difference - if angle > 0.0001: - pv = Matrix.Rotation(angle, 4, ikv).to_quaternion() * pv - set_pole(pv) + pv2 = Matrix.Rotation(-angle, 4, ikv) * pv + set_pole(pv2) + ang2 = rotation_difference(ik_first.matrix, match_bone.matrix) - # Get rotation difference again, to see if we - # compensated in the right direction - q1 = ik_first.matrix.to_quaternion() - q2 = match_bone.matrix.to_quaternion() - angle2 = acos(min(1,max(-1,q1.dot(q2)))) * 2 - if angle2 > angle: - # Compensate in the other direction - pv = Matrix.Rotation((angle*(-2)), 4, ikv).to_quaternion() * pv - set_pole(pv) + # Do the one with the smaller angle + if ang1 < ang2: + set_pole(pv1) def fk2ik_arm(obj, fk, ik): @@ -226,10 +244,13 @@ def fk2ik_arm(obj, fk, ik): uarmi = obj.pose.bones[ik[0]] farmi = obj.pose.bones[ik[1]] handi = obj.pose.bones[ik[2]] - + # Stretch - diff = (uarmi.vector.length + farmi.vector.length) / (uarm.vector.length + farm.vector.length) - uarm['stretch'] *= diff + if handi['auto_stretch'] == 0.0: + uarm['stretch_length'] = handi['stretch_length'] + else: + diff = (uarmi.vector.length + farmi.vector.length) / (uarm.vector.length + farm.vector.length) + uarm['stretch_length'] *= diff # Upper arm position match_pose_rotation(uarm, uarmi) @@ -259,7 +280,7 @@ def ik2fk_arm(obj, fk, ik): pole = obj.pose.bones[ik[3]] # Stretch - handi['stretch'] = uarm['stretch'] + handi['stretch_length'] = uarm['stretch_length'] # Hand position match_pose_translation(handi, hand) @@ -286,8 +307,11 @@ def fk2ik_leg(obj, fk, ik): mfooti = obj.pose.bones[ik[3]] # Stretch - diff = (thighi.vector.length + shini.vector.length) / (thigh.vector.length + shin.vector.length) - thigh['stretch'] *= diff + if footi['auto_stretch'] == 0.0: + thigh['stretch_length'] = footi['stretch_length'] + else: + diff = (thighi.vector.length + shini.vector.length) / (thigh.vector.length + shin.vector.length) + thigh['stretch_length'] *= diff # Thigh position match_pose_rotation(thigh, thighi) @@ -323,7 +347,7 @@ def ik2fk_leg(obj, fk, ik): mfooti = obj.pose.bones[ik[5]] # Stretch - footi['stretch'] = thigh['stretch'] + footi['stretch_length'] = thigh['stretch_length'] # Clear footroll set_pose_rotation(footroll, Matrix()) diff --git a/rigs/biped/arm/__init__.py b/rigs/biped/arm/__init__.py index 8ae934c..3235645 100644 --- a/rigs/biped/arm/__init__.py +++ b/rigs/biped/arm/__init__.py @@ -52,10 +52,10 @@ layout.prop(pose_bones[fk_arm[0]], '["isolate"]', text="Isolate Rotation (" + fk_arm[0] + ")", slider=True) except KeyError: pass - layout.prop(pose_bones[fk_arm[0]], '["stretch"]', text="Stretch FK (" + fk_arm[0] + ")", slider=True) + layout.prop(pose_bones[fk_arm[0]], '["stretch_length"]', text="Length FK (" + fk_arm[0] + ")", slider=True) if is_selected(ik_arm): - layout.prop(pose_bones[ik_arm[2]], '["stretch"]', text="Stretch IK (" + ik_arm[2] + ")", slider=True) - + layout.prop(pose_bones[ik_arm[2]], '["stretch_length"]', text="Length IK (" + ik_arm[2] + ")", slider=True) + layout.prop(pose_bones[ik_arm[2]], '["auto_stretch"]', text="Auto-Stretch IK (" + ik_arm[2] + ")", slider=True) """ hose_script = """ @@ -83,7 +83,7 @@ def __init__(self, obj, bone, params): """ self.obj = obj self.params = params - + # Gather deform rig self.deform_rig = deform.Rig(obj, bone, params) @@ -116,7 +116,7 @@ def add_parameters(params): """ params.use_complex_arm = bpy.props.BoolProperty(name="Complex Arm Rig", default=True, description="Generate the full, complex arm rig with twist bones and rubber-hose controls") params.bend_hint = bpy.props.BoolProperty(name="Bend Hint", default=True, description="Give IK chain a hint about which way to bend. Useful for perfectly straight chains") - + items = [('X', 'X', ''), ('Y', 'Y', ''), ('Z', 'Z', ''), ('-X', '-X', ''), ('-Y', '-Y', ''), ('-Z', '-Z', '')] params.primary_rotation_axis = bpy.props.EnumProperty(items=items, name="Primary Rotation Axis", default='X') @@ -127,7 +127,7 @@ def add_parameters(params): params.separate_hose_layers = bpy.props.BoolProperty(name="Separate Rubber-hose Control Layers:", default=False, description="Enable putting the rubber-hose controls on a separate layer from the other controls") params.hose_layers = bpy.props.BoolVectorProperty(size=32, description="Layers for the rubber-hose controls to be on") - + def parameters_ui(layout, params): """ Create the ui for the rig parameters. @@ -135,17 +135,17 @@ def parameters_ui(layout, params): """ col = layout.column() col.prop(params, "use_complex_arm") - + r = layout.row() r.label(text="Elbow rotation axis:") r.prop(params, "primary_rotation_axis", text="") - + r = layout.row() r.prop(params, "elbow_base_name") - + r = layout.row() r.prop(params, "bend_hint") - + r = layout.row() r.prop(params, "separate_ik_layers") @@ -191,11 +191,11 @@ def parameters_ui(layout, params): row.prop(params, "ik_layers", index=29, toggle=True, text="") row.prop(params, "ik_layers", index=30, toggle=True, text="") row.prop(params, "ik_layers", index=31, toggle=True, text="") - + if params.use_complex_arm: r = layout.row() r.prop(params, "separate_hose_layers") - + r = layout.row() r.active = params.separate_hose_layers diff --git a/rigs/biped/arm/deform.py b/rigs/biped/arm/deform.py index 962a368..a544420 100644 --- a/rigs/biped/arm/deform.py +++ b/rigs/biped/arm/deform.py @@ -18,16 +18,13 @@ # -from math import acos - import bpy from .. import limb_common from ....utils import MetarigError -from ....utils import copy_bone, put_bone from ....utils import connected_children_names -from ....utils import strip_org, make_mechanism_name, make_deformer_name +from ....utils import strip_org class Rig: @@ -52,7 +49,7 @@ def __init__(self, obj, bone, params): use_complex_rig = params.use_complex_arm elbow_base_name = params.elbow_base_name primary_rotation_axis = params.primary_rotation_axis - + # Based on common limb self.rubber_hose_limb = limb_common.RubberHoseLimb(obj, self.org_bones[0], self.org_bones[1], self.org_bones[2], use_complex_rig, elbow_base_name, primary_rotation_axis, layers) diff --git a/rigs/biped/arm/fk.py b/rigs/biped/arm/fk.py index 8080042..740b327 100644 --- a/rigs/biped/arm/fk.py +++ b/rigs/biped/arm/fk.py @@ -22,8 +22,11 @@ from .. import limb_common +from ....utils import MetarigError from ....utils import connected_children_names -from ....utils import create_widget, create_limb_widget +from ....utils import create_widget +from ....utils import strip_org +from ....utils import get_layers class Rig: @@ -39,21 +42,21 @@ def __init__(self, obj, bone, params): """ self.obj = obj - + # Get the chain of 3 connected bones self.org_bones = [bone] + connected_children_names(self.obj, bone)[:2] if len(self.org_bones) != 3: raise MetarigError("RIGIFY ERROR: Bone '%s': input to rig type must be a chain of at least 3 bones" % (strip_org(bone))) - # Get params + # Get params if "layers" in params: layers = get_layers(params["layers"]) else: layers = None - + primary_rotation_axis = params.primary_rotation_axis - + # Arm is based on common limb self.fk_limb = limb_common.FKLimb(obj, self.org_bones[0], self.org_bones[1], self.org_bones[2], primary_rotation_axis, layers) @@ -67,7 +70,7 @@ def generate(self): uarm = bone_list[0] farm = bone_list[1] hand = bone_list[2] - + # Create hand widget ob = create_widget(self.obj, hand) if ob != None: diff --git a/rigs/biped/arm/ik.py b/rigs/biped/arm/ik.py index 60bca5d..d5c9509 100644 --- a/rigs/biped/arm/ik.py +++ b/rigs/biped/arm/ik.py @@ -19,17 +19,13 @@ # import bpy -from rna_prop_ui import rna_idprop_ui_prop_get -from mathutils import Vector from .. import limb_common from ....utils import MetarigError -from ....utils import angle_on_plane -from ....utils import copy_bone from ....utils import connected_children_names -from ....utils import strip_org, make_mechanism_name, insert_before_lr -from ....utils import create_widget, create_line_widget, create_sphere_widget +from ....utils import strip_org +from ....utils import create_widget class Rig: @@ -61,11 +57,10 @@ def __init__(self, obj, bone, params, ikfk_switch=False): bend_hint = params.bend_hint primary_rotation_axis = params.primary_rotation_axis pole_target_base_name = self.params.elbow_base_name + "_target" - + # Arm is based on common limb self.ik_limb = limb_common.IKLimb(obj, self.org_bones[0], self.org_bones[1], self.org_bones[2], pole_target_base_name, primary_rotation_axis, bend_hint, layers, ikfk_switch) - def generate(self): """ Generate the rig. Do NOT modify any of the original bones, except for adding constraints. @@ -76,11 +71,11 @@ def generate(self): uarm = bone_list[0] farm = bone_list[1] hand = bone_list[2] - hand_mch = bone_list[3] + # hand_mch = bone_list[3] pole = bone_list[4] - vispole = bone_list[5] - vishand = bone_list[6] - + # vispole = bone_list[5] + # vishand = bone_list[6] + ob = create_widget(self.obj, hand) if ob != None: verts = [(0.7, 1.5, 0.0), (0.7, -0.25, 0.0), (-0.7, -0.25, 0.0), (-0.7, 1.5, 0.0), (0.7, 0.723, 0.0), (-0.7, 0.723, 0.0), (0.7, 0.0, 0.0), (-0.7, 0.0, 0.0)] diff --git a/rigs/biped/leg/__init__.py b/rigs/biped/leg/__init__.py index 249b340..0a9f0ac 100644 --- a/rigs/biped/leg/__init__.py +++ b/rigs/biped/leg/__init__.py @@ -56,9 +56,10 @@ layout.prop(pose_bones[fk_leg[0]], '["isolate"]', text="Isolate Rotation (" + fk_leg[0] + ")", slider=True) except KeyError: pass - layout.prop(pose_bones[fk_leg[0]], '["stretch"]', text="Stretch FK (" + fk_leg[0] + ")", slider=True) + layout.prop(pose_bones[fk_leg[0]], '["stretch_length"]', text="Length FK (" + fk_leg[0] + ")", slider=True) if is_selected(ik_leg): - layout.prop(pose_bones[ik_leg[2]], '["stretch"]', text="Stretch IK (" + ik_leg[2] + ")", slider=True) + layout.prop(pose_bones[ik_leg[2]], '["stretch_length"]', text="Length IK (" + ik_leg[2] + ")", slider=True) + layout.prop(pose_bones[ik_leg[2]], '["auto_stretch"]', text="Auto-Stretch IK (" + ik_leg[2] + ")", slider=True) """ hose_script = """ @@ -86,7 +87,7 @@ def __init__(self, obj, bone, params): """ self.obj = obj self.params = params - + # Gather deform rig self.deform_rig = deform.Rig(obj, bone, params) @@ -119,7 +120,7 @@ def add_parameters(params): """ params.use_complex_leg = bpy.props.BoolProperty(name="Complex Leg Rig", default=True, description="Generate the full, complex leg rig with twist bones and rubber-hose controls") params.bend_hint = bpy.props.BoolProperty(name="Bend Hint", default=True, description="Give IK chain a hint about which way to bend (useful for perfectly straight chains)") - + items = [('X', 'X', ''), ('Y', 'Y', ''), ('Z', 'Z', ''), ('-X', '-X', ''), ('-Y', '-Y', ''), ('-Z', '-Z', '')] params.primary_rotation_axis = bpy.props.EnumProperty(items=items, name="Primary Rotation Axis", default='X') @@ -130,7 +131,7 @@ def add_parameters(params): params.separate_hose_layers = bpy.props.BoolProperty(name="Separate Rubber-hose Control Layers:", default=False, description="Enable putting the rubber-hose controls on a separate layer from the other controls") params.hose_layers = bpy.props.BoolVectorProperty(size=32, description="Layers for the rubber-hose controls to be on") - + def parameters_ui(layout, params): """ Create the ui for the rig parameters. @@ -142,13 +143,13 @@ def parameters_ui(layout, params): r = layout.row() r.label(text="Knee rotation axis:") r.prop(params, "primary_rotation_axis", text="") - + r = layout.row() r.prop(params, "knee_base_name") - + r = layout.row() r.prop(params, "bend_hint") - + r = layout.row() r.prop(params, "separate_ik_layers") @@ -198,7 +199,7 @@ def parameters_ui(layout, params): if params.use_complex_leg: r = layout.row() r.prop(params, "separate_hose_layers") - + r = layout.row() r.active = params.separate_hose_layers @@ -241,7 +242,6 @@ def parameters_ui(layout, params): row.prop(params, "hose_layers", index=29, toggle=True, text="") row.prop(params, "hose_layers", index=30, toggle=True, text="") row.prop(params, "hose_layers", index=31, toggle=True, text="") - def create_sample(obj): diff --git a/rigs/biped/leg/deform.py b/rigs/biped/leg/deform.py index b8f3f68..cde7325 100644 --- a/rigs/biped/leg/deform.py +++ b/rigs/biped/leg/deform.py @@ -18,17 +18,14 @@ # -from math import acos - import bpy -from mathutils import Vector, Matrix from .. import limb_common from ....utils import MetarigError -from ....utils import copy_bone, put_bone +from ....utils import copy_bone from ....utils import connected_children_names, has_connected_children -from ....utils import strip_org, make_mechanism_name, make_deformer_name +from ....utils import strip_org, make_deformer_name class Rig: @@ -56,9 +53,9 @@ def __init__(self, obj, bone, params): heel = b.name if foot is None: - raise MetarigError("RIGIFY ERROR: Bone '%s': incorrect bone configuration for rig type -- could not find foot bone (that is, a bone with >1 children connected) attached to bone '%s'" % (strip_org(bone), strip_org(shin))) + raise MetarigError("RIGIFY ERROR: Bone '%s': incorrect bone configuration for rig type -- could not find foot bone (that is, a bone with >1 children connected) attached to bone '%s'" % (strip_org(bone), strip_org(leg_bones[1]))) if heel is None: - raise MetarigError("RIGIFY ERROR: Bone '%s': incorrect bone configuration for rig type -- could not find heel bone (that is, a bone with no childrenconnected) attached to bone '%s'" % (strip_org(bone), strip_org(shin))) + raise MetarigError("RIGIFY ERROR: Bone '%s': incorrect bone configuration for rig type -- could not find heel bone (that is, a bone with no children connected) attached to bone '%s'" % (strip_org(bone), strip_org(leg_bones[1]))) # Get the toe toe = None for b in self.obj.data.bones[foot].children: @@ -78,19 +75,18 @@ def __init__(self, obj, bone, params): use_complex_rig = params.use_complex_leg knee_base_name = params.knee_base_name primary_rotation_axis = params.primary_rotation_axis - + # Based on common limb self.rubber_hose_limb = limb_common.RubberHoseLimb(obj, self.org_bones[0], self.org_bones[1], self.org_bones[2], use_complex_rig, knee_base_name, primary_rotation_axis, layers) def generate(self): bone_list = self.rubber_hose_limb.generate() - + # Set up toe bpy.ops.object.mode_set(mode='EDIT') toe = copy_bone(self.obj, self.org_bones[3], make_deformer_name(strip_org(self.org_bones[3]))) eb = self.obj.data.edit_bones eb[toe].use_connect = False eb[toe].parent = eb[self.org_bones[3]] - - return bone_list + return bone_list diff --git a/rigs/biped/leg/fk.py b/rigs/biped/leg/fk.py index 99bf6cc..743e3a1 100644 --- a/rigs/biped/leg/fk.py +++ b/rigs/biped/leg/fk.py @@ -19,17 +19,15 @@ # import bpy -from rna_prop_ui import rna_idprop_ui_prop_get from mathutils import Vector from .. import limb_common from ....utils import MetarigError -from ....utils import copy_bone from ....utils import connected_children_names, has_connected_children -from ....utils import strip_org, make_mechanism_name, insert_before_lr +from ....utils import strip_org from ....utils import get_layers -from ....utils import create_widget, create_limb_widget +from ....utils import create_widget class Rig: @@ -89,9 +87,9 @@ def __init__(self, obj, bone, params): layers = get_layers(params["layers"]) else: layers = None - + primary_rotation_axis = params.primary_rotation_axis - + # Leg is based on common limb self.fk_limb = limb_common.FKLimb(obj, self.org_bones[0], self.org_bones[1], self.org_bones[2], primary_rotation_axis, layers) @@ -106,7 +104,7 @@ def generate(self): shin = ctrl_bones[1] foot = ctrl_bones[2] foot_mch = ctrl_bones[3] - + # Position foot control bpy.ops.object.mode_set(mode='EDIT') eb = self.obj.data.edit_bones diff --git a/rigs/biped/leg/ik.py b/rigs/biped/leg/ik.py index d9b563a..aea8502 100644 --- a/rigs/biped/leg/ik.py +++ b/rigs/biped/leg/ik.py @@ -18,10 +18,7 @@ # -from math import pi, acos - import bpy -from rna_prop_ui import rna_idprop_ui_prop_get from mathutils import Vector from .. import limb_common @@ -31,7 +28,7 @@ from ....utils import copy_bone, flip_bone, put_bone from ....utils import connected_children_names, has_connected_children from ....utils import strip_org, make_mechanism_name, insert_before_lr -from ....utils import create_widget, create_line_widget, create_sphere_widget, create_circle_widget +from ....utils import create_widget, create_circle_widget class Rig: @@ -92,11 +89,10 @@ def __init__(self, obj, bone, params, ikfk_switch=False): bend_hint = params.bend_hint primary_rotation_axis = params.primary_rotation_axis pole_target_base_name = self.params.knee_base_name + "_target" - + # Leg is based on common limb self.ik_limb = limb_common.IKLimb(obj, self.org_bones[0], self.org_bones[1], self.org_bones[2], pole_target_base_name, primary_rotation_axis, bend_hint, self.layers, ikfk_switch) - def generate(self): """ Generate the rig. Do NOT modify any of the original bones, except for adding constraints. @@ -109,15 +105,15 @@ def generate(self): foot = bone_list[2] foot_mch = bone_list[3] pole = bone_list[4] - vispole = bone_list[5] - visfoot = bone_list[6] - + # vispole = bone_list[5] + # visfoot = bone_list[6] + # Build IK foot rig bpy.ops.object.mode_set(mode='EDIT') make_rocker = False if self.org_bones[5] is not None: make_rocker = True - + # Create the bones toe = copy_bone(self.obj, self.org_bones[3], strip_org(self.org_bones[3])) toe_parent = copy_bone(self.obj, self.org_bones[2], make_mechanism_name(strip_org(self.org_bones[3] + ".parent"))) @@ -148,7 +144,7 @@ def generate(self): if make_rocker: rocker1_e = eb[rocker1] rocker2_e = eb[rocker2] - + # Parenting foot_ik_target_e.use_connect = False foot_ik_target_e.parent = roll2_e @@ -177,7 +173,7 @@ def generate(self): roll1_e.parent = rocker2_e rocker2_e.parent = rocker1_e rocker1_e.parent = foot_e - + # Positioning vec = Vector(toe_e.vector) vec.normalize() @@ -225,9 +221,9 @@ def generate(self): rocker1_p = pb[rocker1] rocker2_p = pb[rocker2] toe_p = pb[toe] - toe_parent_p = pb[toe_parent] + # toe_parent_p = pb[toe_parent] toe_parent_socket1_p = pb[toe_parent_socket1] - + # Foot roll control only rotates on x-axis, or x and y if rocker. foot_roll_p.rotation_mode = 'XYZ' if make_rocker: @@ -243,7 +239,7 @@ def generate(self): if make_rocker: rocker1_p.rotation_mode = 'XYZ' rocker2_p.rotation_mode = 'XYZ' - + # toe_parent constraint con = toe_parent_socket1_p.constraints.new('COPY_LOCATION') con.name = "copy_location" @@ -314,18 +310,18 @@ def generate(self): var.targets[0].id_type = 'OBJECT' var.targets[0].id = self.obj var.targets[0].data_path = foot_roll_p.path_from_id() + '.rotation_euler[1]' - + # Constrain toe bone to toe control con = pb[self.org_bones[3]].constraints.new('COPY_TRANSFORMS') con.name = "copy_transforms" con.target = self.obj con.subtarget = toe - + # Set layers if specified if self.layers: foot_roll_p.bone.layers = self.layers toe_p.bone.layers = [(i[0] or i[1]) for i in zip(toe_p.bone.layers, self.layers)] # Both FK and IK layers - + # Create widgets create_circle_widget(self.obj, toe, radius=0.7, head_tail=0.5) @@ -339,7 +335,7 @@ def generate(self): mod = ob.modifiers.new("subsurf", 'SUBSURF') mod.levels = 2 - + ob = create_widget(self.obj, foot) if ob != None: verts = [(0.7, 1.5, 0.0), (0.7, -0.25, 0.0), (-0.7, -0.25, 0.0), (-0.7, 1.5, 0.0), (0.7, 0.723, 0.0), (-0.7, 0.723, 0.0), (0.7, 0.0, 0.0), (-0.7, 0.0, 0.0)] diff --git a/rigs/biped/limb_common.py b/rigs/biped/limb_common.py index 7e739f1..ec29a51 100644 --- a/rigs/biped/limb_common.py +++ b/rigs/biped/limb_common.py @@ -22,12 +22,10 @@ from rna_prop_ui import rna_idprop_ui_prop_get from mathutils import Vector -from ...utils import MetarigError from ...utils import angle_on_plane, align_bone_roll, align_bone_z_axis from ...utils import new_bone, copy_bone, put_bone, make_nonscaling_child from ...utils import strip_org, make_mechanism_name, make_deformer_name, insert_before_lr -from ...utils import get_layers -from ...utils import create_widget, create_limb_widget, create_line_widget, create_sphere_widget, create_circle_widget +from ...utils import create_widget, create_limb_widget, create_line_widget, create_sphere_widget class FKLimb: @@ -48,7 +46,7 @@ def __init__(self, obj, bone1, bone2, bone3, primary_rotation_axis, layers): def generate(self): bpy.ops.object.mode_set(mode='EDIT') - + # Create non-scaling parent bone if self.org_parent != None: loc = Vector(self.obj.data.edit_bones[self.org_bones[0]].head) @@ -79,10 +77,10 @@ def generate(self): ulimb_e = eb[ulimb] flimb_e = eb[flimb] elimb_e = eb[elimb] - + fantistr_e = eb[fantistr] eantistr_e = eb[eantistr] - + elimb_mch_e = eb[elimb_mch] if parent != None: @@ -92,35 +90,35 @@ def generate(self): # Parenting elimb_mch_e.use_connect = False elimb_mch_e.parent = elimb_e - + elimb_e.use_connect = False elimb_e.parent = eantistr_e - + eantistr_e.use_connect = False eantistr_e.parent = flimb_e - + flimb_e.use_connect = False flimb_e.parent = fantistr_e - + fantistr_e.use_connect = False fantistr_e.parent = ulimb_e if parent != None: socket1_e.use_connect = False socket1_e.parent = eb[parent] - + socket2_e.use_connect = False socket2_e.parent = None - + ulimb_e.use_connect = False ulimb_e.parent = socket2_e - + # Positioning fantistr_e.length /= 8 put_bone(self.obj, fantistr, Vector(ulimb_e.tail)) eantistr_e.length /= 8 put_bone(self.obj, eantistr, Vector(flimb_e.tail)) - + if parent != None: socket1_e.length /= 4 socket2_e.length /= 3 @@ -132,8 +130,7 @@ def generate(self): ulimb_p = pb[ulimb] flimb_p = pb[flimb] elimb_p = pb[elimb] - elimb_mch_p = pb[elimb_mch] - + fantistr_p = pb[fantistr] eantistr_p = pb[eantistr] @@ -161,70 +158,70 @@ def generate(self): prop["soft_min"] = prop["min"] = 0.0 prop["soft_max"] = prop["max"] = 1.0 - prop = rna_idprop_ui_prop_get(ulimb_p, "stretch", create=True) - ulimb_p["stretch"] = 1.0 + prop = rna_idprop_ui_prop_get(ulimb_p, "stretch_length", create=True) + ulimb_p["stretch_length"] = 1.0 prop["min"] = 0.05 prop["max"] = 20.0 - prop["soft_min"] = 0.25 + prop["soft_min"] = 0.25 prop["soft_max"] = 4.0 # Stretch drivers def add_stretch_drivers(pose_bone): driver = pose_bone.driver_add("scale", 1).driver var = driver.variables.new() - var.name = "stretch" + var.name = "stretch_length" var.targets[0].id_type = 'OBJECT' var.targets[0].id = self.obj - var.targets[0].data_path = ulimb_p.path_from_id() + '["stretch"]' + var.targets[0].data_path = ulimb_p.path_from_id() + '["stretch_length"]' driver.type = 'SCRIPTED' - driver.expression = "stretch" - + driver.expression = "stretch_length" + driver = pose_bone.driver_add("scale", 0).driver var = driver.variables.new() - var.name = "stretch" + var.name = "stretch_length" var.targets[0].id_type = 'OBJECT' var.targets[0].id = self.obj - var.targets[0].data_path = ulimb_p.path_from_id() + '["stretch"]' + var.targets[0].data_path = ulimb_p.path_from_id() + '["stretch_length"]' driver.type = 'SCRIPTED' - driver.expression = "1/sqrt(stretch)" - + driver.expression = "1/sqrt(stretch_length)" + driver = pose_bone.driver_add("scale", 2).driver var = driver.variables.new() - var.name = "stretch" + var.name = "stretch_length" var.targets[0].id_type = 'OBJECT' var.targets[0].id = self.obj - var.targets[0].data_path = ulimb_p.path_from_id() + '["stretch"]' + var.targets[0].data_path = ulimb_p.path_from_id() + '["stretch_length"]' driver.type = 'SCRIPTED' - driver.expression = "1/sqrt(stretch)" - + driver.expression = "1/sqrt(stretch_length)" + def add_antistretch_drivers(pose_bone): driver = pose_bone.driver_add("scale", 1).driver var = driver.variables.new() - var.name = "stretch" + var.name = "stretch_length" var.targets[0].id_type = 'OBJECT' var.targets[0].id = self.obj - var.targets[0].data_path = ulimb_p.path_from_id() + '["stretch"]' + var.targets[0].data_path = ulimb_p.path_from_id() + '["stretch_length"]' driver.type = 'SCRIPTED' - driver.expression = "1/stretch" - + driver.expression = "1/stretch_length" + driver = pose_bone.driver_add("scale", 0).driver var = driver.variables.new() - var.name = "stretch" + var.name = "stretch_length" var.targets[0].id_type = 'OBJECT' var.targets[0].id = self.obj - var.targets[0].data_path = ulimb_p.path_from_id() + '["stretch"]' + var.targets[0].data_path = ulimb_p.path_from_id() + '["stretch_length"]' driver.type = 'SCRIPTED' - driver.expression = "sqrt(stretch)" - + driver.expression = "sqrt(stretch_length)" + driver = pose_bone.driver_add("scale", 2).driver var = driver.variables.new() - var.name = "stretch" + var.name = "stretch_length" var.targets[0].id_type = 'OBJECT' var.targets[0].id = self.obj - var.targets[0].data_path = ulimb_p.path_from_id() + '["stretch"]' + var.targets[0].data_path = ulimb_p.path_from_id() + '["stretch_length"]' driver.type = 'SCRIPTED' - driver.expression = "sqrt(stretch)" - + driver.expression = "sqrt(stretch_length)" + add_stretch_drivers(ulimb_p) add_stretch_drivers(flimb_p) add_antistretch_drivers(fantistr_p) @@ -277,7 +274,7 @@ def add_antistretch_drivers(pose_bone): ulimb_p.bone.layers = self.layers flimb_p.bone.layers = self.layers elimb_p.bone.layers = self.layers - + # Create control widgets create_limb_widget(self.obj, ulimb) create_limb_widget(self.obj, flimb) @@ -334,7 +331,10 @@ def generate(self): flimb = copy_bone(self.obj, self.org_bones[1], make_mechanism_name(strip_org(insert_before_lr(self.org_bones[1], ".ik")))) elimb = copy_bone(self.obj, self.org_bones[2], strip_org(insert_before_lr(self.org_bones[2], ".ik"))) elimb_mch = copy_bone(self.obj, self.org_bones[2], make_mechanism_name(strip_org(self.org_bones[2]))) - + + ulimb_nostr = copy_bone(self.obj, self.org_bones[0], make_mechanism_name(strip_org(insert_before_lr(self.org_bones[0], ".nostr.ik")))) + flimb_nostr = copy_bone(self.obj, self.org_bones[1], make_mechanism_name(strip_org(insert_before_lr(self.org_bones[1], ".nostr.ik")))) + ulimb_str = copy_bone(self.obj, self.org_bones[0], make_mechanism_name(strip_org(insert_before_lr(self.org_bones[0], ".stretch.ik")))) flimb_str = copy_bone(self.obj, self.org_bones[1], make_mechanism_name(strip_org(insert_before_lr(self.org_bones[1], ".stretch.ik")))) @@ -353,6 +353,8 @@ def generate(self): flimb_e = eb[flimb] elimb_e = eb[elimb] elimb_mch_e = eb[elimb_mch] + ulimb_nostr_e = eb[ulimb_nostr] + flimb_nostr_e = eb[flimb_nostr] ulimb_str_e = eb[ulimb_str] flimb_str_e = eb[flimb_str] pole_e = eb[pole] @@ -361,20 +363,23 @@ def generate(self): # Parenting ulimb_e.use_connect = False + ulimb_nostr_e.use_connect = False if parent != None: ulimb_e.parent = parent_e - + ulimb_nostr_e.parent = parent_e + flimb_e.parent = ulimb_e + flimb_nostr_e.parent = ulimb_nostr_e elimb_e.use_connect = False elimb_e.parent = None - + elimb_mch_e.use_connect = False elimb_mch_e.parent = elimb_e - + ulimb_str_e.use_connect = False ulimb_str_e.parent = ulimb_e.parent - + flimb_str_e.use_connect = False flimb_str_e.parent = ulimb_e.parent @@ -430,6 +435,8 @@ def generate(self): ulimb_p = pb[ulimb] flimb_p = pb[flimb] elimb_p = pb[elimb] + ulimb_nostr_p = pb[ulimb_nostr] + flimb_nostr_p = pb[flimb_nostr] ulimb_str_p = pb[ulimb_str] flimb_str_p = pb[flimb_str] pole_p = pb[pole] @@ -440,16 +447,34 @@ def generate(self): if 'X' in self.primary_rotation_axis: flimb_p.lock_ik_y = True flimb_p.lock_ik_z = True + flimb_nostr_p.lock_ik_y = True + flimb_nostr_p.lock_ik_z = True elif 'Y' in self.primary_rotation_axis: flimb_p.lock_ik_x = True flimb_p.lock_ik_z = True + flimb_nostr_p.lock_ik_x = True + flimb_nostr_p.lock_ik_z = True else: flimb_p.lock_ik_x = True flimb_p.lock_ik_y = True - + flimb_nostr_p.lock_ik_x = True + flimb_nostr_p.lock_ik_y = True + # Limb stretches - ulimb_p.ik_stretch = 0.0001 - flimb_p.ik_stretch = 0.0001 + ulimb_nostr_p.ik_stretch = 0.0 + flimb_nostr_p.ik_stretch = 0.0 + + # This next bit is weird. The values calculated cause + # ulimb and flimb to preserve their relative lengths + # while stretching. + l1 = ulimb_p.length + l2 = flimb_p.length + if l1 < l2: + ulimb_p.ik_stretch = (l1 ** (1 / 3)) / (l2 ** (1 / 3)) + flimb_p.ik_stretch = 1.0 + else: + ulimb_p.ik_stretch = 1.0 + flimb_p.ik_stretch = (l2 ** (1 / 3)) / (l1 ** (1 / 3)) # Pole target only translates pole_p.lock_location = False, False, False @@ -463,76 +488,95 @@ def generate(self): elimb_p["ikfk_switch"] = 0.0 prop["soft_min"] = prop["min"] = 0.0 prop["soft_max"] = prop["max"] = 1.0 - - prop = rna_idprop_ui_prop_get(elimb_p, "stretch", create=True) - elimb_p["stretch"] = 1.0 + + prop = rna_idprop_ui_prop_get(elimb_p, "stretch_length", create=True) + elimb_p["stretch_length"] = 1.0 prop["min"] = 0.05 prop["max"] = 20.0 - prop["soft_min"] = 0.25 + prop["soft_min"] = 0.25 prop["soft_max"] = 4.0 - + + prop = rna_idprop_ui_prop_get(elimb_p, "auto_stretch", create=True) + elimb_p["auto_stretch"] = 1.0 + prop["soft_min"] = prop["min"] = 0.0 + prop["soft_max"] = prop["max"] = 1.0 + # Stretch parameter drivers def add_stretch_drivers(pose_bone): driver = pose_bone.driver_add("scale", 1).driver var = driver.variables.new() - var.name = "stretch" + var.name = "stretch_length" var.targets[0].id_type = 'OBJECT' var.targets[0].id = self.obj - var.targets[0].data_path = elimb_p.path_from_id() + '["stretch"]' + var.targets[0].data_path = elimb_p.path_from_id() + '["stretch_length"]' driver.type = 'SCRIPTED' - driver.expression = "stretch" - + driver.expression = "stretch_length" + driver = pose_bone.driver_add("scale", 0).driver var = driver.variables.new() - var.name = "stretch" + var.name = "stretch_length" var.targets[0].id_type = 'OBJECT' var.targets[0].id = self.obj - var.targets[0].data_path = elimb_p.path_from_id() + '["stretch"]' + var.targets[0].data_path = elimb_p.path_from_id() + '["stretch_length"]' driver.type = 'SCRIPTED' - driver.expression = "stretch" - + driver.expression = "stretch_length" + driver = pose_bone.driver_add("scale", 2).driver var = driver.variables.new() - var.name = "stretch" + var.name = "stretch_length" var.targets[0].id_type = 'OBJECT' var.targets[0].id = self.obj - var.targets[0].data_path = elimb_p.path_from_id() + '["stretch"]' + var.targets[0].data_path = elimb_p.path_from_id() + '["stretch_length"]' driver.type = 'SCRIPTED' - driver.expression = "stretch" - add_stretch_drivers(ulimb_p) + driver.expression = "stretch_length" + add_stretch_drivers(ulimb_nostr_p) # Bend direction hint - if self.bend_hint: - con = flimb_p.constraints.new('LIMIT_ROTATION') + def add_bend_hint(pose_bone, axis): + con = pose_bone.constraints.new('LIMIT_ROTATION') con.name = "bend_hint" con.owner_space = 'LOCAL' - if self.primary_rotation_axis == 'X': + if axis == 'X': con.use_limit_x = True con.min_x = pi / 10 con.max_x = pi / 10 - elif self.primary_rotation_axis == '-X': + elif axis == '-X': con.use_limit_x = True con.min_x = -pi / 10 con.max_x = -pi / 10 - elif self.primary_rotation_axis == 'Y': + elif axis == 'Y': con.use_limit_y = True con.min_y = pi / 10 con.max_y = pi / 10 - elif self.primary_rotation_axis == '-Y': + elif axis == '-Y': con.use_limit_y = True con.min_y = -pi / 10 con.max_y = -pi / 10 - elif self.primary_rotation_axis == 'Z': + elif axis == 'Z': con.use_limit_z = True con.min_z = pi / 10 con.max_z = pi / 10 - elif self.primary_rotation_axis == '-Z': + elif axis == '-Z': con.use_limit_z = True con.min_z = -pi / 10 con.max_z = -pi / 10 + if self.bend_hint: + add_bend_hint(flimb_p, self.primary_rotation_axis) + add_bend_hint(flimb_nostr_p, self.primary_rotation_axis) - # IK Constraint - con = flimb_p.constraints.new('IK') + # Constrain normal IK chain to no-stretch IK chain + con = ulimb_p.constraints.new('COPY_TRANSFORMS') + con.name = "pre_stretch" + con.target = self.obj + con.subtarget = ulimb_nostr + + con = flimb_p.constraints.new('COPY_TRANSFORMS') + con.name = "pre_stretch" + con.target = self.obj + con.subtarget = flimb_nostr + + # IK Constraints + con = flimb_nostr_p.constraints.new('IK') con.name = "ik" con.target = self.obj con.subtarget = elimb_mch @@ -540,7 +584,23 @@ def add_stretch_drivers(pose_bone): con.pole_subtarget = pole con.pole_angle = pole_offset con.chain_count = 2 - + + con = flimb_p.constraints.new('IK') + con.name = "ik" + con.target = self.obj + con.subtarget = elimb_mch + con.chain_count = 2 + + # Driver to enable/disable auto stretching IK chain + fcurve = con.driver_add("influence") + driver = fcurve.driver + var = driver.variables.new() + driver.type = 'AVERAGE' + var.name = "var" + var.targets[0].id_type = 'OBJECT' + var.targets[0].id = self.obj + var.targets[0].data_path = elimb_p.path_from_id() + '["auto_stretch"]' + # Stretch bone constraints con = ulimb_str_p.constraints.new('COPY_TRANSFORMS') con.name = "anchor" @@ -548,14 +608,16 @@ def add_stretch_drivers(pose_bone): con.subtarget = ulimb con = ulimb_str_p.constraints.new('MAINTAIN_VOLUME') con.name = "stretch" - + con.owner_space = 'LOCAL' + con = flimb_str_p.constraints.new('COPY_TRANSFORMS') con.name = "anchor" con.target = self.obj con.subtarget = flimb con = flimb_str_p.constraints.new('MAINTAIN_VOLUME') con.name = "stretch" - + con.owner_space = 'LOCAL' + # Constrain org bones con = pb[self.org_bones[0]].constraints.new('COPY_TRANSFORMS') con.name = "ik" @@ -635,11 +697,11 @@ def add_stretch_drivers(pose_bone): viselimb_p.bone.layers = self.layers vispole_p.bone.layers = self.layers - # Create widgets + # Create widgets create_line_widget(self.obj, vispole) create_line_widget(self.obj, viselimb) create_sphere_widget(self.obj, pole) - + ob = create_widget(self.obj, elimb) if ob != None: verts = [(0.7, 1.5, 0.0), (0.7, -0.25, 0.0), (-0.7, -0.25, 0.0), (-0.7, 1.5, 0.0), (0.7, 0.723, 0.0), (-0.7, 0.723, 0.0), (0.7, 0.0, 0.0), (-0.7, 0.0, 0.0)] @@ -685,7 +747,7 @@ def generate(self): if not self.use_complex_limb: # Simple rig - + # Create bones ulimb = copy_bone(self.obj, self.org_bones[0], make_deformer_name(strip_org(self.org_bones[0]))) flimb = copy_bone(self.obj, self.org_bones[1], make_deformer_name(strip_org(self.org_bones[1]))) @@ -701,14 +763,14 @@ def generate(self): # Parenting elimb_e.parent = flimb_e elimb_e.use_connect = True - + flimb_e.parent = ulimb_e flimb_e.use_connect = True - + if parent != None: elimb_e.use_connect = False ulimb_e.parent = eb[parent] - + # Object mode, get pose bones bpy.ops.object.mode_set(mode='OBJECT') pb = self.obj.pose.bones @@ -732,11 +794,18 @@ def generate(self): con.name = "def" con.target = self.obj con.subtarget = self.org_bones[2] - + return [] else: # Complex rig - + + # Get the .R or .L off the end of the upper limb name if it exists + lr = self.org_bones[0].split(".", 1) + if len(lr) == 1: + lr = "" + else: + lr = lr[1] + # Create bones ulimb1 = copy_bone(self.obj, self.org_bones[0], make_deformer_name(strip_org(insert_before_lr(self.org_bones[0], ".01")))) ulimb2 = copy_bone(self.obj, self.org_bones[0], make_deformer_name(strip_org(insert_before_lr(self.org_bones[0], ".02")))) @@ -745,73 +814,97 @@ def generate(self): elimb = copy_bone(self.obj, self.org_bones[2], make_deformer_name(strip_org(self.org_bones[2]))) junc = copy_bone(self.obj, self.org_bones[1], make_mechanism_name(strip_org(insert_before_lr(self.org_bones[1], ".junc")))) - + uhose = new_bone(self.obj, strip_org(insert_before_lr(self.org_bones[0], "_hose"))) - lr = self.org_bones[0].split(".", 1) # Get the .R or .L off the end of the name if it exists - if len(lr) == 1: - lr = "" - else: - lr = lr[1] jhose = new_bone(self.obj, self.junc_base_name + "_hose." + lr) fhose = new_bone(self.obj, strip_org(insert_before_lr(self.org_bones[1], "_hose"))) - + + uhose_par = copy_bone(self.obj, self.org_bones[0], make_mechanism_name(strip_org(insert_before_lr(uhose, "_parent")))) + jhose_par = copy_bone(self.obj, junc, make_mechanism_name(strip_org(insert_before_lr(jhose, "_parent")))) + fhose_par = copy_bone(self.obj, self.org_bones[1], make_mechanism_name(strip_org(insert_before_lr(fhose, "_parent")))) + # Get edit bones eb = self.obj.data.edit_bones + if parent != None: + parent_e = eb[parent] + else: + parent_e = None + ulimb1_e = eb[ulimb1] ulimb2_e = eb[ulimb2] flimb1_e = eb[flimb1] flimb2_e = eb[flimb2] elimb_e = eb[elimb] - + junc_e = eb[junc] - + uhose_e = eb[uhose] jhose_e = eb[jhose] fhose_e = eb[fhose] - + + uhose_par_e = eb[uhose_par] + jhose_par_e = eb[jhose_par] + fhose_par_e = eb[fhose_par] + # Parenting if parent != None: ulimb1_e.use_connect = False - ulimb1_e.parent = eb[parent] - + ulimb1_e.parent = parent_e + ulimb2_e.use_connect = False ulimb2_e.parent = eb[self.org_bones[0]] - + flimb1_e.use_connect = True flimb1_e.parent = ulimb2_e - + flimb2_e.use_connect = False flimb2_e.parent = eb[self.org_bones[1]] - + elimb_e.use_connect = False elimb_e.parent = eb[self.org_bones[2]] - + junc_e.use_connect = False junc_e.parent = eb[self.org_bones[0]] - + uhose_e.use_connect = False - uhose_e.parent = eb[self.org_bones[0]] - + uhose_e.parent = uhose_par_e + jhose_e.use_connect = False - jhose_e.parent = junc_e - + jhose_e.parent = jhose_par_e + fhose_e.use_connect = False - fhose_e.parent = eb[self.org_bones[1]] - + fhose_e.parent = fhose_par_e + + uhose_par_e.use_connect = False + uhose_par_e.parent = parent_e + + jhose_par_e.use_connect = False + jhose_par_e.parent = parent_e + + fhose_par_e.use_connect = False + fhose_par_e.parent = parent_e + # Positioning ulimb1_e.length *= 0.5 ulimb2_e.head = Vector(ulimb1_e.tail) flimb1_e.length *= 0.5 flimb2_e.head = Vector(flimb1_e.tail) align_bone_roll(self.obj, flimb2, elimb) - + junc_e.length *= 0.2 - + + uhose_par_e.length *= 0.25 + jhose_par_e.length *= 0.15 + fhose_par_e.length *= 0.25 + put_bone(self.obj, uhose_par, Vector(ulimb1_e.tail)) + put_bone(self.obj, jhose_par, Vector(ulimb2_e.tail)) + put_bone(self.obj, fhose_par, Vector(flimb1_e.tail)) + put_bone(self.obj, uhose, Vector(ulimb1_e.tail)) put_bone(self.obj, jhose, Vector(ulimb2_e.tail)) put_bone(self.obj, fhose, Vector(flimb1_e.tail)) - + if 'X' in self.primary_rotation_axis: upoint = Vector(ulimb1_e.z_axis) fpoint = Vector(flimb1_e.z_axis) @@ -821,69 +914,73 @@ def generate(self): else: # Y upoint = Vector(ulimb1_e.z_axis) fpoint = Vector(flimb1_e.z_axis) - + if '-' not in self.primary_rotation_axis: upoint *= -1 fpoint *= -1 - + if 'Y' in self.primary_rotation_axis: uside = Vector(ulimb1_e.x_axis) fside = Vector(flimb1_e.x_axis) else: uside = Vector(ulimb1_e.y_axis) * -1 fside = Vector(flimb1_e.y_axis) * -1 - + uhose_e.tail = uhose_e.head + upoint jhose_e.tail = fhose_e.head + upoint + fpoint fhose_e.tail = fhose_e.head + fpoint - + align_bone_z_axis(self.obj, uhose, uside) - align_bone_z_axis(self.obj, jhose, uside+fside) + align_bone_z_axis(self.obj, jhose, uside + fside) align_bone_z_axis(self.obj, fhose, fside) - + l = 0.125 * (ulimb1_e.length + ulimb2_e.length + flimb1_e.length + flimb2_e.length) uhose_e.length = l jhose_e.length = l fhose_e.length = l - + # Object mode, get pose bones bpy.ops.object.mode_set(mode='OBJECT') pb = self.obj.pose.bones - + ulimb1_p = pb[ulimb1] ulimb2_p = pb[ulimb2] flimb1_p = pb[flimb1] flimb2_p = pb[flimb2] elimb_p = pb[elimb] - + junc_p = pb[junc] - + uhose_p = pb[uhose] jhose_p = pb[jhose] fhose_p = pb[fhose] - + + uhose_par_p = pb[uhose_par] + jhose_par_p = pb[jhose_par] + fhose_par_p = pb[fhose_par] + # Lock axes uhose_p.lock_rotation = (True, True, True) uhose_p.lock_rotation_w = True uhose_p.lock_scale = (True, True, True) - + jhose_p.lock_rotation = (True, True, True) jhose_p.lock_rotation_w = True jhose_p.lock_scale = (True, True, True) - + fhose_p.lock_rotation = (True, True, True) fhose_p.lock_rotation_w = True fhose_p.lock_scale = (True, True, True) - + # B-bone settings ulimb2_p.bone.bbone_segments = 16 ulimb2_p.bone.bbone_in = 0.0 ulimb2_p.bone.bbone_out = 1.0 - + flimb1_p.bone.bbone_segments = 16 flimb1_p.bone.bbone_in = 1.0 flimb1_p.bone.bbone_out = 0.0 - + # Custom properties prop = rna_idprop_ui_prop_get(jhose_p, "smooth_bend", create=True) jhose_p["smooth_bend"] = 0.0 @@ -899,7 +996,7 @@ def generate(self): var.targets[0].id_type = 'OBJECT' var.targets[0].id = self.obj var.targets[0].data_path = jhose_p.path_from_id() + '["smooth_bend"]' - + fcurve = flimb1_p.bone.driver_add("bbone_in") driver = fcurve.driver var = driver.variables.new() @@ -908,7 +1005,7 @@ def generate(self): var.targets[0].id_type = 'OBJECT' var.targets[0].id = self.obj var.targets[0].data_path = jhose_p.path_from_id() + '["smooth_bend"]' - + # Constraints con = ulimb1_p.constraints.new('COPY_SCALE') con.name = "anchor" @@ -923,7 +1020,7 @@ def generate(self): con.target = self.obj con.subtarget = uhose con.volume = 'NO_VOLUME' - + con = ulimb2_p.constraints.new('COPY_LOCATION') con.name = "anchor" con.target = self.obj @@ -937,7 +1034,7 @@ def generate(self): con.target = self.obj con.subtarget = jhose con.volume = 'NO_VOLUME' - + con = flimb1_p.constraints.new('COPY_TRANSFORMS') con.name = "anchor" con.target = self.obj @@ -955,7 +1052,7 @@ def generate(self): con.target = self.obj con.subtarget = fhose con.volume = 'NO_VOLUME' - + con = flimb2_p.constraints.new('COPY_LOCATION') con.name = "anchor" con.target = self.obj @@ -973,13 +1070,56 @@ def generate(self): con.target = self.obj con.subtarget = self.org_bones[2] con.volume = 'NO_VOLUME' - + con = junc_p.constraints.new('COPY_TRANSFORMS') con.name = "bend" con.target = self.obj con.subtarget = self.org_bones[1] con.influence = 0.5 - + + con = uhose_par_p.constraints.new('COPY_ROTATION') + con.name = "follow" + con.target = self.obj + con.subtarget = self.org_bones[0] + con.influence = 1.0 + con = uhose_par_p.constraints.new('COPY_LOCATION') + con.name = "anchor" + con.target = self.obj + con.subtarget = self.org_bones[0] + con.influence = 1.0 + con = uhose_par_p.constraints.new('COPY_LOCATION') + con.name = "anchor" + con.target = self.obj + con.subtarget = jhose + con.influence = 0.5 + + con = jhose_par_p.constraints.new('COPY_ROTATION') + con.name = "follow" + con.target = self.obj + con.subtarget = junc + con.influence = 1.0 + con = jhose_par_p.constraints.new('COPY_LOCATION') + con.name = "anchor" + con.target = self.obj + con.subtarget = junc + con.influence = 1.0 + + con = fhose_par_p.constraints.new('COPY_ROTATION') + con.name = "follow" + con.target = self.obj + con.subtarget = self.org_bones[1] + con.influence = 1.0 + con = fhose_par_p.constraints.new('COPY_LOCATION') + con.name = "anchor" + con.target = self.obj + con.subtarget = jhose + con.influence = 1.0 + con = fhose_par_p.constraints.new('COPY_LOCATION') + con.name = "anchor" + con.target = self.obj + con.subtarget = self.org_bones[2] + con.influence = 0.5 + # Layers if self.layers: uhose_p.bone.layers = self.layers @@ -990,13 +1130,10 @@ def generate(self): uhose_p.bone.layers = layers jhose_p.bone.layers = layers fhose_p.bone.layers = layers - + # Create widgets create_sphere_widget(self.obj, uhose) create_sphere_widget(self.obj, jhose) create_sphere_widget(self.obj, fhose) - + return [uhose, jhose, fhose] - - - diff --git a/rigs/misc/delta.py b/rigs/misc/delta.py index a005fb6..84f3612 100644 --- a/rigs/misc/delta.py +++ b/rigs/misc/delta.py @@ -90,7 +90,6 @@ def generate(self): con.target = self.obj con.subtarget = delta - def create_sample(obj): # generated by rigify.utils.write_metarig bpy.ops.object.mode_set(mode='EDIT') @@ -140,7 +139,6 @@ def create_sample(obj): bone.select_tail = True arm.edit_bones.active = bone - def set_mat(obj, bone_name, matrix): """ Sets the bone to have the given transform matrix. """ diff --git a/rigs/neck_short.py b/rigs/neck_short.py index 9c24832..63174d4 100644 --- a/rigs/neck_short.py +++ b/rigs/neck_short.py @@ -25,7 +25,7 @@ from ..utils import copy_bone, new_bone, put_bone from ..utils import connected_children_names from ..utils import strip_org, make_mechanism_name, make_deformer_name -from ..utils import obj_to_bone, create_circle_widget +from ..utils import create_circle_widget script1 = """ @@ -315,8 +315,8 @@ def gen_control(self): i += 1 # Create control widgets - w1 = create_circle_widget(self.obj, neck_ctrl, radius=1.0, head_tail=0.5, bone_transform_name=self.org_bones[(len(self.org_bones) - 1) // 2]) - w2 = create_circle_widget(self.obj, head_ctrl, radius=1.0, head_tail=0.5, bone_transform_name=self.org_bones[-1]) + create_circle_widget(self.obj, neck_ctrl, radius=1.0, head_tail=0.5, bone_transform_name=self.org_bones[(len(self.org_bones) - 1) // 2]) + create_circle_widget(self.obj, head_ctrl, radius=1.0, head_tail=0.5, bone_transform_name=self.org_bones[-1]) # Return control bones return (head_ctrl, neck_ctrl) diff --git a/rigs/spine.py b/rigs/spine.py index 0983e83..680a4ce 100644 --- a/rigs/spine.py +++ b/rigs/spine.py @@ -33,7 +33,7 @@ from ..utils import copy_bone, new_bone, flip_bone, put_bone from ..utils import connected_children_names from ..utils import strip_org, make_mechanism_name, make_deformer_name -from ..utils import obj_to_bone, create_circle_widget, create_cube_widget +from ..utils import create_circle_widget, create_cube_widget script = """ main = "%s" @@ -174,7 +174,6 @@ def gen_control(self): eb[main_control].length = sum([eb[b].length for b in self.org_bones]) / 2 # Position the controls and sub-controls - pos = eb[controls[0]].head.copy() for name, subname in zip(controls, subcontrols): put_bone(self.obj, name, pivot_rest_pos) put_bone(self.obj, subname, pivot_rest_pos) @@ -443,23 +442,23 @@ def gen_control(self): # Control appearance # Main - w = create_cube_widget(self.obj, main_control) + create_cube_widget(self.obj, main_control) # Spines for name, i in zip(controls[1:-1], self.control_indices[1:-1]): pb[name].custom_shape_transform = pb[self.org_bones[i]] # Create control widgets - w = create_circle_widget(self.obj, name, radius=1.0, head_tail=0.5, with_line=True, bone_transform_name=self.org_bones[i]) + create_circle_widget(self.obj, name, radius=1.0, head_tail=0.5, with_line=True, bone_transform_name=self.org_bones[i]) # Hips pb[controls[0]].custom_shape_transform = pb[self.org_bones[0]] # Create control widgets - w = create_circle_widget(self.obj, controls[0], radius=1.0, head_tail=0.5, with_line=True, bone_transform_name=self.org_bones[0]) + create_circle_widget(self.obj, controls[0], radius=1.0, head_tail=0.5, with_line=True, bone_transform_name=self.org_bones[0]) # Ribs pb[controls[-1]].custom_shape_transform = pb[self.org_bones[-1]] # Create control widgets - w = create_circle_widget(self.obj, controls[-1], radius=1.0, head_tail=0.5, with_line=True, bone_transform_name=self.org_bones[-1]) + create_circle_widget(self.obj, controls[-1], radius=1.0, head_tail=0.5, with_line=True, bone_transform_name=self.org_bones[-1]) # Layers pb[main_control].bone.layers = pb[self.org_bones[0]].bone.layers diff --git a/utils.py b/utils.py index 6fbc635..183ebd9 100644 --- a/utils.py +++ b/utils.py @@ -243,63 +243,63 @@ def make_nonscaling_child(obj, bone_name, location, child_name_postfix=""): """ Takes the named bone and creates a non-scaling child of it at the given location. The returned bone (returned by name) is not a true child, but behaves like one sans inheriting scaling. - + It is intended as an intermediate construction to prevent rig types from scaling with their parents. The named bone is assumed to be an ORG bone. """ if bone_name not in obj.data.bones: raise MetarigError("make_nonscaling_child(): bone '%s' not found, cannot copy it" % bone_name) - + if obj == bpy.context.active_object and bpy.context.mode == 'EDIT_ARMATURE': # Create desired names for bones name1 = make_mechanism_name(strip_org(insert_before_lr(bone_name, child_name_postfix + "_ns_ch"))) name2 = make_mechanism_name(strip_org(insert_before_lr(bone_name, child_name_postfix + "_ns_intr"))) - + # Create bones child = copy_bone(obj, bone_name, name1) intermediate_parent = copy_bone(obj, bone_name, name2) - + # Get edit bones eb = obj.data.edit_bones child_e = eb[child] intrpar_e = eb[intermediate_parent] - + # Parenting child_e.use_connect = False child_e.parent = None - + intrpar_e.use_connect = False intrpar_e.parent = eb[bone_name] - + # Positioning child_e.length *= 0.5 intrpar_e.length *= 0.25 - + put_bone(obj, child, location) put_bone(obj, intermediate_parent, location) - + # Object mode bpy.ops.object.mode_set(mode='OBJECT') pb = obj.pose.bones - + # Add constraints con = pb[child].constraints.new('COPY_LOCATION') con.name = "parent_loc" con.target = obj con.subtarget = intermediate_parent - + con = pb[child].constraints.new('COPY_ROTATION') con.name = "parent_loc" con.target = obj con.subtarget = intermediate_parent - + bpy.ops.object.mode_set(mode='EDIT') - + return child else: raise MetarigError("Cannot make nonscaling child outside of edit mode") - + #============================================= # Widget creation @@ -550,10 +550,10 @@ def align_bone_x_axis(obj, bone, vec): Must be in edit mode. """ bone_e = obj.data.edit_bones[bone] - + vec = vec.cross(bone_e.y_axis) vec.normalize() - + dot = max(-1.0, min(1.0, bone_e.z_axis.dot(vec))) angle = math.acos(dot) @@ -575,10 +575,10 @@ def align_bone_z_axis(obj, bone, vec): Must be in edit mode. """ bone_e = obj.data.edit_bones[bone] - + vec = bone_e.y_axis.cross(vec) vec.normalize() - + dot = max(-1.0, min(1.0, bone_e.x_axis.dot(vec))) angle = math.acos(dot) @@ -698,7 +698,7 @@ def write_metarig(obj, layers=False, func_name="create"): """ code = [] - code.append("import bpy\n") + code.append("import bpy\n\n") code.append("def %s(obj):" % func_name) code.append(" # generated by rigify.utils.write_metarig") @@ -744,7 +744,6 @@ def write_metarig(obj, layers=False, func_name="create"): # Rig type and other pose properties for bone_name in bones: pbone = obj.pose.bones[bone_name] - pbone_written = False code.append(" pbone = obj.pose.bones[bones[%r]]" % bone_name) code.append(" pbone.rigify_type = %r" % pbone.rigify_type)