///////////////////////////////////////////////////////////////////////////// // renderManCurves.mel Version 1.0 by Andrew Osiow Copyright 2009 // // adds the necessary Attributes to make selected Curve Renderable with RenderMan for Maya // Creates a New RenderMan Shader Node to which a RSL Fur Shader can be connected. // // It's assumed that Render for Maya or RenderMan Studio has been loaded // and the user has selected a valid collection of Nurb Curves that // been converted from a pfx node. // ///////////////////////////////////////////////////////////////////////////// global proc renderManCurves () {// Creates a default RenderMan Shader string $selectedCurves[] = `ls -sl`; string $shapeNode[]; string $newRMShader =`shadingNode -asShader RenderManShader`; string $newRMShaderGrp =`sets -renderable true -noSurfaceShader true -empty -name ($newRMShader+"SG")`; connectAttr -f ($newRMShader+".outColor") ($newRMShaderGrp+".surfaceShader"); for ($curve in $selectedCurves) {// rebuild curve to 3rd degree - 2nd degree paint fx curves are not supported by RenderMan rebuildCurve -ch 0 -rpo 1 -rt 0 -end 1 -kr 2 -kcp 0 -kep 1 -kt 0 -s 0 -d 3 $curve; // getShape Node $shapeNode = `listRelatives -s $curve`; // add attributes to render curves addAttr -k true -w true -ln "rman__torattr___curveBaseWidth" -at "float" -dv 0.10 $shapeNode[0]; addAttr -k true -w true -ln "rman__torattr___curveTipWidth" -at "float" -dv 0.10 $shapeNode[0]; addAttr -k true -w true -ln "rman__torattr___customShadingGroup" -dt "string" $shapeNode[0]; // connect the curves up a renderMan Shader connectAttr -f ($newRMShaderGrp+".message") ($shapeNode[0]+".rman__torattr___customShadingGroup"); } }