Commit Graph

8892 Commits

Author SHA1 Message Date
ickshonpe
f415e2e96d
Constify Val::resolve and BorderRadius::resolve (#18595)
# Objective

Constify `Val::resolve` and  `BorderRadius::resolve`

# Solution

* Replace uses of `Vec2::min_element` and `Vec2::max_element` with `min`
and `max` called on the components.
* Make `BorderRadius::resolve` and `BorderRadius::resolve_single_corner`
`const`.
* Swap the order of the `bottom_left` and `bottom_right` fields of
`BorderRadius` and `ResolvedBorderRadius` so they match the ccw order
used in the shader and in css.
2025-05-26 22:17:52 +00:00
Rob Parrett
2e37783242
Move cooldown example instruction text according to example visual guidelines (#19381)
# Objective

Use the same text positioning as other examples that have instruction
text.

See
https://bevyengine.org/learn/contribute/helping-out/creating-examples/#visual-guidelines
2025-05-26 22:01:08 +00:00
theotherphil
523600133d
Add missing docs for diagnostics.rs (#19264)
# Objective

Fill in some more missing doc comments.

---------

Co-authored-by: Jan Hohenheim <jan@hohenheim.ch>
2025-05-26 20:27:46 +00:00
theotherphil
16a286dac3
Update .entry() docs to show both insert-then-modify and modify-or-insert examples (#19327)
# Objective

Fix https://github.com/bevyengine/bevy/issues/16379
2025-05-26 20:27:20 +00:00
François Mockers
8a223be651
Enable state scoped entities by default (#19354)
# Objective

- Enable state scoped entities by default
- Provide a way to disable it when needed

---------

Co-authored-by: Ben Frankel <ben.frankel7@gmail.com>
2025-05-26 20:26:41 +00:00
andriyDev
8db7b6e122
Remove Shader weak_handles from bevy_render. (#19362)
# Objective

- Related to #19024

## Solution

- Use the new `load_shader_library` macro for the shader libraries and
`embedded_asset`/`load_embedded_asset` for the "shader binaries" in
bevy_render.

## Testing

- `animate_shader` example still works

P.S. I don't think this needs a migration guide. Technically users could
be using the `pub` weak handles, but there's no actual good use for
them, so omitting it seems fine. Alternatively, we could mix this in
with the migration guide notes for #19137.
2025-05-26 20:20:25 +00:00
ickshonpe
f04c0ef689
tab_navigation example improvements (#19239)
# Objective

Improve the `tab_navigation` example.

## Solution

* Set different `TabIndex`s for the buttons of each group.
* Label each button with its associated `TabIndex`.
* Reduce the code duplication using a loop.

I tried to flatten it further using the new spawning APIs and
`children!` macro but not sure what the current best way to attach the
observers is.
2025-05-26 20:20:00 +00:00
SpecificProtagonist
158d9aff0e
Fix spawn tracking for spawn commands (#19351)
# Objective

See also
https://discord.com/channels/691052431525675048/1374187654425481266/1375553989185372292.

## Solution

Set spawn info in `Commands::spawn_empty`.
Also added a benchmark for `Commands::spawn`.

## Testing

See added test.
2025-05-26 20:15:21 +00:00
theotherphil
54c9f03021
Mention in .add_observer() docs that first parameter must be a Trigger (#19315)
# Objective

Fix https://github.com/bevyengine/bevy/issues/13860

## Solution

Add note in docs that Trigger must be the first parameter of observer
systems
2025-05-26 20:06:08 +00:00
Benjamin Brienen
818a8fe154
Allow unfocused window creation (#19237)
# Objective

Allow creating a new window without it being focused, when `Window`'s
`focused` is `false.
## Solution

Use `winit`'s `WindowBuilder`'s `with_active` method

## Notes

- `winit`'s doc lists [redox's
`Orbital`](https://gitlab.redox-os.org/redox-os/orbital) as an
unsupported platform, but since Bevy doesn't officially support this
platform, I didn't put it in the documentation.

- I only tested on Linux, which is an unsupported platform. I can give
you a test code if you want to test on another platform.

- I initially put a line
[here](https://github.com/bevyengine/bevy/blob/v0.11.0/crates/bevy_winit/src/system.rs#L72)
to set the Bevy `Window`'s `focused` to `winit_window.has_focus()` after
window creation to avoid the case where `with_active` is not supported,
the window is spawned focused, no `WindowFocused` event is triggered,
and Bevy `Window` would be desynced from winit's window. But after
testing on Linux (which doesn't support `with_active`) it seems like at
that point `has_focus` returns `false` and the event is triggered, so I
removed it. Do you think I should add it back to be safe?

## Changelog

- A new unfocused `Window` can be created by setting `focused` to
`false`.

## Migration Guide

- If a `Window` is spawned with `focused` set to `false`, it will now
start not focused on supported platforms.

Adopted from #9208

---------

Co-authored-by: Sélène Amanita <selene.amanita@net-c.com>
Co-authored-by: Sélène Amanita <134181069+Selene-Amanita@users.noreply.github.com>
Co-authored-by: atlv <email@atlasdostal.com>
Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
2025-05-26 20:05:33 +00:00
theotherphil
f8cb8f237d
Fix a few typos in bevy_ecs docs (#19280)
# Objective

Fix a few minor typos that I noticed when reading the docs.
2025-05-26 20:02:13 +00:00
Niklas Eicker
7c4a1f9d87
Unpin nightly in CI (#19278)
# Objective

In #19253 we pinned nightly due to a bug in Miri. That issue was
resolved and the latest Miri should be usable for us again.

## Solution

- Use latest nightly again

## Testing

- I tested today's Miri locally with
`RUSTUP_TOOLCHAIN=nightly-2025-05-18 MIRIFLAGS="-Zmiri-ignore-leaks
-Zmiri-disable-isolation" RUSTFLAGS="-Zrandomize-layout" cargo miri test
-p bevy_ecs`
2025-05-26 20:01:10 +00:00
theotherphil
348779850b
Add missing doc comments to system_information_diagnostics_plugin (#19267)
# Objective

More trivial doc comments towards being able to deny missing docs across
the board.
2025-05-26 19:59:49 +00:00
theotherphil
3690ad5b0b
Remove apostrophes in possessive its (#19244)
# Objective

Fix some grammatical errors: it's -> its

Not the most useful commit in the world, but I saw a couple of these and
decided to fix the lot.

## Solution
-

## Testing
-
2025-05-26 19:53:14 +00:00
theotherphil
07c9d1acce
Clarify RenderLayers docs (#19241)
# Objective

Clarify `RenderLayers` docs, to fix
https://github.com/bevyengine/bevy/issues/18874

## Solution

-

## Testing

-
2025-05-26 19:52:22 +00:00
theotherphil
a521998eea
Make remove_reflect parameter names consistent between ReflectCommandExt and impl for EntityCommands (#19243)
# Objective

Fix https://github.com/bevyengine/bevy/issues/13390

## Solution

The second parameter of the remove_reflect function is called
component_type_name in ReflectCommandExt but component_type_path in the
implementation for EntityCommands. Use component_type_path in both
places.

## Testing

None
2025-05-26 19:49:56 +00:00
Niklas Eicker
923c2ad281
New cooldown example (#19234)
# Objective

We want to extend our examples with a new category "usage" to
demonstrate common use cases (see bevyengine/bevy-website#2131). This PR
adds an example of animated cooldowns on button clicks.

## Solution

- New example in "usage" directory
- Implement a cooldown with an animated child Node

## Testing

- I ran this on Linux
- [x] test web (with bevy CLI: `bevy run --example cooldown web --open`)

---------

Co-authored-by: Thierry Berger <contact@thierryberger.com>
Co-authored-by: Ida "Iyes" <40234599+inodentry@users.noreply.github.com>
2025-05-26 19:44:17 +00:00
Benjamin Brienen
20057e5ed7
Make sure that serde_json::Map::into_values exists (#19229)
# Objective

cargo update was required to build because into_values was added in a
patch version

## Solution

Depend on the new patch

## Testing

Builds locally now
2025-05-26 19:38:28 +00:00
stevehello166
66877f63be
Add a Dir4 to resolve #17983 (#19223)
# Objective
Fixes #17983 

## Solution

Implemented a basic `Dir4` struct with methods similar to `Dir3` and
`Dir2`.

## Testing

- Did you test these changes? If so, how?
Added unit tests that follow the same pattern of the other Dir structs.
- Are there any parts that need more testing?
Since the other Dir structs use rotations to test renormalization and I
have been following them as a pattern for the Dir4 struct I haven't
implemented a test to cover renormalization of Dir4's.
- How can other people (reviewers) test your changes? Is there anything
specific they need to know?
Use Dir4 in the wild.
- If relevant, what platforms did you test these changes on, and are
there any important ones you can't test?
N/A (Tested on Linux/X11 but it shouldn't be a problem)
2025-05-26 19:35:07 +00:00
Chris Berger
0777cc26aa
Navigate through TabGroups in order. (#19218)
# Objective
Fixes #19156

## Solution
There was a call to sort by `TabIndex` after iterating through all the
`TabGroup`s. Simply removing that line of code made the new test case
pass (navigating through `TabIndex` within different `TabGroup`s and
kept everything else working as expected as far as I can tell.

I went ahead and broke the `focusable` vec down into per-group vecs that
get sorted by `TabIndex` and appended to the main vec in group sorted
order to maintain the sorting that was being done before, but respecting
the `TabGroup` sorting that was missing in the issue that this PR
addresses.

## Testing
I added a new unit test that reproduced the issue outlined above that
will run in CI. This test was failing before deleting the sort, and now
both unit tests are passing.
2025-05-26 19:32:10 +00:00
AlephCubed
0f92d1087c
Fixed broken link in release content README. (#19375)
The link went to a 404 page because it was missing an 's'.
2025-05-26 19:30:03 +00:00
urben1680
b92c0ebd3d
No schedule build pass overwrite if build settings do not change auto_insert_apply_deferred from true (#19217)
# Objective

Fixes #18790.
Simpler alternative to #19195.

## Solution

As suggested by @PixelDust22, simply avoid overwriting the pass if the
schedule already has auto sync points enabled.
Leave pass logic untouched.

It still is probably a bad idea to add systems/set configs before
changing the build settings, but that is not important as long there are
no more complex build passes.

## Testing

Added a test.

---------

Co-authored-by: Thierry Berger <contact@thierryberger.com>
2025-05-26 19:28:56 +00:00
IceSentry
2dc6337875
Add WakeUp event to App (#19212)
# Objective

- The WakeUp event is never added to the app. If you need to use that
event you currently need to add it yourself.

## Solution

- Add the WakeUp event to the App in the WinitPlugin

## Testing

- I tested the window_setting example and it compiled and worked
2025-05-26 19:26:26 +00:00
Emerson Coskey
7ab00ca185
Split Camera.hdr out into a new component (#18873)
# Objective

- Simplify `Camera` initialization
- allow effects to require HDR

## Solution

- Split out `Camera.hdr` into a marker `Hdr` component

## Testing

- ran `bloom_3d` example

---

## Showcase

```rs
// before
commands.spawn((
  Camera3d
  Camera {
    hdr: true
    ..Default::default()
  }
))

// after
commands.spawn((Camera3d, Hdr));

// other rendering components can require that the camera enables hdr!
// currently implemented for Bloom, AutoExposure, and Atmosphere.
#[require(Hdr)]
pub struct Bloom;
```
2025-05-26 19:24:45 +00:00
Fallible Things
cedf8d357a
Explanation for the '2d shapes' example (#19211)
[Explanation](https://bevyengine.org/learn/contribute/helping-out/explaining-examples/)
for the 2d shapes example, taken from the original HackMD document and
edited a bit.

This example is a strange one, it's eye-catching mostly because it's the
first example (at time of writing) in the examples page. That being
said, the example does a decent amount of teaching utility to it: we can
explain the bevy math-shape to mesh pipeline, which illuminates a way of
transforming one form of data (abstract, mathematical shape
descriptions) into another (meshes) which may be novel or inspirational
to some users.

---------

Co-authored-by: theotherphil <phil.j.ellison@gmail.com>
2025-05-26 19:21:01 +00:00
Gino Valente
1674938c49
bevy_reflect: Split up the std module (#18939)
> [!important]
> To **maintainers**: we should wait to merge this one in until after
#18944 lands so that cherry-picking the latter for 0.16.1 is simpler.

# Objective

The `std` module is where we implement the reflection traits for types
that are exported from `std` (including `core` and `alloc`). Over time,
this file has grown increasingly large, making it difficult to navigate
and a pain point for merge conflicts.

The goal of this PR is to break up the module into smaller chunks.

## Solution

The `std` module has been split into many submodules:
- `alloc`
- `bevy_platform`
- `core`
- `std`

Each of these new modules is comprised of submodules that closely
resemble the actual module. For example, the impls for
`::alloc::vec::Vec` have been moved to
`bevy_reflect::impls::alloc::vec::Vec`.

Some liberties were taken. For example, `Cow<'static, Path>` was kept in
`bevy_reflect::impls::std::path` rather than
`bevy_reflect::impls::alloc::borrow`.

You may ask: _Isn't this a little overkill? Why does the one-line impl
for `TypeId` need its own file?_

And yes, it is partly overkill. But the benefit with this approach is
that where an `std`-related type should live is mostly unambiguous. If
we wanted to reflect `::core::net::Ipv4Addr`, it's very clear that it
should be done in `bevy_reflect::impls::core::net`.

We can discuss better ways of breaking this up if people have other
ideas or opinions, but I think this is a pretty straightforward way of
doing it.

### Note to Reviewers

The code is pretty much copy-paste from the mega module to the new
submodules. It's probably best to focus efforts on reviewing the general
module structure, as well as maybe which impls are included where.

You _can_ review the code contained within each impl, but I promise you
the only thing I touched were the paths in the macros so they could be
more hygienic :)

## Testing

You can just check that everything compiles still:

```
cargo check -p bevy_reflect --tests
```
2025-05-26 19:10:47 +00:00
IceSentry
85284cbb90
Move trigger_screenshots to finish() (#19204)
# Objective

- The tigger_screenshots system gets added in `.build()` but relies on a
resource that is only inserted in `.finish()`
- This isn't a bug for most users, but when doing headless mode testing
it can technically work without ever calling `.finish()` and did work
before bevy 0.15 but while migrating my work codebase I had an issue of
test failing because of this

## Solution

- Move the trigger_screenshots system to `.finish()`

## Testing

- I ran the screenshot example and it worked as expected
2025-05-26 18:07:17 +00:00
Griffin
d79efada3b
Optional explicit compressed image format support (#19190)
# Objective

- Allow compressed image formats to be used with `ImagePlugin` and
`GltfPlugin` in cases where there is no `RenderDevice` resource. (For
example, when using a custom render backend)

## Solution

- Define a `CompressedImageFormatSupport` component that allows the user
to explicitly determine which formats are supported.

~~Not sure if this is the best solution. Alternatively, I considered
initializing CompressedImageFormatSupport from render device features
separately, it would need to run after the render device is initialized
but before `ImagePlugin` and `GltfPlugin` finish. Not sure where the
best place for that to happen would be.~~

Update: decided on going with @greeble-dev solution: defining the
`CompressedImageFormatSupport` resource in `bevy_image`, but letting
`bevy_render` register the resource value.
2025-05-26 18:00:33 +00:00
universe
5117e6fd49
don't filter dragged entity out of DragEnter events (#19179)
## produce a DragEnter event when reentering the dragged entity

when making a piano, i want dragging across the keys to trigger the
notes of each key, but currently if i drag out of a key, then back to
it, this will not work since the dragged entity gets filtered out

## Solution

- make DragEnter event work whenever there's an entry. if the user wants
to ignore the dragged entity they can compare `target` and `dragged`

## Testing

- tested this with a modified version of the 2d_shapes example. i added
an observer to the entities: (and added mesh picking plugin)
```rust
.observe(|t: Trigger<Pointer<DragEnter>>| {
    info!("entered {}, started from {}", t.target(), t.dragged);
}
```
- i'm not sure if other things need more testing, or if this is wrong
completely and breaks other things i don't know of!

---

## Showcase

before:


https://github.com/user-attachments/assets/48de606a-e44d-4ca1-ae16-d8dcef640d6e

after:


https://github.com/user-attachments/assets/b1be231f-c826-47bc-be43-c637f22e7846
2025-05-26 17:56:54 +00:00
Stepan Urazov
53f1c06e63
Added support for .wesl files to the regex pattern for examples (#19178)
## Objective

[Shaders / Material -
WESL](https://bevyengine.org/examples-webgpu/shaders/shader-material-wesl/)
example doesn't have a WESL file tab


## Solution

 Added wesl to regex

---------

Co-authored-by: Stepan Urazov <110625288+hg127@users.noreply.github.com>
2025-05-26 17:52:59 +00:00
Lomírus
d1f6470cc2
Fix mismatched FogFalloff (#19174)
# Objective

When user presses <kbd>3</kbd>, the falloff mode should be changed to
`ExponentialSquared` as described in the instructions, but it's not in
fact.

Online Example: https://bevyengine.org/examples-webgpu/3d-rendering/fog/

## Solution

Change it to `ExponentialSquared`

## Testing

- Did you test these changes? If so, how?

Yes, by `cargo run --example fog`

- Are there any parts that need more testing?

No.

- How can other people (reviewers) test your changes? Is there anything
specific they need to know?

```
cargo run --example fog
```

- If relevant, what platforms did you test these changes on, and are
there any important ones you can't test?

N/A
2025-05-26 17:52:27 +00:00
Weihnachtsbaum
841105a993
Add AudioSinkPlayback::position (#19173)
# Objective

- Allow users to get the playback position of playing audio.

## Solution

- Add a `position` method to `AudioSinkPlayback`
- Implement it for `AudioSink` and `SpatialAudioSink`

## Testing

- Updated `audio_control` example to show playback position
2025-05-26 17:50:40 +00:00
Arnold Loubriat
645871e74e
Bump accesskit to 0.19 and accesskit_winit to 0.27 (#19160)
# Objective

- Update AccessKit crates to their latest versions.
- Fixes #19040 

## Solution

- Only modifying Cargo.toml files is needed, few changes under the hood
but nothing impacting Bevy.

## Testing

- I ran the tab_navigation example on Windows 11.
2025-05-26 17:48:36 +00:00
Eagster
b6b54912fa
Nonmax all rows (#19132)
# Objective

Since #18704 is done, we can track the length of unique entity row
collections with only a `u32` and identify an index within that
collection with only a `NonMaxU32`. This leaves an opportunity for
performance improvements.

## Solution

- Use `EntityRow` in sparse sets.
- Change table, entity, and query lengths to be `u32` instead of
`usize`.
- Keep `batching` module `usize` based since that is reused for events,
which may exceed `u32::MAX`.
- Change according `Range<usize>` to `Range<u32>`. This is more
efficient and helps justify safety.
- Change `ArchetypeRow` and `TableRow` to wrap `NonMaxU32` instead of
`u32`.

Justifying `NonMaxU32::new_unchecked` everywhere is predicated on this
safety comment in `Entities::set`: "`location` must be valid for the
entity at `index` or immediately made valid afterwards before handing
control to unknown code." This ensures no entity is in two table rows
for example. That fact is used to argue uniqueness of the entity rows in
each table, archetype, sparse set, query, etc. So if there's no
duplicates, and a maximum total entities of `u32::MAX` none of the
corresponding row ids / indexes can exceed `NonMaxU32`.

## Testing

CI

---------

Co-authored-by: Christian Hughes <9044780+ItsDoot@users.noreply.github.com>
2025-05-26 17:39:55 +00:00
atlv
7bb97a7eec
Provide physical dimensions to wgpu Device::create_texture_with_data (#19129)
# Objective

- Make errors in #19124 #13289 clearer, and opt for option 1. of
https://github.com/gfx-rs/wgpu/issues/7677

## Solution

Remove the round to block size `.physical_size(texture_format);`

Error message now becomes much clearer:
```
thread 'Compute Task Pool (5)' panicked at E:\r\wgpu\wgpu\src\backend\wgpu_core.rs:1423:26:
wgpu error: Validation Error

Caused by:
  In Device::create_texture
    Width 2050 is not a multiple of Bc7RgbaUnormSrgb's block width (4)
```

## Testing

- Tested using the repro in #19124
2025-05-26 17:36:47 +00:00
Gilles Henaux
6341ae4158
Fix AssetChanged code documentation to mention the PostUpdate schedule (#19093)
# Objective

- Fix `AssetChanged` code documentation to mention the `PostUpdate`
schedule instead of the `Last` schedule

## Testing

- Trivial (code doc). Check `bevy_asset/src/lib.rs` in function
`init_asset` to see where this is scheduled:
```rust
           .add_systems(
                PostUpdate,
                Assets::<A>::asset_events
                    .run_if(Assets::<A>::asset_events_condition)
                    .in_set(AssetEvents),
            )
```

Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
2025-05-26 17:34:46 +00:00
SpecificProtagonist
57eda2efa1
Remove warning from Image::resize (#19116)
# Objective

`Image::resize` currently prints a warning when resizing an
uninitialized `Image`, even though the resizing works correctly. For
[code](c92f14c9e7/crates/bevy_ui/src/widget/viewport.rs (L175-L179))
that doesn't care about whether the image is initialized CP-side, this
is inconvenient and unnecessary.
2025-05-26 17:34:07 +00:00
noxmore
c84a808f80
Derive PartialEq for ImageSampler (#19105)
# Objective

Ran into a situation where I need to compare two image samplers. My
current workaround is to compare the `Debug` outputs

## Solution

Derive `PartialEq` on `ImageSampler` and structs in its fields.

## Testing

Full CI passed.
2025-05-26 17:31:21 +00:00
Kumikaya
ee3d9b2a88
Reduce operations in RayCast2d::circle_intersection_at using cross product (#19103)
# Objective

- Using the cross product to compute the perpendicular distance reduces
one multiplication and two additions.
2025-05-26 17:22:14 +00:00
SpecificProtagonist
1c8d2ee3e1
viewport_node example: Remove main world image initialization (#19098)
# Objective

The new viewport example allocates a texture in main memory, even though
it's only needed on the GPU. Also fix an unnecessary warning when a
viewport's texture doesn't exist CPU-side.

## Testing

Run the `viewport_node` example.
2025-05-26 17:20:29 +00:00
robtfm
b641aa0ecf
separate border colors (#18682)
# Objective

allow specifying the left/top/right/bottom border colors separately for
ui elements

fixes #14773

## Solution

- change `BorderColor` to 
```rs
pub struct BorderColor {
    pub left: Color,
    pub top: Color,
    pub right: Color,
    pub bottom: Color,
}
```
- generate one ui node per distinct border color, set flags for the
active borders
- render only the active borders

i chose to do this rather than adding multiple colors to the
ExtractedUiNode in order to minimize the impact for the common case
where all border colors are the same.

## Testing

modified the `borders` example to use separate colors:


![image](https://github.com/user-attachments/assets/5d9a4492-429a-4ee1-9656-215511886164)

the behaviour is a bit weird but it mirrors html/css border behaviour.

---

## Migration:

To keep the existing behaviour, just change `BorderColor(color)` into
`BorderColor::all(color)`.

---------

Co-authored-by: ickshonpe <david.curthoys@googlemail.com>
2025-05-26 16:57:13 +00:00
Emerson Coskey
fb2d79ad60
Better macro errors for get_struct_fields (#17639)
# Objective

- Currently, the error span for `get_struct_field` when encountering an
enum or union points to the macro invocation, rather than the `enum` or
`union` token. It also doesn't mention which macro reported the error.

## Solution

- Report the correct error span
- Add parameter for passing in the name of the macro invocation

## Testing

Bevy compiles fine with this change

## Migration Guide

```rs
// before
let fields = get_struct_fields(&ast.data);

// after
let fields = get_struct_fields(&ast.data, "derive(Bundle)");
```

---------

Co-authored-by: Chris Russell <8494645+chescock@users.noreply.github.com>
2025-05-26 16:57:03 +00:00
Periwink
f33074116b
Make SystemChangeTick Clone (#18991)
# Objective

It can be useful to store the `SystemChangeTick` for a given System. I
wanted to copy them but I noticed that it doesn't implement Clone.
2025-05-26 15:43:06 +00:00
Ben Frankel
475b5a8557
Improve visibility of debug picking node (#18990)
# Objective

Fixes https://github.com/bevyengine/bevy/issues/18989.

## Solution

Add `GlobalZIndex(i32::MAX)`,
`BackgroundColor(Color::BLACK.with_alpha(0.75))`, and some padding.

## Testing

Ran `cargo run --example debug_picking`:


![2025-04-30_1745997924_1280x720](https://github.com/user-attachments/assets/4bd39897-f4ab-4d4d-850b-1b885284b072)

Before this PR:


![2025-04-29_1745972540_1280x720](https://github.com/user-attachments/assets/9c8649f4-0f06-4d4d-8fed-ac20e0d5366e)
2025-05-26 15:39:49 +00:00
Tim
4924cf5828
Remove upcasting methods + Cleanup interned label code (#18984)
Hiya!

# Objective

- Remove upcasting methods that are no longer necessary since Rust 1.86.
- Cleanup the interned label code.
 
## Notes
- I didn't try to remove the upcasting methods from `bevy_reflect`, as
there appears to be some complexity related to remote type reflection.
- There are likely some other upcasting methods floating around.

## Testing
I ran the `breakout` example to check that the hashing/eq
implementations of the labels are still correct.

---------

Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
2025-05-26 15:38:12 +00:00
Jakob Hellermann
93b8f9a303
bevy_ecs: forward type_id in InfallibleSystemWrapper (#18931)
similar to https://github.com/bevyengine/bevy/pull/12030

# Objective

`bevy_mod_debugdump` uses the `SystemTypeSet::system_type` to look up
constrains like `(system_1, system_2.after(system_1))`. For that it
needs to find the type id in `schedule.graph().systems()`

Now with systems being wrapped in an `InfallibleSystemWrapper` this
association was no longer possible.

## Solution

By forwarding the type id in `InfallibleSystemWrapper`,
`bevy_mod_debugdump` can resolve the dependencies as before, and the
wrapper is an unnoticable implementation detail.

## Testing

- `cargo test -p bevy_ecs`
I'm not sure what exactly could break otherwise.
2025-05-26 15:33:05 +00:00
Saladin
af874a58c3
Added explicit dependencies for Arch Linux (#10386)
As I run bevy in a apx container, the default dependencies are bare
minimum.. because of which I was able to find the explicit dependencies
required for bevy. 👍 the same shall also be applicable for the other
distributions but I will have to figure out explicit ones for them and
might open a PR for them later.

# Objective

- Have explicit dependencies listed for a bare minimum system /
container

## Solution

- Running bevy in a bare minimum apx / distrobox container.

---

## Changelog

- Added explicit dependency instructions for Arch Linux

Co-authored-by: SHuRiKeN <40650341+shuriken1812@users.noreply.github.com>
Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
2025-05-26 15:32:48 +00:00
Sébastien Job
2b8bf45f0d
Fix BRP query failing when specifying missing/invalid components (#18871)
# Objective

- Fixes #18869.

## Solution

The issue was the `?` after a `Result` raising the error, instead of
treating it.
Instead it is handled with `ok`, `and_then`, `map` ...

_Edit: I added the following logic._
On `bevy/query` remote requests, when `strict` is false:
- Unregistered components in `option` and `without` are ignored.
- Unregistered components in `has` are considered absent from the
entity.
- Unregistered components in `components` and `with` result in an empty
response since they specify hard requirements.

I made the `get_component_ids` function return a
`AnyhowResult<(Vec<(TypeId, ComponentId)>, Vec<String>)>` instead of the
previous `AnyhowResult<Vec<(TypeId, ComponentId)>>`; that is I added the
list of unregistered components.

## Testing

I tested changes using the same procedure as in the linked issue:
```sh
cargo run --example server --features="bevy_remote"
```
In another terminal:
```sh
# Not strict:
$ curl -X POST http://localhost:15702 -H "Content-Type: application/json" -d '{ "jsonrpc": "2.0", "method": "bevy/query", "id": 0, "params": { "data": { "components": [ "foo::bar::MyComponent" ] } } }'
{"jsonrpc":"2.0","id":0,"result":[]}

# Strict:
$ curl -X POST http://localhost:15702 -H "Content-Type: application/json" -d '{ "jsonrpc": "2.0", "method": "bevy/query", "id": 0, "params": { "data": { "components": [ "foo::bar::MyComponent" ] }, "strict": true } }'
{"jsonrpc":"2.0","id":0,"error":{"code":-23402,"message":"Component `foo::bar::MyComponent` isn't registered or used in the world"}}
```
2025-05-26 15:26:46 +00:00
ickshonpe
c8872c7665
Allow access to font atlases (#18851)
# Objective
It's not possible atm for third-party crates to create their own text
systems that use the existing cosmic-text `FontSystem` and font atlases.

## Solution
Make `FontFaceInfo`, `TextPipeline::map_handle_to_font_id`, and
`load_font_fontdb` public so third-party crates can access and update
the existing font atlases
2025-05-26 15:22:56 +00:00
ickshonpe
3edacb5e46
Enable accessibility features for the button example (#18749)
# Objective

Accessibility features don't work with the UI `button` example because
`InputFocus` must be set for the accessibility systems to recognise the
button.

Fixes #18760

## Solution

* Set the button entity as the `InputFocus` when it is hovered or
pressed.
* Call `set_changed` on the `Button` component when the button's state
changes to hovered or pressed (the accessibility system's only update
the button's state when the `Button` component is marked as changed).

## Testing

Install NVDA, it should say "hover" when the button is hovered and
"pressed" when the button is pressed.

The bounds of the accessibility node are reported incorrectly. I thought
we fixed this, I'll take another look at it. It's not a problem with
this PR.
2025-05-26 15:19:55 +00:00