//-------------------------------------------------------- // Script Name: Camera HUD tool // Last Updated: September 25 2010 // Authors: Bahou reda // e-mail: bahoumohamed_reda@hotmail.com // // create HUD control overscan and pan and image plane opacity // switch between proxy and full resolution image plane // useful for camera projection // Usage : open in script editor and drag to shelf. // //-------------------------------------------------------- //----- query and create HUD ----- if(`headsUpDisplay -q -ex "HUDoverscan"` != 1) { global proc OverscanCam( string $HUD ) { // Ensure undo enabled since we will just trigger this on the button // release event. // undoInfo -swf false; $camera = `modelEditor -q -camera modelPanel4`; { { string $overscan = $camera + ".overscan"; float $value = `hudSlider -q -v $HUD`; setAttr $overscan $value; } } undoInfo -swf true; } hudSlider -section 5 -block 5 -visible 1 -label "overscan :" -value 1.3 -type "float" -minValue 0.05 -maxValue 5 -labelWidth 60 -valueWidth 50 -sliderLength 100 -sliderIncrement 0.005 -dragCommand "OverscanCam( \"HUDoverscan\" )" HUDoverscan; global proc filmOffsetH( string $HUD ) { // Ensure undo enabled since we will just trigger this on the button // release event. // undoInfo -swf false; $camera = `modelEditor -q -camera modelPanel4`; { float $value = `hudSlider -q -v $HUD`; setAttr ($camera+".horizontalFilmOffset") `hudSlider -q -v $HUD`; } undoInfo -swf true; } hudSlider -section 5 -block 7 -visible 1 -label "OffsetH :" -value 0 -type "float" -minValue -0.6 -maxValue 0.6 -labelWidth 60 -valueWidth 50 -sliderLength 100 -sliderIncrement 0.01 -dragCommand "filmOffsetH( \"HUDfilmOffH\" )" HUDfilmOffH; global proc filmOffsetV( string $HUD ) { // Ensure undo enabled since we will just trigger this on the button // release event. // undoInfo -swf false; $camera = `modelEditor -q -camera modelPanel4`; { float $value = `hudSlider -q -v $HUD`; setAttr ($camera+".verticalFilmOffset") `hudSlider -q -v $HUD`; } undoInfo -swf true; } hudSlider -section 5 -block 6 -visible 1 -label "OffsetV :" -value 0 -type "float" -minValue -0.6 -maxValue 0.6 -labelWidth 60 -valueWidth 50 -sliderLength 100 -sliderIncrement 0.01 -dragCommand "filmOffsetV( \"HUDfilmOffV\" )" HUDfilmOffV; global proc changeCamOffset( string $HUD ) { undoInfo -swf false; $camera = `modelEditor -q -camera modelPanel4`; { setAttr ($camera+".horizontalFilmOffset") 0; setAttr ($camera+".verticalFilmOffset") 0; } undoInfo -swf true; } hudButton -s 5 -b 3 -vis 1 -l "reset" -bw 40 -bsh "roundRectangle" -rc "changeCamOffset( \"HUDchangOffButton\" )" HUDchangOffButton; global proc AlphaGain( string $HUD ) { // Ensure undo enabled since we will just trigger this on the button // release event. // undoInfo -swf false; { float $value = `hudSlider -q -v $HUD`; $camera = `modelEditor -q -camera modelPanel4`; string $IP[] = `listConnections -d off -s on ($camera+".imagePlane[0]")`; setAttr($IP[0]+".alphaGain") `hudSlider -q -v $HUD`; } undoInfo -swf true; } hudSlider -section 5 -block 4 -visible 1 -label "alpha :" -value 1 -type "float" -minValue 0 -maxValue 1 -labelWidth 60 -valueWidth 50 -sliderLength 100 -sliderIncrement 0.01 -dragCommand "AlphaGain( \"HUDalpha\" )" HUDalpha; global proc imgSwitch( string $HUD ) { $camera = `modelEditor -q -camera modelPanel4`; string $st[] = `listConnections -d off -s on ($camera+".imagePlane[0]")`; headsUpDisplay -rem HUDreturnState; if ($st[0] == "imagePlanePROXY"){ connectAttr -f imagePlaneFULL.message ($camera+".imagePlane[0]"); headsUpDisplay -section 5 -block 2 -blockAlignment "center" -dataFontSize "large" -dataWidth 50 -label "FULL" -lfs large -command "" HUDreturnState; } else{ connectAttr -f imagePlanePROXY.message ($camera+".imagePlane[0]"); headsUpDisplay -section 5 -block 2 -blockAlignment "center" -dataFontSize "large" -dataWidth 50 -label "PROXY" -lfs large -command "" HUDreturnState; } } hudButton -s 5 -b 1 -vis 1 -l "switch" -bw 50 -bsh "roundRectangle" -rc "imgSwitch( \"HUDchangOffButton\" )" HUDimgSwitch; } else { headsUpDisplay -rem HUDoverscan; headsUpDisplay -rem HUDfilmOffH; headsUpDisplay -rem HUDfilmOffV; headsUpDisplay -rem HUDchangOffButton; headsUpDisplay -rem HUDalpha; headsUpDisplay -rem HUDimgSwitch; headsUpDisplay -rem HUDreturnState; }