bevy/crates/bevy_scene/src
Alice Cecile fcc77fe3d6
Allow users to register their own disabling components / default query filters (#17768)
# Objective

Currently, default query filters, as added in #13120 / #17514 are
hardcoded to only use a single query filter.

This is limiting, as multiple distinct disabling components can serve
important distinct roles. I ran into this limitation when experimenting
with a workflow for prefabs, which don't represent the same state as "an
entity which is temporarily nonfunctional".

## Solution

1. Change `DefaultQueryFilters` to store a SmallVec of ComponentId,
rather than an Option.
2. Expose methods on `DefaultQueryFilters`, `World` and `App` to
actually configure this.
3. While we're here, improve the docs, write some tests, make use of
FromWorld and make some method names more descriptive.

## Follow-up

I'm not convinced that supporting sparse set disabling components is
useful, given the hit to iteration performance and runtime checks
incurred. That's disjoint from this PR though, so I'm not doing it here.
The existing warnings are fine for now.

## Testing

I've added both a doc test and an mid-level unit test to verify that
this works!
2025-02-11 18:25:32 +00:00
..
components.rs Add missing #[reflect(Component, Default)] to SceneRoot and DynamicSceneRoot. (#16816) 2024-12-15 19:18:22 +00:00
dynamic_scene_builder.rs Allow users to register their own disabling components / default query filters (#17768) 2025-02-11 18:25:32 +00:00
dynamic_scene.rs Improved Entity Mapping and Cloning (#17687) 2025-02-06 22:13:41 +00:00
lib.rs Improved Entity Mapping and Cloning (#17687) 2025-02-06 22:13:41 +00:00
scene_filter.rs Move hashbrown and foldhash out of bevy_utils (#17460) 2025-01-23 16:46:08 +00:00
scene_loader.rs Deny derive_more error feature and replace it with thiserror (#16684) 2024-12-06 17:03:55 +00:00
scene_spawner.rs Move hashbrown and foldhash out of bevy_utils (#17460) 2025-01-23 16:46:08 +00:00
scene.rs Improved Entity Mapping and Cloning (#17687) 2025-02-06 22:13:41 +00:00
serde.rs Improved Entity Mapping and Cloning (#17687) 2025-02-06 22:13:41 +00:00