Guys I've tried to copy paste a UV from one object to the other using maxscript, it worked but when it come to instanced object, it somewhat didn't paste it across all instance, but instead it paste it to only 1 specific instance mesh.
For example I have a mesh name Box_001, Box_002, Box_003, etc and all of them are instance to each other, then I have another same mesh BUT not instance to any of the rest name Box_CorrectUV, then I copy and paste the uv from Box_CorrectUV to the Box_001, and I get this:
I can drag and drop that modifier to below that thick line to apply to the rest of the instance and the maxscript listener give this this:
<div>addModifier $Box_002.baseObject (UVW_Mapping_Paste ())
deleteModifier $ 1</div>
Note that it add the modifier to the second instance mesh (Box_002) instead of itself (Box_001). But if I try to run this code myself, it doesn't work.
I kinda get that there is no UVW_Mapping_Paste modifier from the modifier list but even when I test it with this, the code still doesn't work:
addModifier $Box_002.baseObject ($.modifiers[1])
Anyone has idea of how to make this work? Or it's just one of the maxscript limitation that we can do nothing about.
Replies
This will copy UVs from Box001 to anything you have selected so you can at least do it all in one hit but you'll always get the paste modifier at the top of the stack.
Alternatively - you can simply manually move the UVW Mapping Paste modifier down below the grey bar and it'll be applied to all instances
If it's only 1 or 2 type of instance that's easy, but if you have around 50+ mesh in the scene which each of them have their own instances that will take some time.
Oh, actually, this works
it'd be better not to reference the modifiers by index but that'll come out in the wash.
the behaviour is a bit odd - I'm not sure why it needs a uvw modifier to start with - but i can't be boetherd to look very deeply into it.
The benefit of doing the above is that it will work on anything that the manual UVW copy will work on. Basically as long as the UV count matches up and the object class matches (i.e editable poly-editable poly, box-box etc.) it should "work"
@Eric Chadwick I can't instance the mesh to the Box_CorrectUV because the mesh's smoothing group was messed up due to export-import process. I'm using this method to do packing in IPackThat without messed up my original mesh's SG and vertex normal.
If that's not the issue I don't know - the command is new to me.
You do need the unwrap uvw there first but I'm honestly stumped as to why. It was adding it fine in script here (on 2019)
Probably the problem is the Max version as I'm still using 2017. Too bad nothing we can do about it.
In general, with Unwrap UVW and with Skin mods it's better to use modpanel.addmodtoselection with ui set to true. Because unwrap/skin doesn't initialize with addModifier.