Demo entry 5987107

A simple orient tool for Maya


Submitted by anonymous on Sep 12, 2016 at 19:42
Language: Python 3. Code size: 964 Bytes.

#Usage: select the desired control curve then the desired bone(s)
#Creates a control group then 
#duplicates, parents, snaps, orients and zeroes out the selected curve to the selected bones.
# by g-kak teaches typing

import maya.cmds as cmds

def orient_controls(ctrl_crv_src, bone):
    transform = cmds.xform(bone, q = True,ws = True, t = True)
    ctrl_grp = = True, n = str(bone) + "_ctrl_grp")
    cmds.move(transform[0],transform[1],transform[2], ctrl_grp)
    constraint = cmds.orientConstraint(bone, ctrl_grp)
    ctrl_crv = cmds.duplicate(ctrl_crv_src)
    cmds.move(0,0,0,ctrl_crv, os = True)
    control_constraint = cmds.orientConstraint(ctrl_crv, bone)
    cmds.rename(ctrl_crv, str(bone) + "_ctrl")

objects = = True)
for s in range(1,len(objects)):
       orient_controls(objects[0], objects[s])

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).