Commit graph

2004 commits

Author SHA1 Message Date
Markus Sauermann
3de9afc4a9 Fix crash when hiding a Control during mouse-entering
gui.mouse_over can be set to `nullptr` in the `NOTIFICATION_MOUSE_ENTER`-
user-callback a few lines above. This case was previously not handled.
2023-11-23 23:25:00 +01:00
Pedro J. Estébanez
8bebabda18 Let scene replacemnent benefit from certain late pieces of frame logic 2023-11-21 18:32:49 +01:00
Markus Sauermann
d3d00c7039 Fix crash caused by stale owner
Adjust `NOTIFICATION_PREDELETE` in `Node` to clean up owned nodes.
Also print a warning, when the owner becomes invalid.
2023-11-17 19:53:58 +01:00
bruvzg
932174fedf
[Editor] Add option to override editor UI layout direction. 2023-11-17 14:56:45 +02:00
jsjtxietian
4680ced5fa support updating tooltip after editor description change 2023-11-15 14:27:49 +08:00
Mikael Hermansson
a98b94758b Revert "Fix transform notification not getting sent out for RigidBody2D" 2023-11-14 22:17:26 +01:00
Markus Sauermann
fa02d19fd1 Fix internal events not being delivered to some Window types
`AcceptDialog`, `Popup` and `PopupMenu` no longer subscribe to
"window_input" signal, because that is only sent if it is not an
internal signal.

Instead they receive events in `_input_from_window`. They ensure that
the event is also propagated to their super-function, just like
previously the signals would be treated.
2023-11-14 20:29:17 +01:00
Mikael Hermansson
9fb0b52608 Fix transform notification not getting sent out for RigidBody2D 2023-11-13 15:44:32 +01:00
Rémi Verschelde
15b8185c68
Don't use TTR/RTR for ERR/WARN prints
We don't translate those, only editor strings are translated.
2023-11-12 12:00:55 +01:00
kit
d24d73ba31 Make mouse-enter/exit notifications match mouse event propagation
`NOTIFICATION_MOUSE_ENTER` and `NOTIFICATION_MOUSE_EXIT` now includes
the areas of children control nodes if the mouse filters allow it.

In order to check if a Control node itself was entered/exited, the newly
introduced `NOTIFICATION_MOUSE_ENTER_SELF` and
`NOTIFICATION_MOUSE_EXIT_SELF` can be used.

Co-authored-by: Markus Sauermann <6299227+Sauermann@users.noreply.github.com>
2023-11-09 09:11:59 -05:00
Yuri Sizov
623b905d2e Remove unused NOTIFICATION_NODE_RECACHE_REQUESTED notification 2023-11-06 12:16:32 +01:00
warriormaster12
de1dc6c8d4 Fix node property duplication 2023-11-04 10:45:38 +02:00
Michael Alexsander
62ab9bf1c4
Fix NOTIFICATION_WM_SIZE_CHANGED firing if the size hasn't changed 2023-10-31 22:58:12 -03:00
clayjohn
f672198f5e Revert "Add a Disable 2D property to Viewport"
This reverts commit f6cc2603a1.
2023-10-27 14:45:59 +02:00
twobit
b4aa6ad36e Fix reparent losing owner if relationship to original owner is not broken 2023-10-26 13:08:05 -04:00
Gilles Roudière
73f72409f5 Allow normal maps on TileMaps that use texture padding 2023-10-18 14:55:44 +02:00
Rémi Verschelde
7c088f246e
Merge pull request #82846 from SaracenOne/network_authority_instance_placeholders
Copy network authority when instancing placeholders
2023-10-16 10:38:34 +02:00
Rémi Verschelde
9e02dcd44c
Merge pull request #82100 from bitsawer/fix_shader_globals_override
Fix ShaderGlobalsOverride property handling
2023-10-11 22:50:08 +02:00
Rémi Verschelde
a1d7c62df7
Merge pull request #83003 from AThousandShips/null_check_extra
Replace `ERR_FAIL_COND` with `ERR_FAIL_NULL` where applicable
2023-10-09 15:37:14 +02:00
Rémi Verschelde
336260b7b3
Merge pull request #83002 from AThousandShips/safety_check
Replace `sanity` with `safety` for checks
2023-10-09 15:36:49 +02:00
A Thousand Ships
f18aa00e85 Replace ERR_FAIL_COND with ERR_FAIL_NULL where applicable 2023-10-08 17:23:33 +02:00
A Thousand Ships
034c0f1624 Replace sanity with safety for checks 2023-10-08 16:22:24 +02:00
Hugo Locurcio
f6cc2603a1
Add a Disable 2D property to Viewport
This is the 2D counterpart to the existing Disable 3D property.
Its functionality is already internally implemented and used,
but it wasn't exposed.
2023-10-07 17:19:15 +02:00
Rémi Verschelde
3b70e30e9b
Merge pull request #77072 from vPumpking/get-tree-string
Add `Node.get_tree_string` and `Node.get_tree_string_pretty`
2023-10-05 16:32:12 +02:00
Saracen
e1803e27d0 Copy network authority when instancing placeholder nodes. 2023-10-05 12:58:17 +01:00
Rémi Verschelde
3a990e36e6
Merge pull request #80752 from bitsawer/fix_thread_guard
Fix CanvasItem notification thread guard
2023-10-03 17:13:08 +02:00
bruvzg
72e2e47059
[DisplayServer] Add method to estimate window title bar size. 2023-10-03 16:13:52 +03:00
bitsawer
12a2177967 Fix notification thread guards 2023-10-02 19:31:54 +03:00
Rémi Verschelde
1e819ae3aa
Merge pull request #82590 from YuriSizov/window-you-come-to-me-on-this-day-the-day-when-my-child-becomes-exclusive-with-a-transient-parent-to-ask-for-this
Add more context to some `Window` errors
2023-10-02 13:16:39 +02:00
Rémi Verschelde
e95b7e84a4
Merge pull request #80844 from dalexeev/fix-callable-expected-argc
Fix expected argument count for `Callable` call errors
2023-10-02 13:15:53 +02:00
Yuri Sizov
53172d9860 Add more context to some Window errors 2023-09-30 21:44:05 +02:00
bruvzg
c52db6190c
[FileDialog] Make set_visible compatible with native dialogs. 2023-09-30 00:40:49 +03:00
Danil Alexeev
aff767ef07
Fix expected argument count for Callable call errors 2023-09-29 20:00:10 +03:00
Michael Alexsander
9ee82ebe1d
Fix tooltips behaving incorrectly on Tree nodes 2023-09-28 11:18:15 -03:00
Hugo Locurcio
fcbf7011cc
Make 3D editor gizmos and debug shapes ignore fog
This makes them easier to see in their intended colors in scenes with fog.
2023-09-27 00:54:57 +02:00
Marcel Admiraal
3a7eda8f87 Check if input marked handled before processing additional CollisionObjects 2023-09-26 20:42:15 +02:00
Rémi Verschelde
008b08b5fb
Merge pull request #82358 from jsjtxietian/fix-can-not-set-process-priority-of-node-in-editor
Fix can not set process priority of node in certain cases
2023-09-26 13:45:36 +02:00
jsjtxietian
e36117f557 Fix can not set process priority of node if not any process is processing 2023-09-26 19:29:25 +08:00
Rémi Verschelde
79805262f1
Merge pull request #77829 from AThousandShips/mp_fix
Disallow nested custom multiplayers in `SceneTree`
2023-09-26 08:17:02 +02:00
Rémi Verschelde
e4cfd4e26a
Merge pull request #82195 from AThousandShips/radian_fix
Replace `radians` range hint with `radians_as_degrees`
2023-09-25 17:18:38 +02:00
Dario
057367bf4f Add FidelityFX Super Resolution 2.2 (FSR 2.2.1) support.
Introduces support for FSR2 as a new upscaler option available from the project settings. Also introduces an specific render list for surfaces that require motion and the ability to derive motion vectors from depth buffer and camera motion.
2023-09-25 10:37:47 -03:00
A Thousand Ships
a5fe392b78 Disallow nested custom multiplayers in SceneTree
Enables clearing the custom multiplayer
2023-09-25 14:59:05 +02:00
A Thousand Ships
e45927b2f2 Replace radians range hint with radians_as_degrees 2023-09-25 08:50:19 +02:00
bitsawer
71e32364ee Fix ShaderGlobalsOverride property handling 2023-09-22 10:21:20 +03:00
Yuri Sizov
dd3638d425 Merge pull request #81669 from kleonc/gui-tooltip-transparent-background
Enable transparent background for GUI tooltips
2023-09-15 19:48:37 +02:00
vPumpking
bd575c5fe5 Add 'get_tree_string()' and 'get_tree_string_pretty()' to Node class to complement printing methods 2023-09-15 19:18:53 +02:00
kleonc
c66dfd2cfe Enable transparent background for GUI tooltips 2023-09-14 23:39:28 +02:00
Yuri Sizov
56e54b49b6 Merge pull request #81551 from YuriSizov/gui-cache-all-the-theme
Bind remaining theme properties to their respective classes
2023-09-14 15:21:45 +02:00
Yuri Sizov
fe000277ea Bind remaining theme properties to their respective classes
This adds binds for GraphEdit/GraphElement/GraphNode, which were
skipped before due to a rework. This also adds binds for Window,
which was skipped before due to a complicated code organization.

Also adds theme cache entries/direct cache access to a few places
that previously missed it. Some theme properties are now exposed
to other classes via friendships or public getters for convenience.

This removes all string-based theme access from scene/ classes.
2023-09-13 19:31:35 +02:00
A Thousand Ships
a29416e332 [Scene,Main] Replace ERR_FAIL_COND with ERR_FAIL_NULL where applicable 2023-09-12 12:53:06 +02:00
Yuri Sizov
2924bfd4d3 Register theme properties with ThemeDB 2023-09-11 13:45:23 +02:00
Rémi Verschelde
7663c69922
Merge pull request #81388 from YuriSizov/core-gdvirtual-but-less-confused-about-itself
Extract `ScriptInstance` into its own file to simplify includes
2023-09-07 13:53:45 +02:00
Yuri Sizov
d8ff69d53c Extract ScriptInstance to simplify includes
This allows to include script_instance.h directly in the
generated gdvirtual.gen.inc, and remove excessive includes
from the codebase.

This should also allow Resource to use GDVIRTUAL macros,
which wasn't possible previously due to a circular dependency.
2023-09-06 22:54:38 +02:00
Yuri Sizov
58126e479c Introduce the concept of global theme contexts
This commit adds the default theme context, which replaces
the need to manually check the project and the default theme
all the time; simplifies related code.

It also adds framework for custom theme contexts, to be used
by the editor. Custom contexts can be attached to any node,
and not necessarily a GUI/Window node. Contexts do no break
theme inheritance and only define which global themes a node
uses as a fallback.

Contexts propagate NOTIFICATION_THEME_CHANGED when one of their
global themes changes. This ensures that global themes act just
like themes assigned to individual nodes and can be previewed
live in the editor.
2023-09-06 19:40:43 +02:00
kobewi
6de34fde27 Add EditorStringNames singleton 2023-09-03 19:58:18 +02:00
Rémi Verschelde
39b1d860c3
Merge pull request #75382 from AThousandShips/duplicate_bind
Ensure binds are duplicated with `Node` signals
2023-09-01 16:00:05 +02:00
Rémi Verschelde
fc0b3f7021
Merge pull request #80320 from Sauermann/fix-remove-invalidation-function
Remove `CanvasItem::_invalidate_global_transform`
2023-08-30 08:45:27 +02:00
Markus Sauermann
7f317ef1bf Remove CanvasItem::_invalidate_global_transform
The only use of that function can be replaced by `_notify_transform`,
which makes the `propagate_call` unnecessary.
As far as I can tell, the `data.blocked`-checks of `propagate_call`
are not needed in this case, because `_invalidate_global_transform`
causes no user-noticeable changes.
2023-08-30 00:29:42 +02:00
Markus Sauermann
c4705a590b Fix Object::notification order
Previously the `p_reversed` parameter didn't influence the order
in a correct way.
Also script overridden _notification functions were not called in
the correct order.

To fix this some `notification` functions had to add a `p_reversed`
parameter.

This made it necessary to adjust cpp-bindings.

Co-authored-by: David Snopek <dsnopek@gmail.com>
2023-08-30 00:15:55 +02:00
A Thousand Ships
9cf13cedfd Ensure binds are duplicated with Node signals 2023-08-29 16:52:38 +02:00
Rémi Verschelde
8b8b6d1e87
Merge pull request #81006 from KurtBliss/Chance-of-crash-when-Control-overrides-mouse-input-on-Area2D-#79371
Fix possible crash when Control overrides mouse input on Area2D
2023-08-28 15:04:41 +02:00
Rémi Verschelde
072ba70424
Merge pull request #81012 from Jordyfel/center-window
Implement center window function.
2023-08-28 12:07:27 +02:00
Rémi Verschelde
2c0a74a149
Merge pull request #80105 from Sauermann/fix-global-transform
Fix global transform validity for `Node2D` and `Control`
2023-08-28 12:03:53 +02:00
Jordyfel
9819ffb166 Implement window center function. 2023-08-26 21:34:21 +03:00
KurtBliss
dbb01bc451 Fixed, chance of crash when Control overrides mouse input on Area2D
Made Viewport::_cleanup_mouseover_colliders queue up mouse_exit and
mouse_shape_exit signals to emit and at the end of the function's
execution to avoid potential crashes.
2023-08-25 17:51:38 -04:00
Rémi Verschelde
b24eb34669
Merge pull request #80780 from HolonProduction/sub-window-focus-crash
Fix crash when hiding subwindow during popup of new subwindow
2023-08-21 08:23:23 +02:00
HolonProduction
e2cea458a3 Fix crash when hiding subwindow during popup of new subwindow 2023-08-20 17:51:54 +02:00
Rémi Verschelde
e73a4a382e
Merge pull request #79201 from Rindbee/fix-setup-state-not-cleared
Clear the previously set state when configuring for a new scene root node
2023-08-17 15:43:38 +02:00
Rémi Verschelde
77fd8f3416
Merge pull request #80673 from YeldhamDev/give_me_my_windows!
Allow to get a list of visible embedded `Window`s
2023-08-16 16:56:31 +02:00
Rémi Verschelde
c081d1bd24
Merge pull request #78816 from kleonc/scene-tree-fix-drag-drop-to-parent-with-internal-nodes
Fix drag-dropping nodes to parent with internal nodes
2023-08-16 16:54:06 +02:00
Michael Alexsander
de27df5da3
Allow to get a list of visible embedded Windows 2023-08-16 10:42:08 -03:00
Rémi Verschelde
a7dc4c22a9
Merge pull request #80334 from Sauermann/fix-window-out-of-viewport-events
Fix nodes receiving mouse events in black bars of `Window`
2023-08-16 09:12:42 +02:00
Rémi Verschelde
33198d0df0
Merge pull request #75784 from Riteo/int-scale
Add content scale stretch modes, implement integer scaling
2023-08-11 10:32:11 +02:00
Riteo
87cfc415a3 Add content scale stretch modes, implement integer scaling
Integer scaling is achieved (after aspect expansion) by "lying" to the
stretching code about the window's size, telling it that it's always an
integer multiple of the viewport so that it only gets stretched to an
integer factor.

This approach works with all stretch and aspect modes and doesn't
require handling for each, only requiring to "loosen up" some
self-excluding conditions (in other words, replacing some `else if`s
with just `if`s) regarding viewport offset and margin calculation (black
bars).

Includes a tiny usability change that adds a range hint for the content
scale factor between 0.5 to 8.0.

Co-Authored-By: Hugo Locurcio <hugo.locurcio@hugo.pro>
2023-08-10 19:45:47 +02:00
Markus Sauermann
59c13fea5d Fix nodes receiving mouse events in black bars of Window
Previously for InputEvents there was no distinction between
Window-area and Viewport-area.
This was problematic in cases where stretching was used and the Window
contained black bars at the sides of the Viewport.
This PR separates the area of Window and Viewport regarding InputEvents.
2023-08-09 12:34:22 +02:00
Rindbee
4795c3cdfa Clear the previously set state when configuring for a new scene root node
Saving a subscene causes the main scene to be re-instantiated. And the resource
instance in the main scene will be reused when the main scene is re-instantiated.
So for resources with `resource_local_to_scene` enabled, resetting state may be
necessary (at least for `ViewportTexture`).
2023-08-08 23:49:53 +08:00
Rémi Verschelde
46c9a1427d
Merge pull request #80364 from Calinou/control-escape-dismiss-tooltips
Dismiss currently visible or upcoming tooltips when pressing Escape
2023-08-08 16:57:59 +02:00
Rémi Verschelde
1163dac9e3
Merge pull request #80215 from clayjohn/HDR-2D
Add option to enable HDR rendering in 2D
2023-08-08 16:57:33 +02:00
Rémi Verschelde
af722e2bab
Merge pull request #80187 from Sauermann/fix-mouseover-error-handling
Handle potential platform-specific `Window` mouse-enter/exit bugs gracefully
2023-08-08 16:57:09 +02:00
Markus Sauermann
2f8673dc07 Handle potential platform-specific Window mouse-enter/exit bugs gracefully
Also replace `DEV_ASSERT` by `WARN_PRINT_ONCE`.
2023-08-08 13:05:18 +02:00
Markus Sauermann
152572ac38 Fix global transform validity for Node2D and Control
Set global transform to invalid when changing transform
2023-08-08 12:22:55 +02:00
Hugo Locurcio
6307b0be3c
Dismiss currently visible or upcoming tooltips when pressing Escape
This is standard UI behavior in most applications out there.
2023-08-08 07:40:39 +02:00
Rémi Verschelde
faaf27f284
Fix various typos with codespell
Also includes typo fixes from #79993, #80068, #80276, and #80303.

Co-authored-by: betalars <contact@betalars.de>
Co-authored-by: spaceyjase <429978+spaceyjase@users.noreply.github.com>
Co-authored-by: Swarkin <102416174+Swarkin@users.noreply.github.com>
Co-authored-by: Raul Santos <raulsntos@gmail.com>
2023-08-07 13:09:47 +02:00
clayjohn
57eb762bae Add option to enable HDR rendering in 2D
This is needed to allow 2D to fully make use of 3D effects (e.g. glow), and can be used to substantially improve quality of 2D rendering at the cost of performance

Additionally, the 2D rendering pipeline is done in linear space (we skip linear_to_srgb conversion in 3D tonemapping) so the entire Viewport can be kept linear.
This is necessary for proper HDR screen support in the future.
2023-08-07 11:24:03 +02:00
Michael Alexsander
6d2453425b
Improve Window._get_contents_minimum_size()'s code 2023-08-03 10:25:05 -03:00
Rémi Verschelde
f9d960c925
Merge pull request #80178 from YeldhamDev/override_all_the_things
Expose `Window`'s `_get_contents_minimum_size()` to scripting
2023-08-03 14:46:52 +02:00
Yuri Sizov
237bd0a615
Merge pull request #80117 from Sauermann/fix-actually-store-safe-rect
Actually store safe-rect in embedder
2023-08-02 21:48:02 +02:00
Michael Alexsander
f270163ab0
Expose Window's _get_contents_minimum_size() to scripting 2023-08-02 14:40:38 -03:00
Markus Sauermann
1e9d241809 Actually store safe-rect in embedder
`sw` is a copy and not a reference.
Add unit-test for this case.
2023-08-02 17:51:52 +02:00
Markus Sauermann
8c1ce404d7 Fix crash on Windows when closing Window
Send `WINDOW_EVENT_MOUSE_EXIT` when a window is destroyed.

Ensure, that on Windows, the event_callback is still valid during
destroying the `Window`.
2023-08-02 00:17:25 +02:00
Yuri Sizov
defaac6058 Merge pull request #67791 from Sauermann/fix-visual-mouse-notifications
Refactor mouse_entered and mouse_exited signals
2023-08-01 20:03:33 +02:00
Yuri Sizov
fd1ee5d56b Merge pull request #79332 from AThousandShips/mp_crash
Prevent crash when accessing `Node` Multiplayer from thread
2023-08-01 17:25:07 +02:00
Markus Sauermann
1c3c17c608 Refactor mouse_entered and mouse_exited notifications
The previous implementation for signals mouse_entered and mouse_exited
had shortcomings that relate to focused windows and pressed mouse buttons.
For example a Control can be hovered by mouse, even if it is occluded by
an embedded window.

This patch changes the behavior, so that Control and Viewport send
their mouse-enter/exit-notifications based solely on mouse position,
visible area, and input restrictions and not on which window has
focus or which mouse buttons are pressed. This implicitly also
changes when the mouse_entered and mouse_exited signals are sent.

This functionality can not be implemented as a part of
Viewport::_gui_input_event, because of its interplay with Windows and
because Viewport::_gui_input_event is based on input and not on
visibility.
2023-08-01 13:28:49 +02:00
Markus Sauermann
7fead979d6 Disable error condition for accessing safe rect
This PR removes the error-message, which is currently expected to happen.
The task of correctly fixing the underlying problem of window popup
closing is more complex, so this PR solves the immediate
error-notification-problem.
2023-07-26 20:21:30 +02:00
Yuri Sizov
d50c52652f Merge pull request #79805 from kumikumi/fix-subviewport-cursor
Prevent SubViewportContainer overriding Subviewport's cursor with its own cursor
2023-07-26 18:40:30 +02:00
Yuri Sizov
712f49ec57 Merge pull request #79766 from Sauermann/fix-window-determinant-zero
Add determinant check for minimized windows
2023-07-26 18:40:26 +02:00
Yuri Sizov
1de9171c32 Merge pull request #79443 from Sauermann/fix-ingore-hovering
Fix physics passive hovering with `MOUSE_FILTER_IGNORE`
2023-07-26 18:40:14 +02:00
Yuri Sizov
67873d0d5d Merge pull request #79248 from Sauermann/fix-svc-focus-propagation
Make `SubViewportContainer` event propagation aware of focused Control
2023-07-26 18:39:57 +02:00
Yuri Sizov
e8df8c5e2c Merge pull request #78988 from RandomShaper/fix_change_scene
Reimplement scene change
2023-07-26 18:39:43 +02:00
Mikko Ankkala
96b26574b9 Don't override SubViewport's cursor with SubViewportContainer's cursor
Add a warning for having a non-default value of `mouse_default_cursor_shape` in SubViewportContainer

Add test
2023-07-23 22:27:55 +03:00