View Full Version : UVW Channel moving

03 March 2012, 11:46 AM
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.

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 UVWs.

I'm using max 2012

-- check if UV Modifier exists
if (ClassOf $.modifiers[1]) == unwrap_uvw then
print ("unwrap modifier exists")
-- uvw modifier exists, assume it's on channel 3, so set it to channel 1
$.unwrap_uvw.unwrap.setMapChannel 0
--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
$.modifiers[#unwrap_uvw].unwrap.setMapChannel 3
-- reset uvws
$.modifiers[#unwrap_uvw].unwrap.reset ()
-- set uvw channel to 1
$.modifiers[#unwrap_uvw].unwrap.setMapChannel 0

CGTalk Moderation
03 March 2012, 11:46 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.