【发布时间】:2021-01-26 00:04:34
【问题描述】:
我在这里有一个 python 函数,它应该在 Maya 中重命名对象。但是当窗口出现并且我点击“重命名”按钮时,没有任何改变。甚至没有带来新的窗口。请帮忙
def renameObject():
a = cmds.ls(sl=True)
txt = cmds.textField('txtName', q=True, tx=True)
cmds.rename('a', txt)
cmds.confirmDialog(icn='information', message='Done!')
cmds.showWindow()
return
cmds.window(title='Rename Object')
cmds.columnLayout(adj=1)
cmds.text(label= 'Insert Name', w=300, h=30)
cmds.separator()
cmds.textField('txtName')
cmds.button(label='Rename', width=300, c=lambda*args:'renameObject()')
cmds.showWindow()
【问题讨论】:
-
你能提供一个运行的例子吗?请考虑查看minimal reproducible example。这将有助于重现您的问题。