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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2010-01-31 17:30:21 +0300
committerCampbell Barton <ideasman42@gmail.com>2010-01-31 17:30:21 +0300
commit22d8742f0dab025f2789e28e337277f761d4e189 (patch)
treefc131823c381837e2b18def9eb70d348dae00eed /release/scripts/modules/rigify/finger_curl.py
parentfffaa0e18ae68904dad93f8cecfad8350aa229d8 (diff)
white space commit, so the actual changes in the next commiy wont be so hard to find
Diffstat (limited to 'release/scripts/modules/rigify/finger_curl.py')
-rw-r--r--release/scripts/modules/rigify/finger_curl.py72
1 files changed, 36 insertions, 36 deletions
diff --git a/release/scripts/modules/rigify/finger_curl.py b/release/scripts/modules/rigify/finger_curl.py
index 997ed889bb2..760ef10607b 100644
--- a/release/scripts/modules/rigify/finger_curl.py
+++ b/release/scripts/modules/rigify/finger_curl.py
@@ -100,48 +100,48 @@ def deform(obj, definitions, base_names, options):
center = f1a.center
f1a.tail = center
f1b.head = center
-
+
# Create the other deform bones.
f2 = copy_bone_simple(obj.data, definitions[1], "DEF-%s" % base_names[definitions[1]], parent=True)
f3 = copy_bone_simple(obj.data, definitions[2], "DEF-%s" % base_names[definitions[2]], parent=True)
-
+
# Store names before leaving edit mode
f1a_name = f1a.name
f1b_name = f1b.name
f2_name = f2.name
f3_name = f3.name
-
+
# Leave edit mode
bpy.ops.object.mode_set(mode='OBJECT')
-
+
# Get the pose bones
f1a = obj.pose.bones[f1a_name]
f1b = obj.pose.bones[f1b_name]
f2 = obj.pose.bones[f2_name]
f3 = obj.pose.bones[f3_name]
-
+
# Constrain the base digit's bones
con = f1a.constraints.new('DAMPED_TRACK')
con.name = "trackto"
con.target = obj
con.subtarget = definitions[1]
-
+
con = f1a.constraints.new('COPY_SCALE')
con.name = "copy_scale"
con.target = obj
con.subtarget = definitions[0]
-
+
con = f1b.constraints.new('COPY_ROTATION')
con.name = "copy_rot"
con.target = obj
con.subtarget = definitions[0]
-
+
# Constrain the other digit's bones
con = f2.constraints.new('COPY_TRANSFORMS')
con.name = "copy_transforms"
con.target = obj
con.subtarget = definitions[1]
-
+
con = f3.constraints.new('COPY_TRANSFORMS')
con.name = "copy_transforms"
con.target = obj
@@ -151,32 +151,32 @@ def deform(obj, definitions, base_names, options):
def main(obj, bone_definition, base_names, options):
# *** EDITMODE
bpy.ops.object.mode_set(mode='EDIT')
-
+
# get assosiated data
arm = obj.data
bb = obj.data.bones
eb = obj.data.edit_bones
pb = obj.pose.bones
-
+
org_f1 = bone_definition[0] # Original finger bone 01
org_f2 = bone_definition[1] # Original finger bone 02
org_f3 = bone_definition[2] # Original finger bone 03
-
+
# Check options
if "bend_ratio" in options:
bend_ratio = options["bend_ratio"]
else:
bend_ratio = 0.4
-
+
yes = [1, 1.0, True, "True", "true", "Yes", "yes"]
make_hinge = False
if ("hinge" in options) and (eb[org_f1].parent is not None):
if options["hinge"] in yes:
make_hinge = True
-
+
# Needed if its a new armature with no keys
- obj.animation_data_create()
+ obj.animation_data_create()
# Create the control bone
base_name = base_names[bone_definition[0]].split(".", 1)[0]
@@ -185,12 +185,12 @@ def main(obj, bone_definition, base_names, options):
eb[control].connected = eb[org_f1].connected
eb[control].parent = eb[org_f1].parent
eb[control].length = tot_len
-
+
# Create secondary control bones
f1 = copy_bone_simple(arm, bone_definition[0], base_names[bone_definition[0]]).name
f2 = copy_bone_simple(arm, bone_definition[1], base_names[bone_definition[1]]).name
f3 = copy_bone_simple(arm, bone_definition[2], base_names[bone_definition[2]]).name
-
+
# Create driver bones
df1 = copy_bone_simple(arm, bone_definition[0], "MCH-" + base_names[bone_definition[0]]).name
eb[df1].length /= 2
@@ -198,7 +198,7 @@ def main(obj, bone_definition, base_names, options):
eb[df2].length /= 2
df3 = copy_bone_simple(arm, bone_definition[2], "MCH-" + base_names[bone_definition[2]]).name
eb[df3].length /= 2
-
+
# Set parents of the bones, interleaving the driver bones with the secondary control bones
eb[f3].connected = False
eb[df3].connected = False
@@ -206,29 +206,29 @@ def main(obj, bone_definition, base_names, options):
eb[df2].connected = False
eb[f1].connected = False
eb[df1].connected = eb[org_f1].connected
-
+
eb[f3].parent = eb[df3]
eb[df3].parent = eb[f2]
eb[f2].parent = eb[df2]
eb[df2].parent = eb[f1]
eb[f1].parent = eb[df1]
eb[df1].parent = eb[org_f1].parent
-
+
# Set up bones for hinge
if make_hinge:
socket = copy_bone_simple(arm, org_f1, "MCH-socket_"+control, parent=True).name
hinge = copy_bone_simple(arm, eb[org_f1].parent.name, "MCH-hinge_"+control).name
-
+
eb[control].connected = False
eb[control].parent = eb[hinge]
-
+
# Create the deform rig while we're still in edit mode
deform(obj, bone_definition, base_names, options)
-
-
+
+
# *** POSEMODE
bpy.ops.object.mode_set(mode='OBJECT')
-
+
# Set rotation modes and axis locks
pb[control].rotation_mode = obj.pose.bones[bone_definition[0]].rotation_mode
pb[control].lock_location = True, True, True
@@ -241,20 +241,20 @@ def main(obj, bone_definition, base_names, options):
pb[f3].lock_location = True, True, True
pb[df2].rotation_mode = 'YZX'
pb[df3].rotation_mode = 'YZX'
-
+
# Add the bend_ratio property to the control bone
pb[control]["bend_ratio"] = bend_ratio
prop = rna_idprop_ui_prop_get(pb[control], "bend_ratio", create=True)
prop["soft_min"] = 0.0
prop["soft_max"] = 1.0
-
+
# Add hinge property to the control bone
if make_hinge:
pb[control]["hinge"] = 0.0
prop = rna_idprop_ui_prop_get(pb[control], "hinge", create=True)
prop["soft_min"] = 0.0
prop["soft_max"] = 1.0
-
+
# Constraints
con = pb[df1].constraints.new('COPY_LOCATION')
con.target = obj
@@ -263,24 +263,24 @@ def main(obj, bone_definition, base_names, options):
con = pb[df1].constraints.new('COPY_ROTATION')
con.target = obj
con.subtarget = control
-
+
con = pb[org_f1].constraints.new('COPY_TRANSFORMS')
con.target = obj
con.subtarget = f1
-
+
con = pb[org_f2].constraints.new('COPY_TRANSFORMS')
con.target = obj
con.subtarget = f2
-
+
con = pb[org_f3].constraints.new('COPY_TRANSFORMS')
con.target = obj
con.subtarget = f3
-
+
if make_hinge:
con = pb[hinge].constraints.new('COPY_TRANSFORMS')
con.target = obj
con.subtarget = bb[org_f1].parent.name
-
+
hinge_driver_path = pb[control].path_to_id() + '["hinge"]'
fcurve = con.driver_add("influence", 0)
@@ -296,11 +296,11 @@ def main(obj, bone_definition, base_names, options):
mod.poly_order = 1
mod.coefficients[0] = 1.0
mod.coefficients[1] = -1.0
-
+
con = pb[control].constraints.new('COPY_LOCATION')
con.target = obj
con.subtarget = socket
-
+
# Create the drivers for the driver bones (control bone scale rotates driver bones)
controller_path = pb[control].path_to_id() # 'pose.bones["%s"]' % control_bone_name
@@ -349,7 +349,7 @@ def main(obj, bone_definition, base_names, options):
layer = list(arm.bones[bone_definition[0]].layer)
for bone_name in [f1, f2, f3]:
arm.bones[bone_name].layer = layer
-
+
layer = list(arm.bones[bone_definition[0]].layer)
bb[control].layer = layer