Created
September 10, 2017 11:14
-
-
Save rondreas/a8b5ef677771c42dc14796a83adb7c7d to your computer and use it in GitHub Desktop.
Batch export UVs for all selected objects.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import maya.cmds as cmds | |
def batchUVSnapshot(fp, resolution, fileType): | |
# List all selected items | |
items = cmds.ls( selection = True, long = True ) | |
for item in items: | |
cmds.select( item, replace = True) | |
# Items will be unicod strings, and we're only interested | |
# in the part after the last "|" seperator. | |
itemName = str(item.split('|')[-1]) | |
cmds.uvSnapshot( | |
aa = True, | |
o = True, | |
name = fp + itemName, | |
fileFormat = fileType, | |
xResolution = resolution[0], | |
yResolution = resolution[1] | |
) | |
batchUVSnapshot( | |
"/home/pawa/Projects/ShootForTheMoon/res/", | |
[512, 512], | |
"png" | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment