for source_locator in source_objects:
for target_joint in target_objects:
if source_locator.replace(source_prefix, "") == target_joint.replace(target_prefix, ""):
cmds.aimConstraint(target_joint, source_locator, aim=(0, 1, 0),mo=1)
source_prefix = "eyelid_joint_lower_parent_"
target_prefix = "lowerLidLoc_"
source_objects = cmds.ls(source_prefix + "*", type="transform")
target_objects = cmds.ls(target_prefix + "*", type="transform")
for source_locator in source_objects:
for target_joint in target_objects:
if source_locator.replace(source_prefix, "") == target_joint.replace(target_prefix, ""):
cmds.aimConstraint(target_joint, source_locator, aim=(0, 1, 0),mo=1)
sel = cmds.ls("upperLidLoc_*",fl = True)
new_list = sel[::2]
crv = "upper_lid_crv"
for s in new_list:
pos = cmds.xform(s, q = 1, ws = 1, t = 1)
u = getUParam (pos, crv)
name = s.replace ("Loc_", "Pci_")
pci = cmds.createNode("pointOnCurveInfo", n = name)
cmds.connectAttr(crv + '.worldSpace', pci + '.inputCurve')
cmds.setAttr(pci + '.parameter', u)
cmds.connectAttr(pci + '.position', s + '.t')
sel = cmds.ls("lowerLidLoc_*",fl = True)
new_list = sel[::2]
crv = "Lower_lid_crv"
for s in new_list:
pos = cmds.xform(s, q = 1, ws = 1, t = 1)
u = getUParam (pos, crv)
name = s.replace ("Loc_", "Pci_")
pci = cmds.createNode("pointOnCurveInfo", n = name)
cmds.connectAttr(crv + '.worldSpace', pci + '.inputCurve')
cmds.setAttr(pci + '.parameter', u)
cmds.connectAttr(pci + '.position', s + '.t')
curve_name = [("Lower_lid_crv"),("upper_lid_crv")]
for each in curve_name:
cmds.rebuildCurve(each,ch=1,rpo=0,rt=0,end=1,kr=0,kcp=0,kep=1,kt=0,s=7,d=2,tol=0.01)
cmds.delete (each, ch = 1)
cmds.rename('Lower_lid_crvrebuiltCurve1','Lower_lid_skin')
cmds.rename('upper_lid_crvrebuiltCurve1','upper_lid_skin')
cmds.delete ('Lower_lid_skin','upper_lid_skin', ch = 1)
# Convert the MEL command to Python
mel_command = 'wire -gw false -en 1.000000 -ce 0.000000 -li 0.000000 -w {0} {1};'.format("Lower_lid_skin", "Lower_lid_crv")
# Execute the MEL command as Python
mel.eval(mel_command)
# Convert the MEL command to Python
mel_command = 'wire -gw false -en 1.000000 -ce 0.000000 -li 0.000000 -w {0} {1};'.format("upper_lid_skin", "upper_lid_crv")
# Execute the MEL command as Python
mel.eval(mel_command)
list = [("Lower_lid_skin", "Lower_lid_BS"),("upper_lid_skin", "Lower_lid_close_BS"),("upper_lid_skin", "upper_lid_BS"),("Lower_lid_skin", "upper_lid_close_BS")]
for each in list:
cmds.duplicate(each[0], name=each[1])
list = [("Lower_lid_close_BS", "Lower_lid_BS","Lower_lid_blend"),("upper_lid_close_BS", "upper_lid_BS","upper"),("Lower_lid_BS", "Lower_lid_skin","Lower_lid_main_blend"),("upper_lid_BS", "upper_lid_skin","upper_lid_main_blend")]
for each in list:
cmds.blendShape(each[0],each[1],n = each[2], origin="world")
cmds.setAttr('Lower_lid_main_blend.Lower_lid_BS',1)
cmds.setAttr('upper_lid_main_blend.upper_lid_BS',1)
# Define the upper lid curve and the CV indices
curve_name = "upper_lid_skin"
cv_indices = [8, 7, 6, 5, 4, 3, 2, 1, 0]
# Create joints at the CV positions
joints_upper = []
for index in cv_indices:
# Get the world space position of the CV
cv_position = cmds.pointPosition(curve_name + ".cv[{0}]".format(index), w=True)
# Create a joint at the CV position
joint_name = cmds.joint(position=cv_position, name="upper_lid_crv_jnt{0}".format(index))
#joints.append(joint_name)
cmds.parent(w = True)
# Define the lower lid curve and the CV indices
curve_name = "Lower_lid_skin"
cv_indices = [8, 7, 6, 5, 4, 3, 2, 1, 0]
# Create joints at the CV positions
joints_lower = []
for index in cv_indices:
# Get the world space position of the CV
cv_position = cmds.pointPosition(curve_name + ".cv[{0}]".format(index), w=True)
# Create a joint at the CV position
joint_name = cmds.joint(position=cv_position, name="Lower_lid_crv_jnt{0}".format(index))
cmds.parent(w = True)
# Define the joint names and the curve name
joint_prefix = "upper_lid_crv_jnt"
curve_name = "upper_lid_skin"
# Create a list of joint names
joint_names_upper = ["{0}{1}".format(joint_prefix, i) for i in range(0, 9)]
# Bind skin to the curve with a skin influence of 1
cmds.skinCluster(joint_names_upper, curve_name, toSelectedBones=True, bindMethod=0, skinMethod=0, maximumInfluences=1)
# Define the joint names and the curve name
joint_prefix = "Lower_lid_crv_jnt"
curve_name = "Lower_lid_skin"
# Create a list of joint names
joint_names_lower = ["{0}{1}".format(joint_prefix, i) for i in range(0, 9)]
# Bind skin to the curve with a skin influence of 1
cmds.skinCluster(joint_names_lower, curve_name, toSelectedBones=True, bindMethod=0, skinMethod=0, maximumInfluences=1)
# Define the joint names and the radius of the control circles
joint_names = ["upper_lid_crv_jnt8", "upper_lid_crv_jnt6", "upper_lid_crv_jnt4", "upper_lid_crv_jnt2", "upper_lid_crv_jnt0",
"Lower_lid_crv_jnt6", "Lower_lid_crv_jnt4", "Lower_lid_crv_jnt2"]
controller_radius = 0.1 # Adjust the radius as needed
# Create circle controllers at joint positions
controllers = []
for joint_name in joint_names:
joint_position = cmds.xform(joint_name, query=True, translation=True, worldSpace=True)
cmds.circle(name=joint_name + "_ctrl", radius=controller_radius, normal=[0, 0, 1])
controllergroup = cmds.group(n=joint_name + '_grp')
cmds.xform(controllergroup, translation=joint_position, worldSpace=True)
list = [('upper_lid_crv_jnt8_ctrl','inr_corner_lid_ctrl'),('upper_lid_crv_jnt8_grp','inr_corner_lid_ctrl_grp'),('upper_lid_crv_jnt6_ctrl','upr_lid_01_ctrl'),('upper_lid_crv_jnt6_grp','upr_lid_01_ctrl_grp'),('upper_lid_crv_jnt4_ctrl','upr_lid_02_ctrl'),('upper_lid_crv_jnt4_grp','upr_lid_02_ctrl_grp'),('upper_lid_crv_jnt2_ctrl','upr_lid_03_ctrl'),('upper_lid_crv_jnt2_grp','upr_lid_03_ctrl_grp'),('upper_lid_crv_jnt0_ctrl','otr_corner_lid_ctrl'),('upper_lid_crv_jnt0_grp','otr_corner_lid_ctrl_grp'),('Lower_lid_crv_jnt6_ctrl','lwr_lid_01_ctrl'),('Lower_lid_crv_jnt6_grp','lwr_lid_01_ctrl_grp'),('Lower_lid_crv_jnt4_ctrl','lwr_lid_02_ctrl'),('Lower_lid_crv_jnt4_grp','lwr_lid_02_ctrl_grp'),('Lower_lid_crv_jnt2_ctrl','lwr_lid_03_ctrl'),('Lower_lid_crv_jnt2_grp','lwr_lid_03_ctrl_grp')]
for each in list:
cmds.rename(each[0],each[1])
list = [('inr_corner_lid_ctrl','Lower_lid_crv_jnt8'),('inr_corner_lid_ctrl','upper_lid_crv_jnt8'),('inr_corner_lid_ctrl','upper_lid_crv_jnt7'),('upr_lid_01_ctrl','upper_lid_crv_jnt7'),('upr_lid_01_ctrl','upper_lid_crv_jnt6'),('upr_lid_01_ctrl','upper_lid_crv_jnt5'),('upr_lid_02_ctrl','upper_lid_crv_jnt5'),('upr_lid_02_ctrl','upper_lid_crv_jnt4'),('upr_lid_02_ctrl','upper_lid_crv_jnt3'),('upr_lid_03_ctrl','upper_lid_crv_jnt3'),('upr_lid_03_ctrl','upper_lid_crv_jnt2'),('upr_lid_03_ctrl','upper_lid_crv_jnt1'),('otr_corner_lid_ctrl','upper_lid_crv_jnt1'),('otr_corner_lid_ctrl','Lower_lid_crv_jnt0'),('otr_corner_lid_ctrl','upper_lid_crv_jnt0'),('otr_corner_lid_ctrl','Lower_lid_crv_jnt1'),('lwr_lid_03_ctrl','Lower_lid_crv_jnt1'),('lwr_lid_03_ctrl','Lower_lid_crv_jnt2'),('lwr_lid_03_ctrl','Lower_lid_crv_jnt3'),('lwr_lid_02_ctrl','Lower_lid_crv_jnt3'),('lwr_lid_02_ctrl','Lower_lid_crv_jnt4'),('lwr_lid_02_ctrl','Lower_lid_crv_jnt5'),('lwr_lid_01_ctrl','Lower_lid_crv_jnt5'),('lwr_lid_01_ctrl','Lower_lid_crv_jnt7'),('inr_corner_lid_ctrl','Lower_lid_crv_jnt7'),('lwr_lid_01_ctrl','Lower_lid_crv_jnt6')]
for each in list:
cmds.parentConstraint(each[0],each[1],mo = True)
list = [('inr_corner_lid_ctrl'),('upr_lid_01_ctrl'),('upr_lid_01_ctrl'),('upr_lid_02_ctrl'),('upr_lid_03_ctrl'),('upr_lid_03_ctrl'),('otr_corner_lid_ctrl'),('lwr_lid_01_ctrl'),('lwr_lid_02_ctrl'),('lwr_lid_03_ctrl')]
for each in list:
cmds.setAttr(each + '.overrideEnabled' ,True)
cmds.setAttr(each + '.overrideColor' ,4)
cmds.setAttr(each + ".visibility" ,keyable = False, cb = False, lock = True)
cmds.setAttr(each + ".scaleX" ,keyable = False, cb = False, lock = True)
cmds.setAttr(each + ".scaleY" ,keyable = False, cb = False, lock = True)
cmds.setAttr(each + ".scaleZ" ,keyable = False, cb = False, lock = True)
cmds.setAttr(each + ".rotateX" ,keyable = False, cb = False, lock = True)
cmds.setAttr(each + ".rotateY" ,keyable = False, cb = False, lock = True)
cmds.setAttr(each + ".rotateZ" ,keyable = False, cb = False, lock = True)
cmds.addAttr('upr_lid_02_ctrl',sn='blink', min = 0, max=1 ,k=1)
cmds.addAttr('upr_lid_02_ctrl',sn='blinkHeight', min = 0, max=1 ,k=1)
cmds.shadingNode('condition',n = 'upr_lid_blink_cond',asUtility=1)
cmds.shadingNode('condition',n = 'lwr_lid_blink_cond',asUtility=1)
cmds.shadingNode('reverse',n = 'upr_lid_blink_rev',asUtility=1)
list = [('upr_lid_02_ctrl.blink','lwr_lid_blink_cond.colorIfFalseR'),('upr_lid_02_ctrl.blinkHeight','lwr_lid_blink_cond.colorIfTrueR'),('upr_lid_02_ctrl.blinkHeight','lwr_lid_blink_cond.firstTerm'),('upr_lid_02_ctrl.blink','lwr_lid_blink_cond.secondTerm'),('upr_lid_02_ctrl.blinkHeight','upr_lid_blink_rev.inputX'),('upr_lid_02_ctrl.blink','upr_lid_blink_cond.colorIfFalseR'),('upr_lid_blink_rev.outputX','upr_lid_blink_cond.colorIfTrueR'),('upr_lid_02_ctrl.blink','upr_lid_blink_cond.secondTerm'),('upr_lid_blink_rev.outputX','upr_lid_blink_cond.firstTerm'),('lwr_lid_blink_cond.outColorR','Lower_lid_blend.Lower_lid_close_BS'),('upr_lid_blink_cond.outColorR','upper.upper_lid_close_BS')]
for each in list:
cmds.connectAttr(each[0],each[1])
cmds.setAttr('lwr_lid_blink_cond.operation',4)
cmds.setAttr('upr_lid_blink_cond.operation',4)
cmds.setAttr('upr_lid_02_ctrl.blinkHeight',0.5)
locLowerSel = cmds.ls("lowerLidLoc_*",fl = True)
locLowerSelList = locLowerSel[::2]
cmds.group(n='lowerLidLoc_grp',em = True)
cmds.parent(locLowerSelList,'lowerLidLoc_grp')
locUpperSel = cmds.ls("upperLidLoc_*",fl = True)
locUpperSelList = locUpperSel[::2]
cmds.group(n='upperLidLoc_grp',em = True)
cmds.parent(locUpperSelList,'upperLidLoc_grp')
jntUpperSel = cmds.ls("eyelid_joint_upper_parent_*",fl = True)
jntUpperSelList = jntUpperSel[::2]
cmds.group(n='upperLidJnt_grp',em = True)
cmds.parent(jntUpperSelList,'upperLidJnt_grp')
jntLowerSel = cmds.ls("eyelid_joint_lower_parent_*",fl = True)
jntLowerSelList = jntLowerSel[::2]
cmds.group(n='lowerLidJnt_grp',em = True)
cmds.parent(jntLowerSelList,'lowerLidJnt_grp')
crvJntLowerSel = cmds.ls("Lower_lid_crv_jnt*",fl = True)
crvJntLowerSelList = crvJntLowerSel[::2]
cmds.group(n='lowerLidCrvJnt_grp',em = True)
cmds.parent(crvJntLowerSelList,'lowerLidCrvJnt_grp')
crvJntUpperSel = cmds.ls("upper_lid_crv_jnt*",fl = True)
crvJntUpperSelList = crvJntUpperSel[::2]
cmds.group(n='upperLidCrvJnt_grp',em = True)
cmds.parent(crvJntUpperSelList,'upperLidCrvJnt_grp')
list = [('lower_lid_crv_grp'),('upper_lid_crv_grp'),('lid_crv_grp'),('lid_ctrl_grp'),('lid_jnt_grp'),('lid_loc_grp'),('eyelid_grp')]
for each in list:
cmds.group(n=each,em = True)
list = [('upper_lid_crv','upper_lid_crv_grp'),('upper_lid_skin','upper_lid_crv_grp'),('upper_lid_BS','upper_lid_crv_grp'),('upper_lid_close_BS','upper_lid_crv_grp'),('upper_lid_skinBaseWire','upper_lid_crv_grp'),('Lower_lid_crv','lower_lid_crv_grp'),('Lower_lid_skin','lower_lid_crv_grp'),('Lower_lid_BS','lower_lid_crv_grp'),('Lower_lid_close_BS','lower_lid_crv_grp'),('Lower_lid_skinBaseWire','lower_lid_crv_grp'),('inr_corner_lid_ctrl_grp','lid_ctrl_grp'),('upr_lid_01_ctrl_grp','lid_ctrl_grp'),('upr_lid_02_ctrl_grp','lid_ctrl_grp'),('upr_lid_03_ctrl_grp','lid_ctrl_grp'),('otr_corner_lid_ctrl_grp','lid_ctrl_grp'),('lwr_lid_01_ctrl_grp','lid_ctrl_grp'),('lwr_lid_02_ctrl_grp','lid_ctrl_grp'),('lwr_lid_03_ctrl_grp','lid_ctrl_grp'),('upperLidJnt_grp','lid_jnt_grp'),('lowerLidJnt_grp','lid_jnt_grp'),('lowerLidCrvJnt_grp','lid_jnt_grp'),('upperLidCrvJnt_grp','lid_jnt_grp'),('lowerLidLoc_grp','lid_loc_grp'),('upperLidLoc_grp','lid_loc_grp'),('eye_display_loc','lid_loc_grp'),('lid_crv_grp','eyelid_grp'),('lid_ctrl_grp','eyelid_grp'),('lid_jnt_grp','eyelid_grp'),('lid_loc_grp','eyelid_grp'),('upper_lid_crv_grp','lid_crv_grp'),('lower_lid_crv_grp','lid_crv_grp')]
for each in list:
cmds.parent(each[0],each[1])
list = [('lid_crv_grp.visibility'),('lowerLidCrvJnt_grp.visibility'),('upperLidCrvJnt_grp.visibility'),('lid_loc_grp.visibility')]
for each in list:
cmds.setAttr(each,0)
print('Eyelid setup has created.')
def rename_left(*args):
existing_group_name = "eyelid_grp"
prefix = "l_"
objects_in_group = cmds.listRelatives(existing_group_name, allDescendents=True, fullPath=True) or []
for obj in objects_in_group:
new_name = prefix + obj.split("|")[-1]
cmds.rename(obj, new_name)
cmds.rename("eyelid_grp","l_eyelid_grp")
list = [('lowerLidPci_*'),('upperLidPci_*'),('upr_lid_blink_rev'),('lwr_lid_blink_cond'),('upr_lid_blink_cond'),('upper_lid_main_blend'),('upper'),('Lower_lid_main_blend'),('Lower_lid_blend')]
for each in list:
search_pattern = cmds.ls(each)
for obj in search_pattern:
new_name = prefix + obj
cmds.rename(obj, new_name)
# Define the target alias name, weight index, and blend shape node
target_alias_name = "l_Lower_lid_close_BS"
weight_index = 0
blend_shape_node = "l_Lower_lid_blend"
# Check if the alias already exists
current_alias_name = cmds.aliasAttr(blend_shape_node + '.w[' + str(weight_index) + ']', query=True)
if current_alias_name is not None:
# Rename the alias
cmds.aliasAttr(target_alias_name, blend_shape_node + '.w[' + str(weight_index) + ']')
print("Target alias renamed to:", target_alias_name)
else:
print("Alias does not exist. Cannot rename.")
# Define the target alias name, weight index, and blend shape node
target_alias_name = "l_upper_lid_close_BS"
weight_index = 0
blend_shape_node = "l_upper"
# Check if the alias already exists
current_alias_name = cmds.aliasAttr(blend_shape_node + '.w[' + str(weight_index) + ']', query=True)
if current_alias_name is not None:
# Rename the alias
cmds.aliasAttr(target_alias_name, blend_shape_node + '.w[' + str(weight_index) + ']')
print("Target alias renamed to:", target_alias_name)
else:
print("Alias does not exist. Cannot rename.")
# Define the target alias name, weight index, and blend shape node
target_alias_name = "l_Lower_lid_BS"
weight_index = 0
blend_shape_node = "l_Lower_lid_main_blend"
# Check if the alias already exists
current_alias_name = cmds.aliasAttr(blend_shape_node + '.w[' + str(weight_index) + ']', query=True)
if current_alias_name is not None:
# Rename the alias
cmds.aliasAttr(target_alias_name, blend_shape_node + '.w[' + str(weight_index) + ']')
print("Target alias renamed to:", target_alias_name)
else:
print("Alias does not exist. Cannot rename.")
# Define the target alias name, weight index, and blend shape node
target_alias_name = "l_upper_lid_BS"
weight_index = 0
blend_shape_node = "l_upper_lid_main_blend"
# Check if the alias already exists
current_alias_name = cmds.aliasAttr(blend_shape_node + '.w[' + str(weight_index) + ']', query=True)
if current_alias_name is not None:
# Rename the alias
cmds.aliasAttr(target_alias_name, blend_shape_node + '.w[' + str(weight_index) + ']')
print("Target alias renamed to:", target_alias_name)
else:
print("Alias does not exist. Cannot rename.")
print('Left eyelid has renamed.')
def rename_right(*args):
existing_group_name = "eyelid_grp"
prefix = "r_"
objects_in_group = cmds.listRelatives(existing_group_name, allDescendents=True, fullPath=True) or []
for obj in objects_in_group:
new_name = prefix + obj.split("|")[-1]
cmds.rename(obj, new_name)
cmds.rename("eyelid_grp","r_eyelid_grp")
list = [('lowerLidPci_*'),('upperLidPci_*'),('upr_lid_blink_rev'),('lwr_lid_blink_cond'),('upr_lid_blink_cond'),('upper_lid_main_blend'),('upper'),('Lower_lid_main_blend'),('Lower_lid_blend')]
for each in list:
search_pattern = cmds.ls(each)
for obj in search_pattern:
new_name = prefix + obj
cmds.rename(obj, new_name)
# Define the target alias name, weight index, and blend shape node
target_alias_name = "r_Lower_lid_close_BS"
weight_index = 0
blend_shape_node = "r_Lower_lid_blend"
# Check if the alias already exists
current_alias_name = cmds.aliasAttr(blend_shape_node + '.w[' + str(weight_index) + ']', query=True)
if current_alias_name is not None:
# Rename the alias
cmds.aliasAttr(target_alias_name, blend_shape_node + '.w[' + str(weight_index) + ']')
print("Target alias renamed to:", target_alias_name)
else:
print("Alias does not exist. Cannot rename.")
# Define the target alias name, weight index, and blend shape node
target_alias_name = "r_upper_lid_close_BS"
weight_index = 0
blend_shape_node = "r_upper"
# Check if the alias already exists
current_alias_name = cmds.aliasAttr(blend_shape_node + '.w[' + str(weight_index) + ']', query=True)
if current_alias_name is not None:
# Rename the alias
cmds.aliasAttr(target_alias_name, blend_shape_node + '.w[' + str(weight_index) + ']')
print("Target alias renamed to:", target_alias_name)
else:
print("Alias does not exist. Cannot rename.")
# Define the target alias name, weight index, and blend shape node
target_alias_name = "r_Lower_lid_BS"
weight_index = 0
blend_shape_node = "r_Lower_lid_main_blend"
# Check if the alias already exists
current_alias_name = cmds.aliasAttr(blend_shape_node + '.w[' + str(weight_index) + ']', query=True)
if current_alias_name is not None:
# Rename the alias
cmds.aliasAttr(target_alias_name, blend_shape_node + '.w[' + str(weight_index) + ']')
print("Target alias renamed to:", target_alias_name)
else:
print("Alias does not exist. Cannot rename.")
# Define the target alias name, weight index, and blend shape node
target_alias_name = "r_upper_lid_BS"
weight_index = 0
blend_shape_node = "r_upper_lid_main_blend"
# Check if the alias already exists
current_alias_name = cmds.aliasAttr(blend_shape_node + '.w[' + str(weight_index) + ']', query=True)
if current_alias_name is not None:
# Rename the alias
cmds.aliasAttr(target_alias_name, blend_shape_node + '.w[' + str(weight_index) + ']')
print("Target alias renamed to:", target_alias_name)
else:
print("Alias does not exist. Cannot rename.")
print('Rigft eyelid has renamed.')
def store_geometry_name(*args):
global geometry_field
selected = cmds.ls(selection=True)
if selected:
geometry_name = selected[0]
cmds.textField(geometry_field, edit=True, text=geometry_name)
print("Geometry Name:", geometry_name)
else:
cmds.textField(geometry_field, edit=True, text="")
print("No geometry selected.")
def store_head_joint_name(*args):
global head_joint_field
selected = cmds.ls(selection=True)
if selected:
head_joint_name = selected[0]
cmds.textField(head_joint_field, edit=True, text=head_joint_name)
print("Head Joint Name:", head_joint_name)
else:
cmds.textField(head_joint_field, edit=True, text="")
print("No head joint selected.")
def store_jaw_joint_name(*args):
global jaw_joint_field
selected = cmds.ls(selection=True)
if selected:
jaw_joint_name = selected[0]
cmds.textField(jaw_joint_field, edit=True, text=jaw_joint_name)
print("Jaw Joint Name:", jaw_joint_name)
else:
cmds.textField(jaw_joint_field, edit=True, text="")
print("No jaw joint selected.")
def create_upper_lip_edge():
selected_edges = cmds.ls(selection=True, flatten=True)
curves = cmds.polyToCurve(form=2, degree=1, ch=False)
curve = cmds.rename('upr_lip_crv')
cmds.rebuildCurve('upr_lip_crv',rpo=0,ch=1,rt=0,end=1,kr=0,kcp=1,kep=1,kt=0,d=3,tol=0.01)
cmds.rename('upr_lip_bound_crv')
cmds.delete('upr_lip_bound_crv', constructionHistory = True)
cmds.duplicate()
cmds.rename('upr_lip_sticky_crv')
cmds.duplicate()
cmds.rename('upr_lip_wire_crv')
head_joint_name = cmds.textField(head_joint_field, query=True, text=True)
blendshape_node = cmds.blendShape('upr_lip_bound_crv','upr_lip_sticky_crv', 'upr_lip_wire_crv', automatic=True)[0]
cmds.rename(blendshape_node, 'upperLip_wire_bShape')
list = [('upr_lip_crv'),('upr_lip_bound_crv'),('upr_lip_sticky_crv')]
for each in list:
cmds.setAttr(each+'.visibility',0)
cmds.setAttr('upperLip_wire_bShape.upr_lip_bound_crv',1)
cmds.setAttr('upperLip_wire_bShape.upr_lip_sticky_crv',1)
cmds.addAttr(head_joint_name, longName="Lf_Sticky_Lips", attributeType='double', minValue=0, maxValue=10, defaultValue=0)
cmds.setAttr(head_joint_name + '.Lf_Sticky_Lips', keyable=True)
cmds.addAttr(head_joint_name, longName="Rt_Sticky_Lips", attributeType='double', minValue=0, maxValue=10, defaultValue=0)
cmds.setAttr(head_joint_name + '.Rt_Sticky_Lips', keyable=True)
def create_lower_lip_edge():
selected_edges = cmds.ls(selection=True, flatten=True)
curves = cmds.polyToCurve(form=2, degree=1, ch=False)
curve = cmds.rename('lwr_lip_crv')
cmds.rebuildCurve('lwr_lip_crv',rpo=0,ch=1,rt=0,end=1,kr=0,kcp=1,kep=1,kt=0,d=3,tol=0.01)
cmds.rename('lwr_lip_bound_crv')
cmds.delete('lwr_lip_bound_crv', constructionHistory = True)
cmds.duplicate()
cmds.rename('lwr_lip_sticky_crv')
cmds.duplicate()
cmds.rename('lwr_lip_wire_crv')
blendshape_node = cmds.blendShape('lwr_lip_bound_crv','lwr_lip_sticky_crv', 'lwr_lip_wire_crv', automatic=True)[0]
cmds.rename(blendshape_node, 'lowerLip_wire_bShape')
list = [('lwr_lip_crv'),('lwr_lip_bound_crv'),('lwr_lip_sticky_crv')]
for each in list:
cmds.setAttr(each+'.visibility',0)
cmds.setAttr('lowerLip_wire_bShape.lwr_lip_bound_crv',1)
cmds.setAttr('lowerLip_wire_bShape.lwr_lip_sticky_crv',1)
def build_lip_setup():
head_joint_name = cmds.textField(head_joint_field, query=True, text=True)
lf_main_attr = (head_joint_name +".Lf_Sticky_Lips")
rt_main_attr = (head_joint_name +".Rt_Sticky_Lips")
upr_cv_count = cmds.getAttr('upr_lip_wire_crv.degree') + cmds.getAttr('upr_lip_wire_crv.spans') - 1
lwr_cv_count = cmds.getAttr('lwr_lip_wire_crv.degree') + cmds.getAttr('lwr_lip_wire_crv.spans') - 1
lip_val_list = [upr_cv_count, lwr_cv_count]
lip_name_list = ['upperLip', 'lowerLip']
name_counter = 0
for each in lip_val_list:
half_val = (each / 2) + 1
total_val = each + 1
div_val = 10.0 / half_val
counter = 0
while(counter<half_val):
lip_sr = cmds.shadingNode( 'setRange', asUtility=True, n='lf_' + lip_name_list[name_counter] + str(counter+1) + '_setRange')
cmds.setAttr(lip_sr + '.oldMaxX', (div_val * (counter+1)))
cmds.setAttr(lip_sr + '.oldMinX', (div_val * counter))
cmds.setAttr(lip_sr + '.maxX', 0)
cmds.setAttr(lip_sr + '.minX', 1)
if counter == (half_val - 1):
cmds.setAttr(lip_sr + '.minX', 0.5)
cmds.connectAttr(lf_main_attr, lip_sr + '.valueX', f=True)
lip_flip_sr = cmds.shadingNode( 'setRange', asUtility=True, n='lf_' + lip_name_list[name_counter] + '_flip' + str(counter+1) + '_setRange')
cmds.setAttr(lip_flip_sr + '.oldMaxX', 1)
if counter == (half_val - 1):
cmds.setAttr(lip_flip_sr + '.oldMaxX', 0.5)
cmds.setAttr(lip_flip_sr + '.oldMinX', 0)
cmds.setAttr(lip_flip_sr + '.maxX', 0)
cmds.setAttr(lip_flip_sr + '.minX', 1)
if counter == (half_val - 1):
cmds.setAttr(lip_flip_sr + '.minX', 0.5)
cmds.connectAttr(lip_sr + '.outValueX', lip_flip_sr + '.valueX', f=True)
if counter == (half_val - 1):
mid_pma = cmds.shadingNode( 'plusMinusAverage', asUtility=True, n='ct_' + lip_name_list[name_counter] + str(counter+1) + '_plusMinusAverage')
cmds.connectAttr(lip_sr + '.outValueX', mid_pma + '.input2D[0].input2Dx', f=True)
cmds.connectAttr(lip_flip_sr + '.outValueX', mid_pma + '.input2D[0].input2Dy', f=True)
else:
cmds.connectAttr(lip_sr + '.outValueX', lip_name_list[name_counter] + '_wire_bShape.inputTarget[0].inputTargetGroup[0].targetWeights[' + str(counter) + ']', f=True)
cmds.connectAttr(lip_flip_sr + '.outValueX', lip_name_list[name_counter] + '_wire_bShape.inputTarget[0].inputTargetGroup[1].targetWeights[' + str(counter) + ']', f=True)
counter = counter + 1
#div_val = 10.0 / 39
counter = half_val - 1
rev_counter = half_val
while(counter<total_val):
lip_sr = cmds.shadingNode( 'setRange', asUtility=True, n='rt_' + lip_name_list[name_counter] + str(counter+1) + '_setRange')
cmds.setAttr(lip_sr + '.oldMaxX', (div_val * rev_counter))
cmds.setAttr(lip_sr + '.oldMinX', (div_val * (rev_counter-1)))
cmds.setAttr(lip_sr + '.maxX', 0)
cmds.setAttr(lip_sr + '.minX', 1)
if counter == (half_val - 1):
cmds.setAttr(lip_sr + '.minX', 0.5)
cmds.connectAttr(rt_main_attr, lip_sr + '.valueX', f=True)
lip_flip_sr = cmds.shadingNode( 'setRange', asUtility=True, n='rt_' + lip_name_list[name_counter] + '_flip' + str(counter+1) + '_setRange')
cmds.setAttr(lip_flip_sr + '.oldMaxX', 1)
if counter == (half_val - 1):
cmds.setAttr(lip_flip_sr + '.oldMaxX', 0.5)
cmds.setAttr(lip_flip_sr + '.oldMinX', 0)
cmds.setAttr(lip_flip_sr + '.maxX', 0)
cmds.setAttr(lip_flip_sr + '.minX', 1)
if counter == (half_val - 1):
cmds.setAttr(lip_flip_sr + '.minX', 0.5)
cmds.connectAttr(lip_sr + '.outValueX', lip_flip_sr + '.valueX', f=True)
if counter == (half_val - 1):
cmds.connectAttr(lip_sr + '.outValueX', mid_pma + '.input2D[1].input2Dx', f=True)
cmds.connectAttr(lip_flip_sr + '.outValueX', mid_pma + '.input2D[1].input2Dy', f=True)
cmds.connectAttr(mid_pma + '.output2Dx', lip_name_list[name_counter] + '_wire_bShape.inputTarget[0].inputTargetGroup[0].targetWeights[' + str(int(counter)) + ']', f=True)
cmds.connectAttr(mid_pma + '.output2Dy', lip_name_list[name_counter] + '_wire_bShape.inputTarget[0].inputTargetGroup[1].targetWeights[' + str(int(counter)) + ']', f=True)
else:
cmds.connectAttr(lip_sr + '.outValueX', lip_name_list[name_counter] + '_wire_bShape.inputTarget[0].inputTargetGroup[0].targetWeights[' + str(int(counter)) + ']', f=True)
cmds.connectAttr(lip_flip_sr + '.outValueX', lip_name_list[name_counter] + '_wire_bShape.inputTarget[0].inputTargetGroup[1].targetWeights[' + str(int(counter)) + ']', f=True)
counter = counter + 1
rev_counter = rev_counter - 1
name_counter = name_counter + 1
upr_lip_wire_crv1 = cmds.duplicate("upr_lip_wire_crv", rr=True, name="upr_lip_wire_crv1")[0]
upr_lip_wire_crv2 = cmds.duplicate("upr_lip_wire_crv", rr=True, name="upr_lip_wire_crv2")[0]
cmds.xform(upr_lip_wire_crv1, cp=True)
cmds.xform(upr_lip_wire_crv2, cp=True)
cmds.setAttr(upr_lip_wire_crv1 + ".translateZ", 0.2)
cmds.setAttr(upr_lip_wire_crv2 + ".translateZ", -0.2)
lofted_surface = cmds.loft(upr_lip_wire_crv2, upr_lip_wire_crv1, ch=True, u=1, c=0, ar=True, d=3, ss=1, rn=0, po=0, rsn=True)[0]
cmds.rename('upperLip_ribbon')
cmds.delete('upr_lip_wire_crv1')
cmds.delete('upr_lip_wire_crv2')
lwr_lip_wire_crv1 = cmds.duplicate("lwr_lip_wire_crv", rr=True, name="lwr_lip_wire_crv1")[0]
lwr_lip_wire_crv2 = cmds.duplicate("lwr_lip_wire_crv", rr=True, name="lwr_lip_wire_crv2")[0]
cmds.xform(lwr_lip_wire_crv1, cp=True)
cmds.xform(lwr_lip_wire_crv2, cp=True)
cmds.setAttr(lwr_lip_wire_crv1 + ".translateZ", 0.2)
cmds.setAttr(lwr_lip_wire_crv2 + ".translateZ", -0.2)
lofted_surface = cmds.loft(lwr_lip_wire_crv2, lwr_lip_wire_crv1, ch=True, u=1, c=0, ar=True, d=3, ss=1, rn=0, po=0, rsn=True)[0]
cmds.rename('lowerLip_ribbon')
cmds.delete('lwr_lip_wire_crv1')
cmds.delete('lwr_lip_wire_crv2')
#upper lip
num_spans_u = cmds.getAttr('upperLip_ribbon.spansU')
for u in range(num_spans_u + 1):
cmds.select('upperLip_ribbon.sf[{}][0]'.format(u), add=True)
cmds.Rivet()
uvPinOut = cmds.ls(sl=True)
uvPin = uvPinOut.pop(0)
pinOutput_objects = cmds.ls("pinOutput*", type="transform")
pinOutput_objects.sort()
index = 1
for obj in pinOutput_objects:
new_name = "uprLipRivet{}".format(index)
cmds.rename(obj, new_name)
index += 1
cmds.select(clear=1)
locators = cmds.ls('uprLipRivet*', type='transform')
joints = []
for locator in locators:
position = cmds.xform(locator, query=True, translation=True, worldSpace=True)
joint = cmds.joint(position=position, name=locator.replace("uprLipRivet", "uprLipJoint"))
joints.append(joint)
joints = cmds.ls('uprLipJoint*', type='joint')
for joint in joints:
parent = cmds.listRelatives(joint, parent=True)
if parent and parent[0] != 'world':
cmds.parent(joint, world=True)
locators = cmds.ls('uprLipRivet*', type='transform')
joint = cmds.ls('uprLipJoint*', type='joint')
for locator, joint in zip(locators, joints):
cmds.parentConstraint(locator, joint, maintainOffset=True)
#lower lip
cmds.select(clear=1)
num_spans_u = cmds.getAttr('lowerLip_ribbon.spansU')
for u in range(num_spans_u + 1):
cmds.select('lowerLip_ribbon.sf[{}][0]'.format(u), add=True)
cmds.Rivet()
uvPinOut = cmds.ls(sl=True)
uvPin = uvPinOut.pop(0)
pinOutput_objects = cmds.ls("pinOutput*", type="transform")
pinOutput_objects.sort()
index = 1
for obj in pinOutput_objects:
new_name = "lwrLipRivet{}".format(index)
cmds.rename(obj, new_name)
index += 1
cmds.select(clear=1)
locators = cmds.ls('lwrLipRivet*', type='transform')
joints = []
for locator in locators:
position = cmds.xform(locator, query=True, translation=True, worldSpace=True)
joint = cmds.joint(position=position, name=locator.replace("lwrLipRivet", "lwrLipJoint"))
joints.append(joint)
joints = cmds.ls('lwrLipJoint*', type='joint')
for joint in joints:
parent = cmds.listRelatives(joint, parent=True)
if parent and parent[0] != 'world':
cmds.parent(joint, world=True)
locators = cmds.ls('lwrLipRivet*', type='transform')
joint = cmds.ls('lwrLipJoint*', type='joint')
for locator, joint in zip(locators, joints):
cmds.parentConstraint(locator, joint, maintainOffset=True)
cmds.select('upperLip_ribbon', replace=True)
cmds.select('upr_lip_wire_crv', add=True)
wire_deformer = cmds.wire('upperLip_ribbon',n='upperLipStickyWire', wire=cmds.ls(selection=True)[1])
cmds.setAttr('upperLipStickyWire.dropoffDistance[0]', 10)
cmds.select('lowerLip_ribbon', replace=True)
cmds.select('lwr_lip_wire_crv', add=True)
wire_deformer = cmds.wire('lowerLip_ribbon',n='lowerLipStickyWire', wire=cmds.ls(selection=True)[1])
cmds.setAttr('lowerLipStickyWire.dropoffDistance[0]', 10)
num_cvs = cmds.getAttr('lwr_lip_bound_crv.degree') + cmds.getAttr('lwr_lip_bound_crv.spans') + 1
num_joints = num_cvs // 4
for i in range(num_joints):
cv_index = i * 4
cv_position = cmds.pointPosition('lwr_lip_bound_crv.cv[{}]'.format(cv_index), world=True)
joint = cmds.joint(position=cv_position, name='lwr_lip_joint_{}'.format(i+1))
last_cv_position = cmds.pointPosition('lwr_lip_bound_crv.cv[{}]'.format(num_cvs - 1), world=True)
last_joint = cmds.joint(position=last_cv_position, name='lwr_lip_joint_{}'.format(num_joints + 1))
joints_to_unparent = cmds.ls('lwr_lip_joint_1', dag=True, type='joint')
for joint in joints_to_unparent:
cmds.parent(joint, world=True)
num_cvs = cmds.getAttr('upr_lip_bound_crv.degree') + cmds.getAttr('upr_lip_bound_crv.spans') + 1
num_joints = num_cvs // 4
for i in range(num_joints):
cv_index = i * 4
cv_position = cmds.pointPosition('upr_lip_bound_crv.cv[{}]'.format(cv_index), world=True)
joint = cmds.joint(position=cv_position, name='upr_lip_joint_{}'.format(i+1))
last_cv_position = cmds.pointPosition('upr_lip_bound_crv.cv[{}]'.format(num_cvs - 1), world=True)
last_joint = cmds.joint(position=last_cv_position, name='upr_lip_joint_{}'.format(num_joints + 1))
joints_to_unparent = cmds.ls('upr_lip_joint_1', dag=True, type='joint')
for joint in joints_to_unparent:
cmds.parent(joint, world=True)
cmds.select(['lwr_lip_joint_1', 'lwr_lip_joint_2', 'lwr_lip_joint_3', 'lwr_lip_joint_4', 'lwr_lip_joint_5', 'lwr_lip_joint_6', 'lwr_lip_joint_7', 'lwr_lip_bound_crv'], replace=True)
cmds.skinCluster(name='lwrLipSkinCrv')
cmds.select(['lwr_lip_joint_1', 'upr_lip_joint_2', 'upr_lip_joint_3', 'upr_lip_joint_4', 'upr_lip_joint_5', 'upr_lip_joint_6', 'lwr_lip_joint_7', 'upr_lip_bound_crv'], replace=True)
cmds.skinCluster(name='uprLipSkinCrv')
cmds.select(['lwr_lip_joint_1', 'lwr_lip_joint_7', 'lwr_lip_sticky_crv'], replace=True)
cmds.skinCluster(name='lwrLipStickySkinCrv')
cmds.select(['lwr_lip_joint_1', 'lwr_lip_joint_7', 'upr_lip_sticky_crv'], replace=True)
cmds.skinCluster(name='lwrLipStickySkinCrv')
def create_circle_controller(name, size=1):
circle = cmds.circle(name=name, ch=False, radius=size)[0]
cmds.setAttr(circle+'.overrideEnabled',1)
cmds.setAttr(circle + ".overrideColor" ,18)
return circle
def create_group(name):
return cmds.group(name=name, empty=True)
joint_names = ['lwr_lip_joint_1', 'lwr_lip_joint_2', 'lwr_lip_joint_3', 'lwr_lip_joint_4', 'lwr_lip_joint_5', 'lwr_lip_joint_6', 'lwr_lip_joint_7', 'upr_lip_joint_2', 'upr_lip_joint_3', 'upr_lip_joint_4', 'upr_lip_joint_5', 'upr_lip_joint_6']
for joint_name in joint_names:
controller_name = joint_name.replace('_joint', '_ctrl')
controller = create_circle_controller(controller_name)
group_name = controller_name.replace('_ctrl', '_grp')
controller_group = create_group(group_name)
cmds.matchTransform(controller_group, joint_name, pos=True)
cmds.parent(controller, controller_group)
list = [('lwr_lip_ctrl_1'),('lwr_lip_ctrl_2'),('lwr_lip_ctrl_3'),('lwr_lip_ctrl_4'),('lwr_lip_ctrl_5'),('lwr_lip_ctrl_6'),('lwr_lip_ctrl_7'),('upr_lip_ctrl_2'),('upr_lip_ctrl_3'),('upr_lip_ctrl_4'),('upr_lip_ctrl_5'),('upr_lip_ctrl_6')]
for each in list:
cmds.setAttr(each+'.translateX',0)
cmds.setAttr(each+'.translateY',0)
cmds.setAttr(each+'.translateZ',0)
controller_names = ['lwr_lip_ctrl_1','lwr_lip_ctrl_2','lwr_lip_ctrl_3','lwr_lip_ctrl_4','lwr_lip_ctrl_5','lwr_lip_ctrl_6','lwr_lip_ctrl_7','upr_lip_ctrl_2','upr_lip_ctrl_3','upr_lip_ctrl_4','upr_lip_ctrl_5','upr_lip_ctrl_6']
joint_names = ['lwr_lip_joint_1','lwr_lip_joint_2','lwr_lip_joint_3','lwr_lip_joint_4','lwr_lip_joint_5','lwr_lip_joint_6','lwr_lip_joint_7','upr_lip_joint_2','upr_lip_joint_3','upr_lip_joint_4','upr_lip_joint_5','upr_lip_joint_6']
for controller, joint in zip(controller_names, joint_names):
cmds.parentConstraint(controller, joint, maintainOffset=True)
list = [('lip_crv_grp'),('lip_ribbon_grp'),('lip_rivet_grp'),('lip_jnt_grp'),('lip_setup_grp')]
for each in list:
cmds.group(n=each,em=True)
list = [('lwr_lip_joint_1'),('lwr_lip_joint_2'),('lwr_lip_joint_3'),('lwr_lip_joint_4'),('lwr_lip_joint_5'),('upr_lip_joint_2'),('upr_lip_joint_3'),('upr_lip_joint_4')]
for each in list:
cmds.parent(each,'lip_jnt_grp')
list = ['upr_lip_wire_crv','lwr_lip_crv','lwr_lip_bound_crv','lwr_lip_sticky_crv','lwr_lip_wire_crv','upr_lip_crv','upr_lip_bound_crv','upr_lip_sticky_crv','upr_lip_wire_crvBaseWire','lwr_lip_wire_crvBaseWire']
for each in list:
cmds.parent(each,'lip_crv_grp')
list = [('lip_crv_grp','lip_setup_grp'),('lip_ribbon_grp','lip_setup_grp'),('lip_rivet_grp','lip_setup_grp'),('lip_jnt_grp','lip_setup_grp')]
for each in list:
cmds.parent(each[0],each[1])
cmds.setAttr('lip_setup_grp.visibility',0)
cmds.parent('upperLip_ribbon','lip_ribbon_grp')
cmds.parent('lowerLip_ribbon','lip_ribbon_grp')
uprLipRivet_objects = cmds.ls('uprLipRivet*', type='transform')
cmds.parent(uprLipRivet_objects,'lip_rivet_grp')
lwrLipRivet_objects = cmds.ls('lwrLipRivet*', type='transform')
cmds.parent(lwrLipRivet_objects,'lip_rivet_grp')
lwrLipJoint_objects = cmds.ls('lwrLipJoint*', type='transform')
cmds.parent(lwrLipJoint_objects,head_joint_name)
uprLipJoint_objects = cmds.ls('uprLipJoint*', type='transform')
cmds.parent(uprLipJoint_objects,head_joint_name)
def build_inner_eyebrow_locator(*args):
selection = cmds.ls(selection=True, flatten=True)
if not selection:
cmds.warning("Please select a vertex.")
return
vertex = selection[0]
vertex_position = cmds.pointPosition(vertex, world=True)
locator = cmds.spaceLocator(n='l_inr_eyebrow_loc')[0]
cmds.move(vertex_position[0], vertex_position[1], vertex_position[2], locator)
def build_middle_eyebrow_locator(*args):
selection = cmds.ls(selection=True, flatten=True)
if not selection:
cmds.warning("Please select a vertex.")
return
vertex = selection[0]
vertex_position = cmds.pointPosition(vertex, world=True)
locator = cmds.spaceLocator(n='l_mid_eyebrow_loc')[0]
cmds.move(vertex_position[0], vertex_position[1], vertex_position[2], locator)
def build_outer_eyebrow_locator(*args):
selection = cmds.ls(selection=True, flatten=True)
if not selection:
cmds.warning("Please select a vertex.")
return
vertex = selection[0]
vertex_position = cmds.pointPosition(vertex, world=True)
locator = cmds.spaceLocator(n='l_otr_eyebrow_loc')[0]
cmds.move(vertex_position[0], vertex_position[1], vertex_position[2], locator)
def build_cheek_locator(*args):
selection = cmds.ls(selection=True, flatten=True)
if not selection:
cmds.warning("Please select a vertex.")
return
vertex = selection[0]
vertex_position = cmds.pointPosition(vertex, world=True)
locator = cmds.spaceLocator(n='l_cheek_loc')[0]
cmds.move(vertex_position[0], vertex_position[1], vertex_position[2], locator)
def build_all(*args):
list = [('l_inr_eyebrow_loc'),('l_mid_eyebrow_loc'),('l_otr_eyebrow_loc'),('l_cheek_loc')]
for each in list:
cmds.duplicate(each)
list = [('l_inner_eyebrow_ctrl','l_inner_eyebrow_ctrl_grp'),('l_middle_eyebrow_ctrl','l_middle_eyebrow_ctrl_grp'),('l_outer_eyebrow_ctrl','l_outer_eyebrow_ctrl_grp'),('l_cheek_ctrl','l_cheek_ctrl_grp'),('r_inner_eyebrow_ctrl','r_inner_eyebrow_ctrl_grp'),('r_middle_eyebrow_ctrl','r_middle_eyebrow_ctrl_grp'),('r_outer_eyebrow_ctrl','r_outer_eyebrow_ctrl_grp'),('r_cheek_ctrl','r_cheek_ctrl_grp')]
for each in list:
circle = cmds.circle(n=each[0])
cmds.group(n=each[1])
list = [('l_inner_eyebrow_ctrl'),('l_middle_eyebrow_ctrl'),('l_outer_eyebrow_ctrl'),('l_cheek_ctrl'),('r_inner_eyebrow_ctrl'),('r_middle_eyebrow_ctrl'),('r_outer_eyebrow_ctrl'),('r_cheek_ctrl')]
for each in list:
cmds.setAttr(each + '.overrideEnabled',1)
cmds.setAttr(each + ".overrideColor" ,18)
list = [('l_inr_eyebrow_loc1','r_inr_eyebrow_loc'),('l_mid_eyebrow_loc1','r_mid_eyebrow_loc'),('l_otr_eyebrow_loc1','r_otr_eyebrow_loc'),('l_cheek_loc1','r_cheek_loc')]
for each in list:
cmds.rename(each[0],each[1])
cmds.group(n='r_eyebrow_cheek_loc_grp',em=True)
list = [('r_inr_eyebrow_loc'),('r_mid_eyebrow_loc'),('r_otr_eyebrow_loc'),('r_cheek_loc')]
for each in list:
cmds.parent(each,'r_eyebrow_cheek_loc_grp')
cmds.setAttr('r_eyebrow_cheek_loc_grp.scaleX',-1)
list = [('l_inr_eyebrow_loc','l_inner_eyebrow_ctrl_grp'),('l_mid_eyebrow_loc','l_middle_eyebrow_ctrl_grp'),('l_otr_eyebrow_loc','l_outer_eyebrow_ctrl_grp'),('l_cheek_loc','l_cheek_ctrl_grp'),('r_inr_eyebrow_loc','r_inner_eyebrow_ctrl_grp'),('r_mid_eyebrow_loc','r_middle_eyebrow_ctrl_grp'),('r_otr_eyebrow_loc','r_outer_eyebrow_ctrl_grp'),('r_cheek_loc','r_cheek_ctrl_grp')]
for each in list:
forDel = cmds.parentConstraint(each[0],each[1],mo=False)
cmds.delete(forDel)
list = [('l_inr_eyebrow_jnt'),('l_mid_eyebrow_jnt'),('l_otr_eyebrow_jnt'),('l_cheek_jnt'),('r_inr_eyebrow_jnt'),('r_mid_eyebrow_jnt'),('r_otr_eyebrow_jnt'),('r_cheek_jnt')]
for each in list:
cmds.joint(n=each)
list = [('l_inner_eyebrow_ctrl','l_inr_eyebrow_jnt'),('l_middle_eyebrow_ctrl','l_mid_eyebrow_jnt'),('l_outer_eyebrow_ctrl','l_otr_eyebrow_jnt'),('l_cheek_ctrl','l_cheek_jnt'),('r_inner_eyebrow_ctrl','r_inr_eyebrow_jnt'),('r_middle_eyebrow_ctrl','r_mid_eyebrow_jnt'),('r_outer_eyebrow_ctrl','r_otr_eyebrow_jnt'),('r_cheek_ctrl','r_cheek_jnt')]
for each in list:
forDel = cmds.parentConstraint(each[0],each[1],mo=False)
cmds.delete(forDel)
cmds.makeIdentity( 'l_inr_eyebrow_jnt', apply=True, translate=True, rotate=True )
list = [('l_inner_eyebrow_ctrl','l_inr_eyebrow_jnt'),('l_middle_eyebrow_ctrl','l_mid_eyebrow_jnt'),('l_outer_eyebrow_ctrl','l_otr_eyebrow_jnt'),('l_cheek_ctrl','l_cheek_jnt'),('r_inner_eyebrow_ctrl','r_inr_eyebrow_jnt'),('r_middle_eyebrow_ctrl','r_mid_eyebrow_jnt'),('r_outer_eyebrow_ctrl','r_otr_eyebrow_jnt'),('r_cheek_ctrl','r_cheek_jnt')]
for each in list:
cmds.parentConstraint(each[0],each[1],mo=False)
cmds.group(n='eyebrow_cheek_grp',em=True)
list = [('l_inr_eyebrow_jnt'),('l_mid_eyebrow_jnt'),('l_otr_eyebrow_jnt'),('l_cheek_jnt'),('r_inr_eyebrow_jnt'),('r_mid_eyebrow_jnt'),('r_otr_eyebrow_jnt'),('r_cheek_jnt')]
for each in list:
cmds.parent(each,'eyebrow_cheek_grp')
list = [('l_inr_eyebrow_loc'),('l_mid_eyebrow_loc'),('l_otr_eyebrow_loc'),('l_cheek_loc'),('r_eyebrow_cheek_loc_grp')]
for each in list:
cmds.delete(each)
#------------------------------------------------------------------------------------------------#
# ______________ _____ ___ _____ . _______ _____ #
# | | \ \ / \ / / / \ | \ | | #
# | __________| \ \ / \ / / / \ | \ | | #
# | | \ \ / \ / / / \ | |\ \ | | #
# | |__________ \ \ / . \ / / / . \ | | \ \ | | #
# | | \ \ / / \ \ / / / / \ \ | | \ \ | | #
# | __________| \ \/ / \ \/ / / /___\ \ | | \ \ | | #
# | | \ / \ / / _____ \ | | \ \| | #
# | |__________ \ / \ / / / \ \ | | \ | #
# | | \ / \ / / / \ \ | | \ | #
# |______________| \__/ \__/ /___/ \___\ |___| \_____| #
# #
#------------------------------------------------------------------------------------------------#
ui()
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter