I am writing a script that a user triggers by selecting an item in a menu. First, the script must check if any nodes are selected, so I wrote this code:
selectedNodes = nuke.selectedNodes()
if len(selectedNodes) == 0:
msg = 'No nodes selected.'
nuke.message(msg)
If no nodes were selected, the script should flash a message and exit after the user clicks the 'OK' button. I am trying to figure out how to do this. According to the docs, nuke.scriptExit() exits Nuke, which I do not want. I tried using nuke.scriptClose(), which caused Nuke to exit and realaunch! I then used sys.exit(), which caused Nuke to exit. Any hints?