Maya cmds pymel scriptJob() 和 undoInfo() 在回调中撤销(undo)

Maya cmds pymel scriptJob() 和 undoInfo() 在回调中撤销(undo)

def myEventFun():

    cmds.undoInfo(stateWithoutFlush = 0)

    # your code

    pass

    cmds.undoInfo(stateWithoutFlush = 1)

cmds.scriptJob(event = ['SelectionChanged', myEventFun], killWithScene = 1)

stateWithoutFlush 的意思是把 undo 关掉,但是还保留之前的序列

这样就可以 CTRL + Z 直接把回调中的所有步骤一次撤销

原文地址:https://www.cnblogs.com/ibingshan/p/10532052.html