-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
explicitly mention component
in methods on DynamicSceneBuilder
#15210
explicitly mention component
in methods on DynamicSceneBuilder
#15210
Conversation
component
in DynamicSceneBuilder
methodscomponent
in methods on DynamicSceneBuilder
Agreed, I'd like this functionality (and allow_all_resources) later, but this rename is a much clearer first step. |
we actually already have |
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.
Changing deny_all
and allow_all
makes sense to me, but why rename deny
and allow
? Due to static typing, there is no potential confusion there. And in the future, I'd prefer the deny
and allow
methods to accept both components and resources over duplicating the API for resources. Thoughts, @alice-i-cecile?
The filter changes seem good to me, as there is no static typing keeping you from adding resources to it, but I haven't used that part of the API, so take my comment with a grain of salt.
I only renamed I would definitely prefer I could change that part of the pr back if you'd like, although I still personally prefer it this way for consistency. |
does anyone know how I can run the doc test locally? |
I don't think this is possible in a type-safe way. You could use It would also block both components and resources of that type when both exist, which is confusing. LWIM's As a result, I think it's clearer / more future-proof to be explicit about components vs resources. |
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.
Thanks for the explanation! I'm convinced then :)
Note: I've combined the migration guide from #15222 into this PR to make for easier preparation of the final notes. |
# Objective It would be convenient to be able to quickly deny or allow all components and resources on a `DynamicSceneBuilder` with a single method call. Context: #15210 renamed `{allow/deny}_all` to `{allow/deny}_all_components`. ## Solution Added two new methods to `DynamicSceneBuilder`, `allow_all` and `deny_all`, which affect both the component and resource filters. ## Showcase ### Before ```rust let builder = DynamicSceneBuilder::from_world(world) .deny_all_components() .deny_all_resources(); ``` ### After ```rust let builder = DynamicSceneBuilder::from_world(world).deny_all(); ```
Objective
The method names on
DynamicSceneBuilder
are misleading. Specifically,deny_all
andallow_all
implies everything will be denied/allowed, including all components and resources. In reality, these methods only apply to components (which is mentioned in the docs).Solution
deny_all
andallow_all
todeny_all_components
andallow_all_components
We could also add the
deny_all
andallow_all
methods back later, only this time, they would deny/allow both resources and components.Showcase
Before
After
Migration Guide
DynamicSceneBuilder::allow_all
anddeny_all
now set resource accesses, not just components. To return to the previous behavior, use the newallow_all_components
ordeny_all_components
methods.The following methods for
DynamicSceneBuilder
have been renamed:with_filter
->with_component_filter
allow
->allow_component
deny
->deny_component