On 01/05/2016 at 05:12, xxxxxxxx wrote:
I'm creating a plugin tag and, since some of the processes are slow, I wanted to implement a way to stop the calculation.
So, I tried to read the ESC key and, if pressed, a variable is set to True and my calculation process finished.
I tried to read the ESC key with this routine:
def EscPressed() :
msg = c4d.BaseContainer()
if c4d.gui.GetInputState(c4d.BFM_INPUT_KEYBOARD,c4d.KEY_ESC, msg) :
if msg[c4d.BFM_INPUT_VALUE]: return True
return False
And, in my main process, I have the stop variable set to False at the beginning.
Inside the main loop, I have:
if EscPressed() : stop=True
and all my calculation only occur if stop==False
I placed a print stop inside my main loop but it always prints False, no matter how hard and frequently I press the ESC key.
What could be wrong?