Commit graph

225 commits

Author SHA1 Message Date
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
Pedro J. Estébanez
8c288918a0 Remove redundant check from thread guards 2023-06-01 11:08:14 +02: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
Pedro J. Estébanez
250d8d00b5 Fix compile issue in not very conformant compilers 2023-05-22 13:33:40 +02: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
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
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
Yuri Sizov
17f492fb82 Expose dialog parent-and-popup logic to the API 2023-05-15 19:49:28 +02: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
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
kobewi
1b9802fa8c Prevent errors when using ViewportTexture 2023-05-08 15:56:16 +02:00
Aaron Franke
8eb9986dc5
Make Node::get_children() public 2023-04-15 21:59:25 -05: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
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
kobewi
8f8178bda6 Fix auto-translations in editor 2023-03-22 23:57:12 +01:00
SaracenOne
4628736894 Update instances of scenes which have been reimported. 2023-01-16 13:46:33 -08:00
bruvzg
ca8b762797
Add Node::get_window() method. 2023-01-10 11:10:46 +02:00
Rémi Verschelde
3579d7a9f7
Merge pull request #36301 from KoBeWi/daddy_node
Add reparent methods to Node
2023-01-07 13:20:56 +01:00
Rémi Verschelde
d95794ec8a
One Copyright Update to rule them all
As many open source projects have started doing it, we're removing the
current year from the copyright notice, so that we don't need to bump
it every year.

It seems like only the first year of publication is technically
relevant for copyright notices, and even that seems to be something
that many companies stopped listing altogether (in a version controlled
codebase, the commits are a much better source of date of publication
than a hardcoded copyright statement).

We also now list Godot Engine contributors first as we're collectively
the current maintainers of the project, and we clarify that the
"exclusive" copyright of the co-founders covers the timespan before
opensourcing (their further contributions are included as part of Godot
Engine contributors).

Also fixed "cf." Frenchism - it's meant as "refer to / see".
2023-01-05 13:25:55 +01:00
Rémi Verschelde
ef090ee6ea
Merge pull request #68874 from TokageItLab/fix-unique-path-keying
Added option to `get_path_to()` to get the shortest path considering unique name
2022-11-28 14:49:34 +01:00
Rémi Verschelde
d7e3fce995
Merge pull request #68566 from Mickeon/node-print-orphans-static
Make `Node.print_orphan_nodes()` static
2022-11-24 18:55:30 +01:00
Silc Renew
b9d1550590 Add option to get_path_to() to get the shortest path with unique name 2022-11-19 15:06:25 +09:00
VolTer
3b4f5f8a04 Remove more instances of 'instance' being used as a verb 2022-11-16 14:01:53 +01:00
Micky
9b42268467 Make Node.print_orphan_nodes() static 2022-11-12 17:55:42 +01:00
Marc Gilleron
7543a5e014 Rename queue_delete => queue_free
# Conflicts:
#	editor/plugins/tiles/tiles_editor_plugin.cpp
2022-10-24 22:07:02 +01:00
Miguel Gonzalez Sanchez
a97a00bf02
Rename pos -> index on Node 2022-10-14 19:56:34 +01:00
Micky
de9e08da76 Comment not to remove data structs in some Nodes 2022-10-13 15:52:35 +02:00
Marc Gilleron
aed3822a93 Change return type of get_configuration_warnings to PackedStringArray 2022-09-19 16:43:15 +01:00
SaracenOne
cc4bda8500 Add ability to flag classes as experimental or deprecated. 2022-09-11 00:11:33 +01:00
VolTer
e19f7b2407 Remove Remove and Skip 2022-09-09 23:44:31 +02:00
Rémi Verschelde
7936b3cc4c Merge pull request #60108 from KoBeWi/arise_to_top
Rename raise() to move_to_front()
2022-09-08 09:23:31 +02:00
Micky
f577bae76f Rename legible_unique_name param to force_readable_name
With the introduction of Scene Unique Nodes, `is_unique_in_owner`, "Unique Name in Scene" and other descriptions related to the feature, the second parameter of add_child() and add_simbling() could be misunderstood to be related, at first glance.
2022-09-07 11:58:30 +02:00
kobewi
b218727599 Rename raise() to move_to_front() 2022-09-06 22:13:06 +02:00
Rémi Verschelde
889c522a19
Merge pull request #64410 from MewPurPur/rename-notification-instanced 2022-08-30 12:01:58 +02:00
Rémi Verschelde
d93d646723
Merge pull request #64570 from KoBeWi/node🧳ing
Unify node casing adjustment
2022-08-26 09:49:58 +02:00
kobewi
1abdffe7a0 Replace Array return types with TypedArray 2 2022-08-23 23:21:32 +02:00
kobewi
fdab23163f Unify node casing adjustment 2022-08-18 14:08:40 +02:00
Tomasz Chabora
2bdd7e9ea0 Add methods for node reparenting 2022-08-16 19:44:41 +02:00
VolTer
2599710793 Rename NOTIFICATION_INSTANCED to NOTIFICATION_SCENE_INSTANTIATED 2022-08-16 12:41:10 +02:00
Nathan Franke
c3c5985189
move rpc and rpc_id implementations back to header
StackOverflow on why this is needed: https://stackoverflow.com/questions/495021/why-can-templates-only-be-implemented-in-the-header-file
Minor mistake in commit ca7d572908
2022-08-02 18:35:29 -05:00
Fabio Alessandrelli
ca7d572908 [Net] Modularize multiplayer, expose MultiplayerAPI to extensions.
- RPC configurations are now dictionaries.
- Script.get_rpc_methods renamed to Script.get_rpc_config.
- Node.rpc[_id] and Callable.rpc now return an Error.
- Refactor MultiplayerAPI to allow extension.
- New MultiplayerAPI.rpc method with Array argument (for scripts).
- Move the default MultiplayerAPI implementation to a module.
2022-07-26 09:31:12 +02:00
Rémi Verschelde
90019676b0 Code quality: Fix header guards consistency
Adds `header_guards.sh` bash script, used in CI to validate future
changes. Can be run locally to fix invalid header guards.
2022-07-25 11:17:40 +02:00
Rémi Verschelde
11f5d2141a
Merge pull request #61577 from YuriSizov/core-fix-events-for-moved-nodes 2022-06-27 12:02:19 +02:00
reduz
d69e3791bf Fix editor-only visibility for lights
* Update visibility again for editor-only lights if owner changes.

Fixes #26399, supersedes #52327
2022-06-23 08:19:18 +02:00
Yuri Sizov
8e5ad7be46 Mark node groups as dirty for every children if parent is moved 2022-05-31 21:28:04 +03:00
reduz
45af29da80 Add a new HashSet template
* Intended to replace RBSet in most cases.
* Optimized for iteration speed
2022-05-20 22:40:38 +02:00
reduz
746dddc067 Replace most uses of Map by HashMap
* Map is unnecessary and inefficient in almost every case.
* Replaced by the new HashMap.
* Renamed Map to RBMap and Set to RBSet for cases that still make sense
  (order matters) but use is discouraged.

There were very few cases where replacing by HashMap was undesired because
keeping the key order was intended.
I tried to keep those (as RBMap) as much as possible, but might have missed
some. Review appreciated!
2022-05-16 10:37:48 +02:00