我写了一个代码,我想直接从Maya脚本文件夹访问。。 当我试图从托盘访问“poly”或“srfc”时。上面写着“名字没有定义”。 我不熟悉python编程,但我想做一个这样的工具。请在这方面给予帮助。我甚至想在课堂上把这些都包起来。在这方面也请帮忙。。在
import maya.cmds as mc
def win():
if mc.window("filters", exists = True):
mc.deleteUI("filters")
myWindow = mc.window("filters", t= "Tools", s = False, rtf= True, wh = (3, 500))
mc.rowColumnLayout(nc=20)
mc.button(l = "mesh", w= 30, h= 18, c = "poly()", bgc = (.3,.3,.3))
mc.showWindow(myWindow)
def poly():
currentPanel = mc.getPanel(wf = True)
if mc.modelEditor(currentPanel, q=True, polymeshes = True) == 1:
mc.modelEditor(currentPanel, e=True, polymeshes = False)
elif mc.modelEditor(currentPanel, q=True, polymeshes = True) == 0:
mc.modelEditor(currentPanel, e=True, polymeshes = True)
您正在以字符串形式调用
poly()
函数。只有在poly与调用win()
的代码在同一命名空间中定义时,这才有效。将这两个函数包装在一个类中可以让它们看到对方:您还应该直接引用函数对象
poly
,而不是字符串(注意这里缺少引号)这是一个reference on the different ways to hook controls up cleanly
相关问题 更多 >
编程相关推荐