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:
authorLucio Rossi <lucio.rossi75@gmail.com>2017-07-24 19:14:16 +0300
committerLucio Rossi <lucio.rossi75@gmail.com>2017-07-24 19:14:30 +0300
commit33b0e2e9025965133656dd85506bbef62ca3183d (patch)
tree52f2368a79623272cadf64a9c1ca3ac209176231 /rigify/rigs/limbs/leg.py
parent49230a4c122013bf851ab37b029e7d4f624d68ad (diff)
Rigify 0.5: new features, Animation Tools and Quat/Euler converter
small fixes & UI improvements
Diffstat (limited to 'rigify/rigs/limbs/leg.py')
-rw-r--r--rigify/rigs/limbs/leg.py104
1 files changed, 89 insertions, 15 deletions
diff --git a/rigify/rigs/limbs/leg.py b/rigify/rigs/limbs/leg.py
index 021f641b..6c76dd9f 100644
--- a/rigify/rigs/limbs/leg.py
+++ b/rigify/rigs/limbs/leg.py
@@ -5,7 +5,7 @@ from .ui import create_script
from .limb_utils import *
from mathutils import Vector
from ...utils import copy_bone, flip_bone, put_bone, create_cube_widget
-from ...utils import strip_org, make_deformer_name, create_widget
+from ...utils import strip_org, strip_mch, make_deformer_name, create_widget
from ...utils import create_circle_widget, create_sphere_widget, create_line_widget
from ...utils import MetarigError, make_mechanism_name, org
from ...utils import create_limb_widget, connected_children_names
@@ -363,7 +363,7 @@ class Rig:
# Rubber hose drivers
pb = self.obj.pose.bones
- for i,t in enumerate( tweaks[1:-1] ):
+ for i, t in enumerate(tweaks[1:-1]):
# Create custom property on tweak bone to control rubber hose
name = 'rubber_tweak'
@@ -406,18 +406,18 @@ class Rig:
def create_ik(self, parent):
org_bones = self.org_bones
- bpy.ops.object.mode_set(mode ='EDIT')
+ bpy.ops.object.mode_set(mode='EDIT')
eb = self.obj.data.edit_bones
ctrl = get_bone_name(org_bones[0], 'ctrl', 'ik')
mch_ik = get_bone_name(org_bones[0], 'mch', 'ik')
mch_target = get_bone_name(org_bones[0], 'mch', 'ik_target')
- for o, ik in zip( org_bones, [ ctrl, mch_ik, mch_target ] ):
- bone = copy_bone( self.obj, o, ik )
+ for o, ik in zip(org_bones, [ctrl, mch_ik, mch_target]):
+ bone = copy_bone(self.obj, o, ik)
- if org_bones.index(o) == len( org_bones ) - 1:
- eb[ bone ].length /= 4
+ if org_bones.index(o) == len(org_bones) - 1:
+ eb[bone].length /= 4
# Create MCH Stretch
mch_str = copy_bone(
@@ -687,6 +687,13 @@ class Rig:
else:
leg_parent = None
+ mch_name = get_bone_name(strip_org(org_bones[0]), 'mch', 'parent_socket')
+ mch_main_parent = copy_bone(self.obj, org_bones[0], mch_name)
+ eb[mch_main_parent].length = eb[org_bones[0]].length / 12
+ eb[mch_main_parent].parent = eb[bones['parent']]
+ eb[mch_main_parent].roll = 0.0
+ eb[bones['main_parent']].parent = eb[mch_main_parent]
+
# Create heel ctrl bone
heel = get_bone_name(org_bones[2], 'ctrl', 'heel_ik')
heel = copy_bone(self.obj, org_bones[2], heel)
@@ -948,6 +955,10 @@ class Rig:
'max_y' : 1.05,
'owner_space' : 'LOCAL'
})
+ make_constraint(self, mch_main_parent, {
+ 'constraint': 'COPY_ROTATION',
+ 'subtarget': org_bones[0]
+ })
# Create ik/fk switch property
pb_parent = pb[bones['main_parent']]
@@ -1291,6 +1302,55 @@ class Rig:
var.targets[0].data_path = \
owner.path_from_id() + '[' + '"' + prop + '"' + ']'
+ @staticmethod
+ def get_future_names(bones):
+
+ if len(bones) != 4:
+ return
+
+ names = dict()
+
+ thigh = strip_mch(strip_org(bones[0].name))
+ shin = strip_mch(strip_org(bones[1].name))
+ foot = strip_mch(strip_org(bones[2].name))
+ toe = strip_mch(strip_org(bones[3].name))
+
+ suffix = ''
+ if thigh[-2:] == '.L' or thigh[-2:] == '.R':
+ suffix = thigh[-2:]
+ thigh = thigh.rstrip(suffix)
+ shin = shin.rstrip(suffix)
+ foot = foot.rstrip(suffix)
+ toe = toe.rstrip(suffix)
+
+ # the following is declared in rig_ui
+ # controls = ['thigh_ik.R', 'thigh_fk.R', 'shin_fk.R', 'foot_fk.R', 'toe.R', 'foot_heel_ik.R', 'foot_ik.R',
+ # 'MCH-foot_fk.R', 'thigh_parent.R']
+ # tweaks = ['thigh_tweak.R.001', 'shin_tweak.R', 'shin_tweak.R.001']
+ # ik_ctrl = ['foot_ik.R', 'MCH-thigh_ik.R', 'MCH-thigh_ik_target.R']
+ # fk_ctrl = 'thigh_fk.R'
+ # parent = 'thigh_parent.R'
+ # foot_fk = 'foot_fk.R'
+ # pole = 'thigh_ik_target.R'
+
+ names['controls'] = [thigh + '_ik', thigh + '_fk', shin + '_fk', foot + '_fk', toe, foot + '_heel_ik',
+ foot + '_ik', make_mechanism_name(foot + '_fk'), thigh + '_parent']
+ names['ik_ctrl'] = [foot + '_ik', make_mechanism_name(thigh) + '_ik', make_mechanism_name(thigh) + '_ik_target']
+ names['fk_ctrl'] = thigh + '_fk' + suffix
+ names['parent'] = thigh + '_parent' + suffix
+ names['foot_fk'] = foot + '_fk' + suffix
+ names['pole'] = thigh + '_ik_target' + suffix
+
+ names['limb_type'] = 'leg'
+
+ if suffix:
+ for i, name in enumerate(names['controls']):
+ names['controls'][i] = name + suffix
+ for i, name in enumerate(names['ik_ctrl']):
+ names['ik_ctrl'][i] = name + suffix
+
+ return names
+
def generate(self):
bpy.ops.object.mode_set(mode='EDIT')
eb = self.obj.data.edit_bones
@@ -1414,7 +1474,9 @@ def parameters_ui(layout, params):
r = layout.row()
r.prop(params, "bbones")
- for layer in [ 'fk', 'tweak' ]:
+ bone_layers = bpy.context.active_pose_bone.bone.layers[:]
+
+ for layer in ['fk', 'tweak']:
r = layout.row()
r.prop(params, layer + "_extra_layers")
r.active = params.tweak_extra_layers
@@ -1423,23 +1485,35 @@ def parameters_ui(layout, params):
row = col.row(align=True)
for i in range(8):
- row.prop(params, layer + "_layers", index=i, toggle=True, text="")
+ icon = "NONE"
+ if bone_layers[i]:
+ icon = "LAYER_ACTIVE"
+ row.prop(params, layer + "_layers", index=i, toggle=True, text="", icon=icon)
row = col.row(align=True)
- for i in range(16,24):
- row.prop(params, layer + "_layers", index=i, toggle=True, text="")
+ for i in range(16, 24):
+ icon = "NONE"
+ if bone_layers[i]:
+ icon = "LAYER_ACTIVE"
+ row.prop(params, layer + "_layers", index=i, toggle=True, text="", icon=icon)
col = r.column(align=True)
row = col.row(align=True)
- for i in range(8,16):
- row.prop(params, layer + "_layers", index=i, toggle=True, text="")
+ for i in range(8, 16):
+ icon = "NONE"
+ if bone_layers[i]:
+ icon = "LAYER_ACTIVE"
+ row.prop(params, layer + "_layers", index=i, toggle=True, text="", icon=icon)
row = col.row(align=True)
- for i in range(24,32):
- row.prop(params, layer + "_layers", index=i, toggle=True, text="")
+ for i in range(24, 32):
+ icon = "NONE"
+ if bone_layers[i]:
+ icon = "LAYER_ACTIVE"
+ row.prop(params, layer + "_layers", index=i, toggle=True, text="", icon=icon)
def create_sample(obj):