Is it possible to prioritize the _input(..) calls on certain nodes vs others?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Tottel

I’m making an application where you can play piano.
Every key (black and white) has its own script that listens for input and handles presses, releases and drags accordingly. When a key has handled input, I use set_input_as_handled() to stop propagating the input event.
The problem is that black keys are on top of white keys, and they should always be handled first, but as far as I can tell, there is no way to easily do so.
Is there something I can do in the editor, to move a node up in the _input processing order?

I know that I could write a separate class that keeps track of all buttons on the piano and does proper occlusion checking within that class before notifying a key press. But, I would prefer another solution, if there is one…

:bust_in_silhouette: Reply From: DaddyMonster

I suspect you could possibly do this with the order of the nodes with the nodes lower in the branch firing first provided the input timing is same frame. It would definitely work on the ready function, not sure for the input, just put print(name) on a couple and you’ll see the order of execution.

Otherwise, as you say, a class is a sensible option.

I dragged the first-priority nodes down in the tree and that did the trick.
A shamefully error-prone fix, but good enough for me for now. :smiley:

Tottel | 2022-01-14 23:23

Quick dirty fixes are the pixie dust that holds all software together! Glad it saved you writing that pesky Key class, use those 20 mins we saved well! :wink:

DaddyMonster | 2022-01-15 09:57