Search Maya Zest



Thursday, August 29, 2019

Apply subdivision node to all selected vray for maya objects

As you may know you have to apply a subdivision node to vray maya objects in order to render subd surfaces. You can do this manually per object but that could take a very long time if you have a lot.

So go to maya menu select>objects by type>geometry

to select all the objects in your scene. then paste this into the MEL port of your script editor and hit enter.

Boom they will all have the subD node now!




{
string $sel[] = `ls -sl -dag -s`;
for ($each in $sel){
if (`nodeType $each`=="mesh"){
print ("// adding VRay subdivision attributes to "+$each+"\n");
vrayAddAttr($each, "vraySubdivEnable");
vrayAddAttr($each, "vraySubdivUVsAtBorders");
}
}
}


You could modify other attributes like the subD count etc by using commands at the end.