diff options
author | Lucio Rossi <lucio.rossi75@gmail.com> | 2016-09-12 19:32:28 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-09-26 15:29:50 +0300 |
commit | 9324cddf81f4f650d2c56c880143b01b1e285ba1 (patch) | |
tree | 36847bb30e0f3c551e9748cef49c666220edfb06 | |
parent | 1f9e3bfa3b8bc5fe082d7182b422c788691653a1 (diff) |
Pitchipoy: remove root parenting from ctrls with IK_follow and child_of
-rw-r--r-- | rigify/generate.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/rigify/generate.py b/rigify/generate.py index 0536377e..e519c13b 100644 --- a/rigify/generate.py +++ b/rigify/generate.py @@ -300,12 +300,21 @@ def generate_rig(context, metarig): # Get a list of all the bones in the armature bones = [bone.name for bone in obj.data.bones] - # Parent any free-floating bones to the root. + # Parent any free-floating bones to the root excluding bones with child of constraint. + pbones = obj.pose.bones + noparent_bones = [] + for bone in bones: + if 'IK_follow' in pbones[bone].keys(): + noparent_bones += [bone] + bpy.ops.object.mode_set(mode='EDIT') for bone in bones: - if obj.data.edit_bones[bone].parent is None: + if bone in noparent_bones: + continue + elif obj.data.edit_bones[bone].parent is None: obj.data.edit_bones[bone].use_connect = False obj.data.edit_bones[bone].parent = obj.data.edit_bones[root_bone] + bpy.ops.object.mode_set(mode='OBJECT') # Lock transforms on all non-control bones |