Home Technical Talk

Assign random vert colours in Maya? - anyone got a script?

polycounter lvl 6
Offline / Send Message
Beddall polycounter lvl 6
Hey,

Does anyone happen to have a script for Maya (2016) that will fill each object in a selection with a random vert colour?
Or know of a quicker way t do this than manually selecting them one by one, then changing the colour, then hitting apply colour, repeat...

Replies

  • Fansub
    Offline / Send Message
    Fansub sublime tool
    Just bind this to a hotkey and you're done :

    string $Objects[] = `ls -sl -fl`; // Store current selection
    for ($Obj in $Objects) { // Start a loop that will go through each object in your selection list
    select -r $Obj; // Select the first object in the loop
    polyColorPerVertex -rem ; // Remove any vertex color data on the selection
    float $Color[] = `rand <<1,1,1>>`; // Create 3 random floating numbers
    polyColorPerVertex -r $Color[0] -g $Color[1] -b $Color[2] -a 0 -rel -cdo; // Assign the random numbers to each RGB channel
    } // Close your loop
    select $Objects; // Reselect the original selection

    Also,you can bind the following line to a hotkey if you want to remove vertex color data on any given number of selected objects :

    polyColorPerVertex -rem ;






Sign In or Register to comment.