1
我一直在研究Maya中的一個腳本,它允許我使用攝像頭而不必一直進入Attribute Editor
。目前我有一個菜單項和菜單項,我也有複選框標誌。當複選框按鈕被切換時,它會運行一個命令來打印出複選框的結果。我想要做的是有一個if statement
,它將切換任何攝像頭中的dof
屬性,但是通過讀取複選框標誌的結果來完成此操作。我知道如何正確使用if statements
並找到正確的相機,但我不知道如何查詢結果。一些腳本在下面,第四行,if statement
,是我遇到問題的地方。感謝您的幫助!在Maya中使用Python引用結果
#Window Functions go here
def dofToggle(self):
print(cmds.menuItem("dof", q=1, cb=1))
# query the result
if (cmds.menuItem("dof") == 1):
cmds.setAttr(camera1.dof=True)
# window settings go here
if (cmds.window("Camera Tools", exists=True)):
cmds.deleteUI("Camera Tools")
cmds.window(title="Camera Tools", nestedDockingEnabled=True, rtf=True, sizeable=False, menuBar=True, menuBarResize=True, menuBarVisible=True)
cmds.menu(label="dof")
cmds.menuItem("dof", label="on/off", checkBox=True, command=dofToggle)