适用于Maya的Python:将显示层更改为“参考”

问题描述 投票:1回答:1

有没有办法设置显示层的图层状态使用python引用?如果更改发生在图层的创建或事后,则无关紧要。

提供一些上下文:我正在编写一个创建图像平面的脚本,使用“标准化”图像名称拉入参考图像,将其应用于图像平面,将它们移动到位,然后创建一个显示图层的状态设置为参考。到目前为止,除了将图层的状态设置为引用之外的所有内容都在工作。

这是我正在做的一个例子:

    front_ip = cmds.imagePlane(
    name="front_IP",
    fileName="front_ref.jpg",
    lookThrough="front",
    showInAllViews=False)
    cmds.move(0,0,-950)
    cmds.createDisplayLayer(name="front_ref_L")
python 3d maya
1个回答
2
投票

据我所知,您无法更改显示层以在创建时准确引用,但您可以使用setAttr之后执行此操作:

cmds.polySphere() # Create a sphere.
layer = cmds.createDisplayLayer() # Create a layer and add selected sphere.
cmds.setAttr("{}.displayType".format(layer), 2) # Change layer to reference.
© www.soinside.com 2019 - 2024. All rights reserved.