DV Artistic PxrSurface Material Generator

This is a script for Maya 2016, Maya 2017, and Maya 2018 for use with Renderman for Maya Versions 21.0 through 22.0.

Help page

Download the script here.

This script allows users to generate and populate popularly used channels on PxrSurface materials. No need to add Renderman Texture attributes or set color space. A variety of settings are available for select use.

This is for artistic metallic objects: hard opaque plastics, soft rubbers, clothing, cutlery, etc.

if(`window -exists DVpxrArtMatWindow`) {deleteUI DVpxrArtMatWindow ;} ;
window -rtf true -title "DualVission Artistic PxrSurface Master Window" DVpxrArtMatWindow ;
//"By selecting the one of the buttons below, excluding the cancel function, \nyou have verified you have enabled Renderman_for_Maya plugin." ;
columnLayout ;
textFieldGrp -l "Name of Material" -ed true -tx "defaultMat" matNameField ;
frameLayout -l "Map Selection" -cll false -cl false -w 392 ;
columnLayout ;
checkBoxGrp -l "Diffuse Map" -ed true -value1 true diffuseSelectBox ;
checkBoxGrp -l "Specular Face Map" -ed true -value1 true specFaceSelectBox ;
checkBoxGrp -l "Specular Edge Map" -ed true -value1 true specEdgeSelectBox ;
checkBoxGrp -l "Specular Roughness Map" -ed true -value1 true specRoughSelectBox ;
checkBoxGrp -l "Normal Map" -ed true -value1 true normSelectBox ;
setParent..;
setParent..;
frameLayout -l "Map Connection" -cll true -cl true -w 392 ;
columnLayout ;
checkBoxGrp -l "Connect Maps" -ed true -value1 false connectMapSelectBox ;
textFieldGrp -l "Relative File Path" -ed true -tx "sourceimages/" relativeFilePath ;
textFieldGrp -l "File Extension" -ed true -tx ".png" fileExtension ;
frameLayout -l "Naming Convention \(Cannot Be Changed\)" -cll true -cl false ;
textFieldGrp -l "Diffuse Map" -ed false -tx "_diffuse" ;
textFieldGrp -l "Specular Face Map" -ed false -tx "_specFace" ;
textFieldGrp -l "Specular Edge Map" -ed false -tx "_specEdge" ;
textFieldGrp -l "Specular Roughness Map" -ed false -tx "_specRough" ;
textFieldGrp -l "Normal Map" -ed false -tx "_normal" ;
setParent..;
setParent..;
setParent..;
frameLayout -l "Advanced Properties" -cll true -cl true -w 392 ;
frameLayout -l "Models and Directions" -cll false -cl false -w 392 ;
rowLayout -nc 2 ;
checkBoxGrp -l "Use Ggx Model \nover Beckmann Model" -ed true -value1 false ggxSelectBox ;
checkBoxGrp -l "OpenGL Normal Direction \nover DirectX Direction" -ed true -value1 false normDirectSelectBox ;
setParent..;
setParent..;
frameLayout -l "Roughness" -cll false -cl false -w 392 ;
rowLayout -nc 2 ;
checkBoxGrp -l "Connect Roughness \ninto Diffuse" -ed true -value1 false diffRoughSelectBox ;
checkBoxGrp -l "Use Rough Specular \nover Primary Specular" -ed true -value1 false primarySpecSelectBox ;
setParent..;
setParent..;
frameLayout -l "Force Version" -cll false -cl false -w 392 ;
columnLayout ;
checkBoxGrp -l "Force Version Number" -ed true -value1 false forceSelectBox ;
textFieldGrp -l "Override Number" -ed true -tx "" numberNameField;
setParent..;
setParent..;
setParent..;
frameLayout -l "Finalize" -cll false -cl false -w 392 ;
rowLayout -nc 3 ;
button -l "Create" -c "DVpxrArtMatCreator; deleteUI DVpxrArtMatWindow; " -w 131 ;
button -l "Apply" -c "DVpxrArtMatCreator" -w 131 ;
button -l "Cancel" -c "deleteUI DVpxrArtMatWindow" -w 130 ;
setParent..;
setParent..;
showWindow ;
proc DVpxrArtMatCreator(){
//Declare variable used throughout script
string $nameMat = `textFieldGrp -q -tx matNameField` ;
//Declare state of lines
float $testVersion ;
if(`checkBoxGrp -q -value1 forceSelectBox` == true)
{$testVersion = `textFieldGrp -q -tx numberNameField` ;}
else
{$testVersion = `rman getversion` ;} ;
int $testDiffuse ;
if(`checkBoxGrp -q -value1 diffuseSelectBox` == true)
{$testDiffuse = 1 ;}
else
{$testDiffuse = 0 ;} ;
int $testSpecFace ;
if(`checkBoxGrp -q -value1 specFaceSelectBox` == true)
{$testSpecFace = 1 ;}
else
{$testSpecFace = 0 ;} ;
int $testSpecEdge ;
if(`checkBoxGrp -q -value1 specEdgeSelectBox` == true)
{$testSpecEdge = 1 ;}
else
{$testSpecEdge = 0 ;} ;
int $testSpecRough ;
if(`checkBoxGrp -q -value1 specRoughSelectBox` == true)
{$testSpecRough = 1 ;}
else
{$testSpecRough = 0 ;} ;
int $testPrimary ;
if(`checkBoxGrp -q -value1 primarySpecSelectBox` == true)
{$testPrimary = 0 ;}
else
{$testPrimary = 1 ;} ;
int $testNormal ;
if(`checkBoxGrp -q -value1 normSelectBox` == true)
{$testNormal = 1 ;}
else
{$testNormal = 0 ;} ;
int $testGXG ;
if(`checkBoxGrp -q -value1 ggxSelectBox` == true)
{$testGXG = 1 ;}
else
{$testGXG = 0 ;} ;
int $testDiffRough ;
if(`checkBoxGrp -q -value1 diffRoughSelectBox` == true)
{$testDiffRough = 1 ;}
else
{$testDiffRough = 0 ;} ;
int $testNormDirect ;
if(`checkBoxGrp -q -value1 normDirectSelectBox` == true)
{$testNormDirect = 1 ;}
else
{$testNormDirect = 0 ;} ;
int $testConnect ;
string $filePath = `textFieldGrp -q -tx relativeFilePath` ;
string $fileType = `textFieldGrp -q -tx fileExtension` ;
if(`checkBoxGrp -q -value1 connectMapSelectBox` == true)
{$testConnect = 1 ;}
else
{$testConnect = 0 ;} ;
//create and connect pxrsurface nodes
shadingNode -asShader PxrSurface -name $nameMat ;
sets -renderable true -noSurfaceShader true -empty -name ($nameMat + "_SG");
connectAttr -f ($nameMat + ".outColor") ($nameMat + "_SG.surfaceShader");
if($testVersion < 22.0){
//test if a material's diffuse is enabled
if($testDiffuse == 1){
//Declare section variables
string $nameDiffuse = ($nameMat + "_diffuse") ;
string $nameDiffusePlace2d = ($nameDiffuse + "_Place2d") ;
//create and connect texture nodes
shadingNode -asTexture -isColorManaged file -name $nameDiffuse ;
shadingNode -asUtility place2dTexture -name $nameDiffusePlace2d ;
connectAttr -f ($nameDiffusePlace2d + ".coverage") ($nameDiffuse + ".coverage") ;
connectAttr -f ($nameDiffusePlace2d + ".translateFrame") ($nameDiffuse + ".translateFrame") ;
connectAttr -f ($nameDiffusePlace2d + ".rotateFrame") ($nameDiffuse + ".rotateFrame") ;
connectAttr -f ($nameDiffusePlace2d + ".mirrorU") ($nameDiffuse + ".mirrorU") ;
connectAttr -f ($nameDiffusePlace2d + ".mirrorV") ($nameDiffuse + ".mirrorV") ;
connectAttr -f ($nameDiffusePlace2d + ".stagger") ($nameDiffuse + ".stagger") ;
connectAttr -f ($nameDiffusePlace2d + ".wrapU") ($nameDiffuse + ".wrapU") ;
connectAttr -f ($nameDiffusePlace2d + ".wrapV") ($nameDiffuse + ".wrapV") ;
connectAttr -f ($nameDiffusePlace2d + ".repeatUV") ($nameDiffuse + ".repeatUV") ;
connectAttr -f ($nameDiffusePlace2d + ".offset") ($nameDiffuse + ".offset") ;
connectAttr -f ($nameDiffusePlace2d + ".rotateUV") ($nameDiffuse + ".rotateUV") ;
connectAttr -f ($nameDiffusePlace2d + ".noiseUV") ($nameDiffuse + ".noiseUV") ;
connectAttr -f ($nameDiffusePlace2d + ".vertexUvOne") ($nameDiffuse + ".vertexUvOne") ;
connectAttr -f ($nameDiffusePlace2d + ".vertexUvTwo") ($nameDiffuse + ".vertexUvTwo") ;
connectAttr -f ($nameDiffusePlace2d + ".vertexUvThree") ($nameDiffuse + ".vertexUvThree") ;
connectAttr -f ($nameDiffusePlace2d + ".vertexCameraOne") ($nameDiffuse + ".vertexCameraOne") ;
connectAttr ($nameDiffusePlace2d + ".outUV") ($nameDiffuse + ".uv") ;
connectAttr ($nameDiffusePlace2d + ".outUvFilterSize") ($nameDiffuse + ".uvFilterSize") ;
rmanAddAttr $nameDiffuse rman__tx2dFilter "0" ;
rmanAddAttr $nameDiffuse rman__tx2dSwidth "0" ;
rmanAddAttr $nameDiffuse rman__tx2dTwidth "0" ;
rmanAddAttr $nameDiffuse rman__tx2dLerp "0" ;
rmanAddAttr $nameDiffuse rman__applysRGB "1" ;
rmanAddAttr $nameDiffuse rman__unpremultiply "0" ;
//connect texture nodes to master nodes
connectAttr -f ($nameDiffuse + ".outColor") ($nameMat + ".diffuseColor");
if($testConnect == 1){
setAttr -type "string" ($nameDiffuse + ".fileTextureName") ($filePath + $nameDiffuse + $fileType) ;
} ;
} ;
//test if material is regular or rough specular
if($testPrimary == 1){
if($testGXG == 1){setAttr -type "string" ($nameMat + ".specularModelType") "Ggx" ;} ;
if($testSpecFace == 1){
string $nameSpecFace = ($nameMat + "_specFace") ;
string $nameSpecFacePlace2d = ($nameSpecFace + "_Place2d") ;
shadingNode -asTexture -isColorManaged file -name $nameSpecFace ;
shadingNode -asUtility place2dTexture -name $nameSpecFacePlace2d ;
connectAttr -f ($nameSpecFacePlace2d + ".coverage") ($nameSpecFace + ".coverage") ;
connectAttr -f ($nameSpecFacePlace2d + ".translateFrame") ($nameSpecFace + ".translateFrame") ;
connectAttr -f ($nameSpecFacePlace2d + ".rotateFrame") ($nameSpecFace + ".rotateFrame") ;
connectAttr -f ($nameSpecFacePlace2d + ".mirrorU") ($nameSpecFace + ".mirrorU") ;
connectAttr -f ($nameSpecFacePlace2d + ".mirrorV") ($nameSpecFace + ".mirrorV") ;
connectAttr -f ($nameSpecFacePlace2d + ".stagger") ($nameSpecFace + ".stagger") ;
connectAttr -f ($nameSpecFacePlace2d + ".wrapU") ($nameSpecFace + ".wrapU") ;
connectAttr -f ($nameSpecFacePlace2d + ".wrapV") ($nameSpecFace + ".wrapV") ;
connectAttr -f ($nameSpecFacePlace2d + ".repeatUV") ($nameSpecFace + ".repeatUV") ;
connectAttr -f ($nameSpecFacePlace2d + ".offset") ($nameSpecFace + ".offset") ;
connectAttr -f ($nameSpecFacePlace2d + ".rotateUV") ($nameSpecFace + ".rotateUV") ;
connectAttr -f ($nameSpecFacePlace2d + ".noiseUV") ($nameSpecFace + ".noiseUV") ;
connectAttr -f ($nameSpecFacePlace2d + ".vertexUvOne") ($nameSpecFace + ".vertexUvOne") ;
connectAttr -f ($nameSpecFacePlace2d + ".vertexUvTwo") ($nameSpecFace + ".vertexUvTwo") ;
connectAttr -f ($nameSpecFacePlace2d + ".vertexUvThree") ($nameSpecFace + ".vertexUvThree") ;
connectAttr -f ($nameSpecFacePlace2d + ".vertexCameraOne") ($nameSpecFace + ".vertexCameraOne") ;
connectAttr ($nameSpecFacePlace2d + ".outUV") ($nameSpecFace + ".uv") ;
connectAttr ($nameSpecFacePlace2d + ".outUvFilterSize") ($nameSpecFace + ".uvFilterSize") ;
rmanAddAttr $nameSpecFace rman__tx2dFilter "0" ;
rmanAddAttr $nameSpecFace rman__tx2dSwidth "0" ;
rmanAddAttr $nameSpecFace rman__tx2dTwidth "0" ;
rmanAddAttr $nameSpecFace rman__tx2dLerp "0" ;
rmanAddAttr $nameSpecFace rman__applysRGB "1" ;
rmanAddAttr $nameSpecFace rman__unpremultiply "0" ;
connectAttr -f ($nameSpecFace + ".outColor") ($nameMat + ".specularFaceColor");
if($testConnect == 1){
setAttr -type "string" ($nameSpecFace + ".fileTextureName") ($filePath + $nameSpecFace + $fileType) ;
} ;
} ;
if($testSpecEdge == 1){
string $nameSpecEdge = ($nameMat + "_specEdge") ;
string $nameSpecEdgePlace2d = ($nameSpecEdge + "_Place2d") ;
shadingNode -asTexture -isColorManaged file -name $nameSpecEdge ;
shadingNode -asUtility place2dTexture -name $nameSpecEdgePlace2d ;
connectAttr -f ($nameSpecEdgePlace2d + ".coverage") ($nameSpecEdge + ".coverage") ;
connectAttr -f ($nameSpecEdgePlace2d + ".translateFrame") ($nameSpecEdge + ".translateFrame") ;
connectAttr -f ($nameSpecEdgePlace2d + ".rotateFrame") ($nameSpecEdge + ".rotateFrame") ;
connectAttr -f ($nameSpecEdgePlace2d + ".mirrorU") ($nameSpecEdge + ".mirrorU") ;
connectAttr -f ($nameSpecEdgePlace2d + ".mirrorV") ($nameSpecEdge + ".mirrorV") ;
connectAttr -f ($nameSpecEdgePlace2d + ".stagger") ($nameSpecEdge + ".stagger") ;
connectAttr -f ($nameSpecEdgePlace2d + ".wrapU") ($nameSpecEdge + ".wrapU") ;
connectAttr -f ($nameSpecEdgePlace2d + ".wrapV") ($nameSpecEdge + ".wrapV") ;
connectAttr -f ($nameSpecEdgePlace2d + ".repeatUV") ($nameSpecEdge + ".repeatUV") ;
connectAttr -f ($nameSpecEdgePlace2d + ".offset") ($nameSpecEdge + ".offset") ;
connectAttr -f ($nameSpecEdgePlace2d + ".rotateUV") ($nameSpecEdge + ".rotateUV") ;
connectAttr -f ($nameSpecEdgePlace2d + ".noiseUV") ($nameSpecEdge + ".noiseUV") ;
connectAttr -f ($nameSpecEdgePlace2d + ".vertexUvOne") ($nameSpecEdge + ".vertexUvOne") ;
connectAttr -f ($nameSpecEdgePlace2d + ".vertexUvTwo") ($nameSpecEdge + ".vertexUvTwo") ;
connectAttr -f ($nameSpecEdgePlace2d + ".vertexUvThree") ($nameSpecEdge + ".vertexUvThree") ;
connectAttr -f ($nameSpecEdgePlace2d + ".vertexCameraOne") ($nameSpecEdge + ".vertexCameraOne") ;
connectAttr ($nameSpecEdgePlace2d + ".outUV") ($nameSpecEdge + ".uv") ;
connectAttr ($nameSpecEdgePlace2d + ".outUvFilterSize") ($nameSpecEdge + ".uvFilterSize") ;
rmanAddAttr $nameSpecEdge rman__tx2dFilter "0" ;
rmanAddAttr $nameSpecEdge rman__tx2dSwidth "0" ;
rmanAddAttr $nameSpecEdge rman__tx2dTwidth "0" ;
rmanAddAttr $nameSpecEdge rman__tx2dLerp "0" ;
rmanAddAttr $nameSpecEdge rman__applysRGB "1" ;
rmanAddAttr $nameSpecEdge rman__unpremultiply "0" ;
connectAttr -f ($nameSpecEdge + ".outColor") ($nameMat + ".specularEdgeColor");
if($testConnect == 1){
setAttr -type "string" ($nameSpecEdge + ".fileTextureName") ($filePath + $nameSpecEdge + $fileType) ;
} ;
} ;
if($testSpecRough == 1){
string $nameRough = ($nameMat + "_specRough") ;
string $nameRoughPlace2d = ($nameRough + "_Place2d") ;
shadingNode -asTexture -isColorManaged file -name $nameRough ;
shadingNode -asUtility place2dTexture -name $nameRoughPlace2d ;
connectAttr -f ($nameRoughPlace2d + ".coverage") ($nameRough + ".coverage") ;
connectAttr -f ($nameRoughPlace2d + ".translateFrame") ($nameRough + ".translateFrame") ;
connectAttr -f ($nameRoughPlace2d + ".rotateFrame") ($nameRough + ".rotateFrame") ;
connectAttr -f ($nameRoughPlace2d + ".mirrorU") ($nameRough + ".mirrorU") ;
connectAttr -f ($nameRoughPlace2d + ".mirrorV") ($nameRough + ".mirrorV") ;
connectAttr -f ($nameRoughPlace2d + ".stagger") ($nameRough + ".stagger") ;
connectAttr -f ($nameRoughPlace2d + ".wrapU") ($nameRough + ".wrapU") ;
connectAttr -f ($nameRoughPlace2d + ".wrapV") ($nameRough + ".wrapV") ;
connectAttr -f ($nameRoughPlace2d + ".repeatUV") ($nameRough + ".repeatUV") ;
connectAttr -f ($nameRoughPlace2d + ".offset") ($nameRough + ".offset") ;
connectAttr -f ($nameRoughPlace2d + ".rotateUV") ($nameRough + ".rotateUV") ;
connectAttr -f ($nameRoughPlace2d + ".noiseUV") ($nameRough + ".noiseUV") ;
connectAttr -f ($nameRoughPlace2d + ".vertexUvOne") ($nameRough + ".vertexUvOne") ;
connectAttr -f ($nameRoughPlace2d + ".vertexUvTwo") ($nameRough + ".vertexUvTwo") ;
connectAttr -f ($nameRoughPlace2d + ".vertexUvThree") ($nameRough + ".vertexUvThree") ;
connectAttr -f ($nameRoughPlace2d + ".vertexCameraOne") ($nameRough + ".vertexCameraOne") ;
connectAttr ($nameRoughPlace2d + ".outUV") ($nameRough + ".uv") ;
connectAttr ($nameRoughPlace2d + ".outUvFilterSize") ($nameRough + ".uvFilterSize") ;
rmanAddAttr $nameRough rman__tx2dFilter "0" ;
rmanAddAttr $nameRough rman__tx2dSwidth "0" ;
rmanAddAttr $nameRough rman__tx2dTwidth "0" ;
rmanAddAttr $nameRough rman__tx2dLerp "0" ;
rmanAddAttr $nameRough rman__applysRGB "0" ;
rmanAddAttr $nameRough rman__unpremultiply "0" ;
connectAttr -f ($nameRough + ".outAlpha") ($nameMat + ".specularRoughness");
if($testDiffRough == 1){connectAttr -f ($nameRough + ".outAlpha") ($nameMat + ".diffuseRoughness"); } ;
if($testConnect == 1){
setAttr -type "string" ($nameRough + ".fileTextureName") ($filePath + $nameRough + $fileType) ;
setAttr -type "string" ($nameRough + ".colorSpace") "Raw" ;
} ;
} ;
}
else {
if($testGXG == 1){setAttr -type "string" ($nameMat + ".specularModelType") "Ggx" ;} ;
if($testSpecFace == 1){
string $nameSpecFace = ($nameMat + "_specFace") ;
string $nameSpecFacePlace2d = ($nameSpecFace + "_Place2d") ;
shadingNode -asTexture -isColorManaged file -name $nameSpecFace ;
shadingNode -asUtility place2dTexture -name $nameSpecFacePlace2d ;
connectAttr -f ($nameSpecFacePlace2d + ".coverage") ($nameSpecFace + ".coverage") ;
connectAttr -f ($nameSpecFacePlace2d + ".translateFrame") ($nameSpecFace + ".translateFrame") ;
connectAttr -f ($nameSpecFacePlace2d + ".rotateFrame") ($nameSpecFace + ".rotateFrame") ;
connectAttr -f ($nameSpecFacePlace2d + ".mirrorU") ($nameSpecFace + ".mirrorU") ;
connectAttr -f ($nameSpecFacePlace2d + ".mirrorV") ($nameSpecFace + ".mirrorV") ;
connectAttr -f ($nameSpecFacePlace2d + ".stagger") ($nameSpecFace + ".stagger") ;
connectAttr -f ($nameSpecFacePlace2d + ".wrapU") ($nameSpecFace + ".wrapU") ;
connectAttr -f ($nameSpecFacePlace2d + ".wrapV") ($nameSpecFace + ".wrapV") ;
connectAttr -f ($nameSpecFacePlace2d + ".repeatUV") ($nameSpecFace + ".repeatUV") ;
connectAttr -f ($nameSpecFacePlace2d + ".offset") ($nameSpecFace + ".offset") ;
connectAttr -f ($nameSpecFacePlace2d + ".rotateUV") ($nameSpecFace + ".rotateUV") ;
connectAttr -f ($nameSpecFacePlace2d + ".noiseUV") ($nameSpecFace + ".noiseUV") ;
connectAttr -f ($nameSpecFacePlace2d + ".vertexUvOne") ($nameSpecFace + ".vertexUvOne") ;
connectAttr -f ($nameSpecFacePlace2d + ".vertexUvTwo") ($nameSpecFace + ".vertexUvTwo") ;
connectAttr -f ($nameSpecFacePlace2d + ".vertexUvThree") ($nameSpecFace + ".vertexUvThree") ;
connectAttr -f ($nameSpecFacePlace2d + ".vertexCameraOne") ($nameSpecFace + ".vertexCameraOne") ;
connectAttr ($nameSpecFacePlace2d + ".outUV") ($nameSpecFace + ".uv") ;
connectAttr ($nameSpecFacePlace2d + ".outUvFilterSize") ($nameSpecFace + ".uvFilterSize") ;
rmanAddAttr $nameSpecFace rman__tx2dFilter "0" ;
rmanAddAttr $nameSpecFace rman__tx2dSwidth "0" ;
rmanAddAttr $nameSpecFace rman__tx2dTwidth "0" ;
rmanAddAttr $nameSpecFace rman__tx2dLerp "0" ;
rmanAddAttr $nameSpecFace rman__applysRGB "1" ;
rmanAddAttr $nameSpecFace rman__unpremultiply "0" ;
connectAttr -f ($nameSpecFace + ".outColor") ($nameMat + ".roughSpecularFaceColor");
if($testConnect == 1){
setAttr -type "string" ($nameSpecFace + ".fileTextureName") ($filePath + $nameSpecFace + $fileType) ;
} ;
} ;
if($testSpecEdge == 1){
string $nameSpecEdge = ($nameMat + "_specEdge") ;
string $nameSpecEdgePlace2d = ($nameSpecEdge + "_Place2d") ;
shadingNode -asTexture -isColorManaged file -name $nameSpecEdge ;
shadingNode -asUtility place2dTexture -name $nameSpecEdgePlace2d ;
connectAttr -f ($nameSpecEdgePlace2d + ".coverage") ($nameSpecEdge + ".coverage") ;
connectAttr -f ($nameSpecEdgePlace2d + ".translateFrame") ($nameSpecEdge + ".translateFrame") ;
connectAttr -f ($nameSpecEdgePlace2d + ".rotateFrame") ($nameSpecEdge + ".rotateFrame") ;
connectAttr -f ($nameSpecEdgePlace2d + ".mirrorU") ($nameSpecEdge + ".mirrorU") ;
connectAttr -f ($nameSpecEdgePlace2d + ".mirrorV") ($nameSpecEdge + ".mirrorV") ;
connectAttr -f ($nameSpecEdgePlace2d + ".stagger") ($nameSpecEdge + ".stagger") ;
connectAttr -f ($nameSpecEdgePlace2d + ".wrapU") ($nameSpecEdge + ".wrapU") ;
connectAttr -f ($nameSpecEdgePlace2d + ".wrapV") ($nameSpecEdge + ".wrapV") ;
connectAttr -f ($nameSpecEdgePlace2d + ".repeatUV") ($nameSpecEdge + ".repeatUV") ;
connectAttr -f ($nameSpecEdgePlace2d + ".offset") ($nameSpecEdge + ".offset") ;
connectAttr -f ($nameSpecEdgePlace2d + ".rotateUV") ($nameSpecEdge + ".rotateUV") ;
connectAttr -f ($nameSpecEdgePlace2d + ".noiseUV") ($nameSpecEdge + ".noiseUV") ;
connectAttr -f ($nameSpecEdgePlace2d + ".vertexUvOne") ($nameSpecEdge + ".vertexUvOne") ;
connectAttr -f ($nameSpecEdgePlace2d + ".vertexUvTwo") ($nameSpecEdge + ".vertexUvTwo") ;
connectAttr -f ($nameSpecEdgePlace2d + ".vertexUvThree") ($nameSpecEdge + ".vertexUvThree") ;
connectAttr -f ($nameSpecEdgePlace2d + ".vertexCameraOne") ($nameSpecEdge + ".vertexCameraOne") ;
connectAttr ($nameSpecEdgePlace2d + ".outUV") ($nameSpecEdge + ".uv") ;
connectAttr ($nameSpecEdgePlace2d + ".outUvFilterSize") ($nameSpecEdge + ".uvFilterSize") ;
rmanAddAttr $nameSpecEdge rman__tx2dFilter "0" ;
rmanAddAttr $nameSpecEdge rman__tx2dSwidth "0" ;
rmanAddAttr $nameSpecEdge rman__tx2dTwidth "0" ;
rmanAddAttr $nameSpecEdge rman__tx2dLerp "0" ;
rmanAddAttr $nameSpecEdge rman__applysRGB "1" ;
rmanAddAttr $nameSpecEdge rman__unpremultiply "0" ;
connectAttr -f ($nameSpecEdge + ".outColor") ($nameMat + ".roughSpecularEdgeColor");
if($testConnect == 1){
setAttr -type "string" ($nameSpecEdge + ".fileTextureName") ($filePath + $nameSpecEdge + $fileType) ;
} ;
} ;
if($testSpecRough == 1){
string $nameRough = ($nameMat + "_specRough") ;
string $nameRoughPlace2d = ($nameRough + "_Place2d") ;
shadingNode -asTexture -isColorManaged file -name $nameRough ;
shadingNode -asUtility place2dTexture -name $nameRoughPlace2d ;
connectAttr -f ($nameRoughPlace2d + ".coverage") ($nameRough + ".coverage") ;
connectAttr -f ($nameRoughPlace2d + ".translateFrame") ($nameRough + ".translateFrame") ;
connectAttr -f ($nameRoughPlace2d + ".rotateFrame") ($nameRough + ".rotateFrame") ;
connectAttr -f ($nameRoughPlace2d + ".mirrorU") ($nameRough + ".mirrorU") ;
connectAttr -f ($nameRoughPlace2d + ".mirrorV") ($nameRough + ".mirrorV") ;
connectAttr -f ($nameRoughPlace2d + ".stagger") ($nameRough + ".stagger") ;
connectAttr -f ($nameRoughPlace2d + ".wrapU") ($nameRough + ".wrapU") ;
connectAttr -f ($nameRoughPlace2d + ".wrapV") ($nameRough + ".wrapV") ;
connectAttr -f ($nameRoughPlace2d + ".repeatUV") ($nameRough + ".repeatUV") ;
connectAttr -f ($nameRoughPlace2d + ".offset") ($nameRough + ".offset") ;
connectAttr -f ($nameRoughPlace2d + ".rotateUV") ($nameRough + ".rotateUV") ;
connectAttr -f ($nameRoughPlace2d + ".noiseUV") ($nameRough + ".noiseUV") ;
connectAttr -f ($nameRoughPlace2d + ".vertexUvOne") ($nameRough + ".vertexUvOne") ;
connectAttr -f ($nameRoughPlace2d + ".vertexUvTwo") ($nameRough + ".vertexUvTwo") ;
connectAttr -f ($nameRoughPlace2d + ".vertexUvThree") ($nameRough + ".vertexUvThree") ;
connectAttr -f ($nameRoughPlace2d + ".vertexCameraOne") ($nameRough + ".vertexCameraOne") ;
connectAttr ($nameRoughPlace2d + ".outUV") ($nameRough + ".uv") ;
connectAttr ($nameRoughPlace2d + ".outUvFilterSize") ($nameRough + ".uvFilterSize") ;
rmanAddAttr $nameRough rman__tx2dFilter "0" ;
rmanAddAttr $nameRough rman__tx2dSwidth "0" ;
rmanAddAttr $nameRough rman__tx2dTwidth "0" ;
rmanAddAttr $nameRough rman__tx2dLerp "0" ;
rmanAddAttr $nameRough rman__applysRGB "0" ;
rmanAddAttr $nameRough rman__unpremultiply "0" ;
connectAttr -f ($nameRough + ".outAlpha") ($nameMat + ".roughSpecularRoughness");
if($testDiffRough == 1){connectAttr -f ($nameRough + ".outAlpha") ($nameMat + ".diffuseRoughness"); } ;
if($testConnect == 1){
setAttr -type "string" ($nameRough + ".fileTextureName") ($filePath + $nameRough + $fileType) ;
setAttr -type "string" ($nameRough + ".colorSpace") "Raw" ;
} ;
} ;
} ;
if($testNormal == 1)
{
string $nameNormal = ($nameMat + "_normal") ;
shadingNode -asTexture PxrNormalMap -name $nameNormal ;
connectAttr -f ($nameNormal + ".resultN") ($nameMat + ".bumpNormal") ;
if($testNormDirect == 1)
{
rmanSetAttr $nameNormal orientation 0;
}
else
{
rmanSetAttr $nameNormal orientation 1;
} ;
if($testConnect == 1){
setAttr -type "string" ($nameNormal + ".filename") ($filePath + $nameNormal + $fileType) ;
} ;
} ;
}
else {
if($testDiffuse == 1){
string $nameDiffuse = ($nameMat + "_diffuse") ;
shadingNode -asTexture PxrTexture -name $nameDiffuse ;
setAttr ($nameDiffuse + ".linearize") 1;
connectAttr -f ($nameDiffuse + ".resultRGB") ($nameMat + ".diffuseColor") ;
if($testConnect == 1){
setAttr -type "string" ($nameDiffuse + ".filename") ($filePath + $nameDiffuse + $fileType) ;
} ;
} ;
if($testPrimary == 1){
if($testGXG == 1){setAttr -type "string" ($nameMat + ".specularModelType") "Ggx" ;} ;
if($testSpecFace == 1){
string $nameSpecFace = ($nameMat + "_specFace") ;
shadingNode -asTexture PxrTexture -name $nameSpecFace ;
setAttr ($nameSpecFace + ".linearize") 1;
connectAttr -f ($nameSpecFace + ".resultRGB") ($nameMat + ".specularFaceColor") ;
if($testConnect == 1){
setAttr -type "string" ($nameSpecFace + ".filename") ($filePath + $nameSpecFace + $fileType) ;
} ;
} ;
if($testSpecEdge == 1){
string $nameSpecEdge = ($nameMat + "_specEdge") ;
shadingNode -asTexture PxrTexture -name $nameSpecEdge ;
setAttr ($nameSpecEdge + ".linearize") 1;
connectAttr -f ($nameSpecEdge + ".resultRGB") ($nameMat + ".specularEdgeColor") ;
if($testConnect == 1){
setAttr -type "string" ($nameSpecEdge + ".filename") ($filePath + $nameSpecEdge + $fileType) ;
} ;
} ;
if($testSpecRough == 1){
string $nameSpecRough = ($nameMat + "_specRough") ;
shadingNode -asTexture PxrTexture -name $nameSpecRough ;
setAttr ($nameSpecRough + ".linearize") 0;
connectAttr -f ($nameSpecRough + ".resultA") ($nameMat + ".specularRoughness") ;
if($testDiffRough == 1){connectAttr -f ($nameSpecRough + ".resultA") ($nameMat + ".diffuseRoughness"); } ;
if($testConnect == 1){
setAttr -type "string" ($nameSpecRough + ".filename") ($filePath + $nameSpecRough + $fileType) ;
} ;
} ;
}
else{
if($testGXG == 1){setAttr -type "string" ($nameMat + ".roughSpecularModelType") "Ggx" ;} ;
if($testSpecFace == 1){
string $nameSpecFace = ($nameMat + "_specFace") ;
shadingNode -asTexture PxrTexture -name $nameSpecFace ;
setAttr ($nameSpecFace + ".linearize") 1;
connectAttr -f ($nameSpecFace + ".resultRGB") ($nameMat + ".roughSpecularFaceColor") ;
if($testConnect == 1){
setAttr -type "string" ($nameSpecFace + ".filename") ($filePath + $nameSpecFace + $fileType) ;
} ;
} ;
if($testSpecEdge == 1){
string $nameSpecEdge = ($nameMat + "_specEdge") ;
shadingNode -asTexture PxrTexture -name $nameSpecEdge ;
setAttr ($nameSpecEdge + ".linearize") 1;
connectAttr -f ($nameSpecEdge + ".resultRGB") ($nameMat + ".roughSpecularEdgeColor") ;
if($testConnect == 1){
setAttr -type "string" ($nameSpecEdge + ".filename") ($filePath + $nameSpecEdge + $fileType) ;
} ;
} ;
if($testSpecRough == 1){
string $nameSpecRough = ($nameMat + "_specRough") ;
shadingNode -asTexture PxrTexture -name $nameSpecRough ;
setAttr ($nameSpecRough + ".linearize") 0;
connectAttr -f ($nameSpecRough + ".resultA") ($nameMat + ".roughSpecularRoughness") ;
if($testDiffRough == 1){connectAttr -f ($nameSpecRough + ".resultA") ($nameMat + ".diffuseRoughness"); } ;
if($testConnect == 1){
setAttr -type "string" ($nameSpecRough + ".filename") ($filePath + $nameSpecRough + $fileType) ;
} ;
} ;
} ;
if($testNormal == 1){
string $nameNormal = ($nameMat + "_normal") ;
shadingNode -asTexture PxrNormalMap -name $nameNormal ;
connectAttr -f ($nameNormal + ".resultN") ($nameMat + ".bumpNormal") ;
if($testNormDirect == 1)
{
rmanSetAttr $nameNormal orientation 0;
}
else
{
rmanSetAttr $nameNormal orientation 1;
} ;
if($testConnect == 1){
setAttr -type "string" ($nameNormal + ".filename") ($filePath + $nameNormal + $fileType) ;
} ;
} ;
} ;
} ;

Update 17/09/2018 22:44 US EDT: Fixes button size not translating correctly
Update 17/09/2018 23:58 US EDT: Fixes typo

DV Clone Master Script

This script for Maya 2016, Maya 2017, and Maya 2018 will grab objects parented to world or world oriented/centered nodes.

Download the script here.

/*
Limitations
Script can only mirror objects parented to world or world oriented and centered objects
For more concerns, please email me
*/
{
//Finds objects and lists them
string $nodes0[] = `ls -selection`;
//Clones and lists clones of selected objects
duplicate -rr ;
string $nodes1[] = `ls -selection`;
//Groups and lists group
doGroup 0 1 1 ;
string $group[] = `ls -selection`;
for ($node in $group)
{
//Loop through each object and obtain its node
string $node[] = `listRelatives $node`;
float $dimension = `getAttr ($node[0] + ".scaleX")` ;
//Set the x-scale attribute of each shape node to its negative counterpart
setAttr ($node[0] + ".scaleX") (-1*$dimension) ;
}
//Selects group
select -r $group ;
FreezeTransformations ;
//Parents objects to world
parent -world $nodes1 ;
select -cl ;
//Selects and deletes created groups
select -r $group ;
delete ;
//Selects and freezes transforms on affected objects
select -r $nodes0 ;
select -tgl $nodes1 ;
FreezeTransformations ;
}
// Script by Zachary Yarnot the DualVission
// Script for non-commercial and personal use only
// https://yarnot.com/Zach
// zach@yarnot.com
print(" Objects cloned and mirrored. Transforms frozen. ; ") ;

Update 06/09/2018 21:27 US EDT: Fixes typo in release preventing script from functioning with more than one nodes selected.