jeudi 26 octobre 2017

How to query if Camera has Image plane.py

I am trying to figure out how to query if a camera has an image plane. Right now i am using this code to find out what the name of the image plane is but, if 'persp' doesn't have an image plane it errors out with:

line 2: 'NoneType' object has no attribute '__getitem__' #

if someone can help me understand how i can get it to check if the camera has an image plane before it errors out.

1: camShape = cmds.listRelatives('persp', type='camera', fullPath=True)[0]
2: ip = cmds.listConnections(camShape, type="imagePlane")[0]
3: ImageName = ip.split('>')[+1]
4: print ImageName`

Thanks, Adam

Aucun commentaire:

Enregistrer un commentaire