Godot-proposals: Ghost Nodes - Fallback nodes added in modified inherited scenes

Created on 24 Feb 2020  路  3Comments  路  Source: godotengine/godot-proposals

Describe the project you are working on:
Any project using inherited scenes with new nodes added.

Describe the problem or limitation you are having in your project:
Renaming/moving nodes in base scenes (the scenes other scenes inherit from) cause silent data loss in inherited scenes: any nodes added in inherited scenes can deleted if their parent is renamed/moved in the base scene.

Describe the feature / enhancement and how it helps to overcome the problem or limitation:
The feature works like this: when an inherited scene is opened, and some nodes are parented to nodes that were moved/renamed in the base scene, instead of them being lost they are added under a ghost parent, a node that has a path that their parent used to have, preferably marked somehow (icon with a warning symbol, partially transparent icon, name in italics etc., or just the old name prepended with [Ghost]/[Recovered] etc.). Then the scene goes into unsaved state. Saving the scene saves it containing the new ghost node.

The fate of the ghost node and it's children is supposed to be decided by the user, for instance the children can be moved under the node from the inherited scene that their old parent was renamed to, and the ghost node deleted.

Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams:

image

If this enhancement will not be used often, can it be worked around with a few lines of script?:
This problem can be worked around, if one is aware of it, by carefully renaming node paths in base .tscn files and inheriting .tscn files using a global find and replace in a text editor, instead in the Godot's scene tree.

Is there a reason why this should be core and not an add-on in the asset library?:
It touches core functionality.

core

Most helpful comment

While this won't work with deleting, I think for renaming/moving nodes, it would be really nice to automatically adjust the paths. Godot could keep a database (not stored in the committed project files) of which scenes use each scene, and update all of those for every rename.

All 3 comments

This sounds like it could be done, I think in inherited scenes, the nodes put into the original paths save the full path, so the "in between" nodes could be filled with empty nodes (Node), to avoid losing the node and making sure the full path exists, even if it involves doing it for the local scene.

If you made the "ghost" nodes an empty node (Node), wouldn't that mess up any transform data the child nodes had, or no? If all of the children derive from one of the core node types (Control, Node2D, Spatial/Node3D), then I would think the replacement "empty" node should be one of those types instead. But I haven't really done this, so idk if I'm just wrong.

While this won't work with deleting, I think for renaming/moving nodes, it would be really nice to automatically adjust the paths. Godot could keep a database (not stored in the committed project files) of which scenes use each scene, and update all of those for every rename.

Was this page helpful?
0 / 5 - 0 ratings