Commit graph

1948 commits

Author SHA1 Message Date
Danil Alexeev
eb391d3302
Display BitField[Enum] in docs to distinguish from Enum 2023-06-15 17:23:02 +03:00
Rémi Verschelde
c3e5e4ed4b
Merge pull request #68599 from Rindbee/update-edited_scene_root-in-time
Update the edit scene root in time after it is replaced
2023-06-12 17:08:50 +02:00
Rindbee
eb74079dfb Update the edit scene root in time after it is replaced
When changing the type of the edited scene root node, it may be necessary
to update edited scene root in time for the child nodes to work properly.
2023-06-12 21:49:30 +08:00
Rémi Verschelde
9fca498647
Merge pull request #78110 from Sauermann/fix-nofocus-focus
Fix Tooltip getting removed instantly in embedded Window
2023-06-12 11:55:58 +02:00
Markus Sauermann
9d40f99290 Fix Tooltip getting removed instantly in embedded Window
Tooltips are unfocusable Windows. This case was not handled correctly in
`Viewport::_sub_window_register`.
2023-06-11 12:22:59 +02:00
Ninni Pipping
0c16082e1e Use get_node_or_null when null checks are present
Avoids duplicate or unnecessary errors
2023-06-10 13:22:56 +02:00
Markus Sauermann
37a96d3957 Fix that _drop_physics_mouseover only happens when necessary
Previously the call was executed every time, because in the
`_drop_mouse_over();` a few lines above, `gui.mouse_over = nullptr;`
was set.
2023-06-10 09:33:16 +02:00
Ninni Pipping
dcd2b883eb Use NULL instead of COND checks when appropriate
Restricted to scene
2023-06-10 08:56:30 +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
300748e52c
Merge pull request #78044 from RandomShaper/fix_node_prio_ignored
Fix node idle process priority being ignored
2023-06-09 13:45:15 +02: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
Pedro J. Estébanez
8bbc713ebf Fix node idle process priority being ignored 2023-06-09 13:05:07 +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
Rémi Verschelde
37fc598ee1
Merge pull request #77899 from bruvzg/emb_center
Use initial position property for embedded windows to center on parent window.
2023-06-09 12:15:07 +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
Rémi Verschelde
fd2f33942b
Merge pull request #78019 from Sauermann/fix-remove-child-inconsistency
Fix parent inconsistency in `Node::remove_child`
2023-06-09 11:06:49 +02:00
Rémi Verschelde
b083c1dbf5
Merge pull request #78005 from Sauermann/fix-some-simplifications
Some code simplifications
2023-06-09 11:06:26 +02:00
Rémi Verschelde
166643df32
Merge pull request #74937 from bitsawer/fix_uniform_storage
Fix shader uniform storage conversions and crash
2023-06-09 11:04:16 +02:00
Markus Sauermann
7561e176e8 Fix parent inconsistency in Node::remove_child
`NOTIFICATION_CHILD_ORDER_CHANGED` could be triggered, while there
was an inconsistent state:
- parent node no longer had child listed as child
- child node still had parent node listed as parent

Bring these two in sync, before emitting the notification.
2023-06-08 22:51:07 +02:00
Markus Sauermann
302a10e809 Fix CanvasItem::draw_string_outline parameter order
Switch `p_font_size` with `p_size` in header, because in all
other locations, `p_font_size` comes before `p_size`.
2023-06-08 18:15:38 +02:00
Rémi Verschelde
3a19d81691
Merge pull request #77842 from Sauermann/fix-unfocusable-subwindow
Fix input handling for unfocusable embedded windows
2023-06-08 17:38:33 +02:00
Markus Sauermann
5ddab1f363 Some code simplifications
AnimationNodeBlendSpace2DEditor:
- `!tree` is always false, because it is checked a few lines above

CurveEdit:
- grabbing != GRAB_NONE is redundant

GradientTexture2DEdit:
- grabbed != HANDLE_FROM is redundant
- grabbed != HANDLE_TO is redundant

Viewport:
- index is not used afterwards
- In these cases `gui.mouse_focus` is always valid. Move check to a DEV_ASSERT
- simplify `stopped` calculation
2023-06-08 16:15:22 +02:00
Rémi Verschelde
42e4c41e77
Merge pull request #77888 from Calinou/node-improve-thread-guard-errors
Display the node path in Node thread guard errors
2023-06-08 09:10:18 +02:00
Hugo Locurcio
bd468cdec7
Display the node path or name in Node thread guard errors
This makes it easier to diagnose which node is the source of the issue.
2023-06-07 16:06:53 +02:00
Rémi Verschelde
27b402bf73
Merge pull request #77902 from dalexeev/doc-unify-deprecations
Documentation: Unify deprecations
2023-06-07 16:06:50 +02:00
Danil Alexeev
b433020aa6
Documentation: Unify deprecations 2023-06-07 16:34:03 +03:00
kobewi
807431c49a Cancel tooltip when mouse leaves viewport 2023-06-07 00:56:36 +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
Yuri Sizov
2e728e02cc
Merge pull request #77763 from RedworkDE/warning-dialog-crash
Prevent crashes when removing Viewport from scene tree in event handler
2023-06-06 12:19:25 +02:00
bruvzg
e5b312a1e8
Use initial position property for embedded windows to center on parent window. 2023-06-06 09:29:13 +03:00
Rémi Verschelde
85c908654c
Merge pull request #77867 from Sauermann/revert-move-child-update
Don't update mouse cursor state on child order changed
2023-06-05 13:43:11 +02:00
Markus Sauermann
15ee292664 Don't update mouse cursor state on child order changed
Partially Revert "Create a virtual mouse move event after moving child nodes"
This reverts parts of commit ce10ca6979.

The problem was that the the mouse-move event interacted in unexpected ways.
2023-06-05 10:28:55 +02:00
RedworkDE
c4db212870 Prevent crashes when removing Viewport from scene tree in event handler 2023-06-03 23:37:31 +02:00
Aaron Franke
8b42297d7c
Make Viewport::gui_get_focus_owner const 2023-06-02 12:36:10 -05:00
Rémi Verschelde
2e273f0e35
Merge pull request #77724 from RandomShaper/remove_red_th_cond
Remove redundant check from thread guards
2023-06-01 15:52:16 +02:00
Pedro J. Estébanez
8c288918a0 Remove redundant check from thread guards 2023-06-01 11:08:14 +02: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
Yuri Sizov
6dd5ccdedd
Merge pull request #66625 from Sauermann/fix-move-child-update
Create a virtual mouse move event after moving child nodes in tree
2023-05-30 15:57:21 +02:00
Yuri Sizov
3a895eafc0
Merge pull request #77595 from Sauermann/fix-double-inputevent
Fix InputEvent being used twice
2023-05-30 15:25:36 +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
Yuri Sizov
ee7b26403b
Merge pull request #77433 from YuriSizov/editor-reparented-popups-fix
Fix auto-reparenting logic in the `ProgressDialog`
2023-05-29 17:30:46 +02:00
Yuri Sizov
4c5c7cbb58 Fix auto-reparenting logic in the ProgressDialog
* Make sure `Popup` signals are disconnected when unparented.
* Remove a fail condition from `Window::is_embedded` when
not in tree.
2023-05-29 17:02:16 +02:00
bitsawer
23c375d6b4 Fix shader uniform storage conversions and crash 2023-05-29 15:17:13 +03:00
Markus Sauermann
a9bf3de08e Fix InputEvent being used twice
A single mouse click can cause multiple actions, which contradicts
the paradigm that a single Input Event should cause only a single
action.

The solution consists of two parts:
1. Physics Picking as the last step during viewport input event
handling, currently doesn't set the event as handled. This PR sets
the event as handled in the case of physics picking.
2. After an InputEvent is processed by a SubVieportContainer, it is
sent to its parent, even if it set as handled within the SubViewport.
This PR adds an additional test to check if the event is handled
before propagating the event to the parent Control.
2023-05-29 02:39:09 +02:00
Michael Alexsander
af04d3fb2c
Fix error when attempting to move a embedded window with a negative title height 2023-05-28 16:46:16 -03:00
Rémi Verschelde
adbdf9a86e
Merge pull request #77234 from RandomShaper/fix_rtl_mt
Allow threads to mark themselves as safe for nodes
2023-05-24 08:42:59 +02:00
Pedro J. Estébanez
e725b4b02b Allow threads to mark themselves as safe for nodes 2023-05-24 00:22:58 +02:00
Rémi Verschelde
012541763d
Merge pull request #77288 from puchik/expose_get_window_id
Expose get_window_id() from Window class
2023-05-23 19:14:24 +02:00
Rémi Verschelde
ab935aaac6
Merge pull request #77312 from ajreckof/fix_window_unselectable_for_ViewportTexture_NodePath
Fix `Window` derived nodes being unselectable for `ViewportTexture` `NodePath`
2023-05-22 17:02:20 +02:00
Pedro J. Estébanez
250d8d00b5 Fix compile issue in not very conformant compilers 2023-05-22 13:33:40 +02:00
ajreckof
ace7620e55 fix Windowderived nodes being unselectable for ViewportTexture NodePath 2023-05-21 16:28:41 +02:00
Arman Elgudzhyan
49890a99c1 Expose get_window_id() from Window class
Window classes often need a Window ID for operations. This will help with performing operations on cached Windows.
2023-05-20 14:48:24 -07:00
Pedro J. Estébanez
50cf3d6966 Optimize threading-sensitive node data for single-threaded processing 2023-05-17 02:04:41 +02:00
Pedro J. Estébanez
44cc0d2ec2 Let calls through thread guards in resource loading contexts 2023-05-17 01:43:28 +02:00
Rémi Verschelde
755c61b57a
Merge pull request #77064 from brno32/push-input-null-check
Check for null event in Viewport::push_input
2023-05-16 11:04:08 +02:00
Rémi Verschelde
12b7a56202
Merge pull request #76713 from KoBeWi/TODO_is_now
Fix 2D audio in multiple viewports
2023-05-16 11:00:45 +02:00
Rémi Verschelde
508a5bf16e
Merge pull request #76025 from YuriSizov/editor-reparentable-windows
Expose dialog parent-and-popup logic to the API
2023-05-16 10:49:09 +02:00
Rémi Verschelde
59c19a7172
Merge pull request #75250 from bruvzg/lbl_rtl_jst_flags
Expose TextServer justification flags to Label, Label3D, TextMesh and RTL. Add flags to control last/single line justification.
2023-05-16 10:48:45 +02:00
Rémi Verschelde
8cfa19a078
Merge pull request #77000 from reduz/make-more-base-nodes-thread-safe
Make more base nodes thread safe
2023-05-16 00:31:56 +02:00
Alex Drozd
a5a1c3a03c check for null event in Viewport::push_input 2023-05-15 20:16:15 +02:00
Yuri Sizov
17f492fb82 Expose dialog parent-and-popup logic to the API 2023-05-15 19:49:28 +02:00
bruvzg
9163d8c336
Expose TextServer justification flags to Label, Label3D, TextMesh and RTL. Add flags to control last/single line justification. 2023-05-15 19:23:54 +03:00
Juan Linietsky
0a9f72d5a8 Make more base nodes thread safe
Ongoing work to make more of the base nodes thread safe.
2023-05-15 16:54:10 +02:00
Rindbee
1eb250e17d Avoid crash when adjusting a node tree that is not in the tree
When node tree `A` is not in the tree, `remove_child(B)` will not
automatically clean up the owners of `B` and `B`'s child nodes.
This is convenient for implementing operations like `replace_by()`,
but may have hidden dangers when manipulating the rest of the tree
`A`.

This commit makes it safe to manipulate the rest of `A` after freeing
`B`.
2023-05-11 08:57:39 +08:00
Rémi Verschelde
5271186f2f
Merge pull request #75901 from reduz/refactor-node-processing
Refactor Node Processing to allow Scene Multithreading
2023-05-10 12:46:44 +02:00
Rémi Verschelde
31fc7a8525
Merge pull request #62378 from trollodel/gsoc_2022_multiwindow
Add multi window code and shader editors (GSOC'22 Project)
2023-05-10 12:46:19 +02:00
Rémi Verschelde
3b8c828159
Merge pull request #69988 from smix8/navigation_rvo_rework_4.x
Rework Navigation Avoidance
2023-05-10 10:19:12 +02:00
Rémi Verschelde
8e608e9467
Merge pull request #64388 from Rindbee/improve-ViewportTexture
Improve the UX of ViewportTexture in the editor
2023-05-10 10:18:43 +02:00
trollodel
b4d6b47c17 Add multi window code and shader editors 2023-05-10 09:14:21 +02:00
smix8
a6ac305f96 Rework Navigation Avoidance
Rework Navigation Avoidance.
2023-05-10 05:01:58 +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
Juan Linietsky
98c655ec8d Refactor Node Processing
* Node processing works on the concept of process groups.
* A node group can be inherited, run on main thread, or a sub-thread.
* Groups can be ordered.
* Process priority is now present for physics.

This is the first steps towards implementing https://github.com/godotengine/godot-proposals/issues/6424.
No threading or thread guards exist yet in most of the scene code other than Node. That will have to be added later.
2023-05-09 19:17:51 +02:00
Rémi Verschelde
72323a57d0
Merge pull request #57894 from Sauermann/fix-subviewport-1
Fix unrestricted mouse-event propagation to SubViewports for Physics-Picking
2023-05-09 10:43:49 +02: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
Michael Alexsander
8118d0d2f5 Add more uses of appropriate cursors when resizing/moving some UI nodes 2023-05-07 11:14:57 -03:00
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
kleonc
d159123633 Fix recursive Node.find_children 2023-04-09 09:15:21 +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
Markus Sauermann
83fa14a5a9 Include the Window-transform into Viewport::get_final_transform 2023-01-26 15:30:44 +01:00
Markus Sauermann
c4ed247f5f Fix position of Tooltips
CanvasItem::get_screen_transform returns a transform from the CanvasItem
to the coordinate system, where a Popup - created as a child of the
CanvasItem - should be opened.
get_screen_transform makes some simplifications, that work well, when used
in the editor, but not in general cases.

Since Popups like Tooltips are now used more commonly in projects,
it becomes necessary to correct these simplifications.

This solution introduces Viewport::get_popup_base_transform, which makes
the necessary calculations.
2023-01-26 15:15:14 +01:00
Aaron Franke
2bc0bcbd26
PropertyUsage: Rename "DO_NOT_SHARE_ON_DUPLICATE" to "ALWAYS_DUPLICATE" 2023-01-24 16:05:07 -06:00
Yuri Sizov
fab9926a95
Merge pull request #65137 from dalexeev/editor-naming
Rearrange `editor/naming/*` project settings
2023-01-24 22:26:03 +03:00
Rémi Verschelde
11e2278844
Merge pull request #57606 from SaracenOne/update_on_reimport
Update instances of scenes which have been reimported.
2023-01-23 15:35:44 +01:00
Rémi Verschelde
5b1df48c6c
Convert en_GB spelling to en_US with codespell 2023-01-23 11:02:20 +01:00
Rémi Verschelde
cd031fd31a
Merge pull request #71663 from bruvzg/init_pos_x
Reorganize main and sub-window initial position properties.
2023-01-22 11:25:58 +01:00
Rémi Verschelde
229c82690d
Merge pull request #70294 from KoBeWi/treedulate
Add a method to get global modulate
2023-01-21 20:51:42 +01:00
Rémi Verschelde
7b622ce6e8
Merge pull request #71021 from reduz/prevent-physics-callback-removal
Error when removing a physics node during a physics callback
2023-01-21 11:28:02 +01:00
Rémi Verschelde
a83093fa80
Merge pull request #71692 from HalcyonGarside/viewport-debug-draw-fix
Fix incorrect Viewport Debug Draw effects
2023-01-20 08:49:21 +01:00
Rémi Verschelde
9fc40123ab
Merge pull request #71679 from kleonc/draw_polyline_line_strip
`CanvasItem::draw_polyline` Support thin polylines drawn using line strip
2023-01-20 08:48:56 +01:00
Rémi Verschelde
360b61084a
Merge pull request #41239 from dalexeev/fix_draw_rect
Fix `CanvasItem.draw_rect` function with `filled = false`
2023-01-19 22:49:23 +01:00
HalcyonGarside
ef35c4002c Add 'Lighting' to list of Debug Draw viewport options 2023-01-19 15:23:59 -05:00
kleonc
728c51e362 CanvasItem::draw_polyline Support thin polylines drawn using line strip 2023-01-19 21:08:25 +01:00
bruvzg
aade5abd4f
Reorganize main and sub-window initial position properties. 2023-01-19 13:44:06 +02:00
Michael Alexsander
52b077ca28 Fix some small bugs in the Window node 2023-01-18 21:20:49 -03:00
Rémi Verschelde
2050f59e3a
Merge pull request #71623 from kleonc/draw_arc_clamp_to_single_circle
`CanvasItem::draw_arc` Clamp angle difference so arc won't overlap itself
2023-01-18 22:28:24 +01:00
kleonc
43fc483e6c CanvasItem::draw_arc Clamp angle difference so arc won't overlap itself 2023-01-18 15:16:22 +01:00
Mai Lavelle
a058cedb53 Fix crash on touch release 2023-01-17 19:12:55 -05:00
Danil Alexeev
c046bb8389
Fix CanvasItem.draw_rect function with filled = false 2023-01-17 09:15:47 +03:00