mirror of
https://github.com/godotengine/godot.git
synced 2025-12-08 06:09:55 +00:00
Add unique Node IDs to support base and instantiated scene refactorings
The main goal of this PR is to safeguard when a base or instantiated scene changes (nodes renamed, moved or readded), that the hierarchy is still maintained and the node and its overridden properties can be preserved. What it does: * Implements unique node IDs. * These IDs act as a fallback to names when saving. * The IDs are **USED AS A FALLBACK**, so they are just an addition. It should not break any current existing scene. * If a scene renames or moves a node, inherited or instantiated scenes will no longer lose reference to it. Unlike the previous approach, this one is intended to be a fallback, only used if the node is not found. This makes it safer to implement and ensure that, at worst case, we fail to find the node, but nothing breaks.
This commit is contained in:
parent
60b7b8b16e
commit
faddd60c40
6 changed files with 370 additions and 28 deletions
|
|
@ -351,6 +351,7 @@ void ResourceUID::clear() {
|
|||
unique_ids.clear();
|
||||
changed = false;
|
||||
}
|
||||
|
||||
void ResourceUID::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("id_to_text", "id"), &ResourceUID::id_to_text);
|
||||
ClassDB::bind_method(D_METHOD("text_to_id", "text_id"), &ResourceUID::text_to_id);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue