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

Append commands #10400

Merged
merged 2 commits into from Nov 22, 2023
Merged

Append commands #10400

merged 2 commits into from Nov 22, 2023

Conversation

hymm
Copy link
Contributor

@hymm hymm commented Nov 6, 2023

Objective

  • I've been experimenting with different patterns to try and make async tasks more convenient. One of the better ones I've found is to return a command queue to allow for deferred &mut World access. It can be convenient to check for task completion in a normal system, but it is hard to do something with the command queue after getting it back. This pr adds a append to Commands. This allows appending the returned command queue onto the system's commands.

Solution

  • I edited the async compute example to use the new append, but not sure if I should keep the example changed as this might be too opinionated.

Future Work

  • It would be very easy to pull the pattern used in the example out into a plugin or a external crate, so users wouldn't have to add the checking system.

Changelog

  • add append to Commands and CommandQueue

@alice-i-cecile alice-i-cecile added A-ECS Entities, components, systems, and events C-Usability A simple quality-of-life change that makes Bevy easier to use labels Nov 6, 2023
@hymm hymm mentioned this pull request Nov 21, 2023
@alice-i-cecile alice-i-cecile added the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label Nov 21, 2023
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Nov 22, 2023
Merged via the queue into bevyengine:main with commit 208ecb5 Nov 22, 2023
25 checks passed
@hymm hymm deleted the append-commands branch December 28, 2023 00:08
rdrpenguin04 pushed a commit to rdrpenguin04/bevy that referenced this pull request Jan 9, 2024
# Objective

- I've been experimenting with different patterns to try and make async
tasks more convenient. One of the better ones I've found is to return a
command queue to allow for deferred &mut World access. It can be
convenient to check for task completion in a normal system, but it is
hard to do something with the command queue after getting it back. This
pr adds a `append` to Commands. This allows appending the returned
command queue onto the system's commands.

## Solution

- I edited the async compute example to use the new `append`, but not
sure if I should keep the example changed as this might be too
opinionated.

## Future Work

- It would be very easy to pull the pattern used in the example out into
a plugin or a external crate, so users wouldn't have to add the checking
system.

---

## Changelog

- add `append` to `Commands` and `CommandQueue`
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-Usability A simple quality-of-life change that makes Bevy easier to use 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.

None yet

3 participants