我有一个 Python 脚本,可将立体相机的属性存储到 json
文件中,但在存储镜头长度属性时遇到问题。我是 Maya 新手,这可能是一个非常明显的问题,所以我感谢任何意见。
这是我迄今为止尝试过的:
import maya.cmds as cmds
print(cmds.getAttr("cameraMain_C0_ctl.lensLengths"))
我期望看到 15
或 15mm
的值,但结果为零。
a screenshot of the attribute I am trying to store
可以存储这个值吗?
谢谢。
最佳答案
使用以下代码获取属性(相机shapes
):
import maya.cmds as cmds
focalLengthCenter = cmds.camera("stereoCameraCenterCamShape", q=True, fl=True)
focalLengthLeft = cmds.camera("stereoCameraLeft", q=True, fl=True)
focalLengthRight = cmds.camera("stereoCameraRight", q=True, fl=True)
print(focalLengthCenter, focalLengthLeft, focalLengthRight)
# Result (70.0, 70.0, 70.0)
关于python - 如何通过Python获取立体相机镜头长度属性?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55518925/