Fix TypeRegistry use in dynamic scene#9914
Closed
djeedai wants to merge 6 commits into
Closed
Conversation
Fix the use of `TypeRegistry` instead of `TypeRegistryArc` in dynamic scene and its serializer. Rename `DynamicScene::serialize_ron()` into `serialize()` to highlight the fact this is less about serializing to RON and more about serializing to the official Bevy scene format (`.scn` / `.scn.ron`) which the `SceneLoader` can deserialize. The fact the format is based on RON is not the object here. Document `SceneSerializer` with an example showing how to serialize to RON, which is easily transposed to serializing into any other format. Also make the link with the documentation of `SceneLoader` so users understand the full serializing cycle of a Bevy dynamic scene. Fixes bevyengine#9520
MrGVSV
approved these changes
Sep 24, 2023
james7132
approved these changes
Nov 26, 2023
james7132
left a comment
Member
There was a problem hiding this comment.
Thanks for the additional documentation. Could you rebase on main?
jdm
approved these changes
Jan 28, 2024
jdm
left a comment
Contributor
There was a problem hiding this comment.
All the cleanups and documentation additions make sense to me!
Member
|
I've done my best to resolve merge conflicts here, and everything compiles. However, we're now getting some non-trivial failing tests. I don't currently have the time or expertise to fix this up further, so I'm going to put this work done for today. |
Member
|
This is valuable stuff, but not vital enough to hold up the release. Removing from the milestone. Please feel free to reach out if you'd like assistance finishing this up :) |
Contributor
|
I will adopt this PR from @djeedai (he agreed on discord) |
Contributor
Author
|
Closing as adopted. |
github-merge-queue Bot
pushed a commit
that referenced
this pull request
Mar 28, 2024
Adopted from and closes #9914 by @djeedai # Objective Fix the use of `TypeRegistry` instead of `TypeRegistryArc` in dynamic scene and its serializer. Rename `DynamicScene::serialize_ron()` into `serialize()` to highlight the fact this is not about serializing to RON specifically, but rather about serializing to the official Bevy scene format (`.scn` / `.scn.ron`) which the `SceneLoader` can deserialize (and which happens to be based in RON, but that not the object here). Also make the link with the documentation of `SceneLoader` so users understand the full serializing cycle of a Bevy dynamic scene. Document `SceneSerializer` with an example showing how to serialize to a custom format (here: RON), which is easily transposed to serializing into any other format. Fixes #9520 ## Changelog ### Changed * `SceneSerializer` and all related serializing helper types now take a `&TypeRegistry` instead of a `&TypeRegistryArc`. ([SceneSerializer needlessly uses specifically &TypeRegistryArc #9520](#9520)) * `DynamicScene::serialize_ron()` was renamed to `serialize()`. ## Migration Guide * `SceneSerializer` and all related serializing helper types now take a `&TypeRegistry` instead of a `&TypeRegistryArc`. You can upgrade by getting the former from the latter with `TypeRegistryArc::read()`, _e.g._ ```diff let registry_arc: TypeRegistryArc = [...]; - let serializer = SceneSerializer(&scene, ®istry_arc); + let registry = registry_arc.read(); + let serializer = SceneSerializer(&scene, ®istry); ``` * Rename `DynamicScene::serialize_ron()` to `serialize()`. --------- Co-authored-by: Jerome Humbert <djeedai@gmail.com> Co-authored-by: Alice Cecile <alice.i.cecil@gmail.com> Co-authored-by: Gino Valente <49806985+MrGVSV@users.noreply.github.com> Co-authored-by: James Liu <contact@jamessliu.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Objective
Fix the use of
TypeRegistryinstead ofTypeRegistryArcin dynamic scene and its serializer.Rename
DynamicScene::serialize_ron()intoserialize()to highlight the fact this is not about serializing to RON specifically, but rather about serializing to the official Bevy scene format (.scn/.scn.ron) which theSceneLoadercan deserialize (and which happens to be based in RON, but that not the object here). Also make the link with the documentation ofSceneLoaderso users understand the full serializing cycle of a Bevy dynamic scene.Document
SceneSerializerwith an example showing how to serialize to a custom format (here: RON), which is easily transposed to serializing into any other format.Fixes #9520
Changelog
Changed
SceneSerializerand all related serializing helper types now take a&TypeRegistryinstead of a&TypeRegistryArc. (SceneSerializer needlessly uses specifically &TypeRegistryArc #9520)DynamicScene::serialize_ron()was renamed toserialize().Migration Guide
SceneSerializerand all related serializing helper types now take a&TypeRegistryinstead of a&TypeRegistryArc. You can upgrade by getting the former from the latter withTypeRegistryArc::read(), e.g.DynamicScene::serialize_ron()toserialize().