global proc imagePlaneToggler(){ string $selObjs[] = `ls -sl`; int $selNum =`size $selObjs`; global float $onA =.1; global float $onB =.6; global float $onC =.4; global float $offA =.7; global float $offB =.2; global float $offC =.2; if ($selNum == 0) { string $cameras[] = `ls -type camera`; { string $imagePlanes[] = `ls -type imagePlane`; if (`window -exists windowImgPlanes`) deleteUI windowImgPlanes; window -title "Imageplane Toggler" -width 400 windowImgPlanes; rowColumnLayout -numberOfColumns 7 -cs 3 10 -columnWidth 1 35 -columnWidth 2 1 -columnWidth 3 250 -columnWidth 4 50 -columnWidth 5 200 -columnWidth 6 25 //-columnWidth 7 10 -backgroundColor .3 .3 .3 ; for ($plate in $imagePlanes) { string $ipShape = `substitute "^[^>]*\\>" $plate ""`; int $dMode = `getAttr ($ipShape + ".displayMode")`; $cameraConnection =`imagePlane -q -camera $plate`; //------------------------------------------------------------------------ if ($dMode != 0) { string $toggleBtn; $toggleBtn = `button -label ("RGBA") -annotation $plate -bgc $onA $onB $onC `; button -edit -command ("changeButtonColour " + $toggleBtn) $toggleBtn; attrControlGrp -label (" "+$ipShape) -a ($plate+".displayMode") -changeCommand ("changeButtonColourTest " + $toggleBtn); text -font "smallBoldLabelFont" -label ($ipShape+"__________________________________________________") -al "left"; } else { string $toggleBtn; $toggleBtn = `button -label ("NONE") -annotation $plate -bgc $offA $offB $offC `; button -edit -command ("changeButtonColour " + $toggleBtn) $toggleBtn; attrControlGrp -label (" "+$ipShape) -a ($plate+".displayMode") -changeCommand ("changeButtonColourTest " + $toggleBtn); text -font "smallBoldLabelFont" -label ($ipShape+"__________________________________________________") -al "left"; } //------------------------------------------------------------------------ button -label ("select") -command ("select "+ $ipShape+";"); attrControlGrp -label "_________________________depth" -a ($plate+".depth"); button -label ("x") -bgc .2 .2 .2 -command ("delete "+ $ipShape+";"); //text -label $cameraConnection; text -label ""; } text -label ""; text -label ""; text -label ""; text -label ""; text -label ""; text -label ""; text -label ""; button -label "Reload" -command "select -cl;imagePlaneToggler();"; text -label ""; button -label "Alloff" -command "funcOff"; button -label "AllOn" -command "funcOn"; textField -text "Global Frame Cache. Enter Value." -enterCommand "globalCacheChange" globalCache; //text -label ""; button -label "LTC" -command "lookthroughcam"; showWindow windowImgPlanes; } } //----------------------------------------------------------------------------------------------- else if ($selNum > 0) { string $type = `nodeType $selObjs[0]`; if ($type == "camera") { string $selObj[] = `ls -sl`; global string $slider1; if (`window -exists $selObj[0]`) deleteUI $selObj[0]; window -title ("Imageplane Toggler "+$selObj[0]) $selObj[0]; rowColumnLayout -numberOfColumns 5 -columnWidth 1 50 -columnWidth 2 185 -columnWidth 3 50 -columnWidth 4 200 -backgroundColor .15 .15 .15; for ($obj in $selObj) { string $camIP[] = `listConnections -d 1 ($obj +".imagePlane")`; for ($plate in $camIP) { string $component = `substitute "^[^>]*\\>" $plate ""`; $ipShape = `listRelatives -ad -s $component`; int $dMode = `getAttr ($plate + ".displayMode")`; // attrControlGrp -label $plate -a ($plate+".displayMode");//checkBox ; //--------------------------------------------------------------- if ($dMode != 0) { string $toggleBtn; $toggleBtn = `button -label ("RGBA") -annotation $plate -bgc $onA $onB $onC `; button -edit -command ("changeButtonColour " + $toggleBtn) $toggleBtn; attrControlGrp -label ($ipShape) -a ($plate+".displayMode") -changeCommand ("changeButtonColourTest " + $toggleBtn); } else { string $toggleBtn; $toggleBtn = `button -label ("NONE.") -annotation $plate -bgc $offA $offB $offC `; button -edit -command ("changeButtonColour " + $toggleBtn) $toggleBtn; attrControlGrp -label ($ipShape) -a ($plate+".displayMode") -changeCommand ("changeButtonColourTest " + $toggleBtn); } //------------------------------------------------------------------------ button -label ("select") -command ("select "+ $plate+";print " +$component+";"); attrControlGrp -label "_________________________depth" -a ($plate+".depth"); button -label ("X") -bgc .1 .1 .1-command ("delete "+ $plate+";"); } } text -label ""; text -label ""; text -label ""; text -label ""; text -label ""; string $refButn; $refButn = `button -label ("Reload") -annotation $selObjs[0]`; button -edit -command ("reloadWindow " + $refButn) $refButn; string $allOffBtn = `button -label "Alloff" -command "funcOff"`; string $allOnBtn = `button -label "AllOn" -command "funcOn"`; textField -text "Global Frame Cache. Enter Value." -enterCommand "globalCacheChange" globalCache; string $selCamBtn = `button -label "LTC" -annotation $selObjs[0] -bgc .1 .4 .7`; button -edit -command ("lookTcam " + $selCamBtn) $selCamBtn; showWindow $selObj[0]; } else if ($type != "camera") { select -cl; imagePlaneToggler(); } } //-------------------------------------------------------------------------------- } global proc lookthroughcam() { $state = 0; $imagePlanes = `ls -type imagePlane`; print $imagePlanes; for($plane in $imagePlanes){ imagePlane -e -showInAllViews false $plane; } } //-------------------------------------------------------------------------------- global proc funcOff() { $state = 0; $imagePlanes = `ls -type imagePlane`; print $imagePlanes; for($plane in $imagePlanes){ setAttr ($plane+".displayMode") $state; setAttr ($plane+".type") 1; } } //-------------------------------------------------------------------------------- global proc funcOn() { $state = 3; $imagePlanes = `ls -type imagePlane`; print $imagePlanes; for($plane in $imagePlanes){ setAttr ($plane+".displayMode") $state; setAttr ($plane+".type") 0; } } //-------------------------------------------------------------------------------- global proc reloadWindow(string $whichButton) { string $buttonLabel = `button -query -annotation $whichButton`; select $buttonLabel; imagePlaneToggler(); select -d $buttonLabel; } //-------------------------------------------------------------------------------- global proc refreshPlates(string $whichButton) { $imagePlanes = `ls -type imagePlane`; for($plane in $imagePlanes) { string $path = getAttr ($plane+".imageName"); string $filepart = match( "[^/\\]*$", $path ); string $seqNum[] ; tokenize $filepart "." $seqNum ; int $number = ($seqNum[1]); string $directory = `match "^[^\.]*" $path`; //print ($directory+"."+($number+1)+".png"); $path1 = ($directory+"."+($number-0)+".png"); setAttr -type "string"($plane+".imageName") $path1; } print "ahhhhh!!!"; } //-------------------------------------------------------------------------------- global proc globalCacheChange() { $imagePlanes = `ls -type imagePlane`; float $v = `textField -q -tx globalCache`; for($plane in $imagePlanes){ setAttr ($plane+".frameCache") $v; } print ("frame cache is for all imageplanes is" +$v); } //-------------------------------------------------------------------------------- global proc lookTcam(string $whichButton) { string $panel = `getPanel -wf`; string $camname = `button -query -annotation $whichButton`; print ("" +$camname +"\n"); select $camname; lookThroughSelected 0 $panel; } //---------------------------------------------------------------------------------- global proc changeButtonColour (string $whichButton) { global float $offA; global float $offB; global float $offC; string $buttonLabel = `button -query -annotation $whichButton`; int $dMode = `getAttr ($buttonLabel + ".displayMode")`; print $dMode; print $buttonLabel; if ($dMode != 0) { setAttr ($buttonLabel + ".displayMode") 0; setAttr ($buttonLabel + ".type") 1; button -edit -bgc $offA $offB $offC -label "NONE" $whichButton ; } else { setAttr ($buttonLabel + ".displayMode") 3; setAttr ($buttonLabel + ".type") 0; button -edit -bgc .6 .6 .9 -label "RGBA" $whichButton ; } } /////////----------------------- global proc changeButtonColourTest (string $whichButton) { string $buttonLabel = `button -query -annotation $whichButton`; int $dMode = `getAttr ($buttonLabel + ".displayMode")`; global float $onA; global float $onB; global float $onC; global float $offA; global float $offB; global float $offC; if ($dMode == 3) { button -edit -bgc $onA $onB $onC $whichButton; } else if ($dMode == 1) { button -edit -bgc $onA $onB $onC $whichButton; } else if ($dMode == 2) { button -edit -bgc .9 .9 .5 $whichButton; } else { button -edit -bgc $offA $offB $offC $whichButton; } } ///----------------- imagePlaneToggler();