MaxScript $.modifiers[#unwrap_uvw].unwrap.setMapChannel 2

Hi

I try to get some data out of the two first map channels of one object via the unwrap modifier.
No problem for the first one. But, when I switch to map channel 2 I get wrong results, just like if by default $.modifiers[#unwrap_uvw].unwrap.setMapChannel 2 was “moving” the uv rather than “abandoning” it.
I have read on the web the unwrap modifier have some difficulties sometimes to refreshing and that using a forcecompleteredraw dodisabled:true will solve the problem… which is not true for my case.

Looks a bit weird, basically this simple:

addmodifier$ (unwrap_UVW())					
			$.modifiers[#unwrap_uvw].unwrap.setMapChannel 2			
			forcecompleteredraw dodisabled:true  <= this do not change anything actually	

Isnt working. It set well the channel to 2 in the UI but doesnt actually switch the uvs in second (like I said, just like if it was “moving” rather than “abandoning”).

This is quite frustrating as I get all my numbers good when I manually switch to the channel 2 and press “abandon”

Any ideas ?

Thanks
Bloby

OK ! found the solution just after posting :

$.modifiers[#unwrap_uvw].unwrap.reset ()

… that’s so wrong … they could at least put that in the help and best put it as a simple extra argument when you setchannel…

The issue is, it brings up an annoying query box asking if you want to do it or not, any way to make the script automatically say “yes” ?

You can use UIAccessor for that:

dialogMonitorOps.unRegisterNotification id:#unwrap_reset

fn confirmReset =
(
	local hwnd = dialogMonitorOps.getWindowHandle()

	if UIAccessor.GetWindowText hwnd == "Unwrap UVW" then
	(
		uiAccessor.pressDefaultButton()
		true
	)
	else false
)

dialogMonitorOps.enabled = true
dialogMonitorOps.interactive = false
dialogMonitorOps.registerNotification confirmReset id:#unwrap_reset
$.modifiers[#unwrap_uvw].reset()
dialogMonitorOps.enabled = false

Wonderful, problem solved then. Thank you very much : )

Bloby