Home Technical Talk

Maya Script - Randomly Flip UVS, in either X & Y direction

emesjay
polycounter lvl 5
Offline / Send Message
Pinned
emesjay polycounter lvl 5
As title says,

Does anyone know any scripts out there that achieve this?


Cheers!

Replies

  • Sean_P
    Options
    Offline / Send Message
    Sean_P polycounter lvl 3
    Hey,

    I've made 2 scripts

    Version 1 will flip x or y

    //Create an Array of selected objects<br>string $listtoflipped[] =`ls -sl -fl`;<br>//Get size of the array for the loop command<br>int $sizeofarrayflip= `size $listtoflipped`;<br><br>//Loop that will go though all of the objects in the array<br>for($L = 0; $L < $sizeofarrayflip; $L++) {<br>    //randomly creates a float between 1 and 2 but by making it an integer you only get either 1 or 2<br>    int $randomint = `rand 1 2.9`;<br>    //uses the random number to either flip x or y<br>    if ($randomint==1){<br>        polyFlipUV -flipType 0 -local on $listtoflipped[$L];<br>    }    <br>    if ($randomint==2){<br>        polyFlipUV -flipType 1 -local on $listtoflipped[$L];<br>    }<br>}


    Version 2 will flip x or y or not at all

    //Create an Array of selected objects<br>string $listtoflipped[] =`ls -sl -fl`;<br>//Get size of the array for the loop command<br>int $sizeofarrayflip= `size $listtoflipped`;<br>//Loop that will go though all of the objects in the array<br>for($L = 0; $L < $sizeofarrayflip; $L++) {<br>    //randomly creates a float between 1 and 2 but by making it an integer you only get either 1, 2 or 3<br>    int $randomint = `rand 1 3.9`;<br>    //uses the random number to either flip x or y or not at all<br>    if ($randomint==1){<br>        polyFlipUV -flipType 0 -local on $listtoflipped[$L];<br>    }    <br>    if ($randomint==2){<br>        polyFlipUV -flipType 1 -local on $listtoflipped[$L];<br>    }<br>    if ($randomint==3){<br><br>    }<br>}

    Hope that helps.
  • emesjay
    Options
    Offline / Send Message
    emesjay polycounter lvl 5
    Hey Sean, Thanks for that!

    Is it possible to make it flip the Objects UV Shell only, instead of the individual UV vertices itself?

    Cheers! :)
Sign In or Register to comment.