Commit graph

470 commits

Author SHA1 Message Date
Yuri Sizov
4d42d6fdf6 Merge pull request #78706 from RedworkDE/node-rename-inplace
Allow renaming child nodes in `_ready`
2023-07-21 17:15:26 +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
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
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
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
cce100a840
Merge pull request #75459 from kleonc/node-fix-find-children
Fix recursive `Node.find_children`
2023-06-19 22:33:46 +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
Ninni Pipping
dcd2b883eb Use NULL instead of COND checks when appropriate
Restricted to scene
2023-06-10 08:56:30 +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
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
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
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
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
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
8eb9986dc5
Make Node::get_children() public 2023-04-15 21:59:25 -05: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
kobewi
8f8178bda6 Fix auto-translations in editor 2023-03-22 23:57:12 +01:00
Yuri Sizov
81e2b020ba Prevent infinite loops when printing orphan nodes 2023-03-09 16:47:38 +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
Rémi Verschelde
e52213e2fa
More codespell fixes, do more changes from previous ignore list 2023-02-01 12:11:36 +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
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
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
SaracenOne
4628736894 Update instances of scenes which have been reimported. 2023-01-16 13:46:33 -08:00
Danil Alexeev
8f706be6fa
Rearrange editor/naming/* project settings 2023-01-12 11:41:13 +03: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
Juan Linietsky
398e73c689 Error when removing a phycics node during a physics callback
* This behavior is not allowed, the error text suggests using call_deferred().
* Added a check in Node::remove_child to prevent future crashes of this type.
* Fixed a performance regression introduced by #36244.

Fixes #63718, probably other crashes too.
2023-01-07 12:57:24 +01:00
Rémi Verschelde
163f6f5fe8
Merge pull request #68429 from KoBeWi/PropertySettings
Add PropertyInfo overload for GLOBAL_DEF
2023-01-06 22:59:29 +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
kobewi
7c6b659bd7 Add PropertyInfo overload for GLOBAL_DEF 2022-12-11 21:36:48 +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