Commit Graph

835 Commits

Author SHA1 Message Date
3deb5884d7 Renderer agnostic motion vector rendering/OpenXR changes 2024-12-10 15:59:17 -06:00
09dd5e6b20 Merge pull request #98032 from zaevi/fix_drag_preview_position
Fix incorrect drag preview position under transformed `CanvasLayer`.
2024-12-09 14:33:36 -06:00
d58b2e879f Get rid of easily removable uses of const_cast 2024-12-01 17:50:13 -08:00
16ee94a953 Merge pull request #99843 from KoBeWi/easy_windows
Add helper method to get Window from ID
2024-11-29 22:51:45 +01:00
05e93a6010 Merge pull request #99691 from Sauermann/fix-consume-mouse-over
Rename `SubViewportContainer` option `consume_drag_and_drop` to `mouse_target`
2024-11-29 22:51:10 +01:00
e0304a7d00 Add helper method to get Window from ID 2024-11-29 21:15:23 +01:00
f53a220a72 Fix physics picking when hovering an embedded window
When the mouse is hovering an embedded window, it is still considered
within the main viewport.
Previously in this case physics picking was executed, as if no embedded
window was there.

This PR introduces an additional check to exclude these cases.
2024-11-27 22:29:42 +01:00
9c300a6c05 Merge pull request #80965 from Calinou/viewport-add-get-stretch-scale-factor
Add a Viewport method to get automatically computed 2D stretch transform
2024-11-27 10:47:12 -06:00
003647972f Rename consume_drag_and_drop to mouse_target
The functionality of the parameter is not limited to drag-and-drop
operations, but it has also other uses.
So its name should not be tied to drag-and-drop.

The API was created in the not yet released Godot 4.4-dev6, so this
change should not be considered compatibility breaking.
2024-11-25 21:36:29 +01:00
0eca686191 Merge pull request #99270 from Sauermann/fix-svc-drop-config
Introduce a `SubViewportContainer` config for drag-and-drop target locations
2024-11-21 17:56:48 -06:00
285954659d Merge pull request #96721 from aXu-AP/tooltip-distance
Fix tooltip appearing in old place, on movement
2024-11-20 17:03:08 +01:00
0cf99cf95d Add a Viewport method to get automatically computed 2D stretch transform
`Viewport.get_stretch_transform()` returns the automatically computed
2D stretch transform. Combined with `Transform2D.get_scale()`, this is
useful when using the `canvas_items` stretch mode in a project.

There are many situations where knowing this factor is useful:

- Divide Camera2D zoom to keep the size of the 2D game world identical
  regardless of the 2D scale factor (so that UI elements can still be scaled).
- Make certain controls always drawn at 1:1 scale
  (e.g. for the crosshair in a FPS). This is done by dividing the Control
  node's scale by the scale factor.
2024-11-19 23:11:13 +01:00
117158d271 Introduce a SubViewportContainer config for drag-and-drop targets
With the drag-and-drop rewrite, `SubViewportContainer` nodes were no
longer available as drop-locations.

This PR introduces a configuration option, that allows
`SubViewportContainer` to be considered as drop-location, but disables the
`Control` nodes inside its `SubViewport` children as drop-location.
2024-11-19 23:06:41 +01:00
932b2269f8 Fix missing native file dialog title translation. 2024-11-14 14:48:52 +02:00
925b690c98 Core: Integrate Ref::instantiate where possible 2024-11-10 12:41:26 -06:00
be349fa6d3 Fix tooltip appearing in old place, on movement
Fixes tooltip appearing in editor on old position of mouse.
Fixes tooltip appearing even if mouse is in steady motion (now accepts max 5 px movement).
2024-11-05 16:51:23 +02:00
16524a8a01 Add "Game" editor for better runtime debugging 2024-10-30 11:42:17 -03:00
6424b201e2 Don't override auto translate mode of custom tooltip 2024-10-25 16:13:45 +08:00
9aea7cbd15 Fix some flickering tooltips 2024-10-24 08:34:29 +08:00
Zae
3e30dd7954 Fix incorrect drag preview position under transformed CanvasLayer. 2024-10-10 03:08:04 +08:00
6f35915622 Allow Control to show custom tooltip when tooltip text is empty
Co-Authored-By: bruvzg <7645683+bruvzg@users.noreply.github.com>
2024-10-08 15:46:26 +08:00
78801f61da Add auto translate mode for tooltips 2024-09-26 22:31:22 +08:00
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
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
c11107b1fb Fix Viewport Texture must be set to use it 2024-09-17 18:18:07 -04:00
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
d805f38dba Use SNAME for ui actions in Viewport 2024-09-16 14:09:26 +02:00
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
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
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
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
ccc6e5d25f Remove Useless Viewport::gui.key_input_accepted 2024-09-13 20:52:05 +08:00
e589c5baf3 Expose Viewport.gui_cancel_drag() to GDScript as a counterpart to Control.force_drag() 2024-09-06 06:20:22 -04:00
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
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
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
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
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
61e2aa7914 Redraw SubViewportContainer on SubViewport size change 2024-08-19 14:53:53 +02:00
46c6865979 Merge pull request #92391 from rburing/fti_3d
Physics interpolation (3D)
2024-08-16 10:33:37 +02:00
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
f90f663258 Avoid passing handled input event to collision object 3d. 2024-07-27 14:58:56 +08:00
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
c689823c60 Fix subwindow titlebar redraw on oversampling change. 2024-06-23 00:01:56 +03:00
915e39b3c9 Use _camera_3d_set instead of change camera_3d directly 2024-06-20 17:21:38 +08:00
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
9fb9660912 Force canvas item update on oversampling change. 2024-06-03 19:46:49 +03:00
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
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