-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
bevy_scene: Add ReflectBundle
#9165
bevy_scene: Add ReflectBundle
#9165
Conversation
Co-authored-by: Gino Valente <[email protected]>
Note: My approval should probably be taken with a grain of salt as this code is based on #6344 (not trying to intentionally dupe the reviewer system lol) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a few issues with this code:
- how much the implementation duplicates
ReflectComponent
- how many failure cases we have. A lot of
panic!
. - The indentation is all over the place.
Performance
I did take a look at alternative implementation. Notably: could we use DynamicBundle::get_components
to avoid having to recursively navigate the struct? I think yes, but it's not relevant for this PR.
Things to do for approval
The fn
defined in ReflectBundleFns
are very large, so it's going to bloat binaries, pretty bad for wasm.
All said. I think it's fine as of this PR, since you have to explicitly register the ReflectBundle
, so no one is paying for things they don't use, at the cost of some convenience (the need to add a register_data::<Bundle, ReflectBundle>()
). So I'm approving if the following are done:
- Replace the
if let … else x
withlet else x; …
to avoid this rightward drift - Remove the documentation, replace them with reference to doc items in
reflect/component.rs
@nicopap done! |
I think the docs are pretty good at this point. |
Example |
1 similar comment
Example |
# Objective Similar to bevyengine#6344, but contains only `ReflectBundle` changes. Useful for scripting. The implementation has also been updated to look exactly like `ReflectComponent`. --- ## Changelog ### Added - Reflection for bundles. --------- Co-authored-by: Gino Valente <[email protected]>
# Objective Similar to bevyengine#6344, but contains only `ReflectBundle` changes. Useful for scripting. The implementation has also been updated to look exactly like `ReflectComponent`. --- ## Changelog ### Added - Reflection for bundles. --------- Co-authored-by: Gino Valente <[email protected]>
Objective
Similar to #6344, but contains only
ReflectBundle
changes. Useful for scripting. The implementation has also been updated to look exactly likeReflectComponent
.Changelog
Added