diff options
author | Lucio Rossi <lucio.rossi75@gmail.com> | 2016-07-28 19:32:36 +0300 |
---|---|---|
committer | Lucio Rossi <lucio.rossi75@gmail.com> | 2016-08-08 17:34:53 +0300 |
commit | 867321259dd0a1aff8cfc0d2a650321c2e0b4fde (patch) | |
tree | 286a4d965107825b9b7b65e807e2024c5b50add2 /rigify/rigs/pitchipoy/limbs | |
parent | 319a2dbf9ef26f7638bd0923ae5b5127aa91faaa (diff) |
Pitchipoy FK/IK switch implemented
Diffstat (limited to 'rigify/rigs/pitchipoy/limbs')
-rw-r--r-- | rigify/rigs/pitchipoy/limbs/ui.py | 126 |
1 files changed, 107 insertions, 19 deletions
diff --git a/rigify/rigs/pitchipoy/limbs/ui.py b/rigify/rigs/pitchipoy/limbs/ui.py index b086e666..894bf32f 100644 --- a/rigify/rigs/pitchipoy/limbs/ui.py +++ b/rigify/rigs/pitchipoy/limbs/ui.py @@ -1,13 +1,29 @@ -script = """ +script_arm = """ controls = [%s] tweaks = [%s] -ik_ctrl = '%s' +ik_ctrl = [%s] fk_ctrl = '%s' parent = '%s' # IK/FK Switch on all Control Bones if is_selected( controls ): layout.prop( pose_bones[ parent ], '["%s"]', slider = True ) + props = layout.operator("pose.rigify_arm_fk2ik_" + rig_id, text="Snap FK->IK (" + fk_ctrl + ")") + props.uarm_fk = controls[1] + props.farm_fk = controls[2] + props.hand_fk = controls[3] + props.uarm_ik = controls[0] + props.farm_ik = ik_ctrl[1] + props.hand_ik = controls[4] + props = layout.operator("pose.rigify_arm_ik2fk_" + rig_id, text="Snap IK->FK (" + fk_ctrl + ")") + props.uarm_fk = controls[1] + props.farm_fk = controls[2] + props.hand_fk = controls[3] + props.uarm_ik = controls[0] + props.farm_ik = ik_ctrl[1] + props.hand_ik = controls[4] + #props.pole = ik_arm[3] + # BBone rubber hose on each Respective Tweak for t in tweaks: @@ -23,14 +39,56 @@ if is_selected( fk_ctrl ): layout.prop( pose_bones[ parent ], '["%s"]', slider = True ) """ -def create_script( bones, limb_type=None): # limb_type arg is added for future fk/ik - # switch to add in UI scripts - # scripts are different between arms and - # legs and paws +script_leg = """ +controls = [%s] +tweaks = [%s] +ik_ctrl = [%s] +fk_ctrl = '%s' +parent = '%s' +# IK/FK Switch on all Control Bones +if is_selected( controls ): + layout.prop( pose_bones[ parent ], '["%s"]', slider = True ) + props = layout.operator("pose.rigify_leg_fk2ik_" + rig_id, text="Snap FK->IK (" + fk_ctrl + ")") + props.thigh_fk = controls[1] + props.shin_fk = controls[2] + props.foot_fk = controls[3] + props.mfoot_fk = controls[7] + props.thigh_ik = controls[0] + props.shin_ik = ik_ctrl[1] + props.foot_ik = ik_ctrl[2] + props.mfoot_ik = ik_ctrl[2] + props = layout.operator("pose.rigify_leg_ik2fk_" + rig_id, text="Snap IK->FK (" + fk_ctrl + ")") + props.thigh_fk = controls[1] + props.shin_fk = controls[2] + props.foot_fk = controls[3] + props.mfoot_fk = controls[7] + props.thigh_ik = controls[0] + props.shin_ik = ik_ctrl[1] + props.foot_ik = controls[6] + #props.pole = ik_leg[3] + props.footroll = controls[5] + props.mfoot_ik = ik_ctrl[2] + +# BBone rubber hose on each Respective Tweak +for t in tweaks: + if is_selected( t ): + layout.prop( pose_bones[ t ], '["%s"]', slider = True ) + +# IK Stretch on IK Control bone +if is_selected( ik_ctrl ): + layout.prop( pose_bones[ parent ], '["%s"]', slider = True ) + +# FK limb follow +if is_selected( fk_ctrl ): + layout.prop( pose_bones[ parent ], '["%s"]', slider = True ) +""" + +def create_script( bones, limb_type=None): # All ctrls have IK/FK switch controls = [ bones['ik']['ctrl']['limb'] ] + bones['fk']['ctrl'] controls += bones['ik']['ctrl']['terminal'] + controls += [ bones['fk']['mch'] ] controls_string = ", ".join(["'" + x + "'" for x in controls]) @@ -39,17 +97,47 @@ def create_script( bones, limb_type=None): # limb_type arg is added for fut tweaks_string = ", ".join(["'" + x + "'" for x in tweaks]) # IK ctrl has IK stretch - ik_ctrl = bones['ik']['ctrl']['terminal'][-1] - - return script % ( - controls_string, - tweaks_string, - ik_ctrl, - bones['fk']['ctrl'][0], - bones['parent'], - 'IK/FK', - 'rubber_tweak', - 'IK_Strertch', - 'FK_limb_follow' - ) + ik_ctrl = [ bones['ik']['ctrl']['terminal'][-1] ] + ik_ctrl += [ bones['ik']['mch_ik'] ] + ik_ctrl += [ bones['ik']['mch_target'] ] + + ik_ctrl_string = ", ".join(["'" + x + "'" for x in ik_ctrl]) + + if limb_type == 'arm': + return script_arm % ( + controls_string, + tweaks_string, + ik_ctrl_string, + bones['fk']['ctrl'][0], + bones['parent'], + 'IK/FK', + 'rubber_tweak', + 'IK_Strertch', + 'FK_limb_follow' + ) + + elif limb_type == 'leg': + return script_leg % ( + controls_string, + tweaks_string, + ik_ctrl_string, + bones['fk']['ctrl'][0], + bones['parent'], + 'IK/FK', + 'rubber_tweak', + 'IK_Strertch', + 'FK_limb_follow' + ) + elif limb_type == 'paw': + return script_leg % ( + controls_string, + tweaks_string, + ik_ctrl_string, + bones['fk']['ctrl'][0], + bones['parent'], + 'IK/FK', + 'rubber_tweak', + 'IK_Strertch', + 'FK_limb_follow' + ) |