/////v3 pb_UI; proc pb_UI() { if (`window -ex pb_PHYwin`==1) {deleteUI pb_PHYwin;} windowPref -enableAll false; window -t "Physics Shader Tool" -wh 410 250 pb_PHYwin; columnLayout mainLayout; { rowColumnLayout -numberOfColumns 2 -cw 1 200 -cw 2 200; { frameLayout -bs "etchedIn" -l "Object List: " -w 200 -h 200; { rowColumnLayout -numberOfRows 4 -rh 1 20 -rh 2 70 -rh 3 20 -rh 4 67; { text -l " Blend Type:"; textScrollList -numberOfRows 5 -allowMultiSelection 0 -w 190 -append "Opaque" -append "Alpha" -append "Alpha Cutout" -append "Additive" -append "Multiplitive" -showIndexedItem 1 -sii 1 listBlend; text -l " Material Property:"; textScrollList -numberOfRows 29 -allowMultiSelection 0 -w 190 -append "Default" -append "Concrete" -append "Grass" -append "Dirt" -append "Sand" -append "Rock" -append "Gravel" -append "Wood" -append "Brick" -append "Grass" -append "Rubber" -append "Ice" -append "Water" -append "Steel" -append "Aluminium" -append "Character" -append "Wheel" -append "Cloth" -append "Cardboard" -append "Plastic" -append "Thin Steel" -append "Fruit" -append "China" -append "Paper" -append "Leather" -append "Leaf" -append "Molten Metal" -append "Electrified Metal" -append "Burnt Wood" -showIndexedItem 1 - sii 1 matList; } setParent..; } setParent..; frameLayout -bs "etchedIn" -l "Shader Properties: " -w 270 -h 200; { rowColumnLayout -numberOfRows 6 -rh 1 30 -rh 2 30 -rh 3 30 -rh 4 30 -rh 5 30; { checkBox -label "No Physics Hint" -v 1 -cc "pbChangeetSelected" chBox_physics; checkBox -label "Player Shoot Through" -cc "pbChangeetSelected" -v 1 chBox_shootThrough; checkBox -label "AI Shoot Through" -cc "pbChangeetSelected" -v 1 chBox_AIshoot; checkBox -label "AI See Through" -cc "pbChangeetSelected" -v 1 chBox_AIsee; checkBox -label "Force Hit Effects On Shoot Through" -cc "pbChangeetSelected" -v 1 chBox_forceHit; checkBox -label "Ignore Blend Type For Hits" -cc "pbChangeetSelected" -v 1 chBox_igBlendType; } setParent..; } setParent..; } setParent..; } setParent..; button -w 200 -l "Set Material Options" -c "pbChangeShaderOptions" ; showWindow pb_PHYwin; } global proc pbChangeShaderOptions() { string $listMats[]=`hyperShade -smn ""`; int $i; string $selMats[] = `ls -sl`; int $numMats=`size($selMats)`; //gets options form the list int $blendingType[] = `textScrollList -q -sii listBlend`; int $materialType[] = `textScrollList -q -sii matList`; if ($numMats != 0) { for ($i=0; $i<$numMats; $i++) { setAttr ($selMats[$i] + ".blendType ") ($blendingType[0]-1); setAttr ($selMats[$i] + ".materialProperty ") ($materialType[0]-1); } print ("++ Finished ++ \n"); } else{ confirmDialog -m "Select one Mesh at least";} } proc loadList() { string $pb_Objs[]=`ls -sl`; int $numObjs=`size($pb_Objs)`; int $i; textScrollList -e -ra objectList; for($i=0; $i<$numObjs;$i++) { textScrollList -e -append $pb_Objs[$i] objectList; } } global proc pbChangeetSelected() { string $pb_selectedObjs[]=`ls -sl`; string $currentSG; int $i=0; //selects materials from Objects hyperShade -smn ""; string $pb_shaderList[]=`ls -sl`; int $numShaders = size($pb_shaderList); //confirmDialog -m ("num Shaders: " + $numShaders); for ($ph in $pb_shaderList) { select $pb_shaderList[$i]; string $currentSG = $pb_shaderList[$i]; print ("Shader Name: " + $pb_shaderList[$i]+ "\n"); if(!(`checkBox -q -v chBox_physics`)) { string $ex = ($currentSG+".noPhysicsHit"); if(`attributeExists "noPhysicsHit" $currentSG`) $t = `setAttr $ex 0`; } else { string $ex = ($currentSG+".noPhysicsHit"); if(`attributeExists "noPhysicsHit" $currentSG`) $t = `setAttr $ex 1`; } if(!(`checkBox -q -v chBox_shootThrough`)) { string $ex = ($currentSG+".playerShootThrough"); if(`attributeExists "playerShootThrough" $currentSG`) $t = `setAttr $ex 0`; } else { string $ex = ($currentSG+".playerShootThrough"); if(`attributeExists "playerShootThrough" $currentSG`) $t = `setAttr $ex 1`; } if(!(`checkBox -q -v chBox_AIshoot`)) { string $ex = ($currentSG+".aiShootThrough"); if(`attributeExists "aiShootThrough" $currentSG`) $t = `setAttr $ex 0`; } else { string $ex = ($currentSG+".aiShootThrough"); if(`attributeExists "aiShootThrough" $currentSG`) $t = `setAttr $ex 1`; } if(!(`checkBox -q -v chBox_AIsee`)) { string $ex = ($currentSG+".aiSeeThrough"); if(`attributeExists "aiSeeThrough" $currentSG`) $t = `setAttr $ex 0`; } else { string $ex = ($currentSG+".aiSeeThrough"); if(`attributeExists "aiSeeThrough" $currentSG`) $t = `setAttr $ex 1`; } if(!(`checkBox -q -v chBox_forceHit`)) { string $ex = ($currentSG+".hitOnShootThough"); if(`attributeExists "hitOnShootThough" $currentSG`) $t = `setAttr $ex 0`; } else { string $ex = ($currentSG+".hitOnShootThough"); if(`attributeExists "hitOnShootThough" $currentSG`) $t = `setAttr $ex 1`; } if(!(`checkBox -q -v chBox_igBlendType`)) { string $ex = ($currentSG+".ignoreBlendForHits"); if(`attributeExists "ignoreBlendForHits" $currentSG`) $t = `setAttr $ex 0`; } else { string $ex = ($currentSG+".ignoreBlendForHits"); if(`attributeExists "ignoreBlendForHits" $currentSG`) $t = `setAttr $ex 1`; } $i++; } select -r $pb_selectedObjs[0]; print ("++++++++ DONE +++++++++ \n"); } global proc string getSGsFromObj() { string $objConnections[], $shader[],$connectType[]; string $shaderGrpSeeker; pickWalk -d down; $objConnections = `listConnections`; for ($shaderGrpSeeker in $objConnections) { $connectType= `ls -st $shaderGrpSeeker`; if ($connectType[1] == "shadingEngine") { $objConnections[0] = $shaderGrpSeeker; break; } } $shader = `listConnections ($objConnections[0] + ".surfaceShader")`; clear $objConnections; return $shader[0]; } global proc pb_setAll() { string $pb_shaderList[]=`ls -type phong`; if(!(`checkBox -q -v chBox_physics`)) { for($ph in $pb_shaderList) { string $ex = ($ph+".noPhysicsHit"); if(`attributeExists "noPhysicsHit" $ph`) $t = `setAttr $ex 0`; } } else { for($ph in $pb_shaderList) { string $ex = ($ph+".noPhysicsHit"); if(`attributeExists "noPhysicsHit" $ph`) $t = `setAttr $ex 1`; } } if(!(`checkBox -q -v chBox_shootThrough`)) { for($ph in $pb_shaderList) { string $ex = ($ph+".playerShootThrough"); if(`attributeExists "playerShootThrough" $ph`) $t = `setAttr $ex 0`; } } else { for($ph in $pb_shaderList) { string $ex = ($ph+".playerShootThrough"); if(`attributeExists "playerShootThrough" $ph`) $t = `setAttr $ex 1`; } } if(!(`checkBox -q -v chBox_AIshoot`)) { for($ph in $pb_shaderList) { string $ex = ($ph+".aiShootThrough"); if(`attributeExists "aiShootThrough" $ph`) $t = `setAttr $ex 0`; } } else { for($ph in $pb_shaderList) { string $ex = ($ph+".aiShootThrough"); if(`attributeExists "aiShootThrough" $ph`) $t = `setAttr $ex 1`; } } if(!(`checkBox -q -v chBox_AIsee`)) { for($ph in $pb_shaderList) { string $ex = ($ph+".aiSeeThrough"); if(`attributeExists "aiSeeThrough" $ph`) $t = `setAttr $ex 0`; } } else { for($ph in $pb_shaderList) { string $ex = ($ph+".aiSeeThrough"); if(`attributeExists "aiSeeThrough" $ph`) $t = `setAttr $ex 1`; } } if(!(`checkBox -q -v chBox_forceHit`)) { for($ph in $pb_shaderList) { string $ex = ($ph+".hitOnShootThough"); if(`attributeExists "hitOnShootThough" $ph`) $t = `setAttr $ex 0`; } } else { for($ph in $pb_shaderList) { string $ex = ($ph+".hitOnShootThough"); if(`attributeExists "hitOnShootThough" $ph`) $t = `setAttr $ex 1`; } } print ("++++++++ DONE +++++++++ \n"); }