Community
Maya Programming
Welcome to Autodesk’s Maya Forums. Share your knowledge, ask questions, and explore popular Maya SDK topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Connecting a free image plane to several cameras

1 REPLY 1
Reply
Message 1 of 2
jalixko
333 Views, 1 Reply

Connecting a free image plane to several cameras

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

1 REPLY 1
Message 2 of 2
jalixko
in reply to: jalixko

Solved!

If the imagePlane has some imput connections such as the size it is not possible to edit the imagePlane in python.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report