Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Batch export UVs for all selected objects.
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