Keyboard In DAT doesn't work in perform mode

  1. Open a Touch app in perform mode
  2. Callbacks on a Keyboard In DAT are not called, even if the perform window has keyboard focus.

This seems to be quite a major bug. I am delivering a permanent museum installation that receives keyboard messages from hardware buttons and there is currently no way for Touchdesigner to respond to them in perform mode (without someone pressing esc to go back to the editor then f1 to go back to perform mode, at which point the keyboard callbacks work). The app needs to run on startup unmanned so hopefully someone can help me recitify this issue quickly or help find a workaround.

Version 2021.13610

Thanks

Hey @felixfaire I can’t reproduce this.

Attached a quick test made in windows 2021.13610
It opens in perform mode, press any key to see that character displayed.
Does that work for you?

13610_keyboard-dat-in-perform.toe (4.1 KB)

Could it be another app instead of TD has taken focus on your machine, which is why key presses are not seen by TD, and when you manually close/open perform mode TD gets focus again, which is why it then starts to work?

1 Like

Thanks for the swift response nettoyeur.

Your simple toe works fine. I’ve matched the perform mode settings to mine and it still seems ok. I’ve been testing this for a few hours now and I can only describe the performance of my app as inconsistent. Sometimes the app will get keyboard focus on start, other times it wont. The app is loading a large video file and has several geometry generation scripts also required on startup (unless these are already baked into the .toe file).

I am calling:

    def onStart():
    	op('/perform').setForeground()
    	return

In an execute DAT in an effort to force app focus though it isn’t clear from the docs whether this gets keyboard focus or not.

I’m not running any other programs on the machine.

You might be correct something is happening in your loading to steal focus, and onStart() is activated too early for this perhaps.

You could try setting the Panels parameter in the Keyboard In DAT so it only looks at the panel you are viewing through /perform.
To test the theory that setForeground is happening too early, you could throw a button in your window to run that script and see if it works, then at least we can be sure it’s that.

Hey nettoyeur,

Could you please explain the reason behind that network and why is it needed for the keyboard in in perform mode?

It works great and I’m really grateful cause I couldn’t use my keyboard when on perform mode but I’d love to understand the reason behind it.

Thanks!