Hi guys, this is a snippet from a tool I'm writing to streamline some processes for our artists. We have models are unwrapped on channel 1, then unwrapped on channel 3 for baking. Once we have baked a texture we drop channel 3 onto channel 1 and apply the baked texture. All pretty simple stuff!
Now I've basically tried to recreate the process in maxscript and hit a problem. When the object already has UVW modiifier in the stack on channel 3, it works fine. However if the stack is collapsed, I would expect my code to add a unwrap modifier go to channel 3 and reset, then move that to channel 1. What it actually does is change the modifier to channel 1 without actually moving the UVs.
I'm using max 2012.
-- check if UV Modifier exists
if (ClassOf $.modifiers) == unwrap_uvw then
print ("unwrap modifier exists")
-- uvw modifier exists, assume it's on channel 3, so set it to channel 1
--else add UV Modifier
--select channel 3, then reset UV then channel 1
print ("no unwrap modifier exists")
-- add uvw modifier
modPanel.addModToSelection (Unwrap_UVW ()) ui:on
-- set uvw channel to 3
-- reset uvws
-- set uvw channel to 1