Copy paste UVs from one object to another


#1

Hi all,

I’m trying to copy paste UVs across two objects with similar topologies. One way is to copy and paste the Unwrap UVW modifier:

addModifier sourceObject(Unwrap_UVW())
copiedUnwrap = copy sourceObject.modifiers[1]
paste targetObject copiedUnwrap

The issue here is that the modifier is pasted, but the custom Unwrap layout isn’t. Another option is to run the save command from the modifier:

sourceObject.modifiers[#unwrap_uvw].unwrap.save()

However, this opens a dialog, and there aren’t any options exposed to specify a path.

Appreciate the help. Thanks


#2

Or more simple just selected 1st object with the correct uvs and with CTRL select the second object (the one you want to paste the uvs) and run this code:
NOTE that this is available only for the 1st UV channel.

if selection.count == 2 then (
	channelInfo.CopyChannel $[1] 3 1
	channelInfo.PasteChannel $[2] 3 1
)else()

from the mxs help: ChannelInfo.CopyChannel node channelType channel

Cheers!