Commit graph

180 commits

Author SHA1 Message Date
Ninni Pipping
bbd4873eea Fix index in loading of Array[Node] 2023-06-19 23:19:38 +02:00
kobewi
4d4fe94cf0 Safe-guard against missing node arrays 2023-06-14 22:02:39 +02:00
Rémi Verschelde
ad85ecef8d
Merge pull request #77750 from RandomShaper/tidy_shader_data_items
Let editor workaround a case of inconsistency in compound scenes
2023-06-13 13:52:51 +02:00
Pedro J. Estébanez
96c469a138 Let editor workaround a case of inconsistency in compound scenes 2023-06-13 11:05:57 +02:00
Ninni Pipping
dcd2b883eb Use NULL instead of COND checks when appropriate
Restricted to scene
2023-06-10 08:56:30 +02:00
ajreckof
465742d904 Fix typed array export
Apply suggestions from code review to squash later

Revert "Fix typed array export... again"

This reverts commit da8d6734fb.

Co-Authored-By: Tomek <kobewi4e@gmail.com>
2023-05-21 08:40:11 +02:00
VolTer
6c6c1302f3 Fix PackedScenes created with PackedScene.pack() have their exported nodes become null 2023-04-13 16:16:13 +02:00
kobewi
20261016a7 Fix typed array export
Co-authored-by: Guilherme Sousa <guilherme.sousa1994@gmail.com>
2023-04-12 12:19:17 +02:00
kobewi
7780b40a3a Add unbinds to scn 2023-02-01 03:03:55 +01:00
Dmitrii Maganov
5909f9f075 GDScript: Fix issues with typed arrays 2023-01-31 11:54:41 +02: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
kobewi
615c517034 Use range iterators in LocalVector loops 2023-01-21 18:44:42 +01:00
SaracenOne
4628736894 Update instances of scenes which have been reimported. 2023-01-16 13:46:33 -08: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
Micky
885f2a4eca Fix unable to disconnect signal in Editor once created
Adds a CONNECT_INHERITED flag to connections, only available in editor builds. This flag denotes that the signal has been inherited from a previous Scene in the instancing hierarchy.
2022-12-08 13:36:48 +01:00
Adam Scott
a34a26eb66 Add PackedScene::reload_from_file() override 2022-11-28 10:23:02 -05:00
VolTer
3b4f5f8a04 Remove more instances of 'instance' being used as a verb 2022-11-16 14:01:53 +01:00
Rémi Verschelde
7502c808fa Merge pull request #66665 from Mickeon/editor-do-not-edit-inherited-signals
Do not allow editing Scene-inherited signal connections
2022-10-14 10:19:47 +02:00
Micky
6a77563b25 Do not allow editing Scene-inherited signal connections
Inherited connections are also highlighted with the warning color in the Node dock.
2022-10-13 20:13:05 +02:00
bruvzg
0103af1ddd
Fix MSVC warnings, rename shadowed variables, fix uninitialized values, change warnings=all to use /W4. 2022-10-07 11:32:33 +03: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
011dbda2ea
Merge pull request #64999 from Chaosus/fix_packed_scene_crash 2022-08-28 21:21:53 +02:00
Yuri Rubinsky
a33903d23f Prevent crash at loading some scenes 2022-08-28 21:56:04 +03:00
Pedro J. Estébanez
2b73bf1ed1 Make local-to-scene resources behavior consistent in child scenes 2022-08-28 20:17:16 +02:00
Rindbee
d6c0959cb1 Improve PackedScene instantiate
Make `resource_local_to_scene` behave as described in the documentation. (If I understand correctly, the following **instance** refers to **the instance of the sub-scene**.)
2e24b76535/doc/classes/Resource.xml (L70-L72)

If the resources of the sub-scene are modified in the main scene, the modified resources will be recorded in the `tscn` file of the main scene. And the root node of the sub-scene will be set twice.
1. In the main scene, when encountering a sub-scene, the sub-scene will be initialized first;
2. Then use the resources in the main scene to reset the root node of the sub-scene.

This may make `resource_local_to_scene` not work as expected. The resources cannot be shared between the sub-scene root node and other ordinary nodes in the sub-scene.

Yes, if the resources have `resource_local_to_scene` enabled, this patch treats the modified resources of the sub-scene root node as resources in the sub-scene, not in the main scene. Although the modifications are recorded in the `tscn` file of the main scene.
2022-08-28 20:39:09 +08:00
VolTer
2599710793 Rename NOTIFICATION_INSTANCED to NOTIFICATION_SCENE_INSTANTIATED 2022-08-16 12:41:10 +02:00
Yuri Sizov
1362bc22bd Add tests for empty/unnamed arguments to ClassDB, Variant, GDScript 2022-08-08 16:36:01 +03:00
Juan Linietsky
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
reduz
b7c41f9ba1 Add ability to export Node pointers as NodePaths
This PR implements:
* A new hint: PROPERTY_HINT_NODE_TYPE for variant type OBJECT, which can take specific node types as hint string.
* The editor will show it as a node path, but will set it as a pointer to a node from the current scene if you select a path.
* When scene is saved, the node path is saved, then restored as a pointer.

NOTE: This is a proof of concept and this approach will most likely not work. The reason if that, if the node referenced is deleted, then when trying to edit this the node will become invalid.

Potential workarounds: Since this uses the Variant API, it should obtain the pointer from the Variant object ID. Yet, this would either only really work in GDScript or it would need to be implemented with workarounds in every language.
Alternative ways to make this work: Nodes could export an additional property with a node path (like for which_node, it could be which_node_path).
Another alternative: Path editing could happen as a hidden metadata (ignoring the pointer).
2022-06-25 15:50:15 +02:00
Rémi Verschelde
9923851370 Fix typos with codespell
Using codespell 2.2-dev from current git.
2022-05-23 21:32:19 +02: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
reduz
8b7c7f5a75 Add a new HashMap implementation
Adds a new, cleaned up, HashMap implementation.

* Uses Robin Hood Hashing (https://en.wikipedia.org/wiki/Hash_table#Robin_Hood_hashing).
* Keeps elements in a double linked list for simpler, ordered, iteration.
* Allows keeping iterators for later use in removal (Unlike Map<>, it does not do much
  for performance vs keeping the key, but helps replace old code).
* Uses a more modern C++ iterator API, deprecates the old one.
* Supports custom allocator (in case there is a wish to use a paged one).

This class aims to unify all the associative template usage and replace it by this one:
* Map<> (whereas key order does not matter, which is 99% of cases)
* HashMap<>
* OrderedHashMap<>
* OAHashMap<>
2022-05-12 11:21:29 +02:00
kobewi
2b53826ee6 Rescue orphan nodes in inherited scenes 2022-05-09 01:22:31 +02:00
kobewi
1dc7bcc83c Cleanup metadata usage 2022-05-06 00:27:10 +02:00
reduz
0a57f964a3 Implement missing Node & Resource placeholders
Implemented by request of @neikeq to advance in the GDExtension version of Mono.

* If a Resource type is missing upon load, it will be remembered together with its data (Unless manually overriden).
* If a Node type is missing upon load, it will be also be remembered together with its data (unless deleted).

This feature makes working with GDExtension much easier, as it ensures that missing types no longer cause data loss.
2022-05-03 17:08:09 +02:00
reduz
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
C.Even
619d9d143b Fix Callable::bind usage in connections_dialog.h and packed_scene.cpp
* Callable::bind takes an array of pointers to Variant
* Fixes #57057
2022-03-29 12:15:36 +08:00
Rémi Verschelde
45ec0e31c3 Remove last editor code dependencies in template build
SConstruct change also makes it possible to outright delete the `editor`
folder in a `tools=no` build, which we use in CI to ensure no invalid
cross-dependencies are added.
2022-03-28 21:13:01 +02:00
kobewi
bc3aff9b46 Various code and documentation improvements 2022-03-05 22:00:35 +01:00
Rémi Verschelde
b8b4580448
Style: Cleanup single-line blocks, semicolons, dead code
Remove currently unused implementation of TextureBasisU, could be re-added
later on if needed and ported.
2022-02-16 14:06:29 +01:00
Bartłomiej T. Listwon
b6cfc55113 Removed redundant ClassDB::is_class_enabled() and moved second dynamic_cast inside worst case if 2022-01-08 14:09:22 +01:00
Rémi Verschelde
42312f066b
Merge pull request #53313 from KoBeWi/debinded_konnekt 2022-01-04 12:22:46 +01:00
Rémi Verschelde
fe52458154
Update copyright statements to 2022
Happy new year to the wonderful Godot community!
2022-01-03 21:27:34 +01:00
Pedro J. Estébanez
18663aa305 Stop asuming a default value of NIL means there's no default 2021-12-11 14:03:48 +01:00
Nathan Franke
49403cbfa0
Replace String comparisons with "", String() to is_empty()
Also:
- Adds two stress tests to test_string.h
- Changes to .empty() on std::strings
2021-12-09 04:48:38 -06:00
Lightning_A
e078f970db Rename remove() to remove_at() when removing by index 2021-11-23 18:58:57 -07:00
Pedro J. Estébanez
78ffc2a987 Fix crash when loading scene instance after node vanished from parent 2021-11-17 14:00:23 +01:00
Pedro J. Estébanez
8d6f80d367 Add property value pinning 2021-11-08 17:42:30 +01:00
Pedro J. Estébanez
1806ec7c14 Unify determination of default property values 2021-11-07 15:27:47 +01:00