global proc string checkForLayoutNodes() { string $objList[] = `ls -tr`; // list all transform objects string $obj; string $message="NONE"; for ($obj in $objList) { string $myParentList[] = `listRelatives -p $obj`; string $myparent = $myParentList[0]; if ($myparent=="") { // print ("TOP LEVEL ("+$obj+")\n"); } if (gmatch ($obj, "*SpyDataNode*")) { $message = "OLD SpyDataNode found"; } if (gmatch ($obj, "*AngelObjectComponents*")) { $message = ("You cant have AngelObjectComponents in this MB file"); } if (gmatch ($obj, "*AngelComponentTemplate*")) { $message = ("You cant have AngelObjectTemplate in this MB file"); } if (gmatch ($obj, "*AngelObjectData*")) { $message = ("You cant have AngelObjectData in this MB file"); } if (gmatch ($obj, "*AngelObjectTemplates*")) { $message = ("You cant have AngelObjectTemplates in this MB file"); } } return $message; } global proc buildArtHierarchy() { string $out = checkForLayoutNodes(); if ($out != "NONE") { confirmDialog -title "Error" -message $out -button "OK"; return; } // Find out what is selected string $selected[] = `ls -sl`; // Check to make sure something is selected if ( `size( $selected )` ) { if ( !`objExists root` ) { // Create the hierarchy rename -is geom_h; pickWalk -d down; rename geom_hShape; pickWalk -d up; delete -ch; group -n geom; group -n object; group -n root; // Create the bound duplicate -n tmp geom_h; parent -w tmp; select -r tmp; rename -is bound; pickWalk -d down; rename boundShape; pickWalk -d up; select -cl; // Parent the bound parent bound object; select -cl; // Create "pepto-pink" bound material if needed if ( !`objExists abound` ) { shadingNode -asShader lambert -n abound; sets -renderable true -noSurfaceShader true -empty -name aboundSG; connectAttr -f abound.outColor aboundSG.surfaceShader; //showEditor "aboundSG"; setAttr "abound.color" -type double3 1 0 1 ; select -cl; } // Assign the material to the bound sets -edit -forceElement aboundSG |root|object|bound|boundShape; } else { confirmDialog -title "Error" -message "An art hierarchy already exists - delete it to create new art" -button "OK"; } } else { confirmDialog -title "Error" -message "No object is selected" -button "OK"; } }