ScriptSpot

Forum topic · General Scripting

Switch lenght, height and width in uvmap

By Dragan_ilic · 2020-03-29

Description

Hello everyone,
i have a question, is it possible to switch the lenght parameters with the width and height parameters in the uvmap.
F.e. the lenght is 100 and the width is 50, so the script needs to switch the parameters to length:50 and width:100

Attachments
Comments (2)

Dragan_ilic · 2020-04-08

WOW, thank you very much.
You are the best

.

miauu · 2020-04-07

Switch length and height:


(
	global rol_miauu
	try(destroyDialog rol_miauu)catch()
	rollout rol_miauu "Switch UVWMap L/W/H"
	(
		button btn_switchLW "Switch Length and Width" width:150 align:#center
		button btn_switchLH "Switch Length and Height" width:150 align:#center
		button btn_switchWH "Switch Width and Height" width:150 align:#center
		
		on btn_switchLW pressed do
		(
			selObjsArr = selection as array
			if selObjsArr.count != 0 do
			(
				for o in selObjsArr where o.modifiers.count != 0 do
				(
					if classOf o.modifiers[1] == UVWMap do
					(
						swap o.modifiers[1].length o.modifiers[1].width
					)
				)
			)
		)
		
		on btn_switchLH pressed do
		(
			selObjsArr = selection as array
			if selObjsArr.count != 0 do
			(
				for o in selObjsArr where o.modifiers.count != 0 do
				(
					if classOf o.modifiers[1] == UVWMap do
					(
						swap o.modifiers[1].length o.modifiers[1].height
					)
				)
			)
		)
		
		on btn_switchWH pressed do
		(
			selObjsArr = selection as array
			if selObjsArr.count != 0 do
			(
				for o in selObjsArr where o.modifiers.count != 0 do
				(
					if classOf o.modifiers[1] == UVWMap do
					(
						swap o.modifiers[1].width o.modifiers[1].height
					)
				)
			)
		)
	)
	createdialog rol_miauu

)