Skip to content

Instantly share code, notes, and snippets.

@Dogydogsun
Last active May 20, 2022 20:58
Show Gist options
  • Save Dogydogsun/9584ad47d4a60346e47111840a2114b8 to your computer and use it in GitHub Desktop.
Save Dogydogsun/9584ad47d4a60346e47111840a2114b8 to your computer and use it in GitHub Desktop.
Script to skin all parts of the tank track to joints
sel = cmds.ls(sl=True)[0]
currentJoint = 0
joints = cmds.ls("L_chainTank_*_JNT")
currentV = 0
allSections = []
print("Script is running, please wait a minute")
for n in range(1, len(joints)+1):
currentSection = []
for f in range(0, 64):
currentSection.append([sel+".vtx[{}]".format(currentV)])
currentV+=1
allSections.append(currentSection)
print(allSections[0][0])
currentCluster = cmds.skinCluster(joints, sel, n=sel+"_cluster")[0]
for jnt in joints:
print("Applying to joint: " + str(jnt))
for vtx in range(0,64):
cmds.select(allSections[currentJoint][vtx])
cmds.skinPercent(currentCluster, transformValue=[(jnt, 1)])
currentJoint+=1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment