Godot: Refactoring Scene breaks custom properties in inherited scene

Created on 12 Jun 2018  路  5Comments  路  Source: godotengine/godot

Godot version:
3.0.3 rc1

Issue description:
Refactoring the scene hierarchy in the parent scene makes the inherited scene lose custom property.
If the nodes are just moved around and/or renamed, they should keep the child property.
related to #16650

Steps to reproduce

  1. Make Scene A, with B as a children
  2. Make Scene A' inheriting from A
  3. Move B in scene A'
  4. Add a node in A and move B as a child node of that node
  5. A' has the new hiearchy but lost the custom translation of B.
bug confirmed core

Most helpful comment

Can confirm, just lost hours of work in inherited scene because renamed a node in base scene. At least a warning would be fine.

All 5 comments

This issue makes refactoring of inherited scenes impossible. The base class mostly can't be touched when there are many inherited scenes made from it.

The issue is even bigger than that: if, in inherited scenes, a hierarchy of new nodes are added (for instance the base scene has an "Image" 2d Node, the inherited scenes have a set of added Polygon2d's to create a custom image), if the base scene tree changes ("Image" is renamed or moved), all the added nodes in inherited scenes are lost without a warning or an error, and cannot be brought back without version control.

2 possible solutions I can see:

  • On base scene change mirror the change in tree hierarchy of inherited scenes (meaning write to inherited scene files on disc and modify open ones)
  • Story hierarchy by id, reconstruct the tree based on it in the inherited scenes, and pull node names from the base scene

On further thought human readability and simplicity of the .tscn files may be more valuable than a easily refactorable id based system.

But then some damage control would be nice: If on open of the inherited scene potential node/property loss is detected, display a warning with enough info to detect the changed that would cause the loss, and give time for a manual fix (possibly batch text replace in inherited .tscn files).

Can confirm, just lost hours of work in inherited scene because renamed a node in base scene. At least a warning would be fine.

Still valid in the current master branch.

There's actually a warning and error (but after the fact, not preventing the action):

WARNING: instance: Node './B' was modified from inside an instance, but it has vanished.
   At: scene/resources/packed_scene.cpp:148.
ERROR: get_node: Node not found: B.
   At: scene/main/node.cpp:1381.

Can anyone still reproduce this bug in Godot 3.2.3 or any later release?

If yes, please ensure that an up-to-date Minimal Reproduction Project (MRP) is included in this report (a MRP is a zipped Godot project with the minimal elements necessary to reliably trigger the bug). You can upload ZIP files in an issue comment with a drag and drop.

Was this page helpful?
0 / 5 - 0 ratings