我试图弄清楚如何询问相机是否有图像平面。现在,我正在使用这段代码来找出图像平面的名称,但是,如果'persp'没有一个它错误的图像平面:
line 2: 'NoneType' object has no attribute '__getitem__' #如果有人能帮我理解,我如何才能让它检查相机是否有一个图像平面,在它出错之前。
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`谢谢,亚当
发布于 2017-10-27 04:36:43
你可以检查是否有iplane,然后做这些事情或者做空列表。
camShape = cmds.listRelatives('persp', type='camera', fullPath=True)[0]
ip = cmds.listConnections(camShape, type="imagePlane") or []
if ip:
ImageName = ip[0].split('>')[+1]
print ImageNamehttps://stackoverflow.com/questions/46964579
复制相似问题