THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 30/10/2012 at 10:04, xxxxxxxx wrote:
I'm referring to just the keyboard actions by themselves.
Not combined with mouse events. **
C++ plugin version**
When we press the Ctrl key all by itself. We get a return return
GetInputState(BFM_INPUT_KEYBOARD, BFM_INPUT_CHANNEL, msg);
if(msg.GetLong(BFM_INPUT_QUALIFIER) & QCTRL)
{
GePrint("You pushed the ctrl key");
}
Python plugin version.
When we press the Ctrl key all by itself. We do not get a return.
We only get a return if another key besides the Ctrl key is pressed
c4d.gui.GetInputState(c4d.BFM_INPUT_KEYBOARD, c4d.BFM_INPUT_CHANNEL, msg)
if msg.GetLong(c4d.BFM_INPUT_QUALIFIER) & c4d.QCTRL:
print "You pushed the ctrl key"
What makes this whole thing even more strange to me is that if you use this code in a python script or python tag instead of a plugin. The Ctrl key works like the C++ implementation. Meaning..You don't have to hold down a second key to get a result when the Ctrl key is pressed all by itself.
So just in python.
What I'm seeing is that we have two different qualifier behaviors occurring. Depending on whether it's used in a plugin situation. Or in a script or python tag situation. Using the same code.
Is this a bug? Or is it intentional for some reason?
-ScottA
*Edit
Just for sake of full clarity. Here's the python tag code I'm using.
With the timeline running. I get a return from pressing just the Ctrl key by itself.
While in a python plugin scenario. This does not return anything unless a second key is pressed.
This is the same code as the python plugin code. Except of course I have to create the container by hand.
import c4d
def main() :
msg = c4d.BaseContainer()
c4d.gui.GetInputState(c4d.BFM_INPUT_KEYBOARD, c4d.BFM_INPUT_CHANNEL, msg)
if msg.GetLong(c4d.BFM_INPUT_QUALIFIER) & c4d.QCTRL:
print "You pushed the ctrl key"