Blocking interaction like a modal dialog
I am trying to create a modal dialog with pyside. Is ist possible to lock the interface like a native C4D modal dialog does, so the user can't interact with Cinema until my window is closed?
m_adam last edited by m_adam
Hi @Boony2000, unfortunately, we could not provide any support regarding usage of 3rd party module, and I invite you to take a look to the pyside documentation or to ask how a modal dialog can be done in a specialized forum about PySide.
Regarding about general way for doing a modal function. First of all call StopAllThread, and keep the main thread busy until your dialog which is executed into another thread is closed. See Threading with Python.
Moreover, you seem to be already aware of but Cinema 4D offers the possibility to open a GeDialog as modal with the flag c4d.DLG_TYPE_MODAL or c4d.DLG_TYPE_MODAL_RESIZEABLE.
thank you for your answer. In the mean time as a workaround I built a tiny modal c4d dialog that is hidden behind my actual dialog, thus blocking the interface. I will look into building it with a seperate thread to have a cleaner approach.
Just to follow up, what Maxime suggested worked perfectly. No more cheating, basically just
c4d.StopAllThreads() dialogThread.Start() dialogThread.Wait(True)