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

[pull] main from bevyengine:main #48

Open
wants to merge 6,221 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
6221 commits
Select commit Hold shift + click to select a range
21f1e30
Relationships (non-fragmenting, one-to-many) (#17398)
cart Jan 18, 2025
7c8da1c
Reworked Segment types into their cartesian forms (#17404)
Sigma-dev Jan 19, 2025
adc33b5
Rename `TargetCamera` to `UiTargetCamera` (#17403)
ickshonpe Jan 19, 2025
9c5f5b8
docs: rewrite scene loading example documentation for clarity and dep…
Arend-Jan Jan 19, 2025
e66aef2
Correct 'Text2dBundle' to 'Text2d' in example comment (#17425)
theotherphil Jan 19, 2025
5d0e9cf
Flattened `PointerAction::Pressed` into `Press` and `Release`. (#17424)
AlephCubed Jan 19, 2025
8f32c79
Switch `bevy_asset` to `core::prelude` (#17442)
bushrat011899 Jan 20, 2025
edb34cd
Run example validation jobs on `ubuntu-latest` (#17169)
rparrett Jan 20, 2025
a64446b
Create `bevy_platform_support` Crate (#17250)
bushrat011899 Jan 20, 2025
a99674a
`FromWorld` derive macro (#17352)
ecoskey Jan 20, 2025
3f99a3e
Text 2d alignment fix (#17365)
ickshonpe Jan 20, 2025
b2f3248
Make the `animated_mesh` example more intuitive (#17421)
greeble-dev Jan 20, 2025
1dd30a6
Add docs to custom vertex attribute example (#17422)
ChristopherBiscardi Jan 20, 2025
5a9bc28
Support non-Vec data structures in relations (#17447)
alice-i-cecile Jan 20, 2025
59657ed
remove unsound DerefMut impls from `EntityHashMap`/`EntityHashSet` (#…
Victoronz Jan 20, 2025
6fc965e
Expose a few primitive builders, which seemed to be missed? (#17454)
Vrixyz Jan 20, 2025
15facbb
Fixing ui antialiasing clamp call parameters order (#14970) (#17456)
hexroll Jan 20, 2025
ebbd961
docs: enhance documentation in `query.rs` to clarify borrowing rules …
younes-io Jan 20, 2025
a7051a4
Diagnostics for label traits (#17441)
SpecificProtagonist Jan 20, 2025
de54867
Add DefaultQueryFilters (#13120)
NiseVoid Jan 20, 2025
000c362
Include ReflectFromReflect in all dynamic data types. (#17453)
anlumo Jan 20, 2025
ba5e71f
Parent -> ChildOf (#17427)
cart Jan 20, 2025
b34833f
Add an example teaching users about custom relationships (#17443)
alice-i-cecile Jan 20, 2025
42b928b
Added helper methods to `Bundles`. (#17464)
AlephCubed Jan 21, 2025
85eceb0
Add insert and remove recursive methods on `EntityWorldMut` and `Enti…
alice-i-cecile Jan 21, 2025
44ad3bf
Move `Resource` trait to its own file (#17469)
alice-i-cecile Jan 21, 2025
fe24652
Change `World::try_despawn` and `World::try_insert_batch` to return `…
JaySpruce Jan 21, 2025
93e5e6c
fix double comment characters (#17484)
LucDrenth Jan 21, 2025
72ddac1
Retain `RenderMaterialInstances` and `RenderMeshMaterialIds` from fra…
pcwalton Jan 22, 2025
d56536a
Add reflection to the remaining `glam` `Vec` types (#17493)
ilyvion Jan 22, 2025
5c43890
`no_std` Support for `bevy_input_focus` (#17490)
bushrat011899 Jan 22, 2025
f32a6fb
Track callsite for observers & hooks (#15607)
SpecificProtagonist Jan 22, 2025
d921fdc
Add `no_std` Support to `bevy_time` (#17491)
bushrat011899 Jan 22, 2025
784a9d3
Add warning for font sizes `<= 0.0` (#17501)
rparrett Jan 23, 2025
c7ddec5
Fix Time (#17504)
bushrat011899 Jan 23, 2025
41e79ae
Refactored `ComponentHook` Parameters into `HookContext` (#17503)
bushrat011899 Jan 23, 2025
434bbe6
`flex_basis` doc comment fix (#17502)
ickshonpe Jan 23, 2025
9387fcf
Add `no_std` Support to `bevy_a11y` (#17505)
bushrat011899 Jan 23, 2025
fd2afee
Mesh::merge to return a Result (#17475)
Vrixyz Jan 23, 2025
da57dfb
DeriveWorld for enums (#17496)
Bleachfuel Jan 23, 2025
8e6bf06
Add `no_std` support to `bevy_diagnostic` (#17507)
bushrat011899 Jan 23, 2025
17294ee
Update `async-broadcast` (#17500)
rparrett Jan 23, 2025
56aa902
Only include distance fog in the PBR shader if the view uses it. (#17…
pcwalton Jan 23, 2025
68c19de
`Readback`: Add support for texture depth/array layers (#17479)
EmbersArc Jan 23, 2025
dd2d84b
Remove `ViewVisibility` from UI nodes (#17405)
ickshonpe Jan 23, 2025
04990fc
Move `spin` to `bevy_platform_support` out of other crates (#17470)
bushrat011899 Jan 23, 2025
9bc0ae3
Move `hashbrown` and `foldhash` out of `bevy_utils` (#17460)
bushrat011899 Jan 23, 2025
94e0e1f
Updated the 2D examples to make them uniform (#17237)
chamaloriz Jan 23, 2025
d9ba1af
Fix Typo in `bevy_platform_support`'s `spin` Feature (#17516)
bushrat011899 Jan 23, 2025
81a25bb
Procedural atmospheric scattering (#16314)
ecoskey Jan 23, 2025
e459dd9
Replace checks for empty uinodes (#17520)
ickshonpe Jan 24, 2025
14ad252
Make CustomCursor variants CustomCursorImage/CustomCursorUrl structs …
mgi388 Jan 24, 2025
94a238b
implement FromEntitySetIterator (#17513)
Victoronz Jan 24, 2025
e20ac69
Clarify docs for OnAdd, OnInsert, OnReplace, OnRemove triggers (#17512)
RJ Jan 24, 2025
af3a84f
Add many_materials stress test (#17346)
CrazyRoka Jan 24, 2025
40007cd
Adds update interval config for FpsOverlayPlugin (#17489)
spvky Jan 24, 2025
39a1e2b
implement EntityIndexMap/Set (#17449)
Victoronz Jan 24, 2025
deb135c
Proportional scaling for the sprite's texture. (#17258)
silvestrpredko Jan 24, 2025
fc831c3
Implement basic clustered decal projectors. (#17315)
pcwalton Jan 26, 2025
1c765c9
Add support for specular tints and maps per the `KHR_materials_specul…
pcwalton Jan 26, 2025
4995104
impl Eq + Hash for BindGroup/Layout (#17547)
djeedai Jan 26, 2025
1612d21
added Hash to MouseScrollUnit; (#17538)
AustinHellerRepo Jan 26, 2025
eb04f8a
Simplify derive_from_world (#17534)
Bleachfuel Jan 26, 2025
8620cd7
Make the default directional light shadow cascade settings similar to…
pcwalton Jan 27, 2025
dda9788
Implement experimental GPU two-phase occlusion culling for the standa…
pcwalton Jan 27, 2025
7aeb1c5
Disable clustered decals on Metal. (#17554)
pcwalton Jan 27, 2025
37893a3
Fix `Visibility` link on b0004 error page (#17562)
yrns Jan 27, 2025
c0ccc87
UI material border radius (#15171)
ickshonpe Jan 28, 2025
514a35c
Share implementation of sort methods. (#16203)
chescock Jan 28, 2025
15f0027
Rename `ArgList::push` methods to `with` and add new `push` methods w…
atornity Jan 28, 2025
68b779c
Add alpha mode implementation to shader_material_2d (#16603)
Leinnan Jan 28, 2025
99b0d57
Update render_resource gpu buffer doc comments (#17118)
Weshnaw Jan 28, 2025
581034a
Reflect and register the wireframe materials (#17334)
SludgePhD Jan 28, 2025
95174f3
Fix docs mistake in bevy_ecs::world (#17336)
berylllium Jan 28, 2025
644efd6
Fix calculation of skybox rotation (#17476)
hukasu Jan 28, 2025
203d0b4
Move bounding_2d example to math folder (#17523)
NiseVoid Jan 28, 2025
51bb4f0
expose OverflowAxis::Hidden as Overflow functions (#17528)
LucDrenth Jan 28, 2025
dfac3b9
Fix window close in example cause panic (#17533)
jiangheng90 Jan 28, 2025
e8cd12d
Automatically transform cursor hotspot user asks to flip cursor image…
mgi388 Jan 28, 2025
b25bbb7
`Image::get_color_at_3d` and `Image::set_color_at_3d`: Support 2D ima…
EmbersArc Jan 28, 2025
b039bf6
implement UniqueEntityVec (#17549)
Victoronz Jan 28, 2025
a80263a
`no-camera` `many_buttons` argument, only emit UI camera warnings onc…
ickshonpe Jan 28, 2025
5bbcf64
Improved UI camera mapping (#17244)
ickshonpe Jan 28, 2025
d435606
`UiSurface::upsert_node` refactor (#8831)
ickshonpe Jan 28, 2025
b58eda0
feat(ecs): add `EntityEntryCommands::entity()` method chaining (#17580)
JeanMertz Jan 29, 2025
f232674
Remove unnecessary `PartialReflect` bound on `DeserializeWithRegistry…
aecsocket Jan 29, 2025
f7c27b5
Fixes #17508: bevy_color::Color constructor docs get docs matching un…
janis-bhm Jan 29, 2025
909b02e
Fix link to states example (#17595)
scvalex Jan 29, 2025
6bda03c
chore: impl `PartialEq` for `bevy_ui::Text` and `bevy_text::TextColor…
JeanMertz Jan 30, 2025
2c9950f
Remove IDE gitignores (#17603)
SpecificProtagonist Jan 30, 2025
7d68ac0
Use the provided `caller` instead of `Location::caller()` in `despawn…
chescock Jan 30, 2025
59697f9
Make `EntityHashMap::new` and `EntityHashSet::new` const (#17615)
Jondolf Jan 30, 2025
ba1b009
Extract UI nodes into a Vec (#17618)
ickshonpe Jan 30, 2025
fcd1847
`Image::get_color_at` and `Image::set_color_at`: Support 16-bit float…
EmbersArc Jan 31, 2025
e57f732
Smarter testbeds (#17573)
mockersf Jan 31, 2025
082d871
Run handle_lifetime only when AudioSink is added to the world (#17637)
silvestrpredko Feb 2, 2025
33c5e0b
Tiny ci improvements (#17627)
mockersf Feb 2, 2025
361397f
Add a test for direct recursion in required components. (#17626)
ElliottjPierce Feb 2, 2025
7774a62
Fix Maya-exported rigs by not trying to topologically sort glTF nodes…
pcwalton Feb 2, 2025
74acb95
anti-alias outside the edges of UI nodes, not across them (#17631)
ickshonpe Feb 2, 2025
afef7d5
`queue_sprites` comment fix (#17621)
ickshonpe Feb 2, 2025
89a1c49
Fix Taffy viewport node leaks (#17596)
ickshonpe Feb 2, 2025
a893c5d
feat: impl `Ease` for `Isometry[2/3]d` (#17545)
RobWalt Feb 2, 2025
416100a
Fixing `ValArithmeticError` typo and unused variant (#17597)
eckz Feb 2, 2025
9c5ce33
Use more headers in AsBindGroup docs (#17586)
IceSentry Feb 2, 2025
9165fb0
Implement `Serialize`/`Deserialize` for entity collections (#17620)
Jondolf Feb 2, 2025
469b218
Improve ergonomics of `platform_support`'s `Instant` (#17577)
Mathspy Feb 2, 2025
756948e
Fix cursor hotspot out of bounds when flipping (#17571)
mgi388 Feb 2, 2025
55283bb
Revert "Fix rounding bug in camera projection (#16828)" (#17592)
hukasu Feb 2, 2025
75e8e8c
Expose ObserverDescriptor fields (#17623)
cBournhonesque Feb 2, 2025
62285a4
Add simple Disabled marker (#17514)
NiseVoid Feb 2, 2025
aab39d5
Move sprite batches to resource (#17636)
tychedelia Feb 2, 2025
da50648
Add required serde_derive feature flag to bevy_ecs (#17651)
alice-i-cecile Feb 3, 2025
d9df371
Bump crate-ci/typos from 1.29.4 to 1.29.5 (#17655)
dependabot[bot] Feb 3, 2025
f627752
Revert #17631 (#17660)
ickshonpe Feb 3, 2025
adcc80c
Improve `TextSpan` docs (#17415)
rparrett Feb 3, 2025
721bb91
Add basic debug checks for read-only `UnsafeWorldCell` (#17393)
joseph-gio Feb 3, 2025
f22ea72
Atmosphere LUT parameterization improvements (#17555)
mate-h Feb 3, 2025
b978b13
Implementing Reflect on *MeshBuilder types (#17600)
eckz Feb 3, 2025
2d66099
Fix access checks for DeferredWorld as SystemParam. (#17616)
chescock Feb 3, 2025
bdf60d6
Warnings and docs for exponential denormalization in rotate functions…
Novakasa Feb 3, 2025
29d0ef6
Added `try_map_unchanged`. (#17653)
mintlu8 Feb 3, 2025
0ca9d69
Improve docs for `WorldQuery` (#17654)
alice-i-cecile Feb 3, 2025
18c4050
Make `batch_and_prepare_binned_render_phase` only record information …
pcwalton Feb 4, 2025
8c7f1b3
Fix text-2d. (#17674)
tychedelia Feb 4, 2025
642e016
Bump to `uuid` 1.13.1 and enable `js` on `wasm` targets (#17689)
bushrat011899 Feb 5, 2025
48049f7
Don't mark a previous mesh transform as changed if it didn't actually…
pcwalton Feb 5, 2025
69b2ae8
Don't reallocate work item buffers every frame. (#17684)
pcwalton Feb 5, 2025
be9b38e
implement UniqueEntitySlice (#17589)
Victoronz Feb 5, 2025
2ea5e9b
Cold Specialization (#17567)
tychedelia Feb 5, 2025
6f39e44
Introduce methods on QueryState to obtain a Query (#15858)
chescock Feb 5, 2025
6be11a8
Change `GhostNode` into a unit type (#17692)
ickshonpe Feb 5, 2025
03af547
Move `Item` and `fetch` to `QueryData` from `WorldQuery` (#17679)
couyit Feb 5, 2025
ca6b07c
Fix a couple of doc typos (#17673)
theotherphil Feb 5, 2025
03ec644
Basic UI text shadows (#17559)
ickshonpe Feb 5, 2025
ff466a3
Add `weak_handle!` convenience macro (#17384)
SludgePhD Feb 5, 2025
d0c0bad
Split `Component::register_component_hooks` into individual methods (…
bushrat011899 Feb 5, 2025
1b2cf7d
Isolate component registration (#17671)
ElliottjPierce Feb 5, 2025
fdc7cb3
Add a Sphere to `anisotropy` example (#17676)
hukasu Feb 5, 2025
0335f34
Add missing return in default `Relationship::on_insert` impl (#17675)
grind086 Feb 5, 2025
989f547
Weak handle migration (#17695)
SludgePhD Feb 5, 2025
9ea9c5d
Add `edit_material_on_gltf` example (#17677)
hukasu Feb 5, 2025
f2a65c2
Schedule build pass (#11094)
Neo-Zhixing Feb 5, 2025
3c8fae2
Improved Entity Mapping and Cloning (#17687)
cart Feb 6, 2025
6ed3c32
Missing UI glpyhs fix (#17729)
ickshonpe Feb 7, 2025
bcfc086
Include the material bind group in the shadow batch set key. (#17738)
pcwalton Feb 8, 2025
7c2d54c
EaseFunction svg graphs in doc (#17461)
SpecificProtagonist Feb 8, 2025
a9de516
Tidy up `easing_functions` example (#17742)
rparrett Feb 8, 2025
f3d8eb8
Fix rounding in steps easing function (#17743)
rparrett Feb 8, 2025
7fc122a
Retain bins from frame to frame. (#17698)
pcwalton Feb 8, 2025
9f9373c
Fix shadow retention by keying off the `RetainedViewEntity`, not the …
pcwalton Feb 9, 2025
556b750
Set late indirect parameter offsets every frame again. (#17736)
pcwalton Feb 9, 2025
2d62026
main_transparent_pass_2d render node command encoding parallelization…
PPakalns Feb 9, 2025
af6629c
Move specialize_* to QueueMeshes. (#17719)
tychedelia Feb 9, 2025
7400e7a
Cleanup publish process (#17728)
mockersf Feb 9, 2025
0b11b1f
deps: bump notify-debouncer-full to remove unmaintained crate (#17741)
SilentSpaceTraveller Feb 9, 2025
33e8333
Add entity disabling example (#17710)
alice-i-cecile Feb 9, 2025
669d139
Upgrade to wgpu v24 (#17542)
JMS55 Feb 9, 2025
1b7db89
Harden proc macro path resolution and add integration tests. (#17330)
raldone01 Feb 9, 2025
c679b86
adds example for local defaults (#17751)
newclarityex Feb 9, 2025
ea57841
Improved Spawn APIs and Bundle Effects (#17521)
cart Feb 9, 2025
300fe4d
Store UI render target info locally per node (#17579)
ickshonpe Feb 10, 2025
232824c
Fix meshlets when bindless disabled. (#17770)
tychedelia Feb 10, 2025
f176448
Remove `labeled_assets` from `LoadedAsset` and `ErasedLoadedAsset` (#…
andriyDev Feb 10, 2025
8e84b46
many_components stress test improvements (#16913)
hymm Feb 10, 2025
4ecbe00
Add a custom render phase example (#16916)
IceSentry Feb 10, 2025
eee7fd5
Encapsulate `cfg(feature = "track_location")` in a type. (#17602)
chescock Feb 10, 2025
2660ddc
Support decibels in bevy_audio::Volume (#17605)
mgi388 Feb 10, 2025
8435951
Add scroll functionality to bevy_picking (#17704)
colepoirier Feb 10, 2025
7f9588d
Fix documentation of `Entities::get` (#17721)
urben1680 Feb 10, 2025
c34a2c2
`Query::get_many` should not check for duplicates (#17724)
chescock Feb 10, 2025
4fe5776
make bevy math publishable (#17727)
mockersf Feb 10, 2025
db03565
CosmicBuffer is a public type but not not used or accessible in any p…
fschlee Feb 10, 2025
3978ba9
Allowed creating uninitialized images (for use as storage textures) (…
Lege19 Feb 10, 2025
f27e00b
Derive Reflect on Skybox (#17781)
jf908 Feb 10, 2025
359cd43
UI clipping update function comments fix (#17785)
ickshonpe Feb 10, 2025
7d14182
run example in CI on windows using static dxc (#17783)
mockersf Feb 10, 2025
71b2239
Expand `EasingCurve` documentation (#17778)
greeble-dev Feb 10, 2025
a861452
Add user supplied mesh tag (#17648)
tychedelia Feb 10, 2025
69db29e
Sweep bins after queuing so as to only sweep them once. (#17787)
pcwalton Feb 10, 2025
83370e0
Use dual-source blending for rendering the sky (#17672)
ecoskey Feb 10, 2025
575f665
Silence deprecation warning in `Bundle` derive macro (#17369) (#17790)
Person-93 Feb 11, 2025
5e9da92
Add links to the types on the documentation of `GltfAssetLabel` (#17791)
hukasu Feb 11, 2025
fcc77fe
Allow users to register their own disabling components / default quer…
alice-i-cecile Feb 11, 2025
fb0e5c4
Fix failing proc macros when depending on bevy through dev and normal…
raldone01 Feb 11, 2025
c896ad6
Split the labels in many_buttons (#17802)
ickshonpe Feb 11, 2025
fd67ca7
feat(ecs): configurable error handling for fallible systems (#17753)
JeanMertz Feb 11, 2025
5eff6e8
Add relative position reporting to UI picking (#17681)
bytemunch Feb 11, 2025
d6725d3
Expose method to update the internal ticks of Ref and Mut (#17716)
cBournhonesque Feb 11, 2025
5b0d898
Trait tags on docs.rs (#17758)
SpecificProtagonist Feb 11, 2025
7d8504f
feat(ecs): implement fallible observer systems (#17731)
JeanMertz Feb 11, 2025
98dcee2
UI text extraction refactor (#17805)
ickshonpe Feb 11, 2025
aa8793f
Add ways to configure `EasingFunction::Steps` via new `StepConfig` (#…
RobWalt Feb 11, 2025
0cb3eae
Fix validation errors in `Fox.glb` (#17801)
rparrett Feb 11, 2025
fe7a29e
Fix error in scene example (#17799)
rparrett Feb 11, 2025
fc98664
Add tonemapping switch to bloom 2d example (#17789)
hukasu Feb 11, 2025
7a62a4f
gate get_tag behind ndef MESHLET_MESH_MATERIAL_PASS (#17809)
mockersf Feb 11, 2025
ce43395
Don't relocate the meshes when mesh slabs grow. (#17793)
pcwalton Feb 11, 2025
85b366a
Cache `MeshInputUniform` indices in each `RenderBin`. (#17772)
pcwalton Feb 11, 2025
94deca8
Use `target_abi = "sim"` instead of `ios_simulator` feature (#17702)
madsmtm Feb 11, 2025
7398d33
Panic on failure in `scene` example (#17812)
rparrett Feb 11, 2025
cff1736
Deterministic fallible_systems example (#17813)
mockersf Feb 11, 2025
153ce46
implement iterators that yield UniqueEntitySlice (#17796)
Victoronz Feb 12, 2025
15b795d
Use unchecked shaders for better performance (#17767)
JMS55 Feb 12, 2025
c34eaf1
Add separate option to control font size behavior in `many_text2d` (#…
rparrett Feb 12, 2025
2f9613f
Minor tidying in `font_atlas_debug` (#17825)
rparrett Feb 12, 2025
2fd4cc4
Meshlet texture atomics (#17765)
JMS55 Feb 12, 2025
267a0d0
Add ComponentId-taking functions to Entity{Ref,Mut}Except to mirror F…
anlumo Feb 12, 2025
5ff7062
Switch bins from parallel key/value arrays to `IndexMap`s. (#17819)
pcwalton Feb 12, 2025
62c1812
Shorten the 'world lifetime returned from `QueryLens::query()`. (#17694)
chescock Feb 12, 2025
0ede857
Build batches across phases in parallel. (#17764)
pcwalton Feb 13, 2025
610fe51
Update `HitData` position docs (#17833)
bytemunch Feb 13, 2025
2760692
Update `typos` to 1.29.6 (#17850)
rparrett Feb 13, 2025
5ec59cf
Add `NodeImageMode` to the UI prelude (#17848)
ickshonpe Feb 13, 2025
96a4028
Improve clarity of existing bevy_assets documentation (#17830)
alice-i-cecile Feb 13, 2025
05e61d6
implement par_iter_many and par_iter_many_unique (#17815)
Victoronz Feb 13, 2025
101fcaa
Combine `output_index` and `indirect_parameters_index` into one field…
pcwalton Feb 13, 2025
02985c3
`ui_material` example webgl2 fix (#17852)
ickshonpe Feb 13, 2025
0f1c757
Fill out some missing docs for bevy_assets (#17829)
alice-i-cecile Feb 13, 2025
6b837dd
Remove prepasses from the render world when they're removed from the …
pcwalton Feb 14, 2025
3c9e696
Actually add objects to the scene buffers in sorted render phases. (#…
pcwalton Feb 14, 2025
253cc6a
Add `TypeRegistry::register_by_val` (#17817)
NyxAlexandra Feb 15, 2025
7935c7e
Update picking docs to include position space (#17859)
bytemunch Feb 15, 2025
d7fd00a
Bump Rust tracy client version (#17867)
mate-h Feb 15, 2025
0a32450
Support using FilteredResources with ReflectResource. (#15624)
chescock Feb 16, 2025
794bf6a
Move implementations of `Query` methods from `QueryState` to `Query`.…
chescock Feb 16, 2025
7801ed3
Don't delete the buffers that batch building writes into every frame.…
pcwalton Feb 16, 2025
137878a
Replace `BufferVec<PreprocessWorkItem>` with `RawBufferVec<Preprocess…
pcwalton Feb 16, 2025
e186c7c
Fix panic in `custom_render_phase` example (#17866)
rparrett Feb 16, 2025
ee44560
Add `EntityDoesNotExistError`, replace cases of `Entity` as an error,…
JaySpruce Feb 16, 2025
be3c6f7
Improve the docs for ChildOf and Children (#17886)
alice-i-cecile Feb 17, 2025
4045b91
Fix `dds` feature enabling `bevy_gltf` (#17888)
rparrett Feb 17, 2025
45c2666
Fixed `bevy_image` and `bevy_gltf` failing to compile with some featu…
AlephCubed Feb 17, 2025
82f6f70
Fix typos CREDITS.md (#17899)
axlitEels Feb 17, 2025
8e783d3
Sweep old entities from 2D binned render phases (#17903)
superdump Feb 17, 2025
fb1e829
Bump `typos` to 1.29.7 (#17902)
rparrett Feb 17, 2025
8f36106
Split out the `IndirectParametersMetadata` into CPU-populated and GPU…
pcwalton Feb 18, 2025
8976a45
Retain skins from frame to frame. (#17818)
pcwalton Feb 18, 2025
5e569af
Make the specialized pipeline cache two-level. (#17915)
pcwalton Feb 18, 2025
0517b96
Fix motion vector computation after #17688. (#17717)
pcwalton Feb 18, 2025
73970d0
Don't mark newly-hidden meshes invisible until all visibility-determi…
pcwalton Feb 18, 2025
c818c92
Add option to animate materials in many_cubes (#17927)
DGriffin91 Feb 18, 2025
ed62e59
Shader validation enum (#17824)
fjkorf Feb 20, 2025
9e11e96
Fix false positive GPU frustum culling (#17939)
mate-h Feb 20, 2025
f15437e
Rewrite the multidrawable batch set builder for performance. (#17923)
pcwalton Feb 20, 2025
8de6b16
Implement occlusion culling for the deferred rendering pipeline. (#17…
pcwalton Feb 20, 2025
6bcb2b6
Remove unused `#[must_used]` (#17959)
bushrat011899 Feb 21, 2025
2844133
Use global binding arrays for bindless resources. (#17898)
pcwalton Feb 21, 2025
4880a23
Implement occlusion culling for directional light shadow maps. (#17951)
pcwalton Feb 21, 2025
052b9d8
Fix issue with `define_label!` instantiation in a 3rd party crate (#1…
ItsDoot Feb 21, 2025
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
Prev Previous commit
Next Next commit
Add DefaultQueryFilters (bevyengine#13120)
# Objective

Some usecases in the ecosystems are blocked by the inability to stop
bevy internals and third party plugins from touching their entities.
However the specifics of a general purpose entity disabling system are
controversial and further complicated by hierarchies. We can partially
unblock these usecases with an opt-in approach: default query filters.

## Solution

- Introduce DefaultQueryFilters, these filters are automatically applied
to queries that don't otherwise mention the filtered component.
- End users and third party plugins can register default filters and are
responsible for handling entities they have hidden this way.
- Extra features can be left for after user feedback
- The default value could later include official ways to hide entities

---

## Changelog

- Add DefaultQueryFilters
  • Loading branch information
NiseVoid authored Jan 20, 2025
commit de5486725df4a96c4d6002037231b7d886fe3751
152 changes: 152 additions & 0 deletions crates/bevy_ecs/src/entity_disabling.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
//! Types for entity disabling.
//!
//! Disabled entities do not show up in queries unless the query explicitly mentions them.
//!
//! If for example we have `Disabled` as an entity disabling component, when you add `Disabled`
//! to an entity, the entity will only be visible to queries with a filter like
//! [`With`]`<Disabled>` or query data like [`Has`]`<Disabled>`.
//!
//! ### Note
//!
//! Currently only queries for which the cache is built after enabling a filter will have entities
//! with those components filtered. As a result, they should generally only be modified before the
//! app starts.
//!
//! Because filters are applied to all queries they can have performance implication for
//! the enire [`World`], especially when they cause queries to mix sparse and table components.
//! See [`Query` performance] for more info.
//!
//! [`With`]: crate::prelude::With
//! [`Has`]: crate::prelude::Has
//! [`World`]: crate::prelude::World
//! [`Query` performance]: crate::prelude::Query#performance

use crate as bevy_ecs;
use crate::{
component::{ComponentId, Components, StorageType},
query::FilteredAccess,
};
use bevy_ecs_macros::Resource;

/// The default filters for all queries, these are used to globally exclude entities from queries.
/// See the [module docs](crate::entity_disabling) for more info.
#[derive(Resource, Default, Debug)]
#[cfg_attr(feature = "bevy_reflect", derive(bevy_reflect::Reflect))]
pub struct DefaultQueryFilters {
disabled: Option<ComponentId>,
}

impl DefaultQueryFilters {
#[cfg_attr(
not(test),
expect(dead_code, reason = "No Disabled component exist yet")
)]
/// Set the [`ComponentId`] for the entity disabling marker
pub(crate) fn set_disabled(&mut self, component_id: ComponentId) -> Option<()> {
if self.disabled.is_some() {
return None;
}
self.disabled = Some(component_id);
Some(())
}

/// Get an iterator over all currently enabled filter components
pub fn ids(&self) -> impl Iterator<Item = ComponentId> {
[self.disabled].into_iter().flatten()
}

pub(super) fn apply(&self, component_access: &mut FilteredAccess<ComponentId>) {
for component_id in self.ids() {
if !component_access.contains(component_id) {
component_access.and_without(component_id);
}
}
}

pub(super) fn is_dense(&self, components: &Components) -> bool {
self.ids().all(|component_id| {
components
.get_info(component_id)
.is_some_and(|info| info.storage_type() == StorageType::Table)
})
}
}

#[cfg(test)]
mod tests {

use super::*;
use alloc::{vec, vec::Vec};

#[test]
fn test_set_filters() {
let mut filters = DefaultQueryFilters::default();
assert_eq!(0, filters.ids().count());

assert!(filters.set_disabled(ComponentId::new(1)).is_some());
assert!(filters.set_disabled(ComponentId::new(3)).is_none());

assert_eq!(1, filters.ids().count());
assert_eq!(Some(ComponentId::new(1)), filters.ids().next());
}

#[test]
fn test_apply_filters() {
let mut filters = DefaultQueryFilters::default();
filters.set_disabled(ComponentId::new(1));

// A component access with an unrelated component
let mut component_access = FilteredAccess::<ComponentId>::default();
component_access
.access_mut()
.add_component_read(ComponentId::new(2));

let mut applied_access = component_access.clone();
filters.apply(&mut applied_access);
assert_eq!(0, applied_access.with_filters().count());
assert_eq!(
vec![ComponentId::new(1)],
applied_access.without_filters().collect::<Vec<_>>()
);

// We add a with filter, now we expect to see both filters
component_access.and_with(ComponentId::new(4));

let mut applied_access = component_access.clone();
filters.apply(&mut applied_access);
assert_eq!(
vec![ComponentId::new(4)],
applied_access.with_filters().collect::<Vec<_>>()
);
assert_eq!(
vec![ComponentId::new(1)],
applied_access.without_filters().collect::<Vec<_>>()
);

let copy = component_access.clone();
// We add a rule targeting a default component, that filter should no longer be added
component_access.and_with(ComponentId::new(1));

let mut applied_access = component_access.clone();
filters.apply(&mut applied_access);
assert_eq!(
vec![ComponentId::new(1), ComponentId::new(4)],
applied_access.with_filters().collect::<Vec<_>>()
);
assert_eq!(0, applied_access.without_filters().count());

// Archetypal access should also filter rules
component_access = copy.clone();
component_access
.access_mut()
.add_archetypal(ComponentId::new(1));

let mut applied_access = component_access.clone();
filters.apply(&mut applied_access);
assert_eq!(
vec![ComponentId::new(4)],
applied_access.with_filters().collect::<Vec<_>>()
);
assert_eq!(0, applied_access.without_filters().count());
}
}
1 change: 1 addition & 0 deletions crates/bevy_ecs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ pub mod bundle;
pub mod change_detection;
pub mod component;
pub mod entity;
pub mod entity_disabling;
pub mod event;
pub mod hierarchy;
pub mod identifier;
Expand Down
10 changes: 10 additions & 0 deletions crates/bevy_ecs/src/query/access.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1123,6 +1123,16 @@ impl<T: SparseSetIndex> FilteredAccess<T> {
.iter()
.flat_map(|f| f.without.ones().map(T::get_sparse_set_index))
}

/// Returns true if the index is used by this `FilteredAccess` in any way
pub fn contains(&self, index: T) -> bool {
self.access().has_component_read(index.clone())
|| self.access().has_archetypal(index.clone())
|| self.filter_sets.iter().any(|f| {
f.with.contains(index.sparse_set_index())
|| f.without.contains(index.sparse_set_index())
})
}
}

#[derive(Eq, PartialEq)]
Expand Down
106 changes: 97 additions & 9 deletions crates/bevy_ecs/src/query/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use crate::{
batching::BatchingStrategy,
component::{ComponentId, Tick},
entity::{Entity, EntityBorrow, EntitySet},
entity_disabling::DefaultQueryFilters,
prelude::FromWorld,
query::{
Access, DebugCheckedUnwrap, FilteredAccess, QueryCombinationIter, QueryIter, QueryParIter,
Expand Down Expand Up @@ -214,7 +215,7 @@ impl<D: QueryData, F: QueryFilter> QueryState<D, F> {
fn new_uninitialized(world: &mut World) -> Self {
let fetch_state = D::init_state(world);
let filter_state = F::init_state(world);
Self::from_states_uninitialized(world.id(), fetch_state, filter_state)
Self::from_states_uninitialized(world, fetch_state, filter_state)
}

/// Creates a new [`QueryState`] but does not populate it with the matched results from the World yet
Expand All @@ -225,7 +226,7 @@ impl<D: QueryData, F: QueryFilter> QueryState<D, F> {
let fetch_state = D::get_state(world.components())?;
let filter_state = F::get_state(world.components())?;
Some(Self::from_states_uninitialized(
world.id(),
world,
fetch_state,
filter_state,
))
Expand All @@ -236,7 +237,7 @@ impl<D: QueryData, F: QueryFilter> QueryState<D, F> {
/// `new_archetype` and its variants must be called on all of the World's archetypes before the
/// state can return valid query results.
fn from_states_uninitialized(
world_id: WorldId,
world: &World,
fetch_state: <D as WorldQuery>::State,
filter_state: <F as WorldQuery>::State,
) -> Self {
Expand All @@ -255,10 +256,15 @@ impl<D: QueryData, F: QueryFilter> QueryState<D, F> {

// For queries without dynamic filters the dense-ness of the query is equal to the dense-ness
// of its static type parameters.
let is_dense = D::IS_DENSE && F::IS_DENSE;
let mut is_dense = D::IS_DENSE && F::IS_DENSE;

if let Some(default_filters) = world.get_resource::<DefaultQueryFilters>() {
default_filters.apply(&mut component_access);
is_dense &= default_filters.is_dense(world.components());
}

Self {
world_id,
world_id: world.id(),
archetype_generation: ArchetypeGeneration::initial(),
matched_storage_ids: Vec::new(),
is_dense,
Expand All @@ -282,15 +288,24 @@ impl<D: QueryData, F: QueryFilter> QueryState<D, F> {
let filter_state = F::init_state(builder.world_mut());
D::set_access(&mut fetch_state, builder.access());

let mut component_access = builder.access().clone();

// For dynamic queries the dense-ness is given by the query builder.
let mut is_dense = builder.is_dense();

if let Some(default_filters) = builder.world().get_resource::<DefaultQueryFilters>() {
default_filters.apply(&mut component_access);
is_dense &= default_filters.is_dense(builder.world().components());
}

let mut state = Self {
world_id: builder.world().id(),
archetype_generation: ArchetypeGeneration::initial(),
matched_storage_ids: Vec::new(),
// For dynamic queries the dense-ness is given by the query builder.
is_dense: builder.is_dense(),
is_dense,
fetch_state,
filter_state,
component_access: builder.access().clone(),
component_access,
matched_tables: Default::default(),
matched_archetypes: Default::default(),
#[cfg(feature = "trace")]
Expand Down Expand Up @@ -1880,7 +1895,8 @@ impl<D: QueryData, F: QueryFilter> From<QueryBuilder<'_, D, F>> for QueryState<D
mod tests {
use crate as bevy_ecs;
use crate::{
component::Component, prelude::*, query::QueryEntityError, world::FilteredEntityRef,
component::Component, entity_disabling::DefaultQueryFilters, prelude::*,
query::QueryEntityError, world::FilteredEntityRef,
};
use alloc::vec::Vec;

Expand Down Expand Up @@ -2314,4 +2330,76 @@ mod tests {
let query_2 = QueryState::<&B, Without<C>>::new(&mut world);
let _: QueryState<Entity, Changed<C>> = query_1.join_filtered(&world, &query_2);
}

#[test]
fn query_respects_default_filters() {
let mut world = World::new();
world.spawn((A(0), B(0)));
world.spawn((B(0), C(0)));
world.spawn(C(0));

let mut df = DefaultQueryFilters::default();
df.set_disabled(world.register_component::<C>());
world.insert_resource(df);

// Without<C> only matches the first entity
let mut query = QueryState::<()>::new(&mut world);
assert_eq!(1, query.iter(&world).count());

// With<C> matches the last two entities
let mut query = QueryState::<(), With<C>>::new(&mut world);
assert_eq!(2, query.iter(&world).count());

// Has should bypass the filter entirely
let mut query = QueryState::<Has<C>>::new(&mut world);
assert_eq!(3, query.iter(&world).count());

// Other filters should still be respected
let mut query = QueryState::<Has<C>, Without<B>>::new(&mut world);
assert_eq!(1, query.iter(&world).count());
}

#[derive(Component)]
struct Table;

#[derive(Component)]
#[component(storage = "SparseSet")]
struct Sparse;

#[test]
fn query_default_filters_updates_is_dense() {
let mut world = World::new();
world.spawn((Table, Sparse));
world.spawn(Table);
world.spawn(Sparse);

let mut query = QueryState::<()>::new(&mut world);
// There are no sparse components involved thus the query is dense
assert!(query.is_dense);
assert_eq!(3, query.iter(&world).count());

let mut df = DefaultQueryFilters::default();
df.set_disabled(world.register_component::<Sparse>());
world.insert_resource(df);

let mut query = QueryState::<()>::new(&mut world);
// The query doesn't ask for sparse components, but the default filters adds
// a sparse components thus it is NOT dense
assert!(!query.is_dense);
assert_eq!(1, query.iter(&world).count());

let mut df = DefaultQueryFilters::default();
df.set_disabled(world.register_component::<Table>());
world.insert_resource(df);

let mut query = QueryState::<()>::new(&mut world);
// If the filter is instead a table components, the query can still be dense
assert!(query.is_dense);
assert_eq!(1, query.iter(&world).count());

let mut query = QueryState::<&Sparse>::new(&mut world);
// But only if the original query was dense
assert!(!query.is_dense);
assert_eq!(1, query.iter(&world).count());
}
}