I need to make a modal dialog with progress bar to keep the user waiting while I skip some frames to do some calculations and go back to the starting frame.
Modal dialogs will block C4D's main thread, so I cannot change the document.
Async dialogs allows the user to interact with the document, potentially ruining the process.
What can be done here?
Can I prevent the user from altering the document with an async modal?
Hi @rsodre this is the purpose of modal dialogs and should be the only way to go if you want to prevent any interactions from the user.
Now regarding your issue, note, when a modal dialog is displayed some refresh mechanics in C4D are paused, like the update of the UI (viewport, OM).
So you can directly do the logic within your dialog which is within the main thread.
Then add a timer to check when the Dialog is closed and then add an Event. To do so in the Timer check if the dialog is not open with IsOpen and then call EventAdd.
Another solution if you don't want to have the whole logic within your Dialog. Is to either add a SpecialEventAdd from your Dialog and catch this Core Message into another plugin and do the stuff in this plugin or call ExecuteOnMainThread.
If you have any question, please let me know.
@m_adam I think that will not be possible for what I want to do.
I ended up catching BFM_LOSTFOCUS in the dialog, canceling the process.