summaryrefslogtreecommitdiff
path: root/scene/resources/packed_scene.cpp
AgeCommit message (Collapse)Author
2023-01-05One Copyright Update to rule them allRémi Verschelde
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".
2022-12-08Fix unable to disconnect signal in Editor once createdMicky
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-11-28Add PackedScene::reload_from_file() overrideAdam Scott
2022-11-16Remove more instances of 'instance' being used as a verbVolTer
2022-10-14Merge pull request #66665 from Mickeon/editor-do-not-edit-inherited-signalsRémi Verschelde
Do not allow editing Scene-inherited signal connections
2022-10-13Do not allow editing Scene-inherited signal connectionsMicky
Inherited connections are also highlighted with the warning color in the Node dock.
2022-10-07Fix MSVC warnings, rename shadowed variables, fix uninitialized values, ↵bruvzg
change warnings=all to use /W4.
2022-08-30Merge pull request #64410 from MewPurPur/rename-notification-instancedRémi Verschelde
2022-08-28Merge pull request #64999 from Chaosus/fix_packed_scene_crashRémi Verschelde
2022-08-28Prevent crash at loading some scenesYuri Rubinsky
2022-08-28Make local-to-scene resources behavior consistent in child scenesPedro J. Estébanez
2022-08-28Improve PackedScene instantiateRindbee
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**.) https://github.com/godotengine/godot/blob/2e24b76535dceb9cf18ab8ece3304ed92948c1b5/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-16Rename NOTIFICATION_INSTANCED to NOTIFICATION_SCENE_INSTANTIATEDVolTer
2022-08-08Add tests for empty/unnamed arguments to ClassDB, Variant, GDScriptYuri Sizov
2022-07-29Remove Signal connect bindsJuan Linietsky
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-06-25Add ability to export Node pointers as NodePathsreduz
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-05-23Fix typos with codespellRémi Verschelde
Using codespell 2.2-dev from current git.
2022-05-20Add a new HashSet templatereduz
* Intended to replace RBSet in most cases. * Optimized for iteration speed
2022-05-16Replace most uses of Map by HashMapreduz
* 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-12Add a new HashMap implementationreduz
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-09Rescue orphan nodes in inherited sceneskobewi
2022-05-06Cleanup metadata usagekobewi
2022-05-03Implement missing Node & Resource placeholdersreduz
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-04-25Implement Scene Unique Nodesreduz
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-03-29Fix Callable::bind usage in connections_dialog.h and packed_scene.cppC.Even
* Callable::bind takes an array of pointers to Variant * Fixes #57057
2022-03-28Remove last editor code dependencies in template buildRémi Verschelde
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-05Various code and documentation improvementskobewi
2022-02-16Style: Cleanup single-line blocks, semicolons, dead codeRémi Verschelde
Remove currently unused implementation of TextureBasisU, could be re-added later on if needed and ported.
2022-01-08Removed redundant ClassDB::is_class_enabled() and moved second dynamic_cast ↵Bartłomiej T. Listwon
inside worst case if
2022-01-04Merge pull request #53313 from KoBeWi/debinded_konnektRémi Verschelde
2022-01-03Update copyright statements to 2022Rémi Verschelde
Happy new year to the wonderful Godot community!
2021-12-11Stop asuming a default value of NIL means there's no defaultPedro J. Estébanez
2021-12-09Replace String comparisons with "", String() to is_empty()Nathan Franke
Also: - Adds two stress tests to test_string.h - Changes to .empty() on std::strings
2021-11-23Rename `remove()` to `remove_at()` when removing by indexLightning_A
2021-11-17Fix crash when loading scene instance after node vanished from parentPedro J. Estébanez
2021-11-08Add property value pinningPedro J. Estébanez
2021-11-07Unify determination of default property valuesPedro J. Estébanez
2021-11-04Add is_built_in() method to Resourcekobewi
2021-10-05Fix editable children errors when packing scene tree at runtimePouleyKetchoupp
When packing a scene node which is not the root, errors where caused by internal checks in is_editable_instance method. This check can be safely made outside instead.
2021-10-04Add support for unbinding in connection dialogkobewi
2021-09-30Use range iterators for `Map`Lightning_A
2021-09-30Rename Node's `filename` property to `scene_file_path` for clarityHugo Locurcio
2021-09-18Fail at instantiating if the root node is instantiatedgyroninja
2021-08-27Fix loading packed scene with editable children at runtimePouleyKetchoupp
At runtime, packed scenes with nodes marked as editable instance where saved with node type tags, which prevented the scene to be then loaded as an instance, causing duplicated nodes in the tree. This change ensures nodes marked as editable instances and their owned children are properly set as instances. That doesn't make a difference in the editor, since such nodes where already set as instances based on their instance state, but it helps at runtime where instance states are disabled. Co-authored-by: latorril <latorril@gmail.com>
2021-08-13Disable Node3D when compiling without 3D and fix disable_3d optionAaron Franke
2021-07-25Use const references where possible for List range iteratorsRémi Verschelde
2021-07-23Use C++ iterators for Lists in many situationsAaron Franke
2021-06-29Merge pull request #49713 from nekomatata/fix-export-var-override-runtimeRémi Verschelde
Fix export var override in PackedScene at runtime
2021-06-19Rename `instance()`->`instantiate()` when it's a verbLightning_A
2021-06-19Remove side effects of scene savePedro J. Estébanez