首页 文章

从Maya镜头列表中获取Attr

提问于
浏览
-1

我想从镜头列表中的字段(在相机音序器中)获取信息 . 我已解决的枪口名称:

test = cmds.getAttr('shot1.sn')
print test

但其余的......我被困住了 . 当我尝试调用其他参数如startTime时,我会遇到各种错误,具体取决于我是如何尝试的 .

1 回答

  • 0

    欢迎来到SO,Fantasi .

    你提出了一个非常模糊的问题,所以作为回报,你会得到一个非常含糊的答案 .

    您可以在音序器对象上使用 cmds.listConnections 获取您的镜头列表 . 之后,使用 for 循环并使用 cmds.getAttr 获取镜头的信息,如下所示:

    shots = cmds.listConnections("sequencer1", type="shot") or []  # Get a list of all shots from the sequencer.
    
    for shot in shots:
        shot_name = cmds.getAttr("{}.shotName".format(shot))  # Query shot's name.
        start_frame = cmds.getAttr("{}.startFrame".format(shot))  # Query shot's start frame.
        end_frame = cmds.getAttr("{}.endFrame".format(shot))  # Query shot's end frame.
        print shot_name, start_frame, end_frame  # Print out shot's info.
    

    具有2个镜头的音序器的示例输出:

    输出:拍摄1.0 50.0 shotEnd 51.0 120.0

    如果你're unsure about the shot object'属性名称然后you can find them here .

    如果您仍有问题,我建议您从脚本编辑器粘贴错误消息,以便我们可以诊断出错了什么 .

相关问题