onExit() Interrupt project exit

I’m looking to interrupt the quit process in TouchDesigner.

So for example, I’m using an execute DAT, and onExit() I want to run a few checks in my project, and then stop exit if some criteria aren’t met. Is this something that’s possible? I’ve been successful at inserting my own popup window with ui.messageBox, but as soon as I’ve clicked a message box item the project will close.

I could also skip the onExit callback and use another mechanism to run checks and then quit - I was just hoping I could take advantage of that callback. :grimacing:

God, please yes! I also toyed arround with throwing exceptions, but nothing helped.
This would also enable our own prompts instead of the simple UI ones.

Something like returning True for an interrupt would be nice.

1 Like

So you want a way to run onExit() and not exit - just ontinue running, when the user tries to quit (or kill?) the process?

Exactly. This way we could easily implement some nice third-party-tooling. Thats esp. usefull for managing external toxes and the like, or using other sources to check if exiting is allowed etc.
The user should, of course, always have the possibility to exit enyway in one way or another, but in general thats the idea.

+1 to @alphamoonbase here. That’s exactly the hope - Just like Touch has that pop-up to save a network, I’d love to be able to catch Touch on exit and interrupt in the case that a user has unsaved work in a component (UV maps, storage, member attributes, or other info that might get wiped out). This is especially helpful when it comes to plugins for TD, or extensions to TD network behavior:

  • “do you want to save all of your external toxes?”
  • “do you want your custom parameters saved to JSON?”
  • “should I empty storage before quitting?”

All elements that you can work around - but having a clean way to interrupt would be amazing.

FYI, now there is an onExit() in the Execute DAT.

1 Like