Seiten

Mittwoch, 29. Juni 2011

changeMultiCamAttr

A small script for changing multible displayOptions for all cameras in the scene(except the persp and the orthographic ones)

We used the cameraSequencer a lot .So i used the script to standardize all cams in the end before playblasting.

 



















download .mel file


http://dl.dropbox.com/u/34893475/changeMultiCamAttr.mel








//CODE




//rf2010



//UI
if ( `window -exists mCAC` ) {
 deleteUI mCAC;
 }

string $window = `window -title "MultiCamAttrChange" -widthHeight 130 30 mCAC`;
          
frameLayout -collapsable false -label "DisplayOptions"  -borderStyle "etchedOut" displayoptionsLayout ;

       floatSliderGrp -l"Overscan" -min 0.5 -max 3 -pre 1 -field true -v 1 overScanSliderGroup1;

       colorSliderGrp -l "GateMaskColor" -ann 2   -rgb 0.5 0.5 0.5 gateMaskColorSliderGroup1 ;
       floatSliderGrp -l "GateMaskOpacity" -min 0 -max 1 -pre 1 -field true gateMaskOpacitySliderGroup;
    
        setParent ..;

            frameLayout -collapsable true -label "GateSettings"  -borderStyle "etchedOut" -w 300 gateSettingsLayout ;
            radioButtonGrp  -numberOfRadioButtons 3 -labelArray3 "No Gate" "Film Gate" "Resolution Gate" displayGateRadioButtonGrp ;

            setParent ..;

                  frameLayout -collapsable true -label "ClipPlanes"  -borderStyle "etchedOut" -w 300 clipPlanesLayout ;
                  floatFieldGrp -numberOfFields 2 -label "NearClipPlane" -extraLabel "FarClipPlane" -value1 1 -value2 1000 clipPlanesfloatFieldGrp ;

                setParent ..;

                    frameLayout -collapsable false -label "__________________DO_IT______________________"  -borderStyle "etchedOut" commandLayout;

                    button -label "ChangeAttr on All Cams" -c "multiCamsAttr"  -bgc .5 .4 .4 commandButton ;

                    setParent ..;

showWindow $window;


// Script

proc multiCamsAttr () {

//All Variables


//Array for all Cams
string $selCam[] =`ls-ca`;

//Overscan
float $Slg1 = `floatSliderGrp -query -value  overScanSliderGroup1 `;
print "Overscan ="  ;
print $Slg1 ;

//GateMaskOpacity
float $Slg2 = `floatSliderGrp -query -value  gateMaskOpacitySliderGroup `;
print "gateMAskOpacity ="  ;
print $Slg2 ;

// gateMaskColor
vector $Cslg1 = `colorSliderGrp -query -rgb  gateMaskColorSliderGroup1 `;
print "gateMAskColor = "  ;
print $Cslg1 ;
float $CvecX =  $Cslg1.x ;
float $CvecY =  $Cslg1.y ;
float $CvecZ =  $Cslg1.z ;
print "\n" ;
print "gateMAskColor R = "  ;
print $CvecX ;
print "\n" ;
print "gateMAskColor G = "  ;
print $CvecY ;
print "\n" ;
print "gateMAskColor B = "  ;
print $CvecZ ;
print "\n" ;

// Display Gate
int $Rbg = `radioButtonGrp -q -sl displayGateRadioButtonGrp`;
print "radioButtonGrp = "  ;
print $Rbg ;

// near & farClipPlanes
float $Ffg_1[] = `floatFieldGrp -query -value  clipPlanesfloatFieldGrp `;
print "\n" ;
print "nearClipPlanes = "  ;
print $Ffg_1[0] ;
print "\n" ;
print "nearClipPlanes = "  ;
print $Ffg_1[1] ;


// Loop

for ($current in $selCam){
    switch ($current)
    {
        case "perspShape":
        print "\n" ;
        print "persp keep untouched" ;
        break ;
       
        case "topShape":
        print "\n" ;
        print "top keep untouched" ;
        break ;
       
        case "sideShape":
        print "\n" ;
        print "side keep untouched" ;
        break ;
       
            case "frontShape":
        print "\n" ;
        print "front keep untouched" ;
        break ;
       
               
        default :
        setAttr ($current+".overscan") $Slg1 ;
        setAttr ($current+".displayGateMaskOpacity") $Slg2 ;
        setAttr ($current+".displayGateMaskColor") $CvecX $CvecY $CvecZ  ;
        setAttr ($current+".nearClipPlane") $Ffg_1[0];
        setAttr ($current+".farClipPlane") $Ffg_1[1];
        if ( $Rbg == 1 ) {
                        setAttr ($current+".displayFilmGate") off ;
                        setAttr ($current+".displayResolution") off ;
                        setAttr ($current+".displayGateMask") on ;
                        }
        if ( $Rbg == 2 ) {
                        setAttr ($current+".displayFilmGate") on ;
                        setAttr ($current+".displayResolution") off ;
                        setAttr ($current+".displayGateMask") on ;
                        } 
        if ( $Rbg == 3 ) {
                        setAttr ($current+".displayFilmGate") off ;
                        setAttr ($current+".displayResolution") on ;
                        setAttr ($current+".displayGateMask") on ;
                        }                                         
      
        break ;
     }
};

}

Keine Kommentare:

Kommentar veröffentlichen