-
-
Notifications
You must be signed in to change notification settings - Fork 3.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
[Merged by Bors] - bevy_scene: Replace root list with struct #6354
Conversation
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.
I feel like it's a complex implementation of the serialization/deserialization ?
I would have expected to see a SerializedScene
struct we can refer to rather than rely on other docs/examples ?
In any way, it's probably helpful to have a custom deserializer, to iterate over assets or entities I guess, but right now it doesn't seem to be the point ?
Other than that (and the minor space nitpick), LGTM 👍 but I'm not comfortable enough with scenes to commit to an approve though, good luck :)
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.
I'm on board. I think it's very unlikely that we never want to add other data to scenes, whether that's assets, meta-data, resources or something else entirely.
Co-authored-by: Thierry Berger <contact@thierryberger.com>
Yeah the documentation could be improved to bevy_scene overall. As for a
The reason for the custom deserializer is we need access to the |
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.
I agree with the decision to change the scene schema, it is more understandable and easier to extend.
It's unfortunate that we can't just derive the serialization code but that is nothing new. I don't exactly understand how the #[seride(field_identifier)]
stuff works but other that that the implementation looks good.
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.
I haven't written serde code in a long time, but nothing stands out as bad 👍
bors r+ |
# Objective Scenes are currently represented as a list of entities. This is all we need currently, but we may want to add more data to this format in the future (metadata, asset lists, etc.). It would be nice to update the format in preparation of possible future changes. Doing so now (i.e., before 0.9) could mean reduced[^1] breakage for things added in 0.10. [^1]: Obviously, adding features runs the risk of breaking things regardless. But if all features added are for whatever reason optional or well-contained, then users should at least have an easier time updating. ## Solution Made the scene root a struct rather than a list. ```rust ( entities: [ // Entity data here... ] ) ``` --- ## Changelog * The scene format now puts the entity list in a newly added `entities` field, rather than having it be the root object ## Migration Guide The scene file format now uses a struct as the root object rather than a list of entities. The list of entities is now found in the `entities` field of this struct. ```rust // OLD [ ( entity: 0, components: [ // Components... ] ), ] // NEW ( entities: [ ( entity: 0, components: [ // Components... ] ), ] ) ``` Co-authored-by: Gino Valente <49806985+MrGVSV@users.noreply.github.com>
# Objective Scenes are currently represented as a list of entities. This is all we need currently, but we may want to add more data to this format in the future (metadata, asset lists, etc.). It would be nice to update the format in preparation of possible future changes. Doing so now (i.e., before 0.9) could mean reduced[^1] breakage for things added in 0.10. [^1]: Obviously, adding features runs the risk of breaking things regardless. But if all features added are for whatever reason optional or well-contained, then users should at least have an easier time updating. ## Solution Made the scene root a struct rather than a list. ```rust ( entities: [ // Entity data here... ] ) ``` --- ## Changelog * The scene format now puts the entity list in a newly added `entities` field, rather than having it be the root object ## Migration Guide The scene file format now uses a struct as the root object rather than a list of entities. The list of entities is now found in the `entities` field of this struct. ```rust // OLD [ ( entity: 0, components: [ // Components... ] ), ] // NEW ( entities: [ ( entity: 0, components: [ // Components... ] ), ] ) ``` Co-authored-by: Gino Valente <49806985+MrGVSV@users.noreply.github.com>
# Objective Scenes are currently represented as a list of entities. This is all we need currently, but we may want to add more data to this format in the future (metadata, asset lists, etc.). It would be nice to update the format in preparation of possible future changes. Doing so now (i.e., before 0.9) could mean reduced[^1] breakage for things added in 0.10. [^1]: Obviously, adding features runs the risk of breaking things regardless. But if all features added are for whatever reason optional or well-contained, then users should at least have an easier time updating. ## Solution Made the scene root a struct rather than a list. ```rust ( entities: [ // Entity data here... ] ) ``` --- ## Changelog * The scene format now puts the entity list in a newly added `entities` field, rather than having it be the root object ## Migration Guide The scene file format now uses a struct as the root object rather than a list of entities. The list of entities is now found in the `entities` field of this struct. ```rust // OLD [ ( entity: 0, components: [ // Components... ] ), ] // NEW ( entities: [ ( entity: 0, components: [ // Components... ] ), ] ) ``` Co-authored-by: Gino Valente <49806985+MrGVSV@users.noreply.github.com>
# Objective Scenes are currently represented as a list of entities. This is all we need currently, but we may want to add more data to this format in the future (metadata, asset lists, etc.). It would be nice to update the format in preparation of possible future changes. Doing so now (i.e., before 0.9) could mean reduced[^1] breakage for things added in 0.10. [^1]: Obviously, adding features runs the risk of breaking things regardless. But if all features added are for whatever reason optional or well-contained, then users should at least have an easier time updating. ## Solution Made the scene root a struct rather than a list. ```rust ( entities: [ // Entity data here... ] ) ``` --- ## Changelog * The scene format now puts the entity list in a newly added `entities` field, rather than having it be the root object ## Migration Guide The scene file format now uses a struct as the root object rather than a list of entities. The list of entities is now found in the `entities` field of this struct. ```rust // OLD [ ( entity: 0, components: [ // Components... ] ), ] // NEW ( entities: [ ( entity: 0, components: [ // Components... ] ), ] ) ``` Co-authored-by: Gino Valente <49806985+MrGVSV@users.noreply.github.com>
Objective
Scenes are currently represented as a list of entities. This is all we need currently, but we may want to add more data to this format in the future (metadata, asset lists, etc.).
It would be nice to update the format in preparation of possible future changes. Doing so now (i.e., before 0.9) could mean reduced1 breakage for things added in 0.10.
Solution
Made the scene root a struct rather than a list.
Changelog
entities
field, rather than having it be the root objectMigration Guide
The scene file format now uses a struct as the root object rather than a list of entities. The list of entities is now found in the
entities
field of this struct.Footnotes
Obviously, adding features runs the risk of breaking things regardless. But if all features added are for whatever reason optional or well-contained, then users should at least have an easier time updating. ↩