I am going to stat posting some code around here. If you don’t know, I mostly work in Autodesk Maya and I like to write my scripts in Python or PyMel. I am always writing a little snippet of code to handle mundane tasks, so I thought I would start posting those snippets for all to enjoy. I will of course be posting more advanced stuff at some point, but I figure I need to start this nerd party somewhere. One thing I tend to do a lot in my rigging is create and place some object and the position of my joints. In this case it’s locators. If you are totally new to Python in Maya, you will need to know these beginer tips.
1st Make sure you post this code in a Python script window.
2nd Make sure you import the Python commands library into your session with this. import maya.cmds as cmds
3rd Enjoy doing stuff faster.
joints = cmds.ls(sl=True)
for joint in joints:
lctrName = joint.replace('gjnt', 'lctr_ctrl')
jntPos = cmds.xform(joint, q=True, t=True, ws=True)
lctr = cmds.spaceLocator(n=lctrName, p=jntPos)