#-------------------------------------------------------------------------------
# Name: YJ_Spine_Rig
# Purpose: Spine_Rig
#
# Author: YangJie
#
# Created: 10/07/2014
#Email: 691633493@
#-------------------------------------------------------------------------------
from YJ_Rig_Pub import*
from YJ_spline_ik import*
Spine_Jnt_List = YJ_Load_List('Spine_Jnt_List.pkl')
Hip_Jnt_List = YJ_Load_List('Hip_Jnt_List.pkl')
Spine_Ctrl_Nub = int(intFieldGrp('SpineCtrlSegIFG' ,q=1,v=1)[0])
Spine_IKFK_Type = radioCollection('Spine_radioCollection',q=1,sl=1)
def YJ_Hip_Rig():
ZeroCreate = YJRigZeroGrp([Hip_Jnt_List[0]])
parent(ZeroCreate,w=True )
Hip_Grp = rename(ZeroCreate[0], 'Hip_Grp' )
Hip_List = YJ_DuplicateJnt(Hip_Jnt_List,'jnt','anim')
ConstrnList = YJ_SetParentConstraint(Hip_List,Hip_Jnt_List)
YJ_CreateHip_Ctrl(Hip_List[0])
YJ_Scale_Shape(Hip_List,0.5)
def YJ_CreateHip_Ctrl(HipCtrl):
ZeroCreate = YJRigZeroGrp([HipCtrl])
YJ_Creat_Ctrl("Cur5","Hip_Cv")
YJ_Parent_Shape("Hip_Cv",HipCtrl,0,0)
def YJ_Spine_Rig():
ZeroCreate = YJRigZeroGrp([Spine_Jnt_List[0]])
parent(ZeroCreate,w=True )
Spine_Grp = rename(ZeroCreate[0], 'Spine_Grp' )
SpineIK_List = YJ_DuplicateJnt(Spine_Jnt_List,'jnt','SpineIK')
ConstrnList = YJ_SetParentConstraint(SpineIK_List,Spine_Jnt_List)
SpineCtrlLis,SpineCtrZeroGrplLis,Spine_O_All_grp= YJ_CreateSplineIK_All(SpineIK_List[0],SpineIK_List[-1],1,Spine_Ctrl_Nub)
YJ_Try_Parent(Spine_O_All_grp,Spine_Grp)
YJ_Scale_Shape(SpineCtrlLis,0.1)
YJ_Jud_Cre_SpineIKFKCtrl(SpineCtrlLis,SpineCtrZeroGrplLis)
return Spine_Grp
def YJ_Jud_Cre_SpineIKFKCtrl(SpineCtrlLis,SpineCtrZeroGrplLis):
if Spine_IKFK_Type != 'Spine_IK':
YJ_Connect_SpineAttr(SpineCtrlLis,SpineCtrZeroGrplLis)
else:
print 'ha'
def YJ_Spine_Fk_Ctrl(SpineCtrlLis,SpineCtrZeroGrplLis):
SpineCtrlPLis = SpineCtrlLis[:-1]
SpinGrpCharLis = SpineCtrZeroGrplLis[1:]
ParCosList = []
for i in range(len(SpineCtrlPLis)):
Cons = parentConstraint( SpineCtrlPLis[i],SpinGrpCharLis[i],w=1,mo=1)
ParCosList.append(Cons[0])
return ParCosList
def YJ_Connect_SpineAttr(SpineCtrlLis,SpineCtrZeroGrplLis):
ParCosList = YJ_Spine_Fk_Ctrl(SpineCtrlLis,SpineCtrZeroGrplLis)
SpineAttr = YJ_Add_SpineIKFK_Attr(SpineCtrlLis[0])
SpineAttrStr = SpineCtrlLis[0] + "." + SpineAttr[1][1]
RevName = shadingNode('reverse',asUtility=1,n="Spine_Rev" )
connectAttr(SpineAttrStr,RevName+'.inputX')
for i in ParCosList:
Attr_i_LisAt = parentConstraint( i, q=1,wal=1)
Attr_i_Str =i+'.'+Attr_i_LisAt[0]
connectAttr(RevName+'.outputX',Attr_i_Str)
def YJ_Add_SpineIKFK_Attr(Ctrl):
AttrList=[['Kind','Basic'],['Bl','IKFK']]
YJ_AddAttr(Ctrl,AttrList)
return AttrList