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

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Vegdahl <cessen@cessen.com>2013-02-16 22:22:20 +0400
committerNathan Vegdahl <cessen@cessen.com>2013-02-16 22:22:20 +0400
commit21e99d0bd6b6a71cbf871cc4aaf6f2b744cd3d14 (patch)
treea9e1ee9327533ef7018dd08272dd54cd231e6534 /rigify/rigs/spine.py
parent3d5172cf6bc017f929818725ccb890084617c519 (diff)
Rigify: updated naming schemes for control bones.
This required changes to both the default human metarig and some of the rig types. This updates the naming scheme to match new best-practices, as per the CGCookie Flexrig.
Diffstat (limited to 'rigify/rigs/spine.py')
-rw-r--r--rigify/rigs/spine.py48
1 files changed, 4 insertions, 44 deletions
diff --git a/rigify/rigs/spine.py b/rigify/rigs/spine.py
index 332c6f43..29ad1729 100644
--- a/rigify/rigs/spine.py
+++ b/rigify/rigs/spine.py
@@ -20,6 +20,7 @@
""" TODO:
- Add parameters for bone transform alphas.
+ - Add IK spine controls
"""
from math import floor
@@ -32,7 +33,7 @@ from ..utils import MetarigError
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_compass_widget
+from ..utils import obj_to_bone, create_circle_widget, create_cube_widget
script = """
main = "%s"
@@ -73,6 +74,7 @@ class Rig:
self.control_indices.sort()
self.pivot_rest = self.params.rest_pivot_slide
+ # Clamp pivot_rest to within the middle bones of the spine
self.pivot_rest = max(self.pivot_rest, 1.0 / len(self.org_bones))
self.pivot_rest = min(self.pivot_rest, 1.0 - (1.0 / len(self.org_bones)))
@@ -148,22 +150,12 @@ class Rig:
# Create main control bone
main_control = new_bone(self.obj, self.params.spine_main_control_name)
- # Create main control WGT bones
- main_wgt1 = new_bone(self.obj, make_mechanism_name(self.params.spine_main_control_name + ".01"))
- main_wgt2 = new_bone(self.obj, make_mechanism_name(self.params.spine_main_control_name + ".02"))
-
eb = self.obj.data.edit_bones
# Parent the main control
eb[main_control].use_connect = False
eb[main_control].parent = eb[self.org_bones[0]].parent
- # Parent the main WGTs
- eb[main_wgt1].use_connect = False
- eb[main_wgt1].parent = eb[main_control]
- eb[main_wgt2].use_connect = False
- eb[main_wgt2].parent = eb[main_wgt1]
-
# Parent the controls and sub-controls
for name, subname in zip(controls, subcontrols):
eb[name].use_connect = False
@@ -181,12 +173,6 @@ class Rig:
put_bone(self.obj, main_control, pivot_rest_pos)
eb[main_control].length = sum([eb[b].length for b in self.org_bones]) / 2
- # Position the main WGTs
- eb[main_wgt1].tail = (0.0, 0.0, sum([eb[b].length for b in self.org_bones]) / 4)
- eb[main_wgt2].length = sum([eb[b].length for b in self.org_bones]) / 4
- put_bone(self.obj, main_wgt1, pivot_rest_pos)
- put_bone(self.obj, main_wgt2, pivot_rest_pos)
-
# Position the controls and sub-controls
pos = eb[controls[0]].head.copy()
for name, subname in zip(controls, subcontrols):
@@ -379,11 +365,6 @@ class Rig:
con.target = self.obj
con.subtarget = rev_bones[0]
- con = pb[main_wgt1].constraints.new('COPY_ROTATION')
- con.name = "copy_rotation"
- con.target = self.obj
- con.subtarget = rev_bones[0]
-
# Slide constraints
i = 1
tot = len(rev_bones)
@@ -408,26 +389,6 @@ class Rig:
mod.coefficients[0] = 1 - i
mod.coefficients[1] = tot
- # Main WGT
- con = pb[main_wgt1].constraints.new('COPY_ROTATION')
- con.name = "slide." + str(i)
- con.target = self.obj
- con.subtarget = rb
-
- # Driver
- fcurve = con.driver_add("influence")
- driver = fcurve.driver
- var = driver.variables.new()
- driver.type = 'AVERAGE'
- var.name = "slide"
- var.targets[0].id_type = 'OBJECT'
- var.targets[0].id = self.obj
- var.targets[0].data_path = main_control_p.path_from_id() + '["pivot_slide"]'
- mod = fcurve.modifiers[0]
- mod.poly_order = 1
- mod.coefficients[0] = 1.5 - i
- mod.coefficients[1] = tot
-
i += 1
#----------------------------------
@@ -482,8 +443,7 @@ class Rig:
# Control appearance
# Main
- pb[main_control].custom_shape_transform = pb[main_wgt2]
- w = create_compass_widget(self.obj, main_control, bone_transform_name=main_wgt2)
+ w = create_cube_widget(self.obj, main_control)
# Spines
for name, i in zip(controls[1:-1], self.control_indices[1:-1]):