Last active
December 26, 2015 16:49
-
-
Save Gi133/7182664 to your computer and use it in GitHub Desktop.
Joint Control Shape Python Script for Maya
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Joint Control Shape Script | |
| import maya.cmds as cmds | |
| #Declarations and stuff | |
| selected_joint_list = 0 | |
| name_stub = 0 | |
| offset_name = "_offset" | |
| #Get all selected joints | |
| selected_joint_list = cmds.ls("jnt_*", sl=True) | |
| #If no joints were selected then let the user know | |
| if selected_joint_list == 0: | |
| print "No joint selected. Deal with it!" | |
| else: | |
| #For each joint | |
| for _joint in selected_joint_list: | |
| name_stub = _joint.replace("jnt_", "") | |
| #Create a nurbs circle control shape for the joint | |
| cmds.circle( nr=(0, 1, 0), c=(0, 0, 0), n="ctrl_"+name_stub) | |
| #Create the group) | |
| cmds.group("ctrl_"+name_stub, n="grp_"+name_stub+offset_name) | |
| #Parent the group to the joint | |
| cmds.parent("grp_"+name_stub+offset_name, _joint) | |
| #Zero the values of the group | |
| cmds.xform(t=(0,0,0), ro=(1,1,1), s=(1,1,1)) | |
| #Unparent the group | |
| cmds.parent("grp_"+name_stub+offset_name, world=True) | |
| print "Done!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment