Commit Graph

282 Commits

Author SHA1 Message Date
Rémi Verschelde 2a8d30aa9f
Merge pull request #97029 from Hilderin/fix-viewport-texture-must-be-set-to-use-it
Fix Viewport Texture must be set to use it
2024-09-18 11:15:39 +02:00
Hilderin c11107b1fb Fix Viewport Texture must be set to use it 2024-09-17 18:18:07 -04:00
Rémi Verschelde 391849d232
Merge pull request #96867 from L2750558108/remove-gui-key-event-accepted-shit
Remove useless `Viewport::gui.key_input_accepted`
2024-09-16 13:35:13 +02:00
Markus Sauermann 60aaa017ff Enable Drag and Drop for SubViewports and Windows
Make Drag and Drop an application-wide operation.
This allows do drop on Controls in other Viewports/Windows.

In order to achieve this, `Viewport::_update_mouse_over` is adjusted to
remember the Control, that the mouse is over (possibly within nested
viewports). This Control is used as a basis for the Drop-operation, which
replaces the previous algorithm, which was only aware of the topmost
Viewport.

Also now all nodes in the SceneTree are notified about the Drag and Drop
operation, with the exception of SubViewports that are not children of
SubViewportContainers.
2024-09-15 01:06:02 +02:00
2750558108 ccc6e5d25f Remove Useless Viewport::gui.key_input_accepted 2024-09-13 20:52:05 +08:00
kit 307e40e873 Clean up Viewport forced_mouse_focus 2024-08-21 09:37:44 -04:00
bruvzg c689823c60
Fix subwindow titlebar redraw on oversampling change. 2024-06-23 00:01:56 +03:00
bruvzg 9fb9660912
Force canvas item update on oversampling change. 2024-06-03 19:46:49 +03:00
Bastiaan Olij 9042ddf19f Improvements to VRS/Foveated rendering 2024-05-03 17:20:30 +10:00
Markus Sauermann 792b38813f Remove unused variable Viewport::gui.last_mouse_focus
The last use was removed in January 2023
2024-05-01 11:20:40 +02:00
kit 154f727c7a Overhaul TextEdit selection.
The caret is now a part of the selection.
2024-04-26 14:24:10 -04:00
A Thousand Ships 8a88e5ea07
Add missing `RenderInfoType` enum to `Viewport` 2024-03-23 14:03:08 +01:00
Aaron Franke c1e9842afb Organize 2D audio, camera, and physics in Viewport 2024-03-10 13:10:13 -07:00
Markus Sauermann d259f979f5 Fix mouse entered notifications
Make sure, that a windows initial state is `mouse_in_viewport = false`.
This makes sure, that the mouse entered notification is sent when the
mouse hovers a window for the first time.

For embedded Windows, `NOTIFICATION_WM_MOUSE_ENTER` is currently sent
twice in a row. Remove one of the places where it is sent.
`Window::_update_mouse_over()` is the correct one, because there it is
also called for native windows.
2024-02-29 00:57:31 +01:00
Rémi Verschelde 21f0529aa9
Revert "Update Node::get_configuration_warnings signature"
This reverts commit d3852deaa4.
2024-02-17 19:03:21 +01:00
Rémi Verschelde 2b36dcf70a
Merge pull request #75688 from mnemoli/pickone
Add setting for picking only top-most overlapping collision object
2024-02-12 13:33:08 +01:00
RedMser d3852deaa4 Update Node::get_configuration_warnings signature 2024-02-08 23:05:20 +01:00
Markus Sauermann 36c2c4bf0d Remove unused Variable `Viewport::gui_input_group`
The gui input group is not needed during the gui input step.
2024-01-26 23:37:30 +01:00
mnemoli a407219693 Add Viewport setting for picking only first-encountered CanvasItem physics object 2024-01-11 14:18:37 +00:00
Claire Blackshaw fe7725239e Expose a method to get hovered Control in Viewport 2023-12-18 14:53:52 +01:00
kit 78e1702adb fix crash on hiding grandparent on mouse exit 2023-12-02 14:24:56 -05:00
kit d24d73ba31 Make mouse-enter/exit notifications match mouse event propagation
`NOTIFICATION_MOUSE_ENTER` and `NOTIFICATION_MOUSE_EXIT` now includes
the areas of children control nodes if the mouse filters allow it.

In order to check if a Control node itself was entered/exited, the newly
introduced `NOTIFICATION_MOUSE_ENTER_SELF` and
`NOTIFICATION_MOUSE_EXIT_SELF` can be used.

Co-authored-by: Markus Sauermann <6299227+Sauermann@users.noreply.github.com>
2023-11-09 09:11:59 -05:00
clayjohn f672198f5e Revert "Add a Disable 2D property to Viewport"
This reverts commit f6cc2603a1.
2023-10-27 14:45:59 +02:00
Hugo Locurcio f6cc2603a1
Add a Disable 2D property to Viewport
This is the 2D counterpart to the existing Disable 3D property.
Its functionality is already internally implemented and used,
but it wasn't exposed.
2023-10-07 17:19:15 +02:00
Michael Alexsander 9ee82ebe1d
Fix tooltips behaving incorrectly on `Tree` nodes 2023-09-28 11:18:15 -03:00
Dario 057367bf4f Add FidelityFX Super Resolution 2.2 (FSR 2.2.1) support.
Introduces support for FSR2 as a new upscaler option available from the project settings. Also introduces an specific render list for surfaces that require motion and the ability to derive motion vectors from depth buffer and camera motion.
2023-09-25 10:37:47 -03:00
Rémi Verschelde e73a4a382e
Merge pull request #79201 from Rindbee/fix-setup-state-not-cleared
Clear the previously set state when configuring for a new scene root node
2023-08-17 15:43:38 +02:00
Michael Alexsander de27df5da3
Allow to get a list of visible embedded `Window`s 2023-08-16 10:42:08 -03:00
Markus Sauermann 59c13fea5d Fix nodes receiving mouse events in black bars of `Window`
Previously for InputEvents there was no distinction between
Window-area and Viewport-area.
This was problematic in cases where stretching was used and the Window
contained black bars at the sides of the Viewport.
This PR separates the area of Window and Viewport regarding InputEvents.
2023-08-09 12:34:22 +02:00
Rindbee 4795c3cdfa Clear the previously set state when configuring for a new scene root node
Saving a subscene causes the main scene to be re-instantiated. And the resource
instance in the main scene will be reused when the main scene is re-instantiated.
So for resources with `resource_local_to_scene` enabled, resetting state may be
necessary (at least for `ViewportTexture`).
2023-08-08 23:49:53 +08:00
Rémi Verschelde 1163dac9e3
Merge pull request #80215 from clayjohn/HDR-2D
Add option to enable HDR rendering in 2D
2023-08-08 16:57:33 +02:00
Rémi Verschelde faaf27f284
Fix various typos with codespell
Also includes typo fixes from #79993, #80068, #80276, and #80303.

Co-authored-by: betalars <contact@betalars.de>
Co-authored-by: spaceyjase <429978+spaceyjase@users.noreply.github.com>
Co-authored-by: Swarkin <102416174+Swarkin@users.noreply.github.com>
Co-authored-by: Raul Santos <raulsntos@gmail.com>
2023-08-07 13:09:47 +02:00
clayjohn 57eb762bae Add option to enable HDR rendering in 2D
This is needed to allow 2D to fully make use of 3D effects (e.g. glow), and can be used to substantially improve quality of 2D rendering at the cost of performance

Additionally, the 2D rendering pipeline is done in linear space (we skip linear_to_srgb conversion in 3D tonemapping) so the entire Viewport can be kept linear.
This is necessary for proper HDR screen support in the future.
2023-08-07 11:24:03 +02:00
Markus Sauermann 1c3c17c608 Refactor mouse_entered and mouse_exited notifications
The previous implementation for signals mouse_entered and mouse_exited
had shortcomings that relate to focused windows and pressed mouse buttons.
For example a Control can be hovered by mouse, even if it is occluded by
an embedded window.

This patch changes the behavior, so that Control and Viewport send
their mouse-enter/exit-notifications based solely on mouse position,
visible area, and input restrictions and not on which window has
focus or which mouse buttons are pressed. This implicitly also
changes when the mouse_entered and mouse_exited signals are sent.

This functionality can not be implemented as a part of
Viewport::_gui_input_event, because of its interplay with Windows and
because Viewport::_gui_input_event is based on input and not on
visibility.
2023-08-01 13:28:49 +02:00
Markus Sauermann a12627765f Embedded Popups store their safe_rect in their embedder
Storing it in the DisplayServer didn't make sense in this case,
because the embedded window is unknown to the DisplayServer.
2023-06-20 18:06:26 +02:00
Rémi Verschelde 8acf6b41a4
Merge pull request #77209 from Rindbee/ViewportTexture-not-change-RID
Don't change `RID` when changing `viewport_path` in `ViewportTexture`
2023-06-09 15:10:39 +02:00
Rindbee 7532b2d259 Don't change `RID` when changing `viewport_path` in `ViewportTexture`
When changing `viewport_path`, the `proxy`'s target is changed to a new placeholder.

Add a flag `vp_changed` to prevent calling `setup_local_to_scene` (mainly called by toggling `resource_local_to_scene`) when the target viewport has not changed.
2023-06-09 19:50:26 +08:00
Rémi Verschelde 2a8e83ccad
Merge pull request #78017 from Sauermann/fix-physics-passive-hovering
Fix passive mouse hovering for physics
2023-06-09 13:44:05 +02:00
Markus Sauermann 543fdc1490 Fix passive mouse hovering for physics
Currently mouse hovering doesn't update the state, when collision objects
or the camera move.
This PR fixes this problem by taking the mouse position from the viewport
and not from a nonexistent previous event.

Since previous events could potentially be a long time ago, their
modifier-key state might be outdated. This PR fetches the current
status of modifier-keys from `Input`.

These changes allow the removal of some class-variables and making
additional simplifications.
2023-06-09 12:51:10 +02:00
Rémi Verschelde 0cee1e0d4f
Merge pull request #77923 from Sauermann/fix-mouse-position-with-screen-transform
Fix mouse position with screen transform
2023-06-09 12:15:56 +02:00
Markus Sauermann d1fa284e65 Fix mouse position with screen transform
When a Viewport is not directly attached to the screen, the
function `Viewport::get_mouse_position` can't rely on
`get_screen_transform`, because that function is ambiguous in
these situations.
In these cases it is necessary to use the mouse position from
the most recent mouse IputEvent.
2023-06-09 11:29:43 +02:00
Markus Sauermann f00f4a0209 Fix input handling of unfocusable embedded Windows
InputEvents get in some cases sent to the wrong Window.
fix `Viewport::_sub_windows_forward_input`- console error spam
2023-06-06 17:51:19 +02:00
Aaron Franke 8b42297d7c
Make `Viewport::gui_get_focus_owner` const 2023-06-02 12:36:10 -05:00
Markus Sauermann 6d490ce8de Deprecate push_unhandled_input
The functionality of `push_unhandled_input` has changed so that it no
longer propagates input events to SubViewports.
This makes it less predictable and it should be deprecated in favor of
`push_input` which provides the same functionality and more.

Also this deprecation simplifies the Viewport-API by reducing the methods
for pushing input events, so that users don't need to worry about when
to use which function in order to insert input events.
2023-05-31 19:07:04 +02:00
Markus Sauermann ce10ca6979 Create a virtual mouse move event after moving child nodes
This updates mouse cursor and mouse-over-states without the need
for additional mouse movements.
2023-05-29 22:46:19 +02:00
Rindbee af58f1e854 Improve the UX of ViewportTexture in the editor
The associated `ViewportTexture`s will update the `viewport_path`
in time when the `Viewport`'s nodepath is changed (caused by renaming
the node names or moving in the SceneTree dock).

If the target `Viewport` is changed by resetting the `viewport_path`,
the `ViewportTexture`s will be re-setup and emit `changed` signal in
time.
2023-05-10 09:13:43 +08:00
Rémi Verschelde 15f9ac9458
Merge pull request #75751 from KoBeWi/eradicate_ViewportTexture_errors_entirely_and_surely
Prevent errors when using ViewportTexture
2023-05-08 16:40:10 +02:00
Rémi Verschelde bbe05b60c8
Merge pull request #57179 from spacechase0/notify-world2d-changed-master
Propagate previously unused NOTIFICATION_WORLD_2D_CHANGED, make CanvasItem/CollisionObject2D use it
2023-05-08 16:40:00 +02:00
kobewi 1b9802fa8c Prevent errors when using ViewportTexture 2023-05-08 15:56:16 +02:00
Chase Warrington 46e06ee1e6 Propogate previously unused NOTIFICATION_WORLD_2D_CHANGED, make CanvasItem/CollisionObject2D use it 2023-05-01 18:26:55 -04:00