Commit Graph

1768 Commits

Author SHA1 Message Date
Max Hilbrunner fa451ead91
Merge pull request #74883 from dalexeev/fix-thin-multiline-colors 2023-05-05 14:26:37 +02:00
kobewi 8a41eefb97 Fix 2D audio in multiple viewports 2023-05-03 23:09:40 +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
Samuele Panzeri 4aaa2e6477 Fix wait for thread not started 2023-04-27 20:28:22 +02:00
Rémi Verschelde 6aac8af6f1
Merge pull request #69318 from Sauermann/fix-refresh-gui-events
Fix scene reload crash related to mouse cursor update
2023-04-25 15:36:26 +02:00
Aaron Franke 290b09b36c
Expose `determinant` in Transform2D, rename internal method 2023-04-22 13:44:14 -05:00
Rémi Verschelde 3695dfb357
Merge pull request #75509 from KoBeWi/In_physics,_the_observer_effect_is_the_disturbance_of_an_observed_system_by_the_act_of_observation._A_common_example_is_checking_CanvasItem's_global_position,_which_causes_its_transform_to_be_re-calculated-
Fix invalid global position when read outside tree
2023-04-19 10:13:48 +02:00
bruvzg 520a8d8ed2
Add project manager / editor initial screen settings, implement DisplayServer.get_keyboard_focus_screen method. 2023-04-19 08:54:53 +03:00
kobewi 727a4ed79a Fix invalid global position when read outside tree 2023-04-18 22:14:01 +02:00
Yuri Sizov 377d8845da
Merge pull request #75890 from YuriSizov/gui-remember-window-state
Always cache parent visibility in `CanvasItem`
2023-04-18 13:07:41 +02:00
Chris Hutchinson 97712b3f50 Clamp minimum value of time_left to 0.0 2023-04-17 16:49:04 +02:00
Yuri Sizov b8b494a16c
Merge pull request #68397 from aaronfranke/get-child
Make `Node::get_children()` public
2023-04-17 14:28:37 +02:00
angel-721 e347d7d64d Rename internal root canvas group to start with underscore 2023-04-16 17:42:21 -06:00
Aaron Franke 8eb9986dc5
Make `Node::get_children()` public 2023-04-15 21:59:25 -05:00
Rémi Verschelde 347a8e20ae
Merge pull request #69324 from RedMser/advanced-settings-errors
Make it easier to solve warnings/errors referring to project settings
2023-04-11 19:39:53 +02:00
Yuri Sizov c48219f51e
Merge pull request #73658 from smix8/do_not_stop_the_entire_server_cause_you_want_to_pause_4x
Keep NavigationServer active while SceneTree is paused
2023-04-10 16:24:26 +02:00
Yuri Sizov fd6a743823 Always cache parent visibility in CanvasItem 2023-04-10 16:18:46 +02:00
smix8 4b0dee080e Keep NavigationServer active while SceneTree is paused
Keep NavigationServer active while SceneTree is paused.
2023-04-10 15:30:22 +02:00
Juan Linietsky ab5fc22f67 Optimize Node children management
* Adding and removing child nodes is now constant time, speed up should be huge.
* Searching for node paths as in ("path/to/node") should be far faster too.

This changes the children management and makes it a hashmap, optimizing most StringName based operations.
Most operations should be severe speed up without breaking compatibility.

This should fix many issues regarding to node access performance, and may also speed up editor start/end, but benchmarks are needed. So if you want to test, please make some benchmarks!

Further performance improvements will be done in the future by removing NOTIFICATION_MOVED_IN_PARENT and replacing by something less laborious.
2023-04-08 10:54:28 +02:00
Rémi Verschelde c151d3231f
Merge pull request #75760 from reduz/optimize-node-add-child-validation
Optimize Node::add_child validation
2023-04-07 18:20:28 +02:00
Juan Linietsky 223ce4fcb9 Optimize Node::add_child validation
Adding 10k nodes is almost twice as fast.
2023-04-07 13:18:47 +02:00
Samuele Panzeri 404f24b5c4 Update sibling indices after a node is removed.
With change 104392e the code to update node indices on removal was erronously removed.
The out of date indices would cause crashes while selecting nodes in a graph editor (e.g. animation tree) and selected nodes are oftern pushed to beginning or end of the child list for the parent.
2023-04-06 20:47:57 +02:00
Juan Linietsky 104392ef4e Remove NOTIFICATION_MOVED_IN_PARENT
* This notification makes node children management very inefficient.
* Replaced by a NOTIFICATION_CHILDREN_CHANGED (and children_changed signal).
* Changed Canvas code (and similar) to use the above signal, to perform more efficiently.

This PR breaks compatibility (although this notification was very rarely used, even within the engine), but provides an alternate way to do the same.
It is required for the changes in #75627 to be entirely effective.
2023-04-06 13:57:13 +02:00
Yuri Sizov 91ff34b5b5 Add a warning when trying to access theme items too early 2023-04-03 18:01:10 +02:00
Rémi Verschelde b85fc4aa6d
Merge pull request #73646 from KoBeWi/squish
Prevent off-screen controls in editor
2023-04-03 17:07:54 +02:00
RedworkDE aa604c5c47 Do not clamp non-embedded window size to embedder 2023-03-29 22:35:07 +02:00
Yuri Sizov f818d2b98f
Merge pull request #75141 from rcorre/rrc/dialog-pos 2023-03-28 10:54:37 +02:00
Haoyu Qiu 5a5fd33e42 More i18n improvements
* Make placeholder in editor layout dialog translatable.
* Make messages in scene import settings dialog translatable.
* Mark theme override property categories for translation.
2023-03-27 22:24:01 +08:00
Ryan Roden-Corrent 894ce41180
Apply clamp_to_embedder on parent resize and popup.
Fixes #75084.

The clamp_to_embedder setting was added in 8be16e0704,
but was not set on any of the in-editor dialogs.

This patch sets `clamp_to_embedder` on editor dialogs so they cannot be dragged out of the frame.
This also modifies `clamp_to_embedder` so a window is clamped to the bounds of an embedder when
it pops up and when the parent is resized.
2023-03-27 07:08:29 -04:00
Yuri Sizov c95b88cbe9
Merge pull request #75238 from kleonc/canvas-item-fix-notifications-order-on-enter-tree
`CanvasItem` Fix `ENTER_CANVAS` / `VISIBILITY_CHANGED` notifications order when entering tree
2023-03-27 13:00:41 +02:00
RedMser ed960453b7 Make solving project setting errors easier
Show full project setting path in error messages.
Force filtering for advanced settings if filter is not empty.
2023-03-27 08:10:35 +02:00
kobewi 8f8178bda6 Fix auto-translations in editor 2023-03-22 23:57:12 +01:00
kleonc 6e3820fd4d CanvasItem Fix ENTER_CANVAS / VISIBILITY_CHANGED notifications order when entering tree 2023-03-22 20:01:22 +01:00
David Snopek 4d13be3c5e Add missing documentation for MultiplayerPeerExtension 2023-03-20 08:08:59 -07:00
Markus Sauermann 8836f2160a Move call of `push_unhandled_input` from `Window` to `Viewport`
This solves the problem, that mouse events get sent to SubViewports
even if they are outside of the visible area of the SubViewport.

This changes makes SubViewportContainer::unhandled_input redundand.
Shortcut Events now need to be distributed via push_input, in order for
them to be able to reach SubViewports.
2023-03-17 19:22:24 +01:00
Danil Alexeev ba985ecf3f
Fix `draw_multiline_colors()` for `width < 0` 2023-03-14 09:43:56 +03:00
Yuri Sizov 81e2b020ba Prevent infinite loops when printing orphan nodes 2023-03-09 16:47:38 +01:00
Rémi Verschelde 0ef3d1bf56
Merge pull request #73188 from Sauermann/fix-inconsistent-viewport-size
Fix some ways to create inconsistent Viewport size states
2023-03-07 12:04:00 +01:00
Rémi Verschelde 0b98b470cc
Merge pull request #73716 from bruvzg/improve_locale_selection
Improve layout direction/locale automatic selection.
2023-03-06 10:57:56 +01:00
Rémi Verschelde 0885e4b931
Merge pull request #73365 from bruvzg/no_transient_children
Automatically reparent editor message dialogs to avoid error spam.
2023-03-02 11:41:17 +01:00
Fabio Alessandrelli f9bcaccc11 [MP] Fix orphan StringName on close.
Use a static StringName for the registered default interface name.
2023-02-27 09:45:16 +01:00
bruvzg 82d7923c65
Improve layout direction/locale automatic selection. 2023-02-22 08:37:14 +02:00
bruvzg 921f3b7589
Automatically reparent editor message dialogs to avoid error spam. 2023-02-21 12:32:11 +02:00
kobewi 55b50703d7 Prevent off-screen controls in editor 2023-02-20 20:25:39 +01:00
bruvzg 7246b229e1
Set RTL minimal dash size to 2.0, add invalid dash size error to the `draw_dashed_line`. 2023-02-17 08:53:08 +02:00
Rémi Verschelde b90d70d592
Merge pull request #72764 from Sauermann/fix-color-picking
Fix Color Picking
2023-02-17 00:33:20 +01:00
bruvzg 4dfa161120
Add dash and step size checks to draw_dashed_line. 2023-02-16 17:49:18 +02:00
clayjohn 081b31d200 Clear Window before blitting Viewport in gl_compatibility renderer 2023-02-14 10:30:02 -08:00
Rémi Verschelde 830eff64a7
Merge pull request #68027 from ktxyz/window-on-top
Update sub_windows order with respect to FLAG_ALWAYS_ON_TOP
2023-02-14 13:40:24 +01:00
Thomas ten Cate 8a17f94ab2 Some fixes for initial window position and size
- X11: set main window position and size hints correctly
- All platforms: update minimum and maximum size of main window at
  startup

Fixes #70984
2023-02-14 12:15:14 +01:00
bruvzg a000c64eea
Cleanup Window callbacks before destroying in to avoid callback calls with invalid object. 2023-02-13 20:39:17 +02:00
Markus Sauermann 34a7fc7447 Fix some ways to create inconsistent Viewport sizes
In the editor, it was possible to set the size of a `SubViewport` even
in cases where a parent `SubViewportContainer` had stretch enabled.

This PR disables editing a `SubViewport.size` while the parent disallows
it and it makes necessary adjustments during `NOTIFICATION_ENTER_TREE`.
2023-02-13 08:19:00 +01:00
Rémi Verschelde ab2952580c
Merge pull request #73040 from Rindbee/popup_centered_consider_current_size
Calling popup_center* with the default size will use the current size
2023-02-11 14:37:54 +01:00
Rindbee 593598c592 Calling popup_center* with the default size will use the current size 2023-02-11 18:53:53 +08:00
Rémi Verschelde 97afa41da3
Merge pull request #73000 from Sauermann/fix-editor-viewport-size-zero-crash
Fix crash in editor when setting `SubViewport.size` to zero
2023-02-10 15:06:57 +01:00
Markus Sauermann 5bb66d3cfb Fix scene reload crash caused by mouse cursor update
After a scene reload a mouse cursor updates is performed via a
InputEventMouseMotion, that is exposed to the user.
The state of Input is however not adjusted to this InputEventMouseMotion
which can lead to inconsistencies.
This PR makes sure, that it is not exposed to the user.
It utilizes the method of Viewport::_process_picking for marking
events that are not sent to the user, so that this function doesn't
need to be changed.
2023-02-10 01:16:23 +01:00
Markus Sauermann d249370cd7 Fix crash in editor when setting `SubViewport.size` to zero
`Viewport::_set_size` now verifies, that the minimum size is at least 2x2.
Also fix `RendererViewport::viewport_set_size` fail condition.
2023-02-10 00:25:45 +01:00
Markus Sauermann 88f4e5cc94 Fix that `popup_centered` didn't take the window's size into consideration 2023-02-09 22:05:39 +01:00
Markus Sauermann 888add8418 Fix Color Picking
With the 4.x-introduction of Windows the previous method for
color picking was no longer working.

This PR uses the following approach to reintroduce color-picking.
When the Color-Picking-Button is pressed, a quasi-screenshot of the
Window-content is created and displayed in a new Popup-Window.
This new Window allows selecting colors by Mouse-Click.
A Preview of the targeted Color is also displayed.
2023-02-09 01:00:54 +01:00
Danil Alexeev b8eda519d0
Optimize `draw_dashed_line()` and `draw_rect()` 2023-02-08 10:44:12 +03:00
Rémi Verschelde 929333fe26
Merge pull request #62179 from Rindbee/fix-popup_center-off-center
Use min_size/max_size to limit window size and position while popup center
2023-02-07 16:30:41 +01:00
Rémi Verschelde 743e26d4f9
Merge pull request #72829 from Sauermann/fix-code-simplifications
Some code simplifications
2023-02-07 16:30:22 +01:00
Markus Sauermann 826e54fa73 Some code simplifications
1. `number_width` isn't used later
2. `return_type` is used only once
3. AudioServer::get_singleton()->get_channel_count() always returns a channel_count of 1 or larger
4. negative `aa->backward` conditional
5. `current_canvas` == `find_world_2d()->get_canvas()`
6. identical if `render_shadows`
2023-02-07 14:30:16 +01:00
Rindbee c73844f117 Use min_size/max_size to limit the window size and the position while popup center 2023-02-07 21:28:26 +08:00
Markus Sauermann 5312d83f3b Fix Viewport::get_mouse_position for SubViewports
SubViewports don't have a cached mouse position available.
This PR calculates the mouse position from the screen position of
the mouse cursor.
2023-02-07 13:54:47 +01:00
Rémi Verschelde cd0f1e9b10
Merge pull request #72740 from Sauermann/fix-event-device-id
Fix mouse/drag/touch InputEvents having no device id
2023-02-06 23:51:26 +01:00
Markus Sauermann 8748f4dcaa Fix mouse/drag/touch InputEvents having no device id
Some internally created emulated/instantiated events didn't have a
device id. This PR sets for these cases a device id.

Also rename `DEVICE_ID_TOUCH_MOUSE` to the more generic
`DEVICE_ID_EMULATION`.
2023-02-06 22:49:42 +01:00
Markus Sauermann 262d84fa90 Fix MOUSE_FILTER_STOP not affecting emulated mouse events
Touch and Drag events are now stopped by MOUSE_FILTER_STOP
2023-02-06 22:31:03 +01:00
Rémi Verschelde 82ff7b4bce
Merge pull request #68492 from Sauermann/fix-picking-sort
Fix propagation order for 2D physics picking events
2023-02-06 15:38:38 +01:00
Markus Sauermann 6e855e3820 Fix propagation order for 2D physics picking events
This patch adds a viewport-configuration-option for sorting
physics-picking events by the Z-Index and the scene tree position
of the collision objects.
2023-02-04 22:44:36 +01:00
kobewi 7331750618 Fix Camera2D crash due to ParallaxBackground node 2023-02-03 15:36:08 +01:00
Markus Sauermann e3e9da78e8 Remove `Viewport::_get_input_pre_xform`
This function is only relevant for `Window`. So this PR moves
the functionality to the `Window`-class.
2023-02-02 22:03:52 +01:00
Rémi Verschelde a16b0fec40
Merge pull request #72618 from Sauermann/fix-simplify-set-size
Simplify Viewport::_set_size
2023-02-02 21:05:51 +01:00
Markus Sauermann 6743ac34d3 Simplify Viewport::_set_size
`Viewport.to_screen_rect` is used only in a single location to compare it
to `Rect2i()`.

When called from `SubViewport`, `to_screen_rect` is always equal to `Rect2i()`.
When called from `Window`, `to_screen_rect` is always different from `Rect2i()`.

So the comparison `to_screen_rect != Rect2i()` can be replaced by
`Object::cast_to<Window>(this)`.

This allows the removal of `Viewport.to_screen_rect` and the simplification of
`Viewport::_set_size`.
2023-02-02 19:09:14 +01:00
Markus Sauermann 3bc426c9d8 Fix toplevel nomenclature
toplevel was 3.x
top_level is 4.x
2023-02-02 17:37:41 +01:00
kobewi 724d6581d6 Fix Camera2D crashes 2023-02-01 23:49:02 +01:00
Rémi Verschelde e52213e2fa
More codespell fixes, do more changes from previous ignore list 2023-02-01 12:11:36 +01:00
Rémi Verschelde 2852d5e613
Merge pull request #67331 from Sauermann/fix-subviewport-no-stretch-update
Fix stretch transform when resizing SubViewports
2023-02-01 11:10:01 +01:00
Rémi Verschelde f7397a5ac6
Merge pull request #58610 from Sauermann/fix-physics-mouse
Fix execution of physics picking events at unexpected times
2023-02-01 09:41:43 +01:00
Rémi Verschelde 394bb0ee2b
Fix various typos with codespell
Finally do the childs -> children rename too.
2023-02-01 08:45:41 +01:00
Markus Sauermann 8182f29d40 Fix stretch transform when resizing SubViewports
Move calculation of stretch transform from outside to inside
of `Viewport::_set_size` function.
2023-02-01 08:34:40 +01:00
Rémi Verschelde d9ade633b3
Merge pull request #71936 from akien-mga/remove-some-unused-signals
Remove some unused signals
2023-02-01 07:53:52 +01:00
Rémi Verschelde e8240031e7
Merge pull request #71479 from raulsntos/virtual-return-type
Use enum instead of int in virtual methods return type
2023-02-01 07:45:28 +01:00
Rémi Verschelde 51414fc987
Merge pull request #66906 from Sauermann/fix-prohibit-inconsistent-size-state
Prohibit inconsistent size state for SubViewport
2023-02-01 07:26:00 +01:00
Markus Sauermann decbda68d7 Prohibit inconsistent size state for SubViewport
Prohibit size changes of SubViewports with parent SubViewportContainers that have stretch mode enabled.
2023-01-31 22:53:43 +01:00
Raul Santos 9e9eac4676
Use enum instead of int in virtual methods return type 2023-01-31 19:06:49 +01:00
Rémi Verschelde 14a4408e02
Merge pull request #65698 from KoBeWi/cameraman
Rework how current Camera2D is determined
2023-01-31 18:56:20 +01:00
Rémi Verschelde b342dcdf04
Remove some unused signals
Part of #37604.
2023-01-31 18:54:04 +01:00
Rémi Verschelde 2b710bc336
Fix MSVC shadow local warning 2023-01-31 18:06:21 +01:00
Rémi Verschelde 1c42e141d0
Merge pull request #59310 from Sauermann/proposal-event-transform
Calculate window input event transform only on window change
2023-01-31 15:57:07 +01:00
Rémi Verschelde 4cfdd25384
Merge pull request #67507 from Sauermann/fix-toplevel-root-control-node
Fix event propagation to child after set_as_toplevel
2023-01-31 15:55:46 +01:00
Rémi Verschelde bde3310f02
Merge pull request #71995 from Faless/net/4.x_tls_verify
[NET] Refactor TLS configuration.
2023-01-30 13:28:31 +01:00
Rémi Verschelde 2e0d9efb72
Merge pull request #72115 from AThousandShips/clip_children_fix
Hide `clip_children` for some non-drawn CanvasItems
2023-01-30 10:02:54 +01:00
Ninni Pipping bbf203bc32 Hide clip_children for non-drawn CanvasItems 2023-01-30 08:22:06 +01:00
Hugo Locurcio 9f026d5274
Fix Editor Description tooltip not changing until scene is reopened
You still need to select another node to see the tooltip updated first,
but you no longer need to save and reopen the scene to view the updated
tooltip.
2023-01-30 00:18:13 +01:00
Fabio Alessandrelli adba870534 [NET] Refactor TLS configuration.
Use a TLSOptions configuration object which is created via static
functions.

- "TLSOptions.client": uses the standard CA and common name verification.
- "TLSOptions.client_unsafe": uses optional CA verification (i.e. if specified)
- "TLSOptions.server": is the standard server configuration (chain + key)

This will allow us to expand the TLS configuration options to include
e.g. mutual authentication without bloating the classes that uses
StreamPeerTLS and PacketPeerDTLS as underlying peers.
2023-01-28 11:08:02 +01:00
Rémi Verschelde aae96945fa
Merge pull request #71470 from YeldhamDev/window_fixes
Fix some small bugs in the `Window` node
2023-01-27 19:26:31 +01:00
Markus Sauermann b15a3ea3a4 Added assertion check 2023-01-26 16:10:32 +01:00
Rémi Verschelde 058c61b5b3
Merge pull request #68007 from Sauermann/fix-3d-capture
Fix event-content and mouse-signals with 3D-capture-on-drag
2023-01-26 16:00:26 +01:00
Rémi Verschelde 13e20fed99
Merge pull request #68627 from Sauermann/fix-tooltip-position
Fix position of Tooltips
2023-01-26 16:00:14 +01:00