Python Scripting for Maya

I MIIIiiiight create a page on here just to gather cool scripts I find for maya so I can find them later...

So I was running into an issue with a scene where I built the UVs for a whole stack of stuff and placed them in a scene, and then I needed to change the UVs but only for a handful of them but it was a pain to go in and transfer them from one to another over and over so I looked online for a Python script that could do it for me automatically and lo and behold someone had indeed written such a thing.

Just click on the object with the "Correct" UVs, select everything else, then punch that script and blammo! Work done, now go have yourself a sammich.

Huge thanks to nestorprado on tumblr for figuring that out so my lazy butt didn't have to go back to Python 101 to figure it out from scratch.

http://nestorprado.tumblr.com/post/30271496202/multiple-uvs-maya

import maya.cmds as cm

#grab all the selected objects

selectedObjects = cm.ls(sl=True)

#save first one into variable

#pop first one out of the selected objects list

driver = selectedObjects.pop(0)

#for each object in the selected objects list

for object in selectedObjects:

cm.select([driver,object])

#transfer attributes

cm.transferAttributes(sampleSpace=4,transferUVs=2, transferColors=2 )