godotengine / godotengine/godot

`SubViewport` children of `SubViewportContainer` don't all receive mouse click input events due to being set to handled

Open
#89,073 3 comments 1 reaction 0 assignees View on GitHub
enhancement topic:input
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

### Tested versions

- Reproducible in: 4.2.2.rc1.official.c7fb0645a

### System information

Ubuntu 22.10, Vulkan, NVIDIA GeForce RTX™ 2060 / NVIDIA GeForce RTX™ 2060

### Issue description

Having a setup like:
```
- SubViewportContainer
- SubViewport1
- SubViewport2
- ...
```
Only one `SubViewport` gets a mouse button pressed event (possibly other mouse events too). Probably because `SubViewportContainer` sets `SubViewport.handle_input_locally` to `false` and because the container itself sets the event as handled.

I tested the setup with an `Area2D._input_event()`. It might have to do with `Viewport.physics_object_picking` being set to `true` so that `Area2D` can interact with the mouse.

### Steps to reproduce

Open the Minimal Reproduction Project. Make sure to turn on *Debug > Vissible Collision Shapes*, run the project, and click on the `Area2D`s. Notice that only one print function is called, but the message should be printed twice.

The hack solution is to force `SubViewport.handle_input_locally` to `true`.

### Minimal reproduction project (MRP)

[godot-dbg.zip](https://github.com/godotengine/godot/files/14468200/godot-dbg.zip)

Contributor guide

Open the contributing guide

Research direction

Run the linked Minimal Reproduction Project with Debug > Visible Collision Shapes enabled and click both Area2Ds. Start at SubViewportContainer, SubViewport.handle_input_locally, and Area2D._input_event(), then verify that each SubViewport child receives its mouse event without relying on the hack that forces local handling.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
game-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.