ScriptSpot

Forum topic · General Scripting

Move random UV

By titane357 · 2016-02-12

Description

Hi,

I would like to move randomly selected faces in unwrap modifier.

I can move ALL selected faces randomly :
$.modifiers[#unwrap_uvw].unwrap2.MoveSelected [ (random -10 10 )as integer, (random -10 10 )as integer ,0]

But I can't manage to make a loop, so each face would have a different value.

Can somebody help ?

Thanks

Comments (2)

titane357 · 2016-02-13

As usual it works like a charm... :-)

.

miauu · 2016-02-12

Modify this to fit your needs:


(
	uv = modpanel.getcurrentobject()
	if classof (uv) == Unwrap_UVW do
	(
		--	"get selected faces"
		selFacesBA  = uv.getSelectedFaces() 
		for f in selFacesBA do
		(
			uv.selectFaces #{f}
			uv.MoveSelected [ (random -10 10 )as integer, (random -10 10 )as integer ,0]			
		)
		uv.selectFaces selFacesBA
	)
	
)