EventAdd() or how to update?
On 12/02/2018 at 02:50, xxxxxxxx wrote:
i have developed a file manager tool in PySide that performs some c4d actions like create a new empty scene.
When i click i call kill document, but the viewport and the object manager doesnt update until i close my PySide dialog.
So reading the docs, i decided to call c4d.EventAdd(c4d.EVENT_FORCEREDRAW) to see if that solves the problem... turns out it doesnt.
I understand my approach is not very orthodox since PySide is not supported natively in Cinema4d but for the moment this is the way i want to go but i presume this shouldnt make any difference to the problem posted.
so how do i force cinema 4d to update?
On 13/02/2018 at 05:10, xxxxxxxx wrote:
EventAdd() just posts an event, which will be processed in main thread later on. As long as your seemingly modal dialog blocks the main thread, Cinema 4D can not update (nor do anything else).
We strongly recommend to make use of Cinema 4D's own dialogs (GeDialog). Not only because we can not support PySide, but also to provide users with a consistent look and feel. And in this case a asynchronous dialog (DLG_TYPE_ASYNC) would probably more appropriate.
On 18/02/2018 at 23:05, xxxxxxxx wrote:
Im afraid using GeDialog or Cinema's own builtin GUI library is not an option for me right now.
Isnt there an option to grab cinema's main thread from another process/app and send events?
In PyQt we have the option the get a pointer to the main application via QtWidgets.QApplication.instance(), im looking for something similar in Cinema's Python API..
On 20/02/2018 at 04:48, xxxxxxxx wrote:
remember your issue is not so much getting Cinema 4D's main thread, but more about blocking Cinema 4D's main thread with your dialog.
Yes, there are custom events, you can make use of. These are created/sent by SpecialEventAdd() and received either in dialogs in GeDialog.CoreMessage() or MessageData.CoreMessage(). CoreMessage() is then running in the context of Cinema 4D's main thread.