Transfer UVs from one object to multiple objects MAYA
This past week I’ve been painstakingly UVing in maya some hard surface models that I’ve modeled for a new project I’m working on. One thing I found is that having a lot of repeated objects (for example buttons) transfering the UVs from one to the other was easy enough. Just go to Mesh > Transfer Attributes > Option Box and with the default options just change Sample space to Component in the Attribute Settings Tab and your set to go.

The problem comes when you have a million objects. You can’t do it in one go… You have to go object by object and do the same steps over and over again.
Luckily with the magic of python I wrote this trivial script that will do this for you. Just select the first object that has the correct UVs an then select all the other ones that you want to transfer the UVs to.
You’ll turn this:

into this:

With the click of a button (that button being the script in your shelf :D)
Well These next lines are what do it, you’ll see it’s so trivial that you’ll say I could’ve come up with that… :D So if you wanted here it is for you!
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 )
That’s it for today folks if you want to check more Programming stuff for maya just visit my programming portfolio or at nestorprado.com
Enjoy!



