Skip to content

Instantly share code, notes, and snippets.

@krclark
Created November 13, 2016 19:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save krclark/f37faf4cb764c2d7f5af156b09b10964 to your computer and use it in GitHub Desktop.
Save krclark/f37faf4cb764c2d7f5af156b09b10964 to your computer and use it in GitHub Desktop.
#creates planes at each joint under the variable "core" and constrains them to the joint
import maya.cmds as cmd
size = 30
length = 100
offset = 10;
core = "AnimData_Hips"
names="cloth"
cmd.polyPlane(n=names)
xhips = cmd.getAttr(core+".translateX", asString=False)
yhips = cmd.getAttr(core+".translateY", asString=False) + offset
zhips = cmd.getAttr(core".translateZ", asString=False)
cmd.move(xhips, yhips, zhips)
cmd.scale(size, length, length)
cmds.parentConstraint(core, names)
jointsAll = cmd.listRelatives(core, allDescendents=True)
jointsAll.reverse()
for place in jointsAll:
print(place+"\n")
coords = cmd.xform(place,q=True,ws=True,rp=True)
cmd.polyPlane(n=names+"_"+place)
cmd.scale(size, length, length)
xhips = coords[0]
yhips = coords[1]
zhips = coords[2]
cmd.move(xhips, yhips, zhips)
cmd.parentConstraint(place, names+"_"+place)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment