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

Move utilities from examples to bevy_state and add concept of state-scoped entities #13649

Merged
merged 19 commits into from
Jun 4, 2024

Conversation

MiniaczQ
Copy link
Contributor

@MiniaczQ MiniaczQ commented Jun 3, 2024

Objective

Move StateScoped and log_transitions to bevy_state, since they're useful for end users.

Addresses #12852, although not in the way the issue had in mind.

Solution

  • Added bevy_hierarchy to default features of bevy_state.
  • Move log_transitions to transitions module.
  • Move StateScoped to state_scoped module, gated behind bevy_hierarchy feature.
  • Refreshed implementation.
  • Added enable_state_coped_entities<S: States>() to add required machinery to App for clearing state-scoped entities.

Changelog

  • Added log_transitions for displaying state transitions.
  • Added StateScoped for binding entity lifetime to state and app enable_state_coped_entities to register cleaning behavior.

@alice-i-cecile alice-i-cecile added this to the 0.14 milestone Jun 3, 2024
@alice-i-cecile alice-i-cecile added A-ECS Entities, components, systems, and events C-Usability A targeted quality-of-life change that makes Bevy easier to use C-Feature A new feature, making something new possible X-Contentious There are nontrivial implications that should be thought through S-Needs-Review Needs reviewer attention (from anyone!) to move forward D-Trivial Nice and easy! A great choice to get started with Bevy and removed C-Usability A targeted quality-of-life change that makes Bevy easier to use labels Jun 3, 2024
@alice-i-cecile alice-i-cecile changed the title Move utilities from examples to bevy_state Move utilities from examples to bevy_state and add concept of state-bound entities Jun 3, 2024
@alice-i-cecile alice-i-cecile added the M-Needs-Release-Note Work that should be called out in the blog due to impact label Jun 3, 2024
Copy link

@orbachl-mcmaster orbachl-mcmaster left a comment

Choose a reason for hiding this comment

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

I agree with Alice's comments, and otherwise am happy with this!

@alice-i-cecile
Copy link
Member

I've added S-Needs-Release-Notes to this PR. IMO this deserves its own (adjacent) section in the release notes. The functionality is distinct and can be used without substates / computed states, even though it does play nice.

Copy link
Member

@mockersf mockersf left a comment

Choose a reason for hiding this comment

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

scoped entities should work without bevy_hierarchy, by despawning entities not recursively, and the doc for enable_state_scoped_entities should mention that behaviour

as it is currently, it should at least mentions that it despawns recursively

@alice-i-cecile alice-i-cecile requested a review from mockersf June 3, 2024 22:46
Co-authored-by: François Mockers <[email protected]>
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Jun 4, 2024
Merged via the queue into bevyengine:main with commit 58a0c13 Jun 4, 2024
31 checks passed
@alice-i-cecile
Copy link
Member

Thank you to everyone involved with the authoring or reviewing of this PR! This work is relatively important and needs release notes! Head over to bevyengine/bevy-website#1347 if you'd like to help out.

github-merge-queue bot pushed a commit that referenced this pull request Jun 9, 2024
# Objective

- In #13649 additional method had been added to AppExitStates, but there
feature gate left for method in implementation for App at refactoring
stage.
- Fixes #13733 .

## Solution

- Removed the feature gate.

## Testing

- Ran reproducing example from #13733 with no compilation errors
mockersf pushed a commit that referenced this pull request Jun 9, 2024
# Objective

- In #13649 additional method had been added to AppExitStates, but there
feature gate left for method in implementation for App at refactoring
stage.
- Fixes #13733 .

## Solution

- Removed the feature gate.

## Testing

- Ran reproducing example from #13733 with no compilation errors
@MiniaczQ MiniaczQ deleted the move-statebound branch September 7, 2024 19:14
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 C-Feature A new feature, making something new possible D-Trivial Nice and easy! A great choice to get started with Bevy M-Needs-Release-Note Work that should be called out in the blog due to impact S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it X-Contentious There are nontrivial implications that should be thought through
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants