diff options
author | Rindbee <idleman@yeah.net> | 2022-08-17 15:46:37 +0800 |
---|---|---|
committer | Rindbee <idleman@yeah.net> | 2022-08-28 20:39:09 +0800 |
commit | d6c0959cb146aad36b4c6f36d44d69dafd1dd2c8 (patch) | |
tree | c6dfd1e1aa6201a3d1558d9adbf150db68f11451 /scene/gui/gradient_edit.cpp | |
parent | ecfff5b75e175a34cf891b4e0547ab761f212d44 (diff) |
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**.)
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.
Diffstat (limited to 'scene/gui/gradient_edit.cpp')
0 files changed, 0 insertions, 0 deletions