Search code examples
cameramayafor-in-loopmel

Camera Image plane in Autodesk Maya


I'm trying to use a camera bake script from maya 2011 but getting an image plane error. It seems Maya now puts a transform node above the image plane. I also see there is an imagePlane procedure now. Anyone have any ideas on how to attach an existing image plane to a duplicated camera or what this transform node does?

string $oldCamera[] = `ls -l -sl` ;
string $results[] ;
string $curCam = $oldCamera[ 0 ] ;

string $listRelCam[] = `listRelatives -f -type "camera" $curCam` ;
string $newCamera[] = `duplicate -rr $curCam` ;

string $oldShape[] =`listRelatives -f -s $curCam` ;
string $newShape[] = `listRelatives -f -s $newCamera[ 0 ]` ;

// Attach an image plane

string $oldShape[] =`listRelatives -f -s $curCam` ;
string $newShape[] = `listRelatives -f -s $newCamera[ 0 ]` ; 
string $imagePlanes[] = `listConnections -d 1 ( $oldShape[ 0 ] + ".imagePlane" )` ; 

int $count = 0 ;

for ( $im in $imagePlanes ) {
    connectAttr -f ( $im + ".message" )( $newShape[ 0 ] + ".imagePlane[ " + $count + " ]" ) ;
    $count++ ;
}

I also tried it this way but with no success.

int $count = 0 ;

for ( $im in $imagePlanes ) {
    $tempName = `imagePlane -q -n $im` ;
    connectAttr -f ( $tempName[ 0 ] + ".message" )( $newShape[ 0 ] + ".imagePlane[ " + $count + " ]" ) ;
    $count++ ;
}

Solution

  • imagePlane -e -detach imagePlane1; imagePlane -e -camera camera2;