diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-01-03 02:43:46 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-01-03 02:43:46 +0300 |
commit | d8d11c55d9ebdedb72ea2c2bfb5038e612529157 (patch) | |
tree | a7a94e3b635aa8e7afe279f6364266f4c94fceec /release/scripts/modules/rigify/spine_pivot_flex.py | |
parent | 04d0261c37ccd28e8466312f5a2d8260c5a4c9e9 (diff) |
patch from Cessen
Adds a new set of bones to rig types which are to be used for weight paint vgroups, in some these have some more segments to account for twist. also use Aligoriths new copy transform constraint.
Diffstat (limited to 'release/scripts/modules/rigify/spine_pivot_flex.py')
-rw-r--r-- | release/scripts/modules/rigify/spine_pivot_flex.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/release/scripts/modules/rigify/spine_pivot_flex.py b/release/scripts/modules/rigify/spine_pivot_flex.py index 895a5d854c0..a8ba71d1fe6 100644 --- a/release/scripts/modules/rigify/spine_pivot_flex.py +++ b/release/scripts/modules/rigify/spine_pivot_flex.py @@ -122,6 +122,30 @@ def fk(*args): main(*args) +def deform(obj, definitions, base_names, options): + for org_bone_name in definitions[2:]: + bpy.ops.object.mode_set(mode='EDIT') + + # Create deform bone. + bone = copy_bone_simple(obj.data, org_bone_name, "DEF-%s" % base_names[org_bone_name], parent=True) + + # Store name before leaving edit mode + bone_name = bone.name + + # Leave edit mode + bpy.ops.object.mode_set(mode='OBJECT') + + # Get the pose bone + bone = obj.pose.bones[bone_name] + + # Constrain to the original bone + # XXX. Todo, is this needed if the bone is connected to its parent? + con = bone.constraints.new('COPY_TRANSFORMS') + con.name = "copy_loc" + con.target = obj + con.subtarget = org_bone_name + + def main(obj, bone_definition, base_names, options): from Mathutils import Vector, RotationMatrix from math import radians, pi @@ -269,6 +293,7 @@ def main(obj, bone_definition, base_names, options): spine_e.roll += pi # 180d roll del spine_e + deform(obj, bone_definition, base_names, options) bpy.ops.object.mode_set(mode='OBJECT') |