Commit graph

1894 commits

Author SHA1 Message Date
Hendrik Brucker
7e21eb7e00 Extract and reorganize texture resource classes 2023-07-14 20:04:21 +02:00
Yuri Sizov
d8c0d63f07 Merge pull request #79393 from Sauermann/fix-window-focux-indicator
Add a default theme for unfocused Windows
2023-07-14 18:50:01 +02:00
Markus Sauermann
576980f960 Add a default theme for unfocused Windows
At the moment it is impossible to distinguish between focused and
unfocused embedded Windows.
Add a new `theme_item` that is used for coloring the border of
unfocused Windows.
2023-07-12 22:35:03 +02:00
bruvzg
4790da7900
[macOS] Implement optional native file selection dialog support for sandboxed apps. 2023-07-12 22:36:24 +03:00
Yuri Sizov
7ff2a93952 Merge pull request #72248 from RedwanFox/mainloop_init_order_fix
Ensure that SceneTree is initialized and finalized at correct time
2023-07-12 17:16:05 +02:00
Yuri Sizov
223370cb64 Merge pull request #78383 from Sauermann/fix-physics-object-init
Fix Physics Picking captured Object initialization
2023-07-12 17:15:45 +02:00
Yuri Sizov
5dff3c4484 Merge pull request #78538 from Sauermann/fix-code-simplifications
Remove unnecessary value assignments throughout the codebase
2023-07-12 15:09:26 +02:00
Yuri Sizov
631d51c46c Merge pull request #78476 from Sauermann/fix-embedded-safe-area
Embedded Popups store their safe_rect in their embedder
2023-07-12 15:09:20 +02:00
Ninni Pipping
7bd3a3a5e5 Prevent crash when accessing Node Multiplayer from thread 2023-07-11 12:57:25 +02:00
Rémi Verschelde
6cb1162aa0
Merge pull request #79000 from AThousandShips/owner_error
Improve error message for `Node.set_owner`
2023-07-11 11:29:30 +02:00
Rémi Verschelde
988abb2161
Merge pull request #79016 from bruvzg/fix_win_initial_ne_fs
[Windows] Fix setting initial non-exclusive window mode.
2023-07-08 18:21:04 +02:00
Rémi Verschelde
0df423756e
Merge pull request #78847 from Sauermann/fix-sibling-fail
Fix `Node::add_sibling` parent check
2023-07-08 18:20:14 +02:00
kleonc
3f6e35bdb2 Fix drag-dropping nodes to parent with internal nodes 2023-07-07 19:24:44 +02:00
Rémi Verschelde
7961bc6193
Merge pull request #78078 from Sauermann/fix-drop-physics-mouse-over
Ensure that `_drop_physics_mouseover` only happens when necessary
2023-07-07 16:02:13 +02:00
Pedro J. Estébanez
4354cd8d41 Reimplement scene change 2023-07-04 13:29:50 +02:00
bruvzg
db0109b237 [Windows] Fix setting initial non-exclusive window mode. 2023-07-04 13:09:26 +03:00
Ninni Pipping
0183340012 Improve error message for Node.set_owner 2023-07-04 08:51:12 +02:00
Markus Sauermann
b02dff6e1c Fix Node::add_sibling parent check
Replace `data.blocked > 0` by `data.parent->data.blocked > 0` in order
to check if the parent is busy.
2023-06-29 20:21:37 +02:00
Rémi Verschelde
16508ead86
Merge pull request #78745 from RandomShaper/fix_node_pr
Fix node processing order
2023-06-27 23:02:02 +02:00
Pedro J. Estébanez
70ca659143 Fix node internal/non-internal processing order
Bonus:
Fix issues in group-processing related setters
2023-06-27 19:19:55 +02:00
Rindbee
fb1bcac271 Fix that ViewportTexture cannot be setup again after failed setup
`vp_pending` is a flag indicating to wait for `ViewportTexture::_setup_local_to_scene`
to be called. Once this method is called, no matter whether the setup will fail or not,
it needs to be reset to `false`.
2023-06-27 06:45:30 +08:00
Pedro J. Estébanez
fc0e37bbe0 Fix change of precedence in fixup 2023-06-26 19:20:34 +02:00
Rémi Verschelde
6b91f57042
Fixup compilation warning after #78713 2023-06-26 17:55:08 +02:00
Pedro J. Estébanez
a39b683b12 Ensure default node groups' call queue are processed 2023-06-26 16:56:10 +02:00
RedworkDE
2c0caa5828 Allow renaming child nodes in _ready 2023-06-26 13:25:48 +02:00
Markus Sauermann
31fab43b8b Fix scene load crash related to _ready
The iterator might get invalidated during `_ready`-user-code.
Prevent this by disallowing set_name during iterator-operations.
2023-06-25 22:35:38 +02:00
Rémi Verschelde
afe65de110
Merge pull request #78591 from ajreckof/Fix-crash-when-removing-child-during-focus-exit-
Fix crash when removing child during focus exit.
2023-06-23 22:45:51 +02:00
ajreckof
f745299c36 Fix crash when removing child during focus exit. 2023-06-23 21:31:18 +02:00
Rémi Verschelde
68193bee9a
Revert "Fix that the focus-out notification got sent deferred"
This reverts commit 8cdab04d7f.

Fixes #78589.
2023-06-23 18:03:48 +02:00
Markus Sauermann
60c261ba2d Re-add mouse_focus-nullcheck 2023-06-22 21:58:19 +02:00
Rémi Verschelde
283580d0cc
Merge pull request #78566 from kleonc/repeated-sprite-selection-fix
Fix click-selecting Sprites with repeated texture
2023-06-22 18:32:01 +02:00
kleonc
edba45ec8b Fix click-selecting Sprites with repeated texture 2023-06-22 16:37:08 +02:00
jeana helver
5ec1b698d2
Fix missing enum value for Window.initial_position
Reorder the properties in a possibly more intuitive order.

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2023-06-21 22:39:43 +02:00
Markus Sauermann
890fdd56df Code simplifications
CPPcheck found most of them.

no need to assign the variable twice:
- AnimationTrackEditTypeAudio
- SSEffects

variable is assigned in all if-else clauses:
- EditorHelp
- AndroidInputHandler
- MenuBar
- ShaderCompiler

same if clause:
- ItemList

clearing an empty bitfield has no effect:
- Viewport
2023-06-21 22:37:26 +02:00
Nickolai Korshunov
83f065c0ef Ensure that SceneTree is initialized and finalized at correct time
SceneTree should be fully initialized before any tree operation with any node and finalized only after all nodes exited tree.
2023-06-20 23:47:02 +03: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
159f1ec301
Merge pull request #78398 from Sauermann/fix-immediate-focus-out
Fix that the focus-out notification got sent deferred
2023-06-20 13:14:10 +02:00
Rémi Verschelde
cce100a840
Merge pull request #75459 from kleonc/node-fix-find-children
Fix recursive `Node.find_children`
2023-06-19 22:33:46 +02:00
Markus Sauermann
8cdab04d7f Fix that the focus-out notification got sent deferred
Currently the window receives a focus-out notification, directly after
it popup, because currently the signal is sent deferred.
The original intention was that the previously focused window must
receive a focus-out notification.
This change makes the notification more precise by only sending the
focus-out to the previously focused window.
2023-06-18 23:06:07 +02:00
Raul Santos
5373b67e2a
Respect returned bool from virtual process methods in SceneTree
SceneTree overrides the virtual `process` and `physics_process` methods
that it inherits from MainLoop. These methods return a boolean that
determines if the main loop should end.
The SceneTree was ignoring the returned boolean, so scripts inheriting
from SceneTree that override these methods and return true didn't exit
the main loop. Now the boolean is checked.
2023-06-18 20:45:58 +02:00
Markus Sauermann
5b2a5cd2e0 Fix Physics Picking captured Object initialization
Initialize variables when a captured object is known.
2023-06-18 00:45:49 +02:00
smix8
f1d8ddd9bd Remove SceneTree debug avoidance hint
Removes SceneTree debug avoidance hint.
2023-06-16 17:18:47 +02:00
Rémi Verschelde
2ebe692ccc
Merge pull request #78276 from smix8/remove_old_navdebug_materials_4.x
Remove legacy navigation debug materials
2023-06-16 10:20:20 +02:00
Rémi Verschelde
014b395ef3
Merge pull request #78262 from bruvzg/ds_window_focus
[DisplayServer] Add method to check if native window is focused.
2023-06-16 10:19:33 +02:00
bruvzg
28db3c7158 [DisplayServer] Add method to check if native window is focused. 2023-06-16 10:27:52 +03:00
smix8
1b506cd49c Remove legacy navigation debug materials
Removes legacy navigation debug materials.
2023-06-15 16:33:55 +02:00
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