Skip to content

Instantly share code, notes, and snippets.

@boredstiff
Created November 5, 2014 03:31
Show Gist options
  • Save boredstiff/5fd0a5599b309ac5bc36 to your computer and use it in GitHub Desktop.
Save boredstiff/5fd0a5599b309ac5bc36 to your computer and use it in GitHub Desktop.
Maya: Run through a directory of skinned maps, grab their names and output to a file with the proper commands.
#python
"""
Forgot to make a selection set of skinned bones before detaching the weights so I figured why waste 10 minutes
figuring out which bones to grab when I can just make Python do it in less than 2 minutes?
"""
import os
myDir = '/Users/alexwidener/projects/rigging/Ruslan/skins/skin1'
f = []
myControls = []
for (dirpath, dirnames, filenames) in os.walk(myDir):
f.extend(filenames)
break
outputFile = '/Users/alexwidener/Desktop/ruslanParts.txt'
with open(outputFile, 'w') as myFile:
for eachEntry in f:
if "Ruslan_Body_" in eachEntry:
eachEntry = eachEntry.replace("Ruslan_Body_", "").replace(".png", "")
myFile.write("cmds.select(\"" + eachEntry + "\", tgl=True)\n")
myFile.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment