-
-
Notifications
You must be signed in to change notification settings - Fork 21.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Supplement the case of scene instantiation for "Editable Children" #81530
base: master
Are you sure you want to change the base?
Supplement the case of scene instantiation for "Editable Children" #81530
Conversation
e5d0d2e
to
cea3ff6
Compare
What does it fix exactly? |
cea3ff6
to
216ec91
Compare
When Editable Children is enabled, due to copying nodes or specifying the same resource instance for different nodes in batches, the same resource entries will be recorded when saving. When opened again, resources with A test project is provided here. Before opening the scene, please check the text of 0.mp4 |
216ec91
to
f7d0c23
Compare
In the case in #81530 (comment), there may be multiple resource instances with the same |
This is a follow-up to godotengine#65011. For scenes with **Editable Children** enabled, the main scene will record more information and resource mapping will be valid for multiple nodes.
f7d0c23
to
439317f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't say I fully understand the code changes, but it does fix a bug. I'm not familiar enough with using editable children/local to scene to tell if there are any obvious regressions.
@@ -161,6 +172,7 @@ Node *SceneState::instantiate(GenEditState p_edit_state) const { | |||
bool gen_node_path_cache = p_edit_state != GEN_EDIT_STATE_DISABLED && node_path_cache.is_empty(); | |||
|
|||
HashMap<Ref<Resource>, Ref<Resource>> resources_local_to_scene; | |||
HashMap<Node *, HashMap<Ref<Resource>, Ref<Resource>>> resources_local_to_sub_scene; // Record the mappings in sub-scenes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to create typedef
s for these types, they're very cumbersome
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We rarely use typedefs, especially for cases like this.
PackedScene changes at this stage seem risky (4.2 RC imminent), so moving to the next milestone. |
This is a follow-up to #65011.
For scenes with Editable Children enabled, the main scene will record more information and resource mapping will be valid for multiple nodes. See #64487 (comment).