Home Coding, Scripting, Shaders

Vray #mel error

polycounter lvl 5
Offline / Send Message
Pinned
jayantbhatt007 polycounter lvl 5
Hi guys this command giving me an error I'm just trying to modify this code.

(ALL COPYRIGHT GOES TO RAMELLIJ)



CreateVRaymat ()

// CREATE VRAY MATERIAL
global proc CreateVRaymat () {
    string $objectSelected[] = `ls -sl`;
    string $shapes[] = `listRelatives $objectSelected`;
    string $text;
    string $result = `promptDialog
    -title "VRMtl"
    -message "Enter Name:"
    -button "OK" -button "Cancel"
    -defaultButton "OK" -cancelButton "Cancel"
    -dismissString "Cancel"`;  
    // variables
  
    if ($result == "OK") {
        $text = `promptDialog -query -text`;
        shadingNode -asShader VRayMtl;
    rename ($text + "_mat");
       
        sets -renderable true -noSurfaceShader true -empty -name ($text + "_matSG");
        connectAttr -f ($text + "_mat.outColor") ($text + "_matSG.surfaceShader");
    }   
    // if object selected
    if (`size($shapes)`!= 0) {
        int $sizeList = size($shapes);
        for($i=0;$i<$sizeList;++$i) {     
            sets -edit -forceElement ($text + "_matSG") ($shapes[$i]);
            }
        } 
    $warning = "VRMtl '" + $text + "_mat' created";
    warning -n $warning;
}

Replies

Sign In or Register to comment.