Skip to content

Improve scene serialized format #13041

@djeedai

Description

@djeedai

What problem does this solve or what need does it fill?

The scene serialization (.scn.ron) is very verbose.

What solution would you like?

  • Mark a few types as #[serde(transparent)]: e.g. InheritedVisibility which currently serializes as (true) but the parentheses are useless.
  • Don't serialize known defaults: it's highly unlikely we'll ever change the default of Transform, and currently in RON that takes 13 lines.
  • Don't serialize computed types: things like GlobalTransform are overwritten at runtime, there's no value in serializing them, it's not user data.
  • Shorten type names: it's very likely there's more than 1 Transform per file for example, so if we really need the fully qualified type name, add a table in the file mapping short <-> full names, and use the short name everywhere else. This would save a lot of verbosity, and would make the file more readable (it's very unlikely someone will have a component with the same name as a Bevy one, and if they do we can still handle this with a different short name in the mapping table).

What alternative(s) have you considered?

Live with it. Not sure there's much I can do as a third party without a Bevy fix.

Additional context

Currently an empty scene with a single entity with a UI rectangle with almost all default values (so not even a useful one) serializes at 150 lines.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ScenesSerialized ECS data stored on the diskC-FeatureA new feature, making something new possible

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions