forked from bevyengine/bevy
-
Notifications
You must be signed in to change notification settings - Fork 0
[pull] main from bevyengine:main #165
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
Open
pull
wants to merge
108
commits into
jnhyatt:main
Choose a base branch
from
bevyengine:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Objective The required miri check is currently failing due to rust-lang/miri#4323 Let's pin nightly to yesterday to not be blocked today. ## Solution - Pinned nightly to `nightly-2025-05-16` ## Testing - Let's see if the pipeline is green on this PR :D
…19266) # Objective - transitive shader imports sometimes fail to load silently and return Ok - Fixes #19226 ## Solution - Don't return Ok, return the appropriate error code which will retry the load later when the dependencies load ## Testing - `bevy run --example=3d_scene web --open` Note: this is was theoretically a problem before the hot reloading PR, but probably extremely unlikely to occur.
# Objective Fixes #18945 ## Solution Entities that are not visible in any view (camera or light), get their render meshes removed. When they become visible somewhere again, the meshes get recreated and assigned possibly different ids. Point/spot light visible entities weren't cleared when the lights themseves went out of view, which caused them to try to queue these fake visible entities for rendering every frame. The shadow phase cache usually flushes non visible entites, but because of this bug it never flushed them and continued to queue meshes with outdated ids. The simple solution is to every frame clear all visible entities for all point/spot lights that may or may not be visible. The visible entities get repopulated directly afterwards. I also renamed the `global_point_lights` to `global_visible_clusterable` to make it clear that it includes only visible things. ## Testing - Tested with the code from the issue.
# Objective Fixes #19150 ## Solution Normally the `validate_cached_entity` in https://github.com/bevyengine/bevy/blob/86cc02dca229662bdfb371a0e5a1716560ea7baa/crates/bevy_pbr/src/prepass/mod.rs#L1109-L1126 marks unchanged entites as clean, which makes them remain in the phase. If a material is changed to an `alpha_mode` that isn't supposed to be added to the prepass pipeline, the specialization system just `continue`s and doesn't indicate to the cache that the entity is not clean anymore. I made these invalid entities get removed from the pipeline cache so that they are correctly not marked clean and then removed from the phase. ## Testing Tested with the example code from the issue.
# Objective - Reduce nesting ## Solution - Refactor ## Testing - `bevy run --example=3d_scene web --open`
# Objective [see original comment](#18801 (comment)) > Alternately, could we store it on the World instead of a global? I think we have a World nearby whenever we call default_error_handler(). That would avoid the need for atomics or locks, since we could do ordinary reads and writes to the World. Global error handlers don't actually need to be global – per world is enough. This allows using different handlers for different worlds and also removes the restrictions on changing the handler only once. ## Solution Each `World` can now store its own error handler in a resource. For convenience, you can also set the default error handler for an `App`, which applies it to the worlds of all `SubApp`s. The old behavior of only being able to set the error handler once is kept for apps. We also don't need the `configurable_error_handler` feature anymore now. ## Testing New/adjusted tests for failing schedule systems & observers. --- ## Showcase ```rust App::new() .set_error_handler(info) … ```
# Objective Been looking for simplifications in the text systems as part of the text input changes. This enum isn't very helpful I think. We can remove it and the associated parameters and instead just negate the glyph's y-offsets in `extract_text2d_sprite`. ## Solution Remove the `YAxisOrientation` enum and parameters. Queue text sprites relative to the top-left in `extract_text2d_sprite` and negate the glyph's y-offset. ## Testing The `text2d` example can be used for testing: ``` cargo run --example text2d ```
# Objective Add documentation for the last two functions in bevy_picking that are missing them. ## Solution Add boilerplate "Constructs an X" to `PointerHits::new()` and `HitData::new()`. This form of no-information documentation of `new()` functions is used in several places in the repo, and @alice-i-cecile agreed that this is a reasonable approach - the params are already documented on the fields within the struct definition. --------- Co-authored-by: Jan Hohenheim <[email protected]>
# Objective Minor docs fix - add missing "is responsible".
# Objective Spot light shadows are still broken after fixing point lights in #19265 ## Solution Fix spot lights in the same way, just using the spot light specific visible entities component. I also changed the query to be directly in the render world instead of being extracted to be more accurate. ## Testing Tested with the same code but changing `PointLight` to `SpotLight`.
# Objective Fixes errors and warnings on this week's Rust beta pipeline * #18748 (comment)
# Objective Fixes #19286 ## Solution Use material name for mesh entity's Name when available ## Testing Test code, modified from examples/load_gltf.rs ```rust //! Loads and renders a glTF file as a scene. use bevy::{gltf::GltfMaterialName, prelude::*, scene::SceneInstanceReady}; fn main() { App::new() .add_plugins(DefaultPlugins) .add_systems(Startup, setup) .add_observer(on_scene_load) .run(); } fn setup(mut commands: Commands, asset_server: Res<AssetServer>) { commands.spawn(( Camera3d::default(), Transform::from_xyz(0.7, 0.7, 1.0).looking_at(Vec3::new(0.0, 0.3, 0.0), Vec3::Y), )); commands.spawn((DirectionalLight { shadows_enabled: true, ..default() },)); commands.spawn(SceneRoot(asset_server.load( GltfAssetLabel::Scene(0).from_asset("models/FlightHelmet/FlightHelmet.gltf"), ))); } fn on_scene_load( trigger: Trigger<SceneInstanceReady>, children: Query<&Children>, names: Query<&Name>, material_names: Query<&GltfMaterialName>, ) { let target = trigger.target(); for child in children.iter_descendants(target) { let name = if let Ok(name) = names.get(child) { Some(name.to_string()) } else { None }; let material_name = if let Ok(name) = material_names.get(child) { Some(name.0.clone()) } else { None }; info!("Entity name:{:?} | material name:{:?}", name, material_name); } } ``` --- ## Showcase Run log: <img width="859" alt="Image" src="https://github.com/user-attachments/assets/87daddf3-31e6-41f8-9be2-4b292da9b75a" /> --------- Co-authored-by: Alice Cecile <[email protected]> Co-authored-by: Greeble <[email protected]>
# Objective Allowing drawing of UI nodes with a gradient instead of a flat color. ## Solution The are three gradient structs corresponding to the three types of gradients supported: `LinearGradient`, `ConicGradient` and `RadialGradient`. These are then wrapped in a `Gradient` enum discriminator which has `Linear`, `Conic` and `Radial` variants. Each gradient type consists of the geometric properties for that gradient and a list of color stops. Color stops consist of a color, a position or angle and an optional hint. If no position is specified for a stop, it's evenly spaced between the previous and following stops. Color stop positions are absolute, if you specify a list of stops: ```vec   Conic gradients can be used to draw simple pie charts like in CSS: 
## Objective Fix the misleading 2d anchor API where `Anchor` is a component and required by `Text2d` but is stored on a field for sprites. Fixes #18367 ## Solution Remove the `anchor` field from `Sprite` and require `Anchor` instead. ## Migration Guide The `anchor` field has been removed from `Sprite`. Instead the `Anchor` component is now a required component on `Sprite`.
# Objective - Fixes #17390 ## Solution - Remove Component derive ## Testing - cargo clippy
# Objective Fixes #19120 ## Solution Use the find and replace token feature in VSCode to replace all the `Condition`s with `SystemCondition`s. Then look through all the documentation with find and replace to replace all the `Condition`s there. ## Testing - Did you test these changes? If so, how? Yes, used cargo clippy, cargo build and cargo test. - Are there any parts that need more testing? Nope - How can other people (reviewers) test your changes? Is there anything specific they need to know? By compiling and running bevy - If relevant, what platforms did you test these changes on, and are there any important ones you can't test? Shouldn't be, but Fedora Linux with KDE Wayland
## Objective Add documentation useful to users of `bevy_ecs` not also using `App`. Fixes #19270. ## Solution * Add explanation of labels to `Schedule` documentation. * Add example of `derive(ScheduleLabel)` to `trait ScheduleLabel`. * Add a third example to `Schedule` which demonstrates using a schedule via label instead of owning it directly. * Add further explanation and links to `World::add_schedule()`, and `World::run_schedule()`. ## Testing Reviewed generated documentation. Please review this documentation carefully for correctness, as I have little experience with `bevy_ecs` and I am adding this information because it would have helped my own past confusion, but I may still be wrong about how things should be done. --------- Co-authored-by: Alice Cecile <[email protected]> Co-authored-by: theotherphil <[email protected]>
# Objective allow serialization / deserialization on the `ChildOf` entity, for example in network usage. my usage was for the bevy_replicon crate, to replicate `ChildOf`. ## Solution same implementation of serde as other types in the bevy repo --------- Co-authored-by: Hennadii Chernyshchyk <[email protected]>
# Objective Remove errant "a" from docs. (I'm assuming that this sort of trivial fix is easy enough to merge that it's worth doing, but let me know if you'd prefer me to not bother.)
# Objective Fix incorrect average returned by `Diagnostic` after `clear_history` is called. ## Solution Reset sum and ema values in `Diagnostic::clear_history`. ## Testing I have added a cargo test for `Diagnostic::clear_history` that checks average and smoothed average. This test passes, and should not be platform dependent.
# Objective Closes #19175 Make `LogDiagnosticsState` public to be able to edit its filters ## Solution Make `LogDiagnosticsState` public and add methods to allow editing the duration and filter ## Testing `cargo run -p ci` ## Showcase Updated `log_diagnostics` example 
Stores mesh names from glTF files in GltfMeshName component rather than Name component, making both GltfMeshName and GltfMaterialName behave like strings via Deref. # Objective Fixed the side effects of #19287 Fixes Examples that modify gltf materials are broken #19322 ## Solution Add GltfMeshName component and Deref implementations Stores mesh names from glTF files in GltfMeshName component rather than Name component, making both GltfMeshName and GltfMaterialName behave like strings via Deref. ## Testing cargo run --example depth_of_field cargo run --example lightmaps cargo run --example mixed_lighting They are consistent with the situation before the error occurred. --------- Co-authored-by: Alice Cecile <[email protected]> Co-authored-by: Rob Parrett <[email protected]>
## Objective - Add a `--debug` flag to `build-wasm-example` to support debug builds for WebGL2/WebGPU targets. - Fixes #18464 ## Solution - Added `--debug` flag to build Wasm examples in debug mode. - Default remains release mode if `--debug` is not specified. - Updated documentation to describe the new flag and usage. ## Testing - Verified debug and release builds for WebGL2 and WebGPU respectively. - Confirmed wasm artifacts are placed in the correct target dir for each build profile: - Debug: `target/wasm32-unknown-unknown/debug/examples/` - Release: `target/wasm32-unknown-unknown/release/examples/` - Confirmed wasm-bindgen output is written to: `examples/wasm/target/debug` , `examples/wasm/target/release` - Haven't actually tested running the example | Backend | Profile | Artifacts written | Build success | |---------|---------|-------------------|------------------| | webgl2 | debug | ✓ | ✓ | | webgl2 | release | ✓ | ✓ | | webpgu | debug | ✓ | ✓ | | webpgu | release | ✓ | ✓ | ### Examples **Debug** ``` $ cargo run -p build-wasm-example -- --api webgl2 --debug load_gltf ``` ``` Finished `dev` profile [unoptimized + debuginfo] target(s) in 1m 02s wasm-bindgen --out-dir examples/wasm/target/debug --out-name wasm_example --target web target/wasm32-unknown-unknown/debug/examples/load_gltf.wasm ``` **Release** ``` $ cargo run -p build-wasm-example -- --api webgl2 load_gltf` ``` ``` Finished `release` profile [optimized] target(s) in 1m 08s wasm-bindgen --out-dir examples/wasm/target/release --out-name wasm_example --target web target/wasm32-unknown-unknown/release/examples/load_gltf.wasm ``` --------- Co-authored-by: Rob Parrett <[email protected]>
# Objective Now that `bevy_platform::cfg` is merged, we can start tidying up features. This PR starts with `bevy_utils`. ## Solution - Removed `serde` and `critical-section` features (they were just re-exports of `bevy_platform` anyway) - Removed `std`, `alloc` features, relying on `bevy_platform::cfg` to check for availability. - Added `parallel` feature to provide access to the `Parallel` type. - Moved the `HashMap` type aliases into `map.rs` for better organisation. ## Testing - CI
# Objective Fill in some `Reflect` and `app.register_type` gaps. I only really wanted `GlobalZIndex` but figured I'd fill in a few others as well.
## Objective Fix #19114. ## Solution #17875 changed the glTF importer to make sure that sampler filters are linear when anisotropic filtering is enabled - this is required by `wgpu`. But the condition was mistakenly inverted, so it forces the filtering to linear when anisotropic filtering is _not_ enabled. ## Testing ``` cargo run --example color_grading cargo run --example testbed_3d ```
# 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.
# 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
) # 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"}} ```
# Objective Found a typo while looking at gradients in another issue and gave the docs a skim for more. ## Solution A couple typo fixes and some tiny improvements
# 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_anti_aliasing`. ## Testing - `anti_aliasing` 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.
# Objective - A step towards splitting out bevy_camera from bevy_render ## Solution - Move a shim type into bevy_utils to avoid a dependency cycle - Manually expand Deref/DerefMut to avoid having a bevy_derive dependency so early in the dep tree ## Testing - It compiles
# 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_sprite`. ## Testing - `sprite` example still works. - `mesh2d` 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.
…19305) # Objective - move SyncCell and SyncUnsafeCell to bevy_platform ## Solution - move SyncCell and SyncUnsafeCell to bevy_platform ## Testing - cargo clippy works
# Objective - Mend incorrect docs ## Solution - Mend them - add example use - clarify column major ## Testing - No code changes
# Objective Remove `ArchetypeComponentId` and `archetype_component_access`. Following #16885, they are no longer used by the engine, so we can stop spending time calculating them or space storing them. ## Solution Remove `ArchetypeComponentId` and everything that touches it. The `System::update_archetype_component_access` method no longer needs to update `archetype_component_access`. We do still need to update query caches, but we no longer need to do so *before* running the system. We'd have to touch every caller anyway if we gave the method a better name, so just remove `System::update_archetype_component_access` and `SystemParam::new_archetype` entirely, and update the query cache in `Query::get_param`. The `Single` and `Populated` params also need their query caches updated in `SystemParam::validate_param`, so change `validate_param` to take `&mut Self::State` instead of `&Self::State`.
# Objective - Addresses the previous example's lack of visual appeal and clarity. It was missing labels for clear distinction of the shadow settings used on each of the shapes. The suggestion in the linked issue was to either just visually update and add labels or to collapse example to a single node with adjustable settings. - Fixes #19240 ## Solution - Replace the previous static example with a single, central node with adjustable settings as per issue suggestion. - Implement button-based setting adjustments. Unfortunately slider widgets don't seem available yet and I didn't want to further bloat the example. - Improve overall aesthetics of the example -- although color pallette could still be improved. flat gray tones are probably not the best choice as a contrast to the shadow, but the white border does help in that aspect. - Dynamically recolor shadows for visual clarity when increasing shadow count. - Add Adjustable Settings: - Shape selection - Shadow X/Y offset, blur, spread, and count - Add Reset button to restore default settings The disadvantage of this solution is that the old example code would have probably been easier to digest as the new example is quite bloated in comparison. Alternatively I could also just implement labels and fix aesthetics of the old example without adding functionality for adjustable settings, _but_ I personally feel like interactive examples are more engaging to users. ## Testing - Did you test these changes? If so, how? `cargo run --example box_shadow` and functionality of all features of the example. - Are there any parts that need more testing? Not that I am aware of. - How can other people (reviewers) test your changes? Is there anything specific they need to know? Not really, it should be pretty straightforward just running the new example and testing the feats. --- ## Showcase   --------- Co-authored-by: ickshonpe <[email protected]>
Make directional light cascades and tonemapping luts pub so that custom render passes / backends can use them.
# Objective Fixes #18905 ## Solution `world.commands().entity(target_entity).queue(command)` calls `commands.with_entity` without an error handler, instead queue on `Commands` with an error handler ## Testing Added unit test Co-authored-by: Heart <>
# Objective Fixes #19383 ## Solution Add missing param and flags from `ui.wgsl` to `gradients.wgsl` ## Testing `cargo run --example gradients` `cargo run --example stacked_gradients` `cargo run --example radial_gradients` ## Notes `radial_gradients` looks broken, but this appears to be a separate issue. Its appearance now is the same as in the [first screenshot](https://pixel-eagle.com/project/b25a040a-a980-4602-b90c-d480ab84076d/run/10348/compare/10342?screenshot=UI%20(User%20Interface)/radial_gradients.png) recorded in the example runner. I will document this in a separate issue.
# Objective Fixes #19385 Note: this has shader errors due to #19383 and should probably be merged after #19384 ## Solution - Move the example to the UI testbed - Adjust label contents and cell size so that every test case fits on the screen - Minor tidying, slightly less harsh colors while preserving the intentional debug coloring ## Testing `cargo run --example testbed_ui`  --------- Co-authored-by: François Mockers <[email protected]>
) # 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_core_pipeline`. ## Testing - `bloom_3d` example still works. - `motion_blur` example still works. - `meshlet` example still works (it uses a shader from core). 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.
# 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_gizmos`. ## Testing - `2d_gizmos` example still works. - `3d_gizmos` 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.
# 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_ui`. ## Testing - `box_shadow` example still works. - `gradient` example is broken at head (see #19384) - but otherwise gives the same result in the console. - `ui_materials` example still works. - `ui_texture_slice` 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.
# 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_pbr` (excluding meshlets). ## Testing - `atmosphere` example still works - `fog` example still works - `decal` 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.
# Objective #19047 added an `MaybeUninit` field to `EntityMeta`, but did not guarantee that it will be initialized before access: ```rust let mut world = World::new(); let id = world.entities().reserve_entity(); world.flush(); world.entity(id); ``` <details> <summary>Miri Error</summary> ``` error: Undefined Behavior: using uninitialized data, but this operation requires initialized memory --> /home/vj/workspace/rust/bevy/crates/bevy_ecs/src/entity/mod.rs:1121:26 | 1121 | unsafe { meta.spawned_or_despawned.assume_init() } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory | = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information = note: BACKTRACE: = note: inside closure at /home/vj/workspace/rust/bevy/crates/bevy_ecs/src/entity/mod.rs:1121:26: 1121:65 = note: inside `std::option::Option::<&bevy_ecs::entity::EntityMeta>::map::<bevy_ecs::entity::SpawnedOrDespawned, {closure@bevy_ecs::entity::Entities::entity_get_spawned_or_despawned::{closure#1}}>` at /home/vj/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs:1144:29: 1144:33 = note: inside `bevy_ecs::entity::Entities::entity_get_spawned_or_despawned` at /home/vj/workspace/rust/bevy/crates/bevy_ecs/src/entity/mod.rs:1112:9: 1122:15 = note: inside closure at /home/vj/workspace/rust/bevy/crates/bevy_ecs/src/entity/mod.rs:1094:13: 1094:57 = note: inside `bevy_ecs::change_detection::MaybeLocation::<std::option::Option<&std::panic::Location<'_>>>::new_with_flattened::<{closure@bevy_ecs::entity::Entities::entity_get_spawned_or_despawned_by::{closure#0}}>` at /home/vj/workspace/rust/bevy/crates/bevy_ecs/src/change_detection.rs:1371:20: 1371:24 = note: inside `bevy_ecs::entity::Entities::entity_get_spawned_or_despawned_by` at /home/vj/workspace/rust/bevy/crates/bevy_ecs/src/entity/mod.rs:1093:9: 1096:11 = note: inside `bevy_ecs::entity::Entities::entity_does_not_exist_error_details` at /home/vj/workspace/rust/bevy/crates/bevy_ecs/src/entity/mod.rs:1163:23: 1163:70 = note: inside `bevy_ecs::entity::EntityDoesNotExistError::new` at /home/vj/workspace/rust/bevy/crates/bevy_ecs/src/entity/mod.rs:1182:22: 1182:74 = note: inside `bevy_ecs::world::unsafe_world_cell::UnsafeWorldCell::<'_>::get_entity` at /home/vj/workspace/rust/bevy/crates/bevy_ecs/src/world/unsafe_world_cell.rs:368:20: 368:73 = note: inside `<bevy_ecs::entity::Entity as bevy_ecs::world::WorldEntityFetch>::fetch_ref` at /home/vj/workspace/rust/bevy/crates/bevy_ecs/src/world/entity_fetch.rs:207:21: 207:42 = note: inside `bevy_ecs::world::World::get_entity::<bevy_ecs::entity::Entity>` at /home/vj/workspace/rust/bevy/crates/bevy_ecs/src/world/mod.rs:911:18: 911:42 note: inside `main` --> src/main.rs:12:15 | 12 | world.entity(id); | ``` </details> ## Solution - remove the existing `MaybeUninit` in `EntityMeta.spawned_or_despawned` - initialize during flush. This is not needed for soundness, but not doing this means we can't return a sensible location/tick for flushed entities. ## Testing Test via the snippet above (also added equivalent test). --------- Co-authored-by: urben1680 <[email protected]>
# Objective Minimal effort to address feedback here: #19345 (comment) more thoroughly. ## Solution - Remove hardcoded label string comparisons and make more use of the new enum added during review - Resist temptation to let this snowball this into a huge refactor - Maybe come back later for a few other small improvements ## Testing `cargo run --example box_shadow`
# Objective There are several uninlined format args (seems to be in more formatting macros and in more crates) that are not detected on stable, but are on nightly. ## Solution Fix them.
# Objective Recently the `u32` `Entity::generation` was replaced with the new `EntityGeneration` in #19121. This made meanings a lot more clear, and prevented accidental misuse. One common misuse was assuming that `u32`s that were greater than others came after those others. Wrapping makes this assumption false. When `EntityGeneration` was created, it retained the `u32` ordering, which was useless at best and wrong at worst. This pr fixes the ordering implementation, so new generations are greater than older generations. Some users were already accounting for this ordering issue (which was still present in 0.16 and before) by manually accessing the `u32` representation. This made migrating difficult for avian physics; see [here](https://discord.com/channels/691052431525675048/749335865876021248/1377431569228103780). I am generally of the opinion that this type should be kept opaque to prevent accidental misuse. As we find issues like this, the functionality should be added to `EntityGeneration` directly. ## Solution Fix the ordering implementation through `Ord`. Alternatively, we could keep `Ord` the same and make a `cmp_age` method, but I think this is better, even though sorting entity ids may be *marginally* slower now (but more correct). This is a tradeoff. ## Testing I improved documentation for aliasing and ordering, adding some doc tests.
…eady on the first frame. (#19420) # Objective - Due to recent changes related to #19024, the `compute_shader_game_of_life` example panics on some machines especially on Linux. - This is due to us switching more shaders to embedded shaders - this means the compute shader in this example takes more than one frame to load. - The panic in the example occurs if the shader fails to load by the first frame (since the pipeline considers that an error). ## Solution - Make the example do nothing if the shader isn't loaded yet. This has the effect of waiting for the shader to load. ## Testing - Tested the example on my Linux laptop.
# Objective - Fixes #19418 ## Solution - Rename Position to UiPosition in bevy_ui ## Testing - `cargo build` - `cargo run --example gradients` - `cargo run --example stacked_gradients`
# Objective Fixes #19102 Updating mesh_picking doc stating that MAIN_WORLD RenderAssetUsages needs to be on the mesh to be picked.
# Objective Adds the ability to restrict playback of an audio source to a certain region in time. In other words, you can set a custom start position and duration for the audio clip. These options are set via the `PlaybackSettings` component, and it works on all kinds of audio sources. ## Solution - Added public `start_position` and `duration` fields to `PlaybackSettings`, both of type `Option<std::time::Duration>`. - Used rodio's `Source::skip_duration` and `Source::take_duration` functions to implement start position and duration, respectively. - If the audio is looping, it interacts as you might expect - the loop will start at the start position and end after the duration. - If the start position is None (the default value), the audio will start from the beginning, like normal. Similarly, if the duration is None (default), the audio source will play for as long as possible. ## Testing I tried adding a custom start position to all the existing audio examples to test a bunch of different audio sources and settings, and they all worked fine. I verified that it skips the right amount of time, and that it skips the entire audio clip if the start position is longer than the length of the clip. All my testing was done on Fedora Linux. Update: I did similar testing for duration, and ensured that the two options worked together in combination and interacted well with looping audio. --- ## Showcase ```rust // Play a 10 second segment of a song, starting at 0:30.5 commands.spawn(( AudioPlayer::new(song_handle), PlaybackSettings::LOOP .with_start_position(Duration::from_secs_f32(30.5)) .with_duration(Duration::from_secs(10)) )); ```
# Objective - Fix a reference in the example usage comments of bevy_utils Default::default ## Solution - Just a word change in the comments ## Testing - No actual code changes to test
Fixes #18623, allowing `add_state_scoped_event` to work with computed states. As a side note, should state scoped events be updated to match the recently changed [state scoped entities](https://github.com/bevyengine/bevy/blob/main/release-content/migration-guides/rename_StateScoped.md)?
# Objective Fixes #17933 ## Solution Correct "value has changed'" in docs to "value has been added or mutably dereferenced", with a note for emphasis copied from the docs for Changed. ## Testing -
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.1)
Can you help keep this open source service alive? 💖 Please sponsor : )