Skip to content
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

Deprecate SpatialBundle #15830

Merged
merged 1 commit into from
Oct 13, 2024

Conversation

NiseVoid
Copy link
Contributor

Objective

  • Required components replace bundles, but SpatialBundle is yet to be deprecated

Solution

  • Deprecate SpatialBundle
  • Insert Transform and Visibility instead in examples using it
  • In spawn or insert inserting a default Transform or Visibility with component already requiring either, remove those components from the tuple

Testing

  • Did you test these changes? If so, how?
    Yes, I ran the examples I changed and tests
  • Are there any parts that need more testing?
    The gamepad_viewer and and custom_shader_instancing examples don't work as intended due to entirely unrelated code, didn't check main.
  • How can other people (reviewers) test your changes? Is there anything specific they need to know?
    Run examples, or just check that all spawned values are identical
  • If relevant, what platforms did you test these changes on, and are there any important ones you can't test?
    Linux, wayland trough x11 (cause that's the default feature)

Migration Guide

SpatialBundle is now deprecated, insert Transform and Visibility instead which will automatically insert all other components that were in the bundle. If you do not specify these values and any other components in your spawn/insert call already requires either of these components you can leave that one out.

before:

commands.spawn(SpatialBundle::default());

after:

commands.spawn((Transform::default(), Visibility::default());

@NiseVoid NiseVoid added A-ECS Entities, components, systems, and events A-Transform Translations, rotations and scales M-Needs-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Oct 10, 2024
@alice-i-cecile alice-i-cecile added this to the 0.15 milestone Oct 10, 2024
@alice-i-cecile
Copy link
Member

The gamepad_viewer and and custom_shader_instancing examples don't work as intended due to entirely unrelated code, didn't check main.

Can you check the issues for these? I think the former is not yet reported.

examples/shader/custom_phase_item.rs Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't Visibility::default() be added on these removals too?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The bounding example actually doesn't use visibility at all (nor GlobalTransform), I created this example but I'm not sure why I used SpatialBundle instead of just Transform.

.insert(FogVolume {
commands.spawn((
Transform::from_xyz(0.0, 0.5, 0.0),
FogVolume {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should also have Visibility::Visible right? I assume FogVolume would be requiring Visibility::default() if not. It might not matter though...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above, in this case FogVolume requires Visibility which means it defaults to Inherited, and functions as visible.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for addressing my comments!

examples/3d/scrolling_fog.rs Show resolved Hide resolved
Copy link
Contributor

@tom-frantz tom-frantz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! @mnmaita 's comments look like they were all covered, and the other examples had the necessary required components. I didn't see any other uses of SpatialBundle throughout the code base either, so I'm happy to approve given alice-i-cecile 's comments are covered too!

@alice-i-cecile alice-i-cecile added this pull request to the merge queue Oct 13, 2024
@alice-i-cecile alice-i-cecile added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Oct 13, 2024
Merged via the queue into bevyengine:main with commit bdd0af6 Oct 13, 2024
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ECS Entities, components, systems, and events A-Transform Translations, rotations and scales M-Needs-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants