Repository: godotengine/godot (language: cpp)

Issue:
Getting mouse position inside of SubViewport returns (0, 0)
### Tested versions

Tested in 4.3 stable.

### System information

Godot v4.3.stable - Windows 10.0.22631 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 2070 SUPER (NVIDIA; 32.0.15.6590) - 13th Gen Intel(R) Core(TM) i5-13600KF (20 Threads)

### Issue description

When accessing the position of the mouse from a child inside of a SubViewport, I always get (0, 0). Even get_viewport().get_mouse_position() returns (0, 0). 

### Steps to reproduce

1. Create a scene with a SubViewport as a child of the root node.
2. Add a child to the SubViewport, and attach a script to that child.
3. Try to get the mouse position.

### Minimal reproduction project (MRP)

[MousePositionViewportMRP.zip](https://github.com/user-attachments/files/17971090/MousePositionViewportMRP.zip)




Discussion / hints:
This is expected behavior.
Input Events are by default not passed on to a bare `SubViewport` node, because a `SubViewport` alone has no concept of where it is located inside its parent viewport. 

Try placing the `SubViewport` inside a `SubViewportContainer`, which automatically handles input event propagation and mouse position.

Okay thanks, that worked! I think this should be in the documentation but I can't find it anywhere ...

Fix patch:
diff --git a/doc/classes/SubViewport.xml b/doc/classes/SubViewport.xml
index 605cf949c10a..9d41a5e36d63 100644
--- a/doc/classes/SubViewport.xml
+++ b/doc/classes/SubViewport.xml
@@ -6,6 +6,7 @@
 	<description>
 		[SubViewport] Isolates a rectangular region of a scene to be displayed independently. This can be used, for example, to display UI in 3D space.
 		[b]Note:[/b] [SubViewport] is a [Viewport] that isn't a [Window], i.e. it doesn't draw anything by itself. To display anything, [SubViewport] must have a non-zero size and be either put inside a [SubViewportContainer] or assigned to a [ViewportTexture].
+		[b]Note:[/b] [InputEvent]s are not passed to a standalone [SubViewport] by default. To ensure [InputEvent] propagation, a [SubViewport] can be placed inside of a [SubViewportContainer].
 	</description>
 	<tutorials>
 		<link title="Using Viewports">$DOCS_URL/tutorials/rendering/viewports.html</link>


Test patch: