Batch Constraint Joint to Controls
23 Jun 2024
For manual rigging. Building joints first then have the controls based on the joints.
Assumes that joints and controls are already existing with the corresponding related names.
For example, ear_jnt
and ear_con
import pymel.core as pm
obj_sel = pm.ls(sl=True)
for joint_obj in obj_sel:
joint_name = joint_obj.getName()
con_name = joint_name.split("_jnt")[0] + "_con"
con_obj = pm.PyNode(con_name)
pm.parentConstraint(con_obj, joint_obj, mo=True)
pm.scaleConstraint(con_obj, joint_obj, mo=True)
['tail_main_01_jnt', 'tail_main_02_jnt', 'tail_main_03_jnt', 'tail_top_01_M_jnt', 'tail_bot_01_M_jnt', 'tail_top_01_L_jnt', 'tail_bot_01_L_jnt', 'tail_out_01_L_jnt', 'tail_top_01_R_jnt', 'tail_bot_01_R_jnt', 'tail_out_01_R_jnt', 'spine_01_jnt', 'spine_02_jnt', 'chest_jnt', 'head_jnt', 'jaw_jnt', 'brow_01_L_jnt', 'brow_02_L_jnt', 'brow_03_L_jnt', 'brow_04_L_jnt', 'brow_01_R_jnt', 'brow_02_R_jnt', 'brow_03_R_jnt', 'brow_04_R_jnt', 'feather_A_00_L_jnt', 'feather_B_00_L_jnt', 'feather_C_00_L_jnt', 'feather_D_00_L_jnt', 'feather_E_00_L_jnt', 'feather_F_00_L_jnt', 'feather_G_00_L_jnt', 'feather_H_00_L_jnt', 'feather_A_00_R_jnt', 'feather_B_00_R_jnt', 'feather_C_00_R_jnt', 'feather_D_00_R_jnt', 'feather_E_00_R_jnt', 'feather_F_00_R_jnt', 'feather_G_00_R_jnt', 'feather_H_00_R_jnt',