How to select angle distortion in the "Unwrap UVW" editor by code,can someone help me?

How to select angle distortion in the "Unwrap UVW" editor by code,can someone help me?

2829024262
Contributor Contributor
1,115 Views
2 Replies
Message 1 of 3

How to select angle distortion in the "Unwrap UVW" editor by code,can someone help me?

2829024262
Contributor
Contributor

When I added a “Unwrap UVW” editor for a node,I can click the button "Open UV Editor" to open the "Edit UVWs" dialog.In this dialog,I can choose “CheckerPattern”,"TextureChecker" or "Pick Texture".What I'm trying to achieve is to select the angle distortion in the code, and then the distortion can be displayed on both the model and the texture.

 

But I searched all the relevant documentation, but I couldn't find any relevant solutions or interfaces.I tried to get the mapping code for the operation in the listener, but when I check the "angle distortion" in the combobox , the code in the listener is "$.modifiers[#unwrap_uvw].unwrap.setCurrentMap 2".

When I check the "CheckerPattern" in the combobox , the code that appears in the listener is still the same "$.modifiers[#unwrap_uvw].unwrap.setCurrentMap 2".

 

When I reuse this line of code in the listener, the effect he shows in max is just selected “CheckerPattern”.

In this case, obviously I can't check the angle distortion with code. I don't know if anyone can answer my questions.Thank you so much.

0 Likes
Accepted solutions (1)
1,116 Views
2 Replies
Replies (2)
Message 2 of 3

denisT.MaxDoctor
Advisor
Advisor
Accepted solution

 

fn change_edit_uvw_dropdown item:3 = 
(
	cb_hwnd = undefined
	d = windows.getChildHWND 0 "_InternalOption"
	if d != undefined do
	(
		hwnd = d[1]
		cb = for c in (windows.getChildrenHWND hwnd) where c[4] == "ComboBox" do exit with c
		
		if cb != ok do
		(
			cb_hwnd = cb[1]
			windows.sendmessage cb_hwnd (CB_SETCURSEL = 0x014E) item 0
			
			id = uiaccessor.getWindowResourceID cb_hwnd
			
			param = (bit.shift (CBN_SELENDOK = 9) 16) + (bit.and id 0xFFFF)
			windows.sendmessage (UIAccessor.GetParentWindow cb_hwnd) (WM_COMMAND = 0x0111) param cb_hwnd

			param = (bit.shift (CBN_SELCHANGE = 1) 16) + (bit.and id 0xFFFF)
			windows.sendmessage (UIAccessor.GetParentWindow cb_hwnd) (WM_COMMAND = 0x0111) param cb_hwnd
		)
	)
	cb_hwnd
)

max modify mode
modPanel.setCurrentObject $.modifiers[Unwrap_UVW] 
$.modifiers[Unwrap_UVW].edit()

--change_edit_uvw_dropdown item:0 -- #texture checker
--change_edit_uvw_dropdown item:1 -- #checker pattern
change_edit_uvw_dropdown item:3 -- #angle distortion
--change_edit_uvw_dropdown item:4 -- #area distortion

 

 

 

maybe there's something better  😀 

 

 

PS. but in general, it's better not to write code this way... unless you need it very badly 😉

 

0 Likes
Message 3 of 3

2829024262
Contributor
Contributor
Thank you very much for your reply, the solution you gave has solved my problem and has given me a lot of inspiration.Thank you again for your help.
0 Likes