[Closed] Reset UVW via script
Hi all
I have been hanging around the maxscript forums for months now and have learnt some awesome stuff from everyone here, so thanks for that to start with!
I have script that is used to reduce the number of times uvs tile in the V direction. It takes any face that has a UV over 16 tiles, appends them all together to a new array, detches them and moves them down by and integer so the mapping still works.
This works in max 8, in 2009 you need to hit the reset UVW button to see and edit the correct UVs, I cannot for the life of me figure out how to do this.
I have tried quiet mode and #nopromt to supress the pop up dialogue neither worked. The only way i can consider doing this is saving channel 1 out to a file, copying the UV channel that I want (4) to channel 1 modifying it, copying it back and re loading the saved file.
Hassle really, do i really have to do it this way or does someone know how to do it more easily
Hope that makes sense
Thanks in advance
Broomy
you can’t reset uvw via max script without popping up the query dialog, but you can press the “Yes” button and close it.
fn pressResetUVW modi: =
(
if modi == unsupplied do modi = modpanel.getcurrentobject()
if iskindof modi Unwrap_UVW do
(
DialogMonitorOPS.unRegisterNotification id:#resetWatcher
local enabled = DialogMonitorOPS.enabled
fn notification act:enabled =
(
hwnd = DialogMonitorOPS.GetWindowHandle()
if (UIAccessor.isWindow hwnd) and (UIAccessor.GetWindowText hwnd) == "Unwrap UVW" do
(
UIAccessor.PressButtonByName hwnd "&Yes"
)
DialogMonitorOPS.enabled = act
DialogMonitorOPS.unRegisterNotification id:#resetWatcher
)
enabled = DialogMonitorOPS.enabled
DialogMonitorOPS.RegisterNotification notification id:#resetWatcher
DialogMonitorOPS.enabled = on
modi.reset()
)
)
pressResetUVW()
Awesome thanks fella thats excellent!
I dont truly understand it at the moment but it definitely works
I shall now read on every command you have used
Thanks again !
I tried using this… and it seems that it takes too long for it to press yes before my script tries to go into SubObjectLevel 3. So then it resets the UV’s, but then never goes into SO 3…
Should I move my code into that function then?
Thanks!
Nevermind… I fixed it.
I was using the macro select all function that gets printed in the listener when the recorded is on.
But instead I’m using
uvMod.unwrap2.selectFaces #{1…theMesh.faces.count}
So I select all the faces that way. It works, so whatever