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.
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.
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.
I know this is an old thread, but I’m in a similar situation: I want to turn off some operators via what could be onProjectPreSaveAndExit() - AKA I would like to perform some options that will get saved with the file - but ONLY if that is happening when someone is doing a “Save & Quit” and not just any onProjectPreSave() (is there a way to check if TD is in the process of quitting inside of that def?)
Like, the user closed TouchDesigner and TouchDesigner pops up the little dialog asking if you want to “Save & Quit”, “Quit”, or just “Cancel”… They click “Save & Quit” and then this script runs to turn off some ops active PARs before the next time it all starts up…
Or is using the onStart() in the Execute DAT to ‘de-active’ these OPs enough to make SURE they are inactive before TouchDesigner starts to actually cook / do anything with them?