global proc bumpThemAll() { string $shaders[] = `ls "*Shader"`; for ($shade in $shaders) { string $fileNode[] = `defaultNavigation -defaultTraversal -destination ($shade+".color")`; setAttr ($fileNode[0]+".alphaIsLuminance") 1; string $bump = `shadingNode -asUtility bump2d`; connectAttr -f ($bump+".outNormal") ($shade+".normalCamera"); connectAttr -f ($fileNode[0]+".outAlpha") ($bump+".bumpValue"); setAttr ($bump+".bumpDepth") 0.5; } } global proc linkFiles(int $phone, int $new) { setAttr -type "string" ("phone"+$phone+"_file2.fileTextureName") ("sourceimages/phone"+$new+"_f.tif"); setAttr -type "string" ("phone"+$phone+"_file3.fileTextureName") ("sourceimages/phone"+$new+"_b.tif"); setAttr -type "string" ("phone"+$phone+"_file4.fileTextureName") ("sourceimages/phone"+$new+"_s.tif"); } global proc polyfy() { string $selectedObjects[] = `ls -sl`; string $selectedChildren[] = `listRelatives -c $selectedObjects[0]`; int $numSelected = size($selectedObjects); string $polyPhones = `group -em -w -name "poly_phones"`; for ($selected in $selectedChildren) { string $surfaces[] = `listRelatives -c ($selected+"_surfaces")`; string $newGroup = `group -em -w -name ($selected+"_poly")`; for ($surf in $surfaces) { string $newSurface[] = `nurbsToPoly -name ($surf+"_poly") -mnd 1 -ch 0 -pt 1 -ut 1 -un 3 -vt 1 -vn 3 -chr 0.1 -uch 0 -ucr 0 -cht 0.2 -es 0 -ntr 0 -mrt 0 -uss 1 $surf`; } string $buffer[]; tokenize $selected "_" $buffer; string $frontSurfaces[] = `polyUnite -name ($buffer[0]+"_frontP") -ch 0 ($buffer[0]+"_topRightFrontFillet_poly") ($buffer[0]+"_topLeftFrontFillet_poly") ($buffer[0]+"_bottomRightFrontFillet_poly") ($buffer[0]+"_bottomLeftFrontFillet_poly") ($buffer[0]+"_leftFrontFillet_poly") ($buffer[0]+"_rightFrontFillet_poly") ($buffer[0]+"_topFrontFillet_poly") ($buffer[0]+"_bottomFrontFillet_poly") ($buffer[0]+"_bottomSurface_poly") ($buffer[0]+"_topSurface_poly") ($buffer[0]+"_frontSurface_poly")`; string $sideSurfaces[] = `polyUnite -name ($buffer[0]+"_sideP") -ch 0 ($buffer[0]+"_topRightFillet_poly") ($buffer[0]+"_topLeftFillet_poly") ($buffer[0]+"_bottomLeftFillet_poly") ($buffer[0]+"_bottomRightFillet_poly") ($buffer[0]+"_rightSurface_poly") ($buffer[0]+"_leftSurface_poly")`; string $backSurfaces[] = `polyUnite -name ($buffer[0]+"_backP") -ch 0 ($buffer[0]+"_topRightFrontFillet1_poly") ($buffer[0]+"_topLeftFrontFillet1_poly") ($buffer[0]+"_bottomRightFrontFillet1_poly") ($buffer[0]+"_bottomLeftFrontFillet1_poly") ($buffer[0]+"_leftFrontFillet1_poly") ($buffer[0]+"_rightFrontFillet1_poly") ($buffer[0]+"_topFrontFillet1_poly") ($buffer[0]+"_bottomFrontFillet1_poly") ($buffer[0]+"_frontSurface1_poly")`; int $frontFaceCounts[] = `polyEvaluate -f $frontSurfaces[0]`; int $backFaceCounts[] = `polyEvaluate -f $backSurfaces[0]`; int $sideFaceCounts[] = `polyEvaluate -f $sideSurfaces[0]`; int $frontFaceCount = $frontFaceCounts[0] - 1; int $backFaceCount = $backFaceCounts[0] - 1; int $sideFaceCount = $sideFaceCounts[0] - 1; polyProjection -ch 0 -type "Planar" -ibd on -md x ($frontSurfaces[0]+".f[0:"+$frontFaceCount+"]") ($backSurfaces[0]+".f[0:"+$backFaceCount+"]") ; polyProjection -ch 0 -type "Planar" -ibd on -md z ($sideSurfaces[0]+".f[0:"+$sideFaceCount+"]"); string $frontTexture[] = `convertSolidTx -antiAlias 1 -bm 1 -fts 1 -sp 0 -sh 0 -alpha 0 -doubleSided 0 -componentRange 0 -resolutionX 256 -resolutionY 256 -fileFormat "tif" ($buffer[0]+"_projection1.outColor") ($buffer[0]+"_frontP.f[0:"+$frontFaceCount+"]")`; connectAttr -f ($frontTexture[0]+".outColor") ($selected+"_frontShader.color") ; string $backTexture[] = `convertSolidTx -antiAlias 1 -bm 1 -fts 1 -sp 0 -sh 0 -alpha 0 -doubleSided 0 -componentRange 0 -resolutionX 256 -resolutionY 256 -fileFormat "tif" ($buffer[0]+"_projection2.outColor") ($buffer[0]+"_backP.f[0:"+$backFaceCount+"]")`; connectAttr -f ($backTexture[0]+".outColor") ($selected+"_backShader.color") ; string $sideTexture[] = `convertSolidTx -antiAlias 1 -bm 1 -fts 1 -sp 0 -sh 0 -alpha 0 -doubleSided 0 -componentRange 0 -resolutionX 256 -resolutionY 256 -fileFormat "tif" ($buffer[0]+"_projection3.outColor") ($buffer[0]+"_sideP.f[0:"+$sideFaceCount+"]")`; connectAttr -f ($sideTexture[0]+".outColor") ($selected+"_sideShader.color") ; string $united[] = `polyUnite -name ($buffer[0]+"_poly") -ch 0 ($buffer[0]+"_frontP") ($buffer[0]+"_backP") ($buffer[0]+"_sideP")`; parent $united[0] $polyPhones; delete $newGroup; } } global proc loadPhones(int $max) { int $i = 0; for ($i = 1; $i <= $max; $i++) { file -import -type "mayaBinary" -ra true -options "v=0" -pr -loadReferenceDepth "all" ("/mnt/data/maya/projects/chopIt/scenes/phone"+$i+".mb"); } } global proc moveThem() { string $selected[] = `ls -sl`; int $numSelected = size($selected); for ($selectedGroup in $selected) { rotate -r 90 -90 0 $selectedGroup; parent $selectedGroup "originals"; } } global proc tidyThem() { string $selectedLot[] = `ls -sl`; for ($selected in $selectedLot) { string $buffer[]; delete ($selected+"_originalCurves") ($selected+"_backupCurves"); tokenize $selected "_" $buffer; makeIdentity -apply true -t 1 -r 1 -s 1 -n 0 $selected; rotate -r 0 -90 0 ($buffer[0]+"_place3dTexture1") ($buffer[0]+"_place3dTexture2"); rotate -r 0 -180 0 ($buffer[0]+"_place3dTexture3"); scale -r 5 5 1 ($buffer[0]+"_place3dTexture1") ($buffer[0]+"_place3dTexture2") ($buffer[0]+"_place3dTexture3"); } } global proc instanceToLocation(string $prefix) { string $selected[] = `ls -sl`; int $numSelected = size($selected); if ($numSelected >= 2) { string $objects[] = `listRelatives -c $selected[0]`; int $numChildren = size($objects); int $randomChild; int $count = 0; string $instanceGroup = `group -em -w -name "instances"`; for ($i = 1; $i < $numSelected; $i++) { string $locations[] = `listRelatives -c $selected[$i]`; int $numLocations = size($locations); int $j; for ($j = 0; $j < $numLocations; $j++) { $randomChild = rand($numChildren); string $location = $locations[$j]; print("location: "+$location); print("randomNum: "+$randomChild); string $newObject[] = `instance -name ($prefix+"_instancedCopy_"+$count+"_"+$randomChild) $objects[$randomChild]`; $count++; print("newObject: "+$newObject[0]); setAttr($newObject[0]+".tx", getAttr($location+".tx")); setAttr($newObject[0]+".ty", getAttr($location+".ty")); setAttr($newObject[0]+".tz", getAttr($location+".tz")); setAttr($newObject[0]+".rx", getAttr($location+".rx")); setAttr($newObject[0]+".ry", getAttr($location+".ry")); setAttr($newObject[0]+".rz", getAttr($location+".rz")); print("parenting: "); parent $newObject $instanceGroup; print("parented: \n"); } } } else { // Error, print some message on usage print("Usage: instanceToLocation() requires the selection of 2 or more objects, the first should be the group of objects that are to be randomly instanced."); } } global proc replaceObjects() { string $selected[] = `ls -sl`; int $numSelected = size($selected); if ($numSelected >= 2) { string $arrayShape[] = `listRelatives -s $selected[0]`; for ($i = 1; $i < $numSelected; $i++) { setAttr($arrayShape[0]+".initialPosition["+($i-1)+"].initialPositionX", getAttr($selected[$i]+".tx")); setAttr($arrayShape[0]+".initialPosition["+($i-1)+"].initialPositionY", getAttr($selected[$i]+".ty")); setAttr($arrayShape[0]+".initialPosition["+($i-1)+"].initialPositionZ", getAttr($selected[$i]+".tz")); setAttr($arrayShape[0]+".initialRotation["+($i-1)+"].initialRotationX", getAttr($selected[$i]+".rx")); setAttr($arrayShape[0]+".initialRotation["+($i-1)+"].initialRotationY", getAttr($selected[$i]+".ry")); setAttr($arrayShape[0]+".initialRotation["+($i-1)+"].initialRotationZ", getAttr($selected[$i]+".rz")); } setAttr($arrayShape[0]+".numBodies", ($numSelected - 1)); } else { // Error, print some message on usage print("Usage: replaceObjects() requires the selection of 2 or more objects, the first should be the dRigidBodyArray."); } } global proc replaceObjects2() { string $selected[] = `ls -sl`; int $numSelected = size($selected); if ($numSelected >= 2) { string $arrayShape[] = `listRelatives -s $selected[0]`; for ($i = 1; $i < $numSelected; $i++) { setAttr($arrayShape[0]+".initialPosition["+($i-1)+"].initialPositionX", getAttr($selected[$i]+".tx")); setAttr($arrayShape[0]+".initialPosition["+($i-1)+"].initialPositionY", getAttr($selected[$i]+".ty")); setAttr($arrayShape[0]+".initialPosition["+($i-1)+"].initialPositionZ", getAttr($selected[$i]+".tz")); setAttr($arrayShape[0]+".initialRotation["+($i-1)+"].initialRotationX", getAttr($selected[$i]+".rx")); setAttr($arrayShape[0]+".initialRotation["+($i-1)+"].initialRotationY", getAttr($selected[$i]+".ry")); setAttr($arrayShape[0]+".initialRotation["+($i-1)+"].initialRotationZ", getAttr($selected[$i]+".rz")); connectAttr($arrayShape[0]+".position["+($i-1)+"]", $selected[$i]+".t"); connectAttr($arrayShape[0]+".rotation["+($i-1)+"]", $selected[$i]+".r"); } setAttr($arrayShape[0]+".numBodies", ($numSelected - 1)); } else { // Error, print some message on usage print("Usage: replaceObjects() requires the selection of 2 or more objects, the first should be the dRigidBodyArray."); } } global proc linkMe() { string $selected[] = `ls -sl`; int $numSelected = size($selected); if ($numSelected == 2) { string $arrayShape[] = `listRelatives -s $selected[0]`; string $children[] = `listRelatives -c $selected[1]`; int $numChildren = size($children); int $numBodies = getAttr($arrayShape[0]+".numBodies"); group -em -w -name "instances"; for ($i = 0; $i < $numBodies; $i++) { int $randomChild = rand($numChildren); string $newObject[] = `instance -name ("instancedCopy_"+$i) $children[$randomChild]`; parent $newObject "instances"; connectAttr($arrayShape[0]+".position["+($i)+"]", $newObject[0]+".t"); connectAttr($arrayShape[0]+".rotation["+($i)+"]", $newObject[0]+".r"); } } else { // Error, print some message on usage print("Usage: linkMe() requires the selection of exactly 2 objects, the first should be the dRigidBodyArray, the second a group node with children of the random objects to place."); } } global proc setInitial() { string $selected[] = `ls -sl`; int $numSelected = size($selected); if ($numSelected == 1) { string $arrayShape[] = `listRelatives -s $selected[0]`; int $numBodies = getAttr($arrayShape[0]+".numBodies"); for ($i = 0; $i < $numBodies; $i++) { setAttr($arrayShape[0]+".initialPosition["+($i)+"].initialPositionX", getAttr($arrayShape[$i]+".position["+$i+"].positionX")); setAttr($arrayShape[0]+".initialPosition["+($i)+"].initialPositionY", getAttr($arrayShape[$i]+".position["+$i+"].positionY")); setAttr($arrayShape[0]+".initialPosition["+($i)+"].initialPositionZ", getAttr($arrayShape[$i]+".position["+$i+"].positionZ")); setAttr($arrayShape[0]+".initialRotation["+($i)+"].initialRotationX", getAttr($arrayShape[$i]+".rotation["+$i+"].rotationX")); setAttr($arrayShape[0]+".initialRotation["+($i)+"].initialRotationY", getAttr($arrayShape[$i]+".rotation["+$i+"].rotationY")); setAttr($arrayShape[0]+".initialRotation["+($i)+"].initialRotationZ", getAttr($arrayShape[$i]+".rotation["+$i+"].rotationZ")); } } else { // Error, print some message on usage print("Usage: setInitial() requires the selection of one dRigidBodyArray to set the current position as the starting configuration."); } } global proc linkMe3() { string $selected[] = `ls -sl`; int $numSelected = size($selected); if ($numSelected == 2) { string $arrayShape[] = `listRelatives -s $selected[0]`; string $children[] = `listRelatives -c $selected[1]`; int $numChildren = size($children); int $numBodies = getAttr($arrayShape[0]+".numBodies"); for ($i = 0; $i < $numBodies; $i++) { connectAttr($arrayShape[0]+".position["+($i)+"]", $children[$i]+".t"); connectAttr($arrayShape[0]+".rotation["+($i)+"]", $children[$i]+".r"); } } else { // Error, print some message on usage print("Usage: linkMe() requires the selection of exactly 2 objects, the first should be the dRigidBodyArray, the second a group node with children of the random objects to place."); } } global proc linkMe2() { string $selected[] = `ls -sl`; int $numSelected = size($selected); if ($numSelected == 2) { string $newObject[] = `instance -name ("instancedCopy_"+$selected[1]) $selected[1]`; parent $newObject "instances"; connectAttr($selected[0]+".t", $newObject[0]+".t"); connectAttr($selected[0]+".r", $newObject[0]+".r"); } else { // Error, print some message on usage print("Usage: linkMe() requires the selection of exactly 2 objects, the first should be the dRigidBodyArray, the second a group node with children of the random objects to place."); } } global proc bakeMe(int $start, int $finish, int $increment) { string $selected[] = `ls -sl`; int $numSelected = size($selected); if ($numSelected == 3) { string $arrayShape[] = `listRelatives -s $selected[0]`; string $children[] = `listRelatives -c $selected[1]`; string $children2[] = `listRelatives -c $selected[2]`; int $numChildren = size($children); int $numChildren2 = size($children2); int $numBodies = getAttr($arrayShape[0]+".numBodies"); currentTime -edit $start; for ($i = $start; $i < $finish; ) { int $j; for ($j = 0; $j < $numChildren; $j++) { setKeyframe -attribute "t" $children[$j]; setKeyframe -attribute "r" $children[$j]; } for ($j = 0; $j < $numChildren2; $j++) { setKeyframe -attribute "t" $children2[$j]; setKeyframe -attribute "r" $children2[$j]; } int $frameDone = $i; do { $i++; currentTime -edit $i; } while (($frameDone + $increment) > $i); } for ($k = 0; $k < $numChildren; $k++) { string $token[]; tokenize $children[$k] "_" $token; disconnectAttr($arrayShape[0]+".position["+($token[1])+"]", $children[$k]+".t"); disconnectAttr($arrayShape[0]+".rotation["+($token[1])+"]", $children[$k]+".r"); } for ($k = 0; $k < $numChildren2; $k++) { CBdeleteConnection ($children[$k]+".tx"); CBdeleteConnection ($children[$k]+".ty"); CBdeleteConnection ($children[$k]+".tz"); CBdeleteConnection ($children[$k]+".rx"); CBdeleteConnection ($children[$k]+".ry"); CBdeleteConnection ($children[$k]+".rz"); } } else { // Error, print some message on usage print("Usage: bakeMe() requires the selection of exactly 2 objects, the first should be the dRigidBodyArray, the second a group node containing the corresponding objects!"); } } global proc bakeMeNew(int $start, int $finish, int $increment) { string $selected[] = `ls -sl`; int $numSelected = size($selected); if ($numSelected == 3) { string $arrayShape[] = `listRelatives -s $selected[0]`; string $children[] = `listRelatives -c $selected[1]`; string $children2[] = `listRelatives -c $selected[2]`; int $numChildren = size($children); int $numChildren2 = size($children2); int $numBodies = getAttr($arrayShape[0]+".numBodies"); int $j; int $frameDone; currentTime -edit $start; for ($i = $start; $i < $finish; ) { for ($j = 0; $j < $numChildren; $j++) { setKeyframe -attribute "t" $children[$j]; setKeyframe -attribute "r" $children[$j]; } for ($j = 0; $j < $numChildren2; $j++) { setKeyframe -attribute "t" $children2[$j]; setKeyframe -attribute "r" $children2[$j]; } $frameDone = $i; do { $i++; currentTime -edit $i; } while (($frameDone + $increment) > $i); } } else { // Error, print some message on usage print("Usage: bakeMe() requires the selection of exactly 2 objects, the first should be the dRigidBodyArray, the second a group node containing the corresponding objects!"); } } global proc fillet(string $surfaceName, string $edge1, string $edge2) { freeFormFillet -name $surfaceName -ch 0 -po 0 -depth 0.5 -bias 0 -pt 0.002 -tt 0.1 $edge1 $edge2 ; // displaySmoothness -divisionsU 3 -divisionsV 3 -pointsWire 16 -pointsShaded 4 -polygonObject 3 $surfaceName; // subdivDisplaySmoothness -smoothness 3 $surfaceName; // setAttr(($surfaceName+".displayRenderTessellation"), 1); setAttr(($surfaceName+".curvatureTolerance"), 0); } global proc renderTess(string $surfaceName, int $uDiv, int $vDiv) { setAttr(($surfaceName+"Shape.uDivisionsFactor"), $uDiv); setAttr(($surfaceName+"Shape.vDivisionsFactor"), $vDiv); } global proc buildIt(string $phoneName, float $scaling) { string $selected[] = `ls -sl`; int $numSelected = size($selected); if ($numSelected == 3) { print("Scaling is: "+$scaling); source "createRenderNode"; string $phoneGroup = `group -em -w -name $phoneName`; string $originalCurvesGroup = `group -em -w -name ($phoneName+"_originalCurves")`; string $surfacesGroup = `group -em -w -name ($phoneName+"_surfaces")`; string $backupCurves = `group -em -w -name ($phoneName+"_backupCurves")`; for ($i = 0; $i <= 2; $i++) { string $backup[] = `duplicate $selected[$i]`; parent $backup[0] $backupCurves; } duplicate -name "tempCurve" $selected[0]; scale -r -1 1 1 "tempCurve"; attachCurve -ch 0 -rpo 1 -kmk 1 -m 0 -bb 0.5 -bki 0 -p 0.1 "tempCurve" $selected[0] ; duplicate -name "tempCurve2" $selected[2]; scale -r -1 1 1 "tempCurve2"; attachCurve -ch 0 -rpo 1 -kmk 1 -m 0 -bb 0.5 -bki 0 -p 0.1 "tempCurve2" $selected[2] ; duplicate -name "mirrorCurve" $selected[1]; scale -r -1 1 1 "mirrorCurve"; duplicate -name "origCurve" $selected[1]; // Delete the history delete -ch "tempCurve" "tempCurve2" "mirrorCurve" "origCurve"; parent $selected[0] $selected[1] $selected[2] $originalCurvesGroup; parent $originalCurvesGroup $phoneGroup; scale -r $scaling $scaling $scaling "tempCurve" "tempCurve2" "mirrorCurve" "origCurve"; move -r 0 0.6 0 "tempCurve" "tempCurve2" "mirrorCurve" "origCurve"; boundary -name "frontSurface" -ch 0 -or 0 -ep 0 -rn 0 -po 0 -ept 0.001 "tempCurve" "origCurve" "tempCurve2" "mirrorCurve"; // displaySmoothness -divisionsU 3 -divisionsV 3 -pointsWire 16 -pointsShaded 4 -polygonObject 3 "frontSurface"; // subdivDisplaySmoothness -smoothness 3 "frontSurface"; renderTess("frontSurface", 10, 20); float $inverseScaling = 1/ $scaling; scale -r $inverseScaling 1 1 "mirrorCurve" "origCurve"; scale -r 1 1 $inverseScaling "tempCurve" "tempCurve2"; duplicate -name "topCurve" "tempCurve"; duplicate -name "bottomCurve" "tempCurve2"; duplicate -name "leftCurve" "mirrorCurve"; duplicate -name "rightCurve" "origCurve"; move -r 0 -0.2 0 "tempCurve" "tempCurve2" "mirrorCurve" "origCurve"; move -r 0 -1 0 "topCurve" "bottomCurve" "leftCurve" "rightCurve"; loft -name "topSurface" -ch 0 -u 1 -c 0 -ar 1 -d 3 -ss 3 -rn 0 -po 0 -rsn true "tempCurve" "topCurve"; // displaySmoothness -divisionsU 3 -divisionsV 3 -pointsWire 16 -pointsShaded 4 -polygonObject 3 "topSurface"; // subdivDisplaySmoothness -smoothness 3 "topSurface"; loft -name "bottomSurface" -ch 0 -u 1 -c 0 -ar 1 -d 3 -ss 3 -rn 0 -po 0 -rsn true "tempCurve2" "bottomCurve"; // displaySmoothness -divisionsU 3 -divisionsV 3 -pointsWire 16 -pointsShaded 4 -polygonObject 3 "bottomSurface"; // subdivDisplaySmoothness -smoothness 3 "bottomSurface"; loft -name "leftSurface" -ch 0 -u 1 -c 0 -ar 1 -d 3 -ss 3 -rn 0 -po 0 -rsn true "mirrorCurve" "leftCurve"; // displaySmoothness -divisionsU 3 -divisionsV 3 -pointsWire 16 -pointsShaded 4 -polygonObject 3 "leftSurface"; // subdivDisplaySmoothness -smoothness 3 "leftSurface"; loft -name "rightSurface" -ch 0 -u 1 -c 0 -ar 1 -d 3 -ss 3 -rn 0 -po 0 -rsn true "origCurve" "rightCurve"; // displaySmoothness -divisionsU 3 -divisionsV 3 -pointsWire 16 -pointsShaded 4 -polygonObject 3 "rightSurface"; // subdivDisplaySmoothness -smoothness 3 "rightSurface"; renderTess("topSurface", 30, 1); renderTess("bottomSurface", 30, 1); renderTess("leftSurface", 30, 1); renderTess("rightSurface", 30, 1); fillet("bottomFrontFillet", "bottomSurface.v["+(getAttr("bottomSurfaceShape.minValueV"))+"]", "frontSurface.v["+(getAttr("frontSurfaceShape.maxValueV"))+"]"); renderTess("bottomFrontFillet", 3, 5); fillet("topFrontFillet", "topSurface.v["+(getAttr("topSurfaceShape.minValueV"))+"]", "frontSurface.v["+(getAttr("frontSurfaceShape.minValueV"))+"]"); renderTess("topFrontFillet", 3, 5); fillet("rightFrontFillet", "rightSurface.v["+(getAttr("rightSurfaceShape.minValueV"))+"]", "frontSurface.u["+(getAttr("frontSurfaceShape.maxValueU"))+"]"); renderTess("rightFrontFillet", 3, 5); fillet("leftFrontFillet", "leftSurface.v["+(getAttr("leftSurfaceShape.minValueV"))+"]", "frontSurface.u["+(getAttr("frontSurfaceShape.minValueU"))+"]"); renderTess("leftFrontFillet", 3, 5); fillet("bottomLeftFrontFillet", "bottomFrontFillet.v["+(getAttr("bottomFrontFilletShape.minValueV"))+"]", "leftFrontFillet.v["+(getAttr("leftFrontFilletShape.maxValueV"))+"]"); fillet("bottomRightFrontFillet", "rightFrontFillet.v["+(getAttr("rightFrontFilletShape.maxValueV"))+"]", "bottomFrontFillet.v["+(getAttr("bottomFrontFilletShape.maxValueV"))+"]"); fillet("topLeftFrontFillet", "leftFrontFillet.v["+(getAttr("leftFrontFilletShape.minValueV"))+"]", "topFrontFillet.v["+(getAttr("topFrontFilletShape.minValueV"))+"]"); fillet("topRightFrontFillet", "topFrontFillet.v["+(getAttr("topFrontFilletShape.maxValueV"))+"]", "rightFrontFillet.v["+(getAttr("rightFrontFilletShape.minValueV"))+"]"); fillet("bottomLeftFillet", "bottomSurface.u["+(getAttr("bottomSurface.minValueU"))+"]", "leftSurface.u["+(getAttr("leftSurface.maxValueU"))+"]"); fillet("bottomRightFillet", "bottomSurface.u["+(getAttr("bottomSurface.maxValueU"))+"]", "rightSurface.u["+(getAttr("rightSurface.maxValueU"))+"]"); fillet("topLeftFillet", "topSurface.u["+(getAttr("topSurface.minValueU"))+"]", "leftSurface.u["+(getAttr("leftSurface.minValueU"))+"]"); fillet("topRightFillet", "topSurface.u["+(getAttr("topSurface.maxValueU"))+"]", "rightSurface.u["+(getAttr("rightSurface.minValueU"))+"]"); string $duplicatedFillets[] = `duplicate -rr "frontSurface" "bottomFrontFillet" "topFrontFillet" "rightFrontFillet" "leftFrontFillet" "bottomLeftFrontFillet" "bottomRightFrontFillet" "topLeftFrontFillet" "topRightFrontFillet"`; // Create the textures for the various objects // Starting with the front shader string $shader = `shadingNode -name ($phoneName+"_frontShader") -asShader blinn`; string $shadingGroup = `sets -renderable true -noSurfaceShader true -empty -name ($shader+"SG") $shader`; connectAttr($shader+".outColor", $shadingGroup+".surfaceShader"); sets -e -fe $shadingGroup "topRightFrontFillet" "topLeftFrontFillet" "bottomRightFrontFillet" "bottomLeftFrontFillet" "leftFrontFillet" "rightFrontFillet" "topFrontFillet" "bottomFrontFillet" "frontSurface" "bottomSurface" "topSurface"; string $projectionNode = `createRenderNodeCB -as2DTexture "" file ("defaultNavigation -force true -connectToExisting -source %node -destination "+$shader+".color")`; print("Projection node made: "+$projectionNode); string $fileNode[] = `defaultNavigation -defaultTraversal -destination ($projectionNode+".image")`; string $texture3d[] = `defaultNavigation -defaultTraversal -destination ($projectionNode+".placementMatrix")`; setAttr -type "string" ($fileNode[0]+".fileTextureName") ("sourceimages/"+$phoneName+"_f.tif"); rotate -r -os -90 0 0 $texture3d[0]; scale -r 5 5 1 $texture3d[0]; // Next the back shader $shader = `shadingNode -name ($phoneName+"_backShader") -asShader blinn`; $shadingGroup = `sets -renderable true -noSurfaceShader true -empty -name ($shader+"SG") $shader`; connectAttr($shader+".outColor", $shadingGroup+".surfaceShader"); for ($duplicates in $duplicatedFillets) { sets -e -fe $shadingGroup $duplicates; } $projectionNode = `createRenderNodeCB -as2DTexture "" file ("defaultNavigation -force true -connectToExisting -source %node -destination "+$shader+".color")`; string $fileNode2[] = `defaultNavigation -defaultTraversal -destination ($projectionNode+".image")`; string $texture3d2[] = `defaultNavigation -defaultTraversal -destination ($projectionNode+".placementMatrix")`; setAttr -type "string" ($fileNode2[0]+".fileTextureName") ("sourceimages/"+$phoneName+"_b.tif"); rotate -r -os -90 0 0 $texture3d2[0]; scale -r 5 5 1 $texture3d2[0]; // Finally the side shader $shader = `shadingNode -name ($phoneName+"_sideShader") -asShader blinn`; $shadingGroup = `sets -renderable true -noSurfaceShader true -empty -name ($shader+"SG") $shader`; connectAttr($shader+".outColor", $shadingGroup+".surfaceShader"); sets -e -fe $shadingGroup topRightFillet topLeftFillet bottomRightFillet bottomLeftFillet rightSurface leftSurface; $projectionNode = `createRenderNodeCB -as2DTexture "" file ("defaultNavigation -force true -connectToExisting -source %node -destination "+$shader+".color")`; string $fileNode3[] = `defaultNavigation -defaultTraversal -destination ($projectionNode+".image")`; string $texture3d3[] = `defaultNavigation -defaultTraversal -destination ($projectionNode+".placementMatrix")`; setAttr -type "string" ($fileNode3[0]+".fileTextureName") ("sourceimages/"+$phoneName+"_s.tif"); rotate -r -os -90 0 90 $texture3d3[0]; scale -r 5 5 1 $texture3d3[0]; // Put everything where it should be and tidy up what is no longer needed for ($duplicates in $duplicatedFillets) { scale -r 1 -1 1 $duplicates; parent $duplicates $surfacesGroup; } parent "topRightFillet" "topLeftFillet" "bottomRightFillet" "bottomLeftFillet" "topRightFrontFillet" "topLeftFrontFillet" "bottomRightFrontFillet" "bottomLeftFrontFillet" "leftFrontFillet" "rightFrontFillet" "topFrontFillet" "bottomFrontFillet" "rightSurface" "leftSurface" "bottomSurface" "topSurface" "frontSurface" $surfacesGroup; parent $backupCurves $phoneGroup; parent $texture3d[0] $texture3d2[0] $texture3d3[0] $phoneGroup; parent $surfacesGroup $phoneGroup; delete "tempCurve" "tempCurve2" "mirrorCurve" "origCurve" "topCurve" "bottomCurve" "leftCurve" "rightCurve"; delete "layer1"; delete "nurbsPlane1"; select -r $texture3d[0] $texture3d2[0] $texture3d3[0]; HideSelectedObjects; select -r $phoneGroup; } }