Author : polygoo


Reply
Reply
 
Thread Tools Display Modes
eddybrown's Avatar
Old (#1)
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.

Code:
-- 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
else
	(
		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
	)
Offline , vertex, 31 Posts, Join Date Oct 2008, Location UK Send a message via MSN to eddybrown  
   Reply With Quote

monster's Avatar
Old (#2)
The unwrap modifier has problems refreshing it's state while a script is running. It works for me if you put this above the last line.

forcecompleteredraw dodisabled:true
Juan Martinez | Blog | Animator at Verse, Inc
Offline , polycounter, 953 Posts, Join Date Oct 2004, Location Dallas, TX USA Send a message via ICQ to monster Send a message via AIM to monster  
   Reply With Quote

eddybrown's Avatar
Old (#3)
Quote:
Originally Posted by monster View Post
The unwrap modifier has problems refreshing it's state while a script is running. It works for me if you put this above the last line.

forcecompleteredraw dodisabled:true
Legend. That works great thanks!
Offline , vertex, 31 Posts, Join Date Oct 2008, Location UK Send a message via MSN to eddybrown  
   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Copyright 1998-2012 A. Risch