// =========================================================================== // Copyright 2018 Autodesk, Inc. All rights reserved. // // Use of this software is subject to the terms of the Autodesk license // agreement provided at the time of installation or download, or which // otherwise accompanies this software in either electronic or hard copy form. // =========================================================================== global proc cnctBumpProjNormal (string $nodeName) { string $nodeType[] = `ls -showType $nodeName`; string $class[] = `getClassification $nodeType[1]`; if( size($class) != 0 ) { string $base[]; tokenize ($class[0], "/", $base); if( $base[0] == "shader" ) { string $normal[] = `ls ($nodeName + ".normalCamera")`; if( size($normal) != 0 ) { string $connectedNode[] = `listConnections $normal`; if( size($connectedNode) != 0 ) { string $outNormal[] = `ls ($connectedNode[0] + ".outNormal")`; if( size($outNormal) != 0 ) { string $attr; string $attrs[] = `listConnections -d false $nodeName`; for($attr in $attrs) { if( $attr != $connectedNode[0] ) { connectNormalToProjection($attr, $outNormal[0]); } } } } } } } } global proc connectNormalToProjection (string $nodeName, string $normalAttr) { string $attr; string $attrs[] = `listConnections -d false $nodeName`; string $normal[] = `ls ($nodeName + ".normalCamera")`; if( size($normal) != 0 ) { string $connectedNode[] = `listConnections $normal`; if( size($connectedNode) == 0 ) { connectAttr $normalAttr $normal; return; } } return; }