//------------------------------------------------------------------------------ //-- Aa_Move_UVs //-- //-- Randomly moves UVs from objects with the same name (in order to avoid //-- visible tilling on duplicated objects) //-- //-- Version : 1.0 //-- Author : Alexandre Aillet (webmaster@F-oeni-X.com) //-- Created : June 2004 //-- Updated : March 2005, july 2009. //-- //-- How-to : call 'Aa_Move_UVs()' from script editor or shelf command //------------------------------------------------------------------------------ //----------------------------------------------------------------------- //-- Aa_Move_UVs //----------------------------------------------------------------------- //-- Create an UI window //-- input : null //-- output : null //----------------------------------------------------------------------- global proc Aa_Move_UVs(){ window -t "Move UVs" -s 1 -mxb 0 -rtf 1 windowTransfer; columnLayout -adj 1 -cal "center"; textFieldGrp -cw 1 75 -adj 1 -cal 1 "center" -l "Objects name" objets; button -l "Move" -c "Move_UVs()"; showWindow windowTransfer; } //----------------------------------------------------------------------- //-- Move_UVs //----------------------------------------------------------------------- //-- Randomly moves UVs from objects with the same name //-- input : null //-- output : null //----------------------------------------------------------------------- global proc Move_UVs(){ select -cl; string $objs = substituteAllString(`textFieldGrp -q -tx objets`, " ", ""); string $noSuffix = `match ".*[^0-9]" $objs`; if($noSuffix!= ""){ string $obj; string $lsObjs[] = `ls -tr ($noSuffix + "*")`; for($obj in $lsObjs){ polySelectConstraint -type 0x0010 -shell true -mode 3; float $u = `rand 0 1`; float $v = `rand 0 1`; polyEditUV -u $u -v $v ; select -cl; } } else{ warning("No object found"); } }