Container AND kinematic body inside should recive mouse events. Godots philosophie of events

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


My Problem is that a container AND a kinematic body inside should receive mouse events. If I set the mouse filter to pass only the container receives the event and if I set it to pass only the kinematic body receives it.

This is as the documentation describes Events Doku

My Project/Why I need it

I wanted to create some kind of subview. I like the idea of containers. Inside a subview, there should be a viewport (as Local Map) and some gui Elements which I would rather place with anchor and margin. This local map has kinematic bodies which should accept events. Also, i want to be able to zoom in the map IF the mouse is on top of this viewport. To check if the mouse is inside the easiest way is to use the “mouse_entered” and “mouse_exited” signals of the container.
So the container needs to get the mouse events, but then ALL events are accepted, not only the ones I want (in this case the mouse_move event is most likely which triggers the entered/exited signals)

It is possible to directly call the functions of the map and its collision bodies, but this will be nearly impossible to maintain for a larger project.
So the best way is to proper gate specific events further as if they were unhandled. In other words do the step from “controller._input_event(ev)” to “_unhandled_input(ev)” manually, but the tree does not have the _unhandled_input.

Also, I think it is really strange that ALL mouse events in a container must be filtered the same way. It seems impossible that the programmer can handle specific events and leave others unhandled (in this container-node). For me this seems like a huge problem. Has somebody else problems because of this?