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

explicitly mention component in methods on DynamicSceneBuilder #15210

Merged
merged 5 commits into from
Sep 15, 2024
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions crates/bevy_scene/src/dynamic_scene_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ impl<'w> DynamicSceneBuilder<'w> {

/// Specify a custom component [`SceneFilter`] to be used with this builder.
#[must_use]
pub fn with_filter(mut self, filter: SceneFilter) -> Self {
pub fn with_component_filter(mut self, filter: SceneFilter) -> Self {
self.component_filter = filter;
self
}
Expand All @@ -92,10 +92,10 @@ impl<'w> DynamicSceneBuilder<'w> {
///
/// This method may be called multiple times for any number of components.
///
/// This is the inverse of [`deny`](Self::deny).
/// This is the inverse of [`deny_component`](Self::deny_component).
/// If `T` has already been denied, then it will be removed from the denylist.
#[must_use]
pub fn allow<T: Component>(mut self) -> Self {
pub fn allow_component<T: Component>(mut self) -> Self {
self.component_filter = self.component_filter.allow::<T>();
self
}
Expand All @@ -104,10 +104,10 @@ impl<'w> DynamicSceneBuilder<'w> {
///
/// This method may be called multiple times for any number of components.
///
/// This is the inverse of [`allow`](Self::allow).
/// This is the inverse of [`allow_component`](Self::allow_component).
/// If `T` has already been allowed, then it will be removed from the allowlist.
#[must_use]
pub fn deny<T: Component>(mut self) -> Self {
pub fn deny_component<T: Component>(mut self) -> Self {
self.component_filter = self.component_filter.deny::<T>();
self
}
Expand All @@ -116,9 +116,9 @@ impl<'w> DynamicSceneBuilder<'w> {
///
/// This is useful for resetting the filter so that types may be selectively [denied].
///
/// [denied]: Self::deny
/// [denied]: Self::deny_component
#[must_use]
pub fn allow_all(mut self) -> Self {
pub fn allow_all_components(mut self) -> Self {
self.component_filter = SceneFilter::allow_all();
self
}
Expand All @@ -127,9 +127,9 @@ impl<'w> DynamicSceneBuilder<'w> {
///
/// This is useful for resetting the filter so that types may be selectively [allowed].
///
/// [allowed]: Self::allow
/// [allowed]: Self::allow_component
#[must_use]
pub fn deny_all(mut self) -> Self {
pub fn deny_all_components(mut self) -> Self {
self.component_filter = SceneFilter::deny_all();
self
}
Expand Down Expand Up @@ -571,7 +571,7 @@ mod tests {
let entity_b = world.spawn(ComponentB).id();

let scene = DynamicSceneBuilder::from_world(&world)
.allow::<ComponentA>()
.allow_component::<ComponentA>()
.extract_entities([entity_a_b, entity_a, entity_b].into_iter())
.build();

Expand All @@ -598,7 +598,7 @@ mod tests {
let entity_b = world.spawn(ComponentB).id();

let scene = DynamicSceneBuilder::from_world(&world)
.deny::<ComponentA>()
.deny_component::<ComponentA>()
.extract_entities([entity_a_b, entity_a, entity_b].into_iter())
.build();

Expand Down
Loading