Hello again;
when I wish to use the global status bar in Python (c4d.StatusSetBar()
etc) I need to relinquish control to C4D so the GUI can be updated and the status bar is actually redrawn. If I'm in a Python script and just keep setting the status bar, it's only updated after the script has ended:
for p in xrange(101):
c4d.StatusSetBar(p)
time.sleep(0.05)
So, this code obviously doesn't work.
Adding EventAdd()
doesn't work either, as this will only add a redraw to the message queue, which is not evaluated until the script ends.
Using c4d.GeSyncMessage(c4d.EVMSG_CHANGE)
seems promising but it always returns False
.
DrawViews
only redraws the viewports.
Is it really impossible to relinquish control from a Python script to enable C4D to evaluate the message queue once, and then return to the script? Or enforce the update of the status bar in some other way? It's definitely not an insurmountable technical issue, because if I call MessageDialog
in between...
for p in xrange(101):
c4d.StatusSetBar(p)
if p in [5,20,30,40,50,75,100]:
gui.MessageDialog("xxx")
time.sleep(0.05)
...not only the dialog appears, but also the status bar is updated. And the really strange effect: The status bar seems to update distinctly several times between message dialogs at some points. Try [0,100]
as timing for the dialogs to appear... what's causing these intermediate updates? Why doesn't that work without the dialog calls?
(We do not need to discuss calling the status bar updates in asynchronous worker threads or through the message system; I just want to know whether there is a way to call it from a script, and to solve the dialog riddle...)