proc EJL_uvShader() { string $sel[] = `ls -sl`; string $texPath = "T:/home/users/ericly/mayaSetups/8.5/Lyman/UV_mapper.jpg"; for ($x in $sel) { // create shader for object being manipulated if ( !`objExists "EJL_uv_shader"`) { string $shader = `shadingNode -asShader -n EJL_uv_shader lambert` ; string $sg = `sets -renderable true -noSurfaceShader true -empty -name EJL_uv_shaderSG`; connectAttr -f ($shader + ".outColor") ($sg + ".surfaceShader"); string $file = `shadingNode -asTexture file`; string $p2d = `shadingNode -asUtility place2dTexture`; connectAttr -f ($p2d + ".coverage") ($file + ".coverage"); connectAttr -f ($p2d + ".translateFrame") ($file + ".translateFrame"); connectAttr -f ($p2d + ".rotateFrame") ($file + ".rotateFrame"); connectAttr -f ($p2d + ".mirrorU") ($file + ".mirrorU"); connectAttr -f ($p2d + ".mirrorV") ($file + ".mirrorV"); connectAttr -f ($p2d + ".stagger") ($file + ".stagger"); connectAttr -f ($p2d + ".wrapU") ($file + ".wrapU"); connectAttr -f ($p2d + ".wrapV") ($file + ".wrapV"); connectAttr -f ($p2d + ".repeatUV") ($file + ".repeatUV"); connectAttr -f ($p2d + ".offset") ($file + ".offset"); connectAttr -f ($p2d + ".rotateUV") ($file + ".rotateUV"); connectAttr -f ($p2d + ".noiseUV") ($file + ".noiseUV"); connectAttr -f ($p2d + ".vertexUvOne") ($file + ".vertexUvOne"); connectAttr -f ($p2d + ".vertexUvTwo") ($file + ".vertexUvTwo"); connectAttr -f ($p2d + ".vertexUvThree") ($file + ".vertexUvThree"); connectAttr -f ($p2d + ".vertexCameraOne") ($file + ".vertexCameraOne"); connectAttr ($p2d + ".outUV") ($file + ".uv"); connectAttr ($p2d + ".outUvFilterSize") ($file + ".uvFilterSize"); source AEfileTemplate.mel; AEassignTextureCB ($file + ".fileTextureName") $texPath "image"; connectAttr -force ($file + ".outColor") ($shader + ".color"); setAttr ($shader + ".diffuse") 1; setAttr ($p2d + ".repeatU") 10; setAttr ($p2d + ".repeatV") 10; //setAttr ($shader + ".color") -type double3 0.721 0.716227 0.607803 ; // assign shader select -r $x; sets -e -forceElement $sg $x; } else { // just assign shader select -r $x; sets -e -forceElement "EJL_uv_shaderSG" $x; } // } }