Skip to content

Instantly share code, notes, and snippets.

@bohdon
Last active August 23, 2021 20:59
Show Gist options
  • Save bohdon/df856b36969d242175b75f1a4d781f08 to your computer and use it in GitHub Desktop.
Save bohdon/df856b36969d242175b75f1a4d781f08 to your computer and use it in GitHub Desktop.
Maya snippet to snap controls to joints, update CONTROL_JOINT_MAP with your own mappings
import pymel.core as pm
def snap_ctls_to_joints(ctl_joint_map):
for ctl_name, joint_name in CONTROL_JOINT_MAP.items():
ctl = pm.PyNode(ctl_name)
joint = pm.PyNode(joint_name)
ctl.setMatrix(joint.wm.get(), worldSpace=True)
CONTROL_JOINT_MAP = {
"clavicle_ctl":"clavicle",
"upperarm_ctl":"upperarm",
"lowerarm_ctl":"lowerarm",
"hand_ctl":"hand",
}
snap_ctls_to_joints(CONTROL_JOINT_MAP)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment