Commit Graph

405 Commits

Author SHA1 Message Date
e48c5daddf Unify usage of GLOBAL/EDITOR_GET 2022-10-18 19:01:48 +02:00
a97a00bf02 Rename pos -> index on Node 2022-10-14 19:56:34 +01:00
b754df2b99 Fix node name casing issues
Co-authored-by: ryburnj <jordanryburn@gmail.com>
2022-10-10 22:31:26 +02:00
0103af1ddd Fix MSVC warnings, rename shadowed variables, fix uninitialized values, change warnings=all to use /W4. 2022-10-07 11:32:33 +03:00
f501e4f665 Unix: Remove now unnecessary I/O defines, cleanup
- `LIBC_FILEIO_ENABLED` wasn't defined anywhere, even in _other platforms_.
- `NO_NETWORK` is also never defined. It probably isn't enough anyway to
  disable network APIs in the current codebase.
- `UNIX_SOCKET_UNAVAILABLE` is never defined in this code but used by some
  other platforms, clarify that.
- `NO_STATVFS` can be removed as Android supports it since API level 19,
  which is our current min SDK level. It's also only used for
  `DirAccessUnix::get_space_left()` which is anyway overridden by
  `DirAccessJAndroid::get_space_left()` so it shouldn't make a difference.
  * Fixed documentation for `DirAccess.get_space_left()`.
- `NO_FCNTL` is likely also a remnant of early Android days, in current NDK
  r23 it seems to be available. Also cleaned up unused `fcntl.h` includes.
- `NO_ALLOCA` is never defined, and we use alloca in many places now.
2022-10-03 12:33:41 +02:00
aed3822a93 Change return type of get_configuration_warnings to PackedStringArray 2022-09-19 16:43:15 +01:00
8899f1eec2 Merge pull request #65595 from KoBeWi/minus_children
Allow negative indices in `move_child()`
2022-09-10 09:59:15 +02:00
31e62ca827 Allow negative indices in move_child() 2022-09-10 03:54:04 +02:00
e19f7b2407 Remove Remove and Skip 2022-09-09 23:44:31 +02:00
7936b3cc4c Merge pull request #60108 from KoBeWi/arise_to_top
Rename raise() to move_to_front()
2022-09-08 09:23:31 +02:00
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
b218727599 Rename raise() to move_to_front() 2022-09-06 22:13:06 +02:00
0bf3f79157 Merge pull request #63902 from dalexeev/string-cases 2022-08-30 14:06:28 +02:00
889c522a19 Merge pull request #64410 from MewPurPur/rename-notification-instanced 2022-08-30 12:01:58 +02:00
d4555ef5fb Add String.to_{camel,pascal,snake}_case methods 2022-08-30 12:36:24 +03:00
d93d646723 Merge pull request #64570 from KoBeWi/node🧳ing
Unify node casing adjustment
2022-08-26 09:49:58 +02:00
1abdffe7a0 Replace Array return types with TypedArray 2 2022-08-23 23:21:32 +02:00
fdab23163f Unify node casing adjustment 2022-08-18 14:08:40 +02:00
2599710793 Rename NOTIFICATION_INSTANCED to NOTIFICATION_SCENE_INSTANTIATED 2022-08-16 12:41:10 +02:00
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
d4433ae6d3 Remove Signal connect binds
Remove the optional argument p_binds from `Object::connect` since it was deprecated by Callable.bind().
Changed all uses of it to Callable.bind()
2022-07-29 16:26:13 +02:00
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
462432f89f Add an underscore to internal group names as per engine policy
This also adds `SNAME()` macros where relevant to improve performance.
2022-07-01 20:16:25 +02:00
11f5d2141a Merge pull request #61577 from YuriSizov/core-fix-events-for-moved-nodes 2022-06-27 12:02:19 +02:00
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
3e6de687b8 Node: Rename child_exited_tree to child_exiting_tree
The name was confusing as this signal is emitted around the same time as
`tree_exiting` and `NOTIFICATION_EXIT_TREE`, i.e. while the child node is
still in tree.

Fixes #59210.
2022-06-20 11:55:19 +02:00
8e5ad7be46 Mark node groups as dirty for every children if parent is moved 2022-05-31 21:28:04 +03:00
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
3e96abce07 fix a bug in get_node_and_resource 2022-05-16 19:40:59 +02:00
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
1dc7bcc83c Cleanup metadata usage 2022-05-06 00:27:10 +02:00
180e5d3028 Remove RES and REF typedefs in favor of spelled out Ref<>
These typedefs don't save much typing compared to the full `Ref<Resource>`
and `Ref<RefCounted>`, yet they sometimes introduce confusion among
new contributors.
2022-05-03 01:43:50 +02:00
aee2240d5f [Net] Allow branch-specific MultiplayerAPIs.
Removes custom_multiplayer from Node.
MultiplayerAPI overrides are now set at SceneTree level, and apply to
whole branches.
Impact on performance when using only the default multiplayer or
overriding it is minimal, the use of branches can likely be further
optimized by caching nodes and relevant MultiplayerAPI IDs.
2022-04-26 17:22:54 +02:00
9c2ea7e296 Node: Re-add find_node as find_child, improve docs
The new name contrasts it better with `find_parent`, and makes it clear
that it only matches child/descendant nodes.

Also rename `find_nodes` to `find_children` accordingly.
2022-04-25 15:21:22 +02:00
8580f377a3 Implement Scene Unique Nodes
Implements https://github.com/godotengine/godot-proposals/issues/4096

* Nodes can be marked unique to the scene in the editor (or via code).
* Unique nodes can be accessed via the **%** prefix at any point in the path. From that point in the path (depending on whether the scene of the path is), the unique node will be fetched.
* Implementation is very optimal, as these nodes are cached.
2022-04-25 12:19:17 +02:00
d1207a0504 [Input] Add extra shortcut_input input processing step to process Unicode character input with Alt / Ctrl modifiers, after processing of shortcuts. 2022-04-05 13:46:45 +03:00
8e5d927af5 Merge pull request #59590 from Calinou/rename-print-stray-nodes 2022-03-31 22:21:51 +02:00
a29f2bfe54 Rename Node.print_stray_nodes() to Node.print_orphan_nodes()
The "orphan" terminology is already used elsewhere.
2022-03-31 18:33:02 +02:00
63f7f44ccb Make vararg method bind no return and return
Type emit_signal exposed method return type

set UndoRedo add_do_method and add_undo_method exposed return void

Set TreeItem::_call_recursive_bind returns void

Set _rpc_bind and _rpc_id_bind returns void in Node

Set _call_group and _call_group_flags method returns void in SceneTree

Set godot-cpp-test CI flag to false
2022-03-30 11:43:12 +02:00
21637dfc25 Remove VARIANT_ARG* macros
* Very old macros from the time Godot was created.
* Limited arguments to 5 (then later changed to 8) in many places.
* They were replaced by C++11 Variadic Templates.
* Renamed methods that take argument pointers to have a "p" suffix. This was used in some places and not in others, so made it standard.
* Also added a dereference check for Variant*. Helped catch a couple of bugs.
2022-03-09 18:39:13 +01:00
417698c202 Merge pull request #58042 from Sauermann/fix-viewport-border-notifications
Fix Viewport mouse enter+exit notifications
2022-02-19 09:07:07 +01:00
78dc608aa8 Change 'find_node' to 'find_nodes' and Add 'type' parameter
Changed 'find_node' to 'find_nodes' which now returns an 'TypedArray<Node>', as well as Added a 'type' parameter to match against specific node types, which supports inheritance.
2022-02-17 01:44:13 -06:00
415042ac89 Connect notifications from Container to Viewport
mouse enter+exit
2022-02-15 22:41:30 +01:00
0f5455230c Use switch consistently in _notification (scene folder) 2022-02-15 18:44:55 +01:00
b396fd4eef Improve compilation speed (forward declarations/includes cleanup) 2022-02-12 02:46:22 +01:00
a18ba63417 [Net] Allow to use strings as method name in RPC.
Node::rpc and Node::rpc_id will now also accepts Strings instead of only
accepting StringNames.
2022-02-09 14:27:16 +01:00
d219547c96 [Net] New replication interface, spawner and synchronizer nodes.
Initial implementation of the MultiplayerReplicationInterface and its
default implementation (SceneReplicationInterface).

New MultiplayerSpawner node helps dealing with instantiation of scenes
on remote peers (e.g. clients).
It supports both custom spawns via a `_spawn_custom` virtual function,
and optional auto-spawn of known scenes via a TypedArray<PackedScenes>
property.

New MultiplayerSynchornizer helps synchronizing states between the local
and remote peers, supports both sync and spawn properties and is
configured via a `SceneReplicationConfig` resource.
It can also sync via path (i.e. without being spawned by a
MultiplayerSpawner if both peers has it in tree, but will not send the
spawn state in that case, only the sync one.
2022-02-04 14:56:30 +01:00
244db37508 Cleanup and move char functions to the char_utils.h header. 2022-02-04 11:35:01 +02:00
fbd9599b04 Add a signal to notify when children nodes enter or exit tree
-Allows more fine grained notifications (hence better performance) than using the global scene tree signals (node added and removed).
-Required for #55950
2022-02-02 11:28:11 +01:00
d681d99e12 Merge pull request #52134 from RandomShaper/fix_naming 2022-01-20 22:01:37 +01:00