Handle mouse Input Event only if mouse is over the viewport

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

I have a split screen like setup with multiple viewports on the same screen. I need to handle mouse related input events, most particularly InputEventMouseMotion, but ONLY if the mouse is hovering over the particular viewport. This input may be otherwise unhandled, but I need nothing done unless the mouse is over the viewport the object listening for input is in. How can this be accomplished?

:bust_in_silhouette: Reply From: Inces

You can just use individual viewports methods for reading inputs and reacting. Get references to them and check Viewport in documentaion. They have their own local input events and even if this won’t work for You, You can just get which viewport is being hovered with get_visible_rect