Hi,
I am trying to create a python script to swtich an image plane between cameras.
The scripts works fine but when I add animation keys to the cameras I get this error:
Error: RuntimeError: file <maya console> line 23: Unable to edit the image plane.
This is my script:
#Compose shot
import maya.cmds as cmds
import maya.mel as mel
#Get camera shot clip atrributes
camSel = cmds.ls( sl=True )
print camSel
if len(camSel) == 1:
camSelShape = cmds.listRelatives(camSel)
print str(camSelShape)
clp = cmds.listConnections( camSelShape, d=True )
matchingClip = [s for s in clp if "clip" in s]
#Get attribs from clip
getAst = cmds.getAttr(str(matchingClip[0]) + '.startFrame')
getAet = cmds.getAttr(str(matchingClip[0]) + '.endFrame')
#Set up the Maya GUI to compose the shot
cmds.playbackOptions( ast = getAst , aet = getAet, min = getAst , max = getAet )
cmds.lookThru( 'perspView', camSelShape[0])
cmds.currentTime(getAst)
#Connect IP to camera
print cmds.listRelatives(camSelShape)
cmds.imagePlane( 'myIp1', e = True, d = True)
ipcamera = cmds.imagePlane( 'myIp1', camera = str(camSel[0]), e = True)
mel.eval ( ' showEditorExact(' + camSelShape[0] + '->myIpShape1) ' )
else:
print "Select only one camera"
Any help will be appreciated.
Thanks