# Error: RuntimeError: file <maya console> line 13: Object '<function save_snapshots at 0x000001757D101EB8>' not found. #
我正在编写一个脚本来创建uv快照。目前,我一直在获取“save\u snapshots”来获取“uv\u snapshots\u res”应该给出的整数
在我的UI中,“save”按钮使用的是partial,我不完全理解它是如何工作的。如果我按命令的顺序将save\u快照移到“texSizeControl”后面,它就不会运行了(我想?)
希望对解释使用函数时传递参数的工作原理,以及“部分”操作的顺序有点帮助。。。 唯一的原因,我到目前为止,是因为这个网站和寻找其他领域的例子。整个单选按钮的事情是一个完全的挑战,我不知道我是否完全正确工作:/sorry
任何你提供的帮助或建议我都洗耳恭听
## UV SNAPSHOTS
## PYTHON
import maya.cmds as mc
def get_snapshot_res(label, *args):
uv_snap_res = label
def save_snapshots(get_snapshot_res, uv_snap_res, *args):
get_snapshot_res(uv_snap_res)
print get_snapshot_res
def passValue(texSizeControl, *args):
radioCol = mc.radioCollection(texSizeControl, query=True, sl=True)
getSelectRadioVal = mc.radioButton(radioCol, query=True, label=True)
get_snapshot_res(getSelectRadioVal)
def save_snapshots_ui(*args):
myWindow = 'Create UV Snapshots'
if mc.window(myWindow, exists=True):
mc.deleteUI(myWindow)
mc.window(myWindow, title = myWindow)
mc.columnLayout(adjustableColumn=True)
mc.text(label='Choose your resolution for UV Snapshots', font='obliqueLabelFont')
texSizeControl = mc.radioCollection()
saveRadio1k = mc.radioButton(label='1024')
saveRadio2k = mc.radioButton(label='2048')
saveRadio4k = mc.radioButton(label='4096')
saveRadio8k = mc.radioButton(label='8192')
texSizeControl = mc.radioCollection(texSizeControl, edit=True, select=saveRadio2k )
mc.button(label='save', command= partial(passValue, save_snapshots, texSizeControl))
mc.setParent( '..' )
mc.showWindow()
save_snapshots_ui()
尝试删除不需要的*args,您应该这样编写脚本:
你知道吗====================================
相关问题 更多 >
编程相关推荐