Does anyone know of a tool that will take uv shells and move them into the 0-1 uv range without changing their relative positions in the uv editor. I'm cleaning up some messy props and artists have their shells scattered randomly sometimes 100 tiles away from zero, I'd like to click a magic button and get these back in 0-1 without having to fix any uv's after the fact.
Well, bugo, that moves it by exactly one unit, which isn't exactly what he's after, and it'd mean changing the number for every different amount you need to move each piece.
He wants a one-click solution for pieces of UV anywhere outside the 0-1 range.
To do this you'd need to query the selection, find how far outside the 0-1 range they are, and offset them back by the opposite amount.
Sounds like a fairly straightforward script, I might take a quick look now...
malcolm: Try this... I just threw it together in 20 minutes now but it seems to work fairly well on the stuff I tried it out on. It may be a bit slower on objects with tens of thousands of UVs... it will work on any selection, but it'll be fastest if you manually select the parts you want to move into the 0-1 range first.
Just copy this .mel file into your My Documents/maya/scripts/ folder, type rehash; into the MEL command line to refresh your script folder so that it picks it up (otherwise restart Maya).
Then make a selection and type mopGatherUVs; into the command line. You could create a shelf button for this command.
Let me know how it goes.
Obviously this is used at your discretion, I accept no responsibility for any loss of work as a result of using this script (although I can't imagine anything would break that much, and you probably saved recently anyway, right? ).
Well that was interesting, I downloaded that script and tried it out also. That may be handy somtime in the future. Does anyone know of a simlar script that would pack all the uvs in 0 to 1 space tight and equally spaced like in headus uv layout you can choose pack uvs.
Arriving late to the party, but, does anyone still have the MopGatherUV script? The link's 404, and I've been looking for something like this for days now.
hi there, i found the script via google, but it doesn't work for me. http://www.ldaustinart.com/paul//scripts/mopGatherUVs.mel
i select the shells i want to move and type in mopGatherUVs;
for a second a small window pops up, but the uvs stay exactly where they are and nothing else happens...
with some small changes it works for me now. thanks alot MoP!
// Procedure to automatically put UVs back inside the 0-1 range.
mopGatherUVs;
global proc mopGatherUVs()
{
// Check selection.
string $uvSel[] = `polyListComponentConversion -tuv`;
if ( !`size $uvSel` )
{
error "Please make a UV selection to gather into the 0-1 range.";
}
I have a problem with some models for a game, in the previous version I hat no problems with my models, but in the latest realese of the game I keep getting this error message on my models "Error: UVs out of range [-8,8]".
Question is, can I use this same procedure as "athyri" posted, or would this not work to correct these errors im getting ?
your not giveing us much info to go on, and also giveing us a error from a game engine you never told us about dosnt help much either since we dont know the requirements of that engine.
just use nightshade uv editor or uv delux they add this feature + many more. what feature of it do you need? it also wouldn't take long to get any of this features working on python for newer mayas as well
Replies
polyEditUV -u 1 -v 0 ;
Left
polyEditUV -u -1 -v 0 ;
and etc..
He wants a one-click solution for pieces of UV anywhere outside the 0-1 range.
To do this you'd need to query the selection, find how far outside the 0-1 range they are, and offset them back by the opposite amount.
Sounds like a fairly straightforward script, I might take a quick look now...
mopGatherUVs
Just copy this .mel file into your My Documents/maya/scripts/ folder, type rehash; into the MEL command line to refresh your script folder so that it picks it up (otherwise restart Maya).
Then make a selection and type mopGatherUVs; into the command line. You could create a shelf button for this command.
Let me know how it goes.
Obviously this is used at your discretion, I accept no responsibility for any loss of work as a result of using this script (although I can't imagine anything would break that much, and you probably saved recently anyway, right? ).
Cody I never had your toolset I just had random one off buttons you ripped out for me.
Haha this is actually what I was looking for. Thanks!
Arriving late to the party, but, does anyone still have the MopGatherUV script? The link's 404, and I've been looking for something like this for days now.
Thank you.
lod3, have you found it ? I'm looking for this script as well . Somebody please help !
Thank you !
http://www.ldaustinart.com/paul//scripts/mopGatherUVs.mel
i select the shells i want to move and type in mopGatherUVs;
for a second a small window pops up, but the uvs stay exactly where they are and nothing else happens...
// Procedure to automatically put UVs back inside the 0-1 range.
mopGatherUVs;
global proc mopGatherUVs()
{
// Check selection.
string $uvSel[] = `polyListComponentConversion -tuv`;
if ( !`size $uvSel` )
{
error "Please make a UV selection to gather into the 0-1 range.";
}
// Flatten component selection.
$uvSel = `ls -fl $uvSel`;
// Show progress.
progressWindow
-title "mopGatherUVs"
-status "Gathering UVs..."
-max `size $uvSel`
-min 0
-isInterruptable 1;
for ( $uv in $uvSel )
{
// Check for user cancel request.
if ( `progressWindow -q -isCancelled` )
{
break;
}
float $pos[] = `polyEditUV -q $uv`;
float $offsetU = 0;
float $offsetV = 0;
int $move = 0;
// Find U offset.
if ( $pos[ 0 ] < 0 )
{
$offsetU = 1 - trunc( $pos[ 0 ] );
$move = 1;
}
else if ( $pos[ 0 ] > 1 )
{
$offsetU = 0 - trunc( $pos[ 0 ] );
$move = 1;
}
// Find V offset.
if ( $pos[ 1 ] < 0 )
{
$offsetV = 1 - trunc( $pos[ 1 ] );
$move = 1;
}
else if ( $pos[ 1 ] > 1 )
{
$offsetV = 0 - trunc( $pos[ 1 ] );
$move = 1;
}
if ( $move )
{
select -r $uv;
polyEditUVShell -r 1 -u $offsetU -v $offsetV;
}
progressWindow -e -s 1;
}
// Finish progress.
progressWindow -ep;
}
I have a problem with some models for a game, in the previous version I hat no problems with my models, but in the latest realese of the game I keep getting this error message on my models "Error: UVs out of range [-8,8]".
Question is, can I use this same procedure as "athyri" posted, or would this not work to correct these errors im getting ?
greets
Jegge
http://www.creativecrash.com/maya/downloads/scripts-plugins/texturing/c/uvdeluxe
Just make sure it's set to Relative and X/Y will control up/down/left/right shell positioning. Moving it by 1 will shift everything 1 full tile.