/*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> //Tool Name (c) 2004 Film Offset Control with Image Plane //Version 2.0 For Maya 5.0 //Author Dann Tarmy //Run Command filmOffset5; >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/ global proc filmOffset5() { filmOffsetRun(0); } global proc filmOffsetRun(int $panelNum) { // Get Current Camera // global string $currentCamera; $currentCamera = `getCurrentCamera`; // lists DAG not shape // string $camShape[] = `listRelatives -c -typ camera $currentCamera`; // finds shape // string $imagePlane[] = `listConnections -t imagePlane $camShape[0]`; string $windowTitle; if ($imagePlane[0] != "") { $windowTitle = ($currentCamera + " - Film Back & Image Plane Control");} else { $windowTitle = ($currentCamera + " - Film Back Control");} string $xOffset = ($currentCamera + ".horizontalFilmOffset"); string $yOffset = ($currentCamera + ".verticalFilmOffset"); string $overscan = ($currentCamera + ".overscan"); float $overscanStart = `getAttr ($currentCamera + ".overscan")`; string $resetCam = "resetCamera("+$overscanStart+",$currentCamera)"; string $opacity; string $depth; string $resetIP; float $depthMax; global string $PanelName; $PanelName = ("filmOffset_w" + $panelNum); int $imagePlaneState; if ($imagePlane[0] != "") { $imagePlaneState = `getAttr ($imagePlane[0] + ".displayMode")`; $opacity = ($imagePlane[0] + ".alphaGain"); $depth = ($imagePlane[0] + ".depth"); float $opacityStart = `getAttr ($imagePlane[0] + ".alphaGain")`; float $depthStart = `getAttr ($imagePlane[0] + ".depth")`; $depthMax = ($depthStart *2 ); $resetIP = "resetIP("+$depthStart+","+$opacityStart+",$currentCamera)"; } if (`window -q -exists $PanelName`) deleteUI $PanelName; window -menuBar true -maximizeButton false -title $windowTitle -iconName "filmOffset" -w 390 -h 250 $PanelName; columnLayout; menu -label "extras" -tearOff false; menuItem -label "Switch Active Camera" -command "filmOffsetRun($panelNum)"; menuItem -label "Launch New Panel" -command "newPanel($panelNum)"; menuItem -label "Reset Conrol Panel Size" -command "window -e -w 390 -h 250 $PanelName"; rowColumnLayout -numberOfRows 8; attrFieldSliderGrp -label "Film Offset Horizontal" -hmb 1 -min -1 -max 1 -fmn -100 -fmx 100 -at $xOffset; attrFieldSliderGrp -label "Film Offset Verticle" -hmb 1 -min -1 -max 1 -fmn -100 -fmx 100 -at $yOffset; attrFieldSliderGrp -label "Overscan" -hmb 1 -min 0 -max 3 -fmx 30 -at $overscan; button -label "Reset Camera Offset" -c $resetCam; if ($imagePlane[0] != "") { checkBox -label "Image Plane Active" -onc "showImagePlane(+$currentCamera+)" -ofc "hideImagePlane(+$currentCamera+)" -v $imagePlaneState; attrFieldSliderGrp -label "Image Plane Opacity" -hmb 1 -min 0 -max 1 -fmn 0 -fmx 1 -at $opacity; attrFieldSliderGrp -label "Image Plane Depth" -hmb 1 -min 0.1 -max $depthMax -fmn 0 -fmx 10000 -at $depth; button -label "Reset Image Plane" -c $resetIP; } print ($PanelName+"\r\n"); showWindow $PanelName; } global proc showImagePlane(string $cc) { // string $currentCamera = `getCurrentCamera`; string $camShape[] = `listRelatives -c -typ camera $cc`; // finds shape // string $imagePlane[] = `listConnections -t imagePlane $camShape[0]`; setAttr ($imagePlane[0] + ".displayMode") 3; } global proc hideImagePlane(string $cc) { // string $currentCamera = `getCurrentCamera`; string $camShape[] = `listRelatives -c -typ camera $cc`; // finds shape // string $imagePlane[] = `listConnections -t imagePlane $camShape[0]`; setAttr ($imagePlane[0] + ".displayMode") 0; } global proc resetCamera(float $overscanReset,string $cc) { // string $currentCamera = `getCurrentCamera`; string $xOffset = ($cc + ".horizontalFilmOffset"); string $yOffset = ($cc + ".verticalFilmOffset"); string $overscan = ($cc + ".overscan"); setAttr $xOffset 0; setAttr $yOffset 0; setAttr $overscan $overscanReset; } global proc resetIP(float $depthReset,float $opacityReset,string $cc) { //string $currentCamera = `getCurrentCamera`; string $camShape[] = `listRelatives -c -typ camera $cc`; // finds shape // string $imagePlane[] = `listConnections -t imagePlane $camShape[0]`; string $depth = ($imagePlane[0] + ".depth"); string $opacity = ($imagePlane[0] + ".alphaGain"); setAttr $depth $depthReset; setAttr $opacity $opacityReset; } global proc string getCurrentCamera() { string $currentCameraLocal; string $panel = `getPanel -wf`; if ( "modelPanel" == `getPanel -to $panel` ) { $currentCameraLocal = `modelEditor -q -camera $panel`; } // global string $currentCamera; return $currentCameraLocal; } global proc newPanel(int $panelUp) { $panelUp += 1; filmOffsetRun($panelUp); }