Commit Graph

813 Commits

Author SHA1 Message Date
Lisandro Lorea bdcee836ad Expose Viewport::get_audio_listener_2d and Viewport::get_audio_listener_3d to scripting
Document exposed methods

Apply suggestions from code review

Co-authored-by: Micky <66727710+Mickeon@users.noreply.github.com>

Document default behavior when no audio listeners are active
2024-09-19 18:43:33 -03:00
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 ab55a40f0c
Merge pull request #97070 from KoBeWi/snaming_ur_inputs
Use `SNAME` for `ui` actions in Viewport
2024-09-16 15:25:47 +02:00
kobewi d805f38dba Use SNAME for ui actions in Viewport 2024-09-16 14:09:26 +02: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
Rémi Verschelde ac80ba71e2
Merge pull request #93500 from anniryynanen/multi-press
Improve button behavior when multiple mouse buttons are used at the same time
2024-09-16 13:34:15 +02:00
Anni Ryynänen 2033510a65
Improve button behavior when multiple mouse buttons are used at the same time
- To emit `pressed`, buttons require that the press was initiated while hovering.
- Controls can't grab focus from a mouse click if they're not hovered.
- Hovers are updated both before and after a handled mouse button event.
2024-09-15 19:06:10 +03: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
graydoubt e589c5baf3 Expose Viewport.gui_cancel_drag() to GDScript as a counterpart to Control.force_drag() 2024-09-06 06:20:22 -04:00
Rémi Verschelde e2dd56bea7
Merge pull request #95902 from kitbdev/remove-forced-mouse-focus
Clean up Viewport's `forced_mouse_focus`
2024-09-03 17:38:17 +02:00
aaronp64 7a9acd5aca Fix SubViewport/AudioStreamPlayer2D crash
Updated Viewport destructor to remove itself from World2D, to avoid World2D keeping invalid pointers.
2024-09-03 08:27:47 -04:00
Rémi Verschelde f565996472
Merge pull request #92536 from Daylily-Zeleen/daylily-zeleen/fix_3d_input_event
Add missing check to avoid passing handled input event to collision object 3d.
2024-08-28 00:10:57 +02:00
Rémi Verschelde 40c17d6380
Merge pull request #95846 from jadoc/fix-tooltips
Only reset the tooltip timer when the mouse has actually moved
2024-08-26 22:45:28 +02:00
Alex Docauer 125ff3213a
Only reset tooltip timer when mouse actually moved
InputEventMouseMotion isn't guaranteed to fire only on actual mouse
movement. It's not uncommon for the underlying OS motion event to be
sent either by the OS itself or another application even though the
mouse hasn't moved.  Godot will generate such zero-motion
InputEventMouseMotion events itself for things like cursor shape
changes.

Once started, the tooltip timer is reset only after a mouse movement of
at least 5 pixels in one frame.
2024-08-22 19:20:41 -07:00
kit 307e40e873 Clean up Viewport forced_mouse_focus 2024-08-21 09:37:44 -04:00
jordi 61e2aa7914
Redraw SubViewportContainer on SubViewport size change 2024-08-19 14:53:53 +02:00
Rémi Verschelde 46c6865979
Merge pull request #92391 from rburing/fti_3d
Physics interpolation (3D)
2024-08-16 10:33:37 +02:00
Rémi Verschelde a86c3e44dd
Merge pull request #91965 from aaronp64/tooltip_size
Fix tooltip content being cut off at some display scales
2024-08-16 10:33:25 +02:00
Daylily-Zeleen f90f663258 Avoid passing handled input event to collision object 3d. 2024-07-27 14:58:56 +08:00
Ricardo Buring 2f8ab4a654 Fixed Timestep Interpolation (3D)
Adds 3D fixed timestep interpolation to the rendering server.
This does not yet include support for multimeshes or particles.

Co-authored-by: lawnjelly <lawnjelly@gmail.com>
2024-07-07 22:15:23 +02:00
bruvzg c689823c60
Fix subwindow titlebar redraw on oversampling change. 2024-06-23 00:01:56 +03:00
Ainsley 915e39b3c9 Use `_camera_3d_set` instead of change camera_3d directly 2024-06-20 17:21:38 +08:00
Rémi Verschelde b7ea8415c2
Merge pull request #91997 from aaronp64/tooltip_transforms
Fix tooltip mouse position conversion for scaled controls
2024-06-10 16:11:39 +02:00
bruvzg 9fb9660912
Force canvas item update on oversampling change. 2024-06-03 19:46:49 +03:00
aaronp64 aa07828503 Fix tooltip mouse position conversion for scaled controls
Viewport used get_global_transform().xform_inv(mpos) to convert the mouse position to the control's local coordinates when getting the control's tooltip, which does not handle scale correctly.  This impacted tooltips for any controls that depended on the position to determine what tooltip to show, including RichTextLabel, ItemList, Tree, and probably some others.  This change is for Viewport to use get_global_transform_with_canvas().affine_inverse().xform(mpos) for tooltips instead, to match what we do for Viewport::_gui_call_input.

Fixes #91984
2024-05-15 17:28:58 -04:00
aaronp64 ca8e3d4923 Fix tooltip content being cut off at some display scales
When getting the minimum size for a tooltip, we get the value as a Vector2.  Window::set_size() takes a Vector2i, so this size was getting truncated.  At certain display scales, this could be enough to cut off part of the tooltip.  Updated to call Vector2::ceil() to round up before calling Window::set_size()

Fixes #91958
2024-05-15 09:19:00 -04:00
kobewi 413c11357d Use Core/Scene stringnames consistently 2024-05-13 23:41:07 +02:00
A Thousand Ships 86de59d60a
[Core] Add `LocalVector::has` for convenience 2024-05-06 18:03:37 +02:00
Bastiaan Olij 9042ddf19f Improvements to VRS/Foveated rendering 2024-05-03 17:20:30 +10:00
Rémi Verschelde b2af040423
Merge pull request #91425 from Sauermann/fix-force-drag-focus-crash
Make `mouse_focus` and `mouse_focus_mask` consistent for force_drag
2024-05-02 12:46:45 +02:00
A Thousand Ships 308dbb8c63
[Core] Add scalar versions of `Vector*` `min/max/clamp/snap(ped)`
Convenience for a number of cases operating on single values
2024-05-02 10:31:13 +02:00
Markus Sauermann 30a19a5c2f Make `mouse_focus` and `mouse_focus_mask` consistent for force_drag
In `Viewport::_gui_force_drag` currently `Viewport::gui.mouse_focus`
gets cleared, but `Viewport::gui.mouse_focus_mask` doesn't get cleared.

This is an inconsistency which can cause a crash.

With the change of this PR, `mouse_focus_mask` also gets cleared.
This is in alignment with how regular drag and drop clears both variables.
2024-05-02 00:10:29 +02: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
Bastiaan Olij cbab7dc049 OpenXR: Change timing of xrWaitFrame and add thread safety features to OpenXR 2024-05-01 14:24:41 +10:00
Rémi Verschelde ca38212604
Merge pull request #89643 from mnemoli/pickone-fix-89641
Fix mouse events when `physics_object_picking_first_only` enabled
2024-04-30 17:03:10 +02:00
kit 154f727c7a Overhaul TextEdit selection.
The caret is now a part of the selection.
2024-04-26 14:24:10 -04:00
kobewi 3ebb5b84a0 Add separate feature tags for editor runtime 2024-04-26 14:44:38 +02:00
Koyper 0881c81c13 Fix non-embedded Windows resizing to match Viewport content scale factor 2024-04-17 09:30:16 -05:00
Rémi Verschelde 0c71ba7801
Merge pull request #89880 from dsnopek/openxr-composition-layers-node3d-drs
Add support for OpenXR composition layers
2024-04-04 17:09:07 +02:00
David Snopek 0f2b804059 Add support for OpenXR composition layers
Co-authored-by: Bastiaan Olij <mux213@gmail.com>
2024-04-04 09:20:23 -05:00
Markus Sauermann 48ea019322 Fix a special case for button masks
In certain situations it is possible that in a `Viewport` the same
mouse button is pressed twice in series without releasing it in
between.
In this case, focus stealing should happen to ensure, that the
mouse button is not sent unintentionally to the previously focused
Control node.
2024-03-28 20:22:49 +01:00
Rémi Verschelde 17c66c0bea
Merge pull request #89805 from AThousandShips/viewport_report
Add missing `RenderInfoType` enum to `Viewport`
2024-03-25 11:18:43 +01:00
A Thousand Ships 8a88e5ea07
Add missing `RenderInfoType` enum to `Viewport` 2024-03-23 14:03:08 +01:00
A Thousand Ships 79ba22a73f
Use `Vector*` component-wise `min/max/clamp` functions where applicable 2024-03-20 13:47:42 +01:00
mnemoli ca23775374 Fix mouse_enter/mouse_exit events when physics_object_picking_first_only is on 2024-03-18 11:19:22 +00:00
Aaron Franke c1e9842afb Organize 2D audio, camera, and physics in Viewport 2024-03-10 13:10:13 -07:00
Rémi Verschelde 99ba2519ea
Merge pull request #88992 from Sauermann/fix-window-mouse-notification
Fix mouse entered notifications
2024-02-29 13:55:12 +01: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