Bundle refactor - Option bundles and Box<dyn Bundle>#19491
Draft
SkiFire13 wants to merge 50 commits intobevyengine:mainfrom
Draft
Bundle refactor - Option bundles and Box<dyn Bundle>#19491SkiFire13 wants to merge 50 commits intobevyengine:mainfrom
Option bundles and Box<dyn Bundle>#19491SkiFire13 wants to merge 50 commits intobevyengine:mainfrom
Conversation
…namic register_info
github-merge-queue bot
pushed a commit
that referenced
this pull request
Jun 20, 2025
# Objective - Splitted off from #19491 - Make adding generated code to the `Bundle` derive macro easier - Fix a bug when multiple fields are `#[bundle(ignore)]` ## Solution - Instead of accumulating the code for each method in a different `Vec`, accumulate only the names of non-ignored fields and their types, then use `quote` to generate the code for each of them in the method body. - To fix the bug, change the code populating the `BundleFieldKind` to push only one of them per-field (previously each `#[bundle(ignore)]` resulted in pushing twice, once for the correct `BundleFieldKind::Ignore` and then again unconditionally for `BundleFieldKind::Component`) ## Testing - Added a regression test for the bug that was fixed
This was referenced Jun 21, 2025
github-merge-queue bot
pushed a commit
that referenced
this pull request
Jun 30, 2025
# Objective - Splitted off from #19491 - Add some benchmarks for spawning and inserting components. Right now these are pretty short, but it's expected that they will be extended when different kinds of dynamic bundles will be implemented.
Trashtalk217
pushed a commit
to Trashtalk217/bevy
that referenced
this pull request
Jul 10, 2025
# Objective - Splitted off from bevyengine#19491 - Make adding generated code to the `Bundle` derive macro easier - Fix a bug when multiple fields are `#[bundle(ignore)]` ## Solution - Instead of accumulating the code for each method in a different `Vec`, accumulate only the names of non-ignored fields and their types, then use `quote` to generate the code for each of them in the method body. - To fix the bug, change the code populating the `BundleFieldKind` to push only one of them per-field (previously each `#[bundle(ignore)]` resulted in pushing twice, once for the correct `BundleFieldKind::Ignore` and then again unconditionally for `BundleFieldKind::Component`) ## Testing - Added a regression test for the bug that was fixed
omeranson
added a commit
to omeranson/bevy
that referenced
this pull request
Apr 2, 2026
omeranson
added a commit
to omeranson/bevy
that referenced
this pull request
Apr 3, 2026
omeranson
added a commit
to omeranson/bevy
that referenced
this pull request
Apr 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note: this is in the process of being split up, consider reviewing the individual PRs unless you're looking for the whole context
Objective
BundleforOption<T: Bundle>BundleforBox<dyn Bundle>andVec<Box<dyn Bundle>>Self: Sizedbounds toBundletrait methods #14879Optionbundles be faster than callinginserta second time#[bundle(ignore)]fields were handled in the wrong waySolution
StaticBundle(name bikesheddable) for usecases where the set of components of a bundle must be knowable without an instance of the bundle and switch functions that needed this aspect ofBundle;&selfparameters toBundle's methods to allow them to depend onself's value;Bundles:ComponentIdsis_static,is_boundedandcache_keymethods onBundle.BundleforOption<T: Bundle>as a bounded bundle (i.e. withis_static = false,is_bounded = trueand a cache key depending on whether it isSomeorNone);Bundledyn-compatible and implementBundleforBox<dyn Bundle>where Self: Sizedand by introducing a couple of new dyn-compatible automatically-implemented supertraits,BundleDynandBundleEffectDyn.#[bundle(dynamic)]attribute for theBundlederive macro to opt-out of derivingStaticBundleandBundleFromComponentsBundleFromComponentscould theoretically be implemented for bounded but non-static bundles, but it seems tricky and I decided to leave it out from this PRTesting
Bundlecomes with its own tests incrates/bevy_ecs/src/bundle.rsShowcase