THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 27/10/2012 at 21:01, xxxxxxxx wrote:
Have problems getting the ESC keyboard input to be
read instead of for example a qualifier key as in this code:
if c4d.gui.GetInputState(c4d.BFM_INPUT_KEYBOARD,c4d.BFM_INPUT_CHANNEL, bc) :
if bc[c4d.BFM_INPUT_QUALIFIER] & c4d.QCTRL:
print "ESC (should be)Pressed"
Anyone know the correct constants to use?
I think I've tried all combinations I could
think of but just run around in circles atm.
On 28/10/2012 at 09:02, xxxxxxxx wrote:
I just went through this same hell yesterday. When trying to implement the Esc keypress in my C++ ThreadsExample plugin.
Give this code a shot:
#Checks to see if the Esc key was pressed in Python
from c4d import gui
def main() :
msg = c4d.BaseContainer()
if gui.GetInputState(c4d.BFM_INPUT_KEYBOARD, c4d.KEY_ESC, msg) :
print "ESC pressed"
The SDK's are very vague and almost no help at all. You can't just go look it up in the SDK.
I basically had to use my entire bag of tricks and notes from other people's code that I've collected over the years to figure it out. And even then it was rather difficult.
Here is the C++ code in case anyone needs it too:
//Checks to see if the Esc key was pressed in C++
if(GetInputState(BFM_INPUT_KEYBOARD, KEY_ESC, msg))
if(msg.GetData(BFM_INPUT_VALUE)==TRUE) //If the Esc button was pressed
GePrint("You pushed the Esc key"); //Print this to the console
On 28/10/2012 at 09:26, xxxxxxxx wrote:
Thanks Scott. That works fine for my purposes,
breaking a for loop.
On 28/10/2012 at 09:50, xxxxxxxx wrote:
Looks like one can use the operator on the msg(BaseContainer) directly.
if c4d.gui.GetInputState(c4d.BFM_INPUT_KEYBOARD,c4d.KEY_ESC, msg) :
print "ESC Pressed"