Home Coding, Scripting, Shaders

Random color materail Maya #mel

polycounter lvl 8
Offline / Send Message
Pinned
jayantbhatt007 polycounter lvl 8

Hi, Suppose I made a blue blinn color material through MEL. There is anyway when I again click on the button it's assigning the random color or changing the color of the material from blue to Pink, Red kind off?

 

  1. <p>window;<br>frameLayout -label "jayant";<br>flowLayout -columnSpacing 7 -w 20 -h 50;<br>symbolButton -w 40 -h 40 -image "blinn.svg" -c "blue()" ;<br>showWindow;</p><p>//It will create blue mateial and assign it to your seleted objectttrFilter1</p><p>proc blue()</p><p>{<br>string $sel[] = `ls -sl`;<br>$blinn = `shadingNode -asShader blinn`;<br>setAttr ($blinn+".color") -type double3 0.15 0.35 1.0 ;<br>setAttr ($blinn+".specularRollOff") 0.3;<br>$blinnSG = `sets -renderable true -noSurfaceShader true -empty -name blinnSG`;<br>connectAttr -force ($blinn+".outColor") ($blinnSG+".surfaceShader");<br>select -r $sel;<br>hyperShade -assign $blinn;<br>}</p>

Replies

  • Tekoppar
    Offline / Send Message
    Tekoppar polycounter lvl 10
    1. window;<br> frameLayout -label "jayant";<br> flowLayout -columnSpacing 7 -w 20 -h 50;<br> symbolButton -w 40 -h 40 -image "blinn.svg" -c "blue()" ;<br> showWindow;//It will create blue mateial and assign it to your seleted objectttrFilter1proc <br> proc blue(){<br> string $sel[] = `ls -sl`;<br> $blinn = `shadingNode -asShader blinn`;<br> float $rCol = `rand 0 1`;<br> float $gCol = `rand 0 1`;<br> float $bCol = `rand 0 1`;<br> setAttr ($blinn+".color") -type double3 $rCol $gCol $bCol;<br> setAttr ($blinn+".specularRollOff") 0.3;<br> $blinnSG = `sets -renderable true -noSurfaceShader true -empty -name blinnSG`;<br> connectAttr -force ($blinn+".outColor") ($blinnSG+".surfaceShader");<br> select -r $sel;<br> hyperShade -assign $blinn;<br> }


  • jayantbhatt007
    Offline / Send Message
    jayantbhatt007 polycounter lvl 8
    Tekoppar said:
    1. window;<br> frameLayout -label "jayant";<br> flowLayout -columnSpacing 7 -w 20 -h 50;<br> symbolButton -w 40 -h 40 -image "blinn.svg" -c "blue()" ;<br> showWindow;//It will create blue mateial and assign it to your seleted objectttrFilter1proc <br> proc blue(){<br> string $sel[] = `ls -sl`;<br> $blinn = `shadingNode -asShader blinn`;<br> float $rCol = `rand 0 1`;<br> float $gCol = `rand 0 1`;<br> float $bCol = `rand 0 1`;<br> setAttr ($blinn+".color") -type double3 $rCol $gCol $bCol;<br> setAttr ($blinn+".specularRollOff") 0.3;<br> $blinnSG = `sets -renderable true -noSurfaceShader true -empty -name blinnSG`;<br> connectAttr -force ($blinn+".outColor") ($blinnSG+".surfaceShader");<br> select -r $sel;<br> hyperShade -assign $blinn;<br> }


    Hi thank you so much :)
Sign In or Register to comment.