-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[Merged by Bors] - derive clone for Input #3569
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a fan of adding I also disagree that events used by egui should be removed from |
Yeah this seams relatively harmless. I'm in! |
bors r+ |
# Objective - As part of exploring input event suppression in bevy_egui here: vladbat00/bevy_egui@53c1773 - I found that the only way to suppress events properly, is to allow to clone the relevant Input<Whatever>, and update with events manually from within the system. This cloned Input then is discarded, the Events<*> structs are cleared, and bevy_input's normal update of Input proceeds, without the events that have been suppressed. ## Solution - This enables Input to be cloned, allowing it to be manually updated with events.
Build failed (retrying...): |
# Objective - As part of exploring input event suppression in bevy_egui here: vladbat00/bevy_egui@53c1773 - I found that the only way to suppress events properly, is to allow to clone the relevant Input<Whatever>, and update with events manually from within the system. This cloned Input then is discarded, the Events<*> structs are cleared, and bevy_input's normal update of Input proceeds, without the events that have been suppressed. ## Solution - This enables Input to be cloned, allowing it to be manually updated with events.
commit 9a7852db0f22eb41f259a1afbb4926eb73863a10 Author: devjobe <[email protected]> Date: Tue Feb 8 23:18:11 2022 +0000 Fix SetSpriteTextureBindGroup to use index (#3896) # Objective Fix `SetSpriteTextureBindGroup` to use index instead of hard coded 1. Fixes #3895 ## Solution 1 -> I Co-authored-by: devjobe <[email protected]> commit bdbf626341a35582350711f87fa17dea4ec129f6 Author: Alice Cecile <[email protected]> Date: Tue Feb 8 23:04:19 2022 +0000 Implement init_resource for `Commands` and `World` (#3079) # Objective - Fixes #3078 - Fixes #1397 ## Solution - Implement Commands::init_resource. - Also implement for World, for consistency and to simplify internal structure. - While we're here, clean up some of the docs for Command and World resource modification. commit 38f6da5a85a8037de5eb4ea8531902ea1269ede1 Author: B-Janson <[email protected]> Date: Tue Feb 8 16:24:46 2022 +0000 Add generic systems example (#2636) # Objective My attempt at fixing #2142. My very first attempt at contributing to Bevy so more than open to any feedback. I borrowed heavily from the [Bevy Cheatbook page](https://bevy-cheatbook.github.io/patterns/generic-systems.html?highlight=generic#generic-systems). ## Solution Fairly straightforward example using a clean up system to delete entities that are coupled with app state after exiting that state. Co-authored-by: B-Janson <[email protected]> commit 56b0e88b5331a2df31b757ff91b5ef30853bb5c5 Author: Loch Wansbrough <[email protected]> Date: Tue Feb 8 04:14:34 2022 +0000 Add view transform to view uniform (#3885) (cherry picked from commit de943381bd2a8b242c94db99e6c7bbd70006d7c3) # Objective The view uniform lacks view transform information. The inverse transform is currently provided but this is not sufficient if you do not have access to an `inverse` function (such as in WGSL). ## Solution Grab the view transform, put it in the view uniform, use the same matrix to compute the inverse as well. commit 1e049a651b13021653c31ec5903212936d585241 Author: Ryo Hirayama <[email protected]> Date: Tue Feb 8 04:14:33 2022 +0000 Fix type mismatch error with latest winit (#3883) # Objective When I use the latest winit with bevy main, I got this error. ``` error[E0308]: mismatched types --> /Users/ryo/.cargo/git/checkouts/bevy-f7ffde730c324c74/b13f238/crates/bevy_winit/src/lib.rs:191:5 | 191 | event_loop.run_return(event_handler) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `i32` | help: consider using a semicolon here | 191 | event_loop.run_return(event_handler); | + help: try adding a return type | 187 | -> i32 where | ++++++ ``` In [this commit](https://github.com/rust-windowing/winit/commit/a52f755ce8dfffe53329163364908937c780057d), the signature of `run_return` was changed in winit. ## Solution This tiny PR does not add support for exit code, but makes compilation successful. commit 6615b7bf6439c9bcaf59982b2713e1c1564bf0f5 Author: Daniel McNab <[email protected]> Date: Tue Feb 8 04:00:58 2022 +0000 Deprecate `.system` (#3302) # Objective - Using `.system()` is no longer idiomatic. ## Solution - Give a warning when using it commit 2f11c9dca84902423d37c887f941e835dad66ff7 Author: Gingeh <[email protected]> Date: Tue Feb 8 03:37:34 2022 +0000 Add Query::contains (#3090) # Objective - Fixes #3089 commit 1468211e2bb91c528098fbe1c7f9c3d8bbb072c7 Author: François <[email protected]> Date: Tue Feb 8 02:59:54 2022 +0000 fix unreachable macro calls for rust 2021 (#3889) # Objective - It was decided in Rust 2021 to make macro like `panic` require a string literal to format instead of directly an object - `unreachable` was missed during the first pass but it was decided to go for it anyway now: https://github.com/rust-lang/rust/issues/92137#issuecomment-1019519285 - this is making Bevy CI fail now: https://github.com/bevyengine/bevy/runs/5102586734?check_suite_focus=true ## Solution - Fix calls to `unreachable` commit b3462428c9e65865499cd3739c0ab3459a2c30d9 Author: MinerSebas <[email protected]> Date: Tue Feb 8 00:03:50 2022 +0000 Move the CoreStage::Startup to a seperate StartupSchedule label (#2434) # Objective - `CoreStage::Startup` is unique in the `CoreStage` enum, in that it represents a `Schedule` and not a `SystemStage`. - This can lead to confusion about how `CoreStage::Startup` and the `StartupStage` enum are related. - Beginners sometimes try `.add_system_to_stage(CoreStage::Startup, setup.system())` instead of `.add_startup_system(setup.system())`, which causes a Panic: ``` thread 'main' panicked at 'Stage 'Startup' does not exist or is not a SystemStage', crates\bevy_ecs\src\schedule\mod.rs:153:13 stack backtrace: 0: std::panicking::begin_panic_handler at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b\/library\std\src\panicking.rs:493 1: std::panicking::begin_panic_fmt at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b\/library\std\src\panicking.rs:435 2: bevy_ecs::schedule::{{impl}}::add_system_to_stage::stage_not_found at .\crates\bevy_ecs\src\schedule\mod.rs:153 3: bevy_ecs::schedule::{{impl}}::add_system_to_stage::{{closure}}<tuple<bevy_ecs::system::function_system::IsFunctionSystem, tuple<bevy_ecs::system::commands::Commands, bevy_ecs::change_detection::ResMut<bevy_asset::assets::Assets<bevy_render::mesh::mesh::Me at .\crates\bevy_ecs\src\schedule\mod.rs:161 4: core::option::Option<mut bevy_ecs::schedule::stage::SystemStage*>::unwrap_or_else<mut bevy_ecs::schedule::stage::SystemStage*,closure-0> at C:\Users\scher\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core\src\option.rs:427 5: bevy_ecs::schedule::Schedule::add_system_to_stage<tuple<bevy_ecs::system::function_system::IsFunctionSystem, tuple<bevy_ecs::system::commands::Commands, bevy_ecs::change_detection::ResMut<bevy_asset::assets::Assets<bevy_render::mesh::mesh::Mesh>>, bevy_ec at .\crates\bevy_ecs\src\schedule\mod.rs:159 6: bevy_app::app_builder::AppBuilder::add_system_to_stage<tuple<bevy_ecs::system::function_system::IsFunctionSystem, tuple<bevy_ecs::system::commands::Commands, bevy_ecs::change_detection::ResMut<bevy_asset::assets::Assets<bevy_render::mesh::mesh::Mesh>>, be at .\crates\bevy_app\src\app_builder.rs:196 7: 3d_scene::main at .\examples\3d\3d_scene.rs:4 8: core::ops::function::FnOnce::call_once<fn(),tuple<>> at C:\Users\scher\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core\src\ops\function.rs:227 ``` ## Solution - Replace the `CoreStage::Startup` Label with the new `StartupSchedule` unit type. Resolves #2229 commit f7478f448ab1493986a4fcb60f7567c95a8dba4d Author: dataphract <[email protected]> Date: Mon Feb 7 22:07:43 2022 +0000 doc: remove mention of void return type in entry_point docs (#3881) # Objective The docs for `{VertexState, FragmentState}::entry_point` stipulate that the entry point function in the shader must return void. This seems to be specific to GLSL; WGSL has no `void` type and its entry point functions return values that describe their output. ## Solution Remove the mention of the `void` return type. commit 3d6e4893f66bec6e6cfba8c76cf28c81bf92ea17 Author: François <[email protected]> Date: Mon Feb 7 21:50:52 2022 +0000 reverse how diagnostic values are saved (#3056) # Objective - Currently, when getting a diagnostic value, the oldest value is returned. This is not the best for a diagnostic with a large history, as you could get a value from several frames away ## Solution - I changed the order in which the history is used to follow ["The “default” usage of this type as a queue is to use push_back to add to the queue, and pop_front to remove from the queue."](https://doc.rust-lang.org/std/collections/vec_deque/struct.VecDeque.html) commit b13f238fc73692741ff87f804117770b1f42933c Author: Delphine <[email protected]> Date: Sun Feb 6 04:16:16 2022 +0000 allow Entity to be deserialized with serde_json (#3873) # Objective - `serde_json` assumes that numbers being deserialized are either u64 or i64. - `Entity` serializes and deserializes as a u32. - Deserializing an `Entity` with `serde_json` fails with: `Error("invalid type: integer 10947, expected expected Entity"` ## Solution - Implemented a visitor for u64 that allows an `Entity` to be deserialized in this case. - While I was here, also fixed the redundant "expected expected Entity" in the error message - Tested the change in a local project which now correctly deserializes `Entity` structs with `serde_json` when it couldn't before commit 75286b8540dc5795270465ed4584321f1a8dc3eb Author: François <[email protected]> Date: Sun Feb 6 01:07:56 2022 +0000 check if resource for asset already exists before adding it (#3560) # Objective - Fix #3559 - Avoid erasing existing resource `Assets<T>` when adding it twice ## Solution - Before creating a new `Assets<T>`, check if it has already been added to the world Co-authored-by: François <[email protected]> Co-authored-by: Aevyrie Roessler <[email protected]> commit 59ee512292ab5e3b4be1ed6a32e6601413096857 Author: MinerSebas <[email protected]> Date: Sun Feb 6 01:07:55 2022 +0000 Add TransformBundle (#3054) # Objective - Bevy currently has no simple way to make an "empty" Entity work correctly in a Hierachy. - The current Solution is to insert a Tuple instead: ```rs .insert_bundle((Transform::default(), GlobalTransform::default())) ``` ## Solution * Add a `TransformBundle` that combines the Components: ```rs .insert_bundle(TransformBundle::default()) ``` * The code is based on #2331, except for missing the more controversial usage of `TransformBundle` as a Sub-bundle in preexisting Bundles. Co-authored-by: MinerSebas <[email protected]> Co-authored-by: Carter Anderson <[email protected]> commit 7604665880204e0aea79611c4ce0ff9d70a55755 Author: TheRawMeatball <[email protected]> Date: Sun Feb 6 00:52:47 2022 +0000 Implement AnyOf queries (#2889) Implements a new Queryable called AnyOf, which will return an item as long as at least one of it's requested Queryables returns something. For example, a `Query<AnyOf<(&A, &B, &C)>>` will return items with type `(Option<&A>, Option<&B>, Option<&C>)`, and will guarantee that for every element at least one of the option s is Some. This is a shorthand for queries like `Query<(Option<&A>, Option<&B>, Option<&C>), Or<(With<A>, With<B>, With&C>)>>`. Co-authored-by: Carter Anderson <[email protected]> commit a0af066af7dabf40457777504d2c5e323250b000 Author: Pocket7878 <[email protected]> Date: Sat Feb 5 17:21:00 2022 +0000 fix typo in bevy_ecs/README.md (#3869) # Objective Fixes #3866 ## Solution Fix comment in bevy_ecs/README.md commit 385a2b189528d0c6c706f7d25969414b61450774 Author: François <[email protected]> Date: Sat Feb 5 01:52:47 2022 +0000 add examples on how to have a data source running in another thread / in a task pool thread (#2915) Add two examples on how to communicate with a task that is running either in another thread or in a thread from `AsyncComputeTaskPool`. Loosely based on https://github.com/bevyengine/bevy/discussions/1150 commit 865698548f23fa13a03202442bf114f5c01b8f46 Author: TheRawMeatball <[email protected]> Date: Fri Feb 4 21:22:12 2022 +0000 Fix HDR asset support (#3795) The HDR texture loader was never added to the app, this PR makes sure it is added when the relevant feature is enabled. commit 3431335ee9a2e3cfda81485d8080f85c0bc50461 Author: Jakob Hellermann <[email protected]> Date: Fri Feb 4 03:37:45 2022 +0000 add missing `into_inner` to `ReflectMut` (#3841) `Mut<T>`, `ResMut<T>` etc. have `.into_inner()` methods, but `ReflectMut` doesn't for some reason. commit 1477765f626b39c4a52d42f567acfa9efb0e8123 Author: aloucks <[email protected]> Date: Fri Feb 4 03:37:44 2022 +0000 Replace VSync with PresentMode (#3812) # Objective Enable the user to specify any presentation modes (including `Mailbox`). Fixes #3807 ## Solution I've added a new `PresentMode` enum in `bevy_window` that mirrors the `wgpu` enum 1:1. Alternatively, I could add a new dependency on `wgpu-types` if that would be preferred. commit fe0e5580db9e32f344605f598f7e2b056f2afc96 Author: Mika <[email protected]> Date: Fri Feb 4 03:37:42 2022 +0000 Fix node update (#3785) # Objective Fixes #3784 ## Solution Check if the node size is actually different from previous commit b11ee3ffb83864a989b329585e1f2ff5b368c1af Author: Gwen <[email protected]> Date: Fri Feb 4 03:37:40 2022 +0000 Remove duplicate call to set_vertex_buffer(0, ...) in shader_instancing example (#3738) ## Objective The [`DrawMeshInstanced`] command in the example sets vertex buffer 0 twice, with two identical calls to: ```rs pass.set_vertex_buffer(0, gpu_mesh.vertex_buffer.slice(..)); ``` ## Solution Remove the second call as it is unecessary. [`DrawMeshInstanced`]: https://github.com/bevyengine/bevy/blob/f3de12bc5e03c58a9b863943b8db84a321422bec/examples/shader/shader_instancing.rs#L217-L258 commit b7dfe1677fd8f92d3bbf0af658515e077b96cd1a Author: Jakob Hellermann <[email protected]> Date: Fri Feb 4 03:37:38 2022 +0000 include sources in shader validation error (#3724) ## Objective When print shader validation error messages, we didn't print the sources and error message text, which led to some confusing error messages. ```cs error: ┌─ wgsl:15:11 │ 15 │ return material.color + 1u; │ ^^^^^^^^^^^^^^^^^^^^ naga::Expression [11] ``` ## Solution New error message: ```cs error: Entry point fragment at Vertex is invalid ┌─ wgsl:15:11 │ 15 │ return material.color + 1u; │ ^^^^^^^^^^^^^^^^^^^^ naga::Expression [11] │ = Expression [11] is invalid = Operation Add can't work with [8] and [10] ``` commit aa7b15889303244ebb732e6f5663051a71d5555e Author: Boutillier <[email protected]> Date: Fri Feb 4 03:21:33 2022 +0000 Add a size method on Image. (#3696) # Objective Add a simple way for user to get the size of a loaded texture in an Image object. Aims to solve #3689 ## Solution Add a `size() -> Vec2` method Add two simple tests for this method. Updates: . method named changed from `size_2d` to `size` commit 142e7f3c5058f498f263c24d94604e5e6521d358 Author: TheRawMeatball <[email protected]> Date: Fri Feb 4 03:21:31 2022 +0000 Backport soundness fix (#3685) #3001 discovered a soundness bug in World::resource_scope, this PR backports the fix with a smaller PR to patch out the bug sooner. Fixes #3147 commit e928acb9ff12230893f696f1e2e6d5f6a17f69ac Author: Robert Swain <[email protected]> Date: Fri Feb 4 03:21:29 2022 +0000 bevy_asset: Add AssetServerSettings watch_for_changes member (#3643) # Objective - `asset_server.watch_for_changes().unwrap()` only watches changes for assets loaded **_after_** that call. - Technically, the `hot_asset_reloading` example is racey as the watch on the asset path is set up in an async task scheduled from the asset `load()`, but the filesystem watcher is only constructed in a call that comes **_after_** the call to `load()`. ## Solution - It feels safest to allow enabling watching the filesystem for changes on the asset server from the point of its construction. Therefore, adding such an option to `AssetServerSettings` seemed to be the correct solution. - Fix `hot_asset_reloading` by inserting the `AssetServerSettings` resource with `watch_for_changes: true` instead of calling `asset_server.watch_for_changes().unwrap()`. - Document the shortcomings of `.watch_for_changes()` commit ca83e8a6debce99656989df2656dd6e1926352d8 Author: dataphract <[email protected]> Date: Fri Feb 4 03:07:22 2022 +0000 fix: remove unneeded filter in check_light_mesh_visibility (#3861) # Objective The query for `VisiblePointLights` in `check_light_mesh_visibility` has a `Without<DirectionalLight>` filter. However, because `VisiblePointLights` is no longer an alias for `VisibleEntities`, the query won't conflict with the query for `DirectionalLight`s and thus the filter is unnecessary. ## Solution Remove the filter and the outdated comment explaining its purpose. commit fe4a42a6485df4e441424dc6e66ae083dac52a3b Author: Daniel Bearden <[email protected]> Date: Fri Feb 4 03:07:21 2022 +0000 Mut to immut impls (#3621) # Objective - Provide impls for mutable types to relevant immutable types. - Closes #2005 ## Solution - impl From<ResMut> for Res - impl From<NonSendMut> for NonSend - Mut to &/&mut already impl'd in change_detection_impl! macro commit 6b8d64cd019ad9a1dbe53752fed50c87c178af61 Author: JoJoJet <[email protected]> Date: Fri Feb 4 03:07:20 2022 +0000 impl more traits for bevy_core::Name (#3611) # Objective - `Name` component is missing some useful trait impls. ## Solution - Implement the missing traits. `Display`, `AsRef<str>`, and several other conversions to and from strings. commit f00aec2454dff63a992dcef30256b8663c38ac5b Author: MrGVSV <[email protected]> Date: Fri Feb 4 03:07:18 2022 +0000 Added method to restart the current state (#3328) # Objective It would be useful to be able to restart a state (such as if an operation fails and needs to be retried from `on_enter`). Currently, it seems the way to restart a state is to transition to a dummy state and then transition back. ## Solution The solution is to add a `restart` method on `State<T>` that allows for transitioning to the already-active state. ## Context Based on [this](https://discord.com/channels/691052431525675048/742884593551802431/920335041756815441) question from the Discord. Closes #2385 Co-authored-by: Carter Anderson <[email protected]> commit e2cce092d7d00d71c3643b02105e9c96879631dd Author: rezural <[email protected]> Date: Fri Feb 4 02:42:59 2022 +0000 derive clone for Input (#3569) # Objective - As part of exploring input event suppression in bevy_egui here: https://github.com/mvlabat/bevy_egui/pull/50/commits/53c1773583f2dfc2a8f8bc2aa93de1c9c5fd05ec - I found that the only way to suppress events properly, is to allow to clone the relevant Input<Whatever>, and update with events manually from within the system. This cloned Input then is discarded, the Events<*> structs are cleared, and bevy_input's normal update of Input proceeds, without the events that have been suppressed. ## Solution - This enables Input to be cloned, allowing it to be manually updated with events. commit ef65548fbaf104c7627c696a21843e41f6ca425e Author: ickk <[email protected]> Date: Fri Feb 4 02:42:58 2022 +0000 Change default window title to "app" (#3417) Implements the changes cart decided on in https://github.com/bevyengine/bevy/pull/3404#issuecomment-999806086 > - The default title should be changed to app so we don't leak the "bevy context" by default. app is generic enough that most people building real games will probably want to change it, but also generic enough that if someone doesn't manually set it, users won't bat an eye. I prefer this to binary names because they won't be consistent on all platforms / setups. A user (or developer) renaming a binary would implicitly rename the window title, which feels odd to me. > - No debug info in the title by default. An opt in plugin for that would be nice though. closes #3404 ? commit bb1538a13926327ad7996a1e7ba9c12c5784ac9a Author: Kevin King <[email protected]> Date: Fri Feb 4 02:26:18 2022 +0000 improve error message for attempting to add systems using add_system_to_stage (#3287) # Objective Fixes #3250 ## Solution Since this panic occurs in bevy_ecs, and StartupStage is part of bevy_app, we really only have access to the Debug string of the `stage_label` parameter. This led me to the hacky solution of comparing the debug output of the label the user provides with the known variants of StartupStage. An alternative would be to do this error handling further up in bevy_app, where we can access StartupStage's typeid, but I don't think it is worth having a panic in 2 places (_ecs, and _app). commit f584e729537262cb0166586933396763f353784d Author: James Beilby <[email protected]> Date: Fri Feb 4 02:09:24 2022 +0000 Add Transform::rotate_around method (#3107) # Objective - Missing obvious way to rotate a transform around a point. This is popularly used for rotation of an object in world space ("orbiting" a point), or for local rotation of an object around a pivot point on that object. - Present in other (not to be named) game engines - Was question from user on Discord today (thread "object rotation") ## Solution - Added Transform::rotate_around method where point is specified in reference frame of the parent (if any) or in world space. commit 37a7be56dbfcac13cede6df3c06c53ba79aedcb6 Author: François <[email protected]> Date: Fri Feb 4 01:46:35 2022 +0000 Make transform builder methods const (#3045) # Objective - Make transform builder methods `const` ## Solution - I made them `const` commit 7d712406fe661c79c828753db6fb20210a3d93c1 Author: Charles <[email protected]> Date: Fri Feb 4 01:24:47 2022 +0000 Simplify sending empty events (#2935) # Objective When using empty events, it can feel redundant to have to specify the type of the event when sending it. ## Solution Add a new `fire()` function that sends the default value of the event. This requires that the event derives Default. Co-authored-by: Carter Anderson <[email protected]> commit 6f111136b9f2ebd5ab0975389f4c810242d1645d Author: Daniel McNab <[email protected]> Date: Thu Feb 3 23:56:57 2022 +0000 Cleanup some things which shouldn't be components (#2982) # Objective - Using `Stopwatch` and `Timer` as raw components is a footgun. ## Solution - Stop them from being components commit 1f99363de90cafc596f162e100511c2356cabd67 Author: bilsen <[email protected]> Date: Thu Feb 3 23:43:25 2022 +0000 Add &World as SystemParam (#2923) # Objective Make it possible to use `&World` as a system parameter ## Solution It seems like all the pieces were already in place, very simple impl Co-authored-by: Carter Anderson <[email protected]> commit c216738b33d7a38aee08e885dc03f43f6b13a6f1 Author: Garett Cooper <[email protected]> Date: Thu Feb 3 23:22:08 2022 +0000 Implement len and is_empty for EventReaders (#2969) # Objective Provide a non-consuming method of checking if there are events in an `EventReader`. Fixes #2967 ## Solution Implements the `len` and `is_empty` functions for `EventReader` and `ManualEventReader`, giving users the ability to check for the presence of new events without consuming any. Co-authored-by: Carter Anderson <[email protected]> commit af22cc1dc3713a24115e1cf8088cf7d4703f6d34 Author: bjorn3 <[email protected]> Date: Thu Feb 3 22:34:31 2022 +0000 Use ManuallyDrop instead of forget in insert_resource_with_id (#2947) # Objective Calling forget would invalidate the data pointer before it is used. ## Solution Use `ManuallyDrop` to prevent the value from being dropped without moving it. commit 6ac9d6876f7c0b71b1f84ec3e5df3460acba9449 Author: Daniel McNab <[email protected]> Date: Thu Feb 3 22:34:29 2022 +0000 Make ECS benchmark more representative (#2941) # Objective - The addition was being optimised out in the `for_each` loop, but not the `for` loop - Previously this meant that the `for_each` loop looked 3 times as fast - it's actually only 2 times as fast - Effectively, the addition take one unit of time, the for_each takes one unit of time, and the for loop version takes two units of time. ## Solution - `black_box` the count in each loop Note that this does not fix `for_each` being faster than `for`, unfortunately. commit c44f8b2b68dfece1183c2ec7abb26b5fde746304 Author: Alice Cecile <[email protected]> Date: Thu Feb 3 04:25:45 2022 +0000 Run tests (including doc tests) in `cargo run -p ci` command (#3849) # Objective - Using the `cargo run -p ci` command locally is unreliable, as it does not run tests. - This is particularly unreliable for doc tests, as they are not run as part of `cargo test`. ## Solution - add more steps to the appropriate Rust file. ## Known Problems This duplicates work done to run tests when run on Github. @mockersf, suggestions on if we care / how we can mitigate it? commit 19bd6b9c320c34d55f7e5f8bd16f51f0bb8831b2 Author: François <[email protected]> Date: Thu Feb 3 04:25:44 2022 +0000 Update rodio 0.15 (#3846) # Objective - Update rodio to 0.15 - Replace #3828 commit 21ac4bc0ae24e519896f997bcfe9c215c5f78901 Author: Stefan Seemayer <[email protected]> Date: Thu Feb 3 04:11:19 2022 +0000 impl Command for <impl FnOnce(&mut World)> (#2996) This is my first contribution to this exciting project! Thanks so much for your wonderful work. If there is anything that I can improve about this PR, please let me know :) # Objective - Fixes #2899 - If a simple one-off command is needed to be added within a System, this simplifies that process so that we can simply do `commands.add(|world: &mut World| { /* code here */ })` instead of defining a custom type implementing `Command`. ## Solution - This is achieved by `impl Command for F where F: FnOnce(&mut World) + Send + Sync + 'static` as just calling the function. I am not sure if the bounds can be further relaxed but needed the whole `Send`, `Sync`, and `'static` to get it to compile. commit 69e9a47d92ff8599c270d77a6ce2917c97059d8c Author: MinerSebas <[email protected]> Date: Thu Feb 3 03:32:02 2022 +0000 SystemParam Derive fixes (#2838) # Objective A user on Discord couldn't derive SystemParam for this Struct: ```rs #[derive(SystemParam)] pub struct SpatialQuery<'w, 's, Q: WorldQuery + Send + Sync + 'static, F: WorldQuery + Send + Sync + 'static = ()> where F::Fetch: FilterFetch, { query: Query<'w, 's, (C, &'static Transform), F>, } ``` ## Solution 1. The `where`-clause is now also copied to the `SystemParamFetch` impl Block. 2. The `SystemParamState` impl Block no longer gets any defaults for generics Co-authored-by: MinerSebas <[email protected]> commit b506c30cd39742385e48e742ab464023ef3c6689 Author: dataphract <[email protected]> Date: Thu Feb 3 00:43:37 2022 +0000 fix: only init_resource() once for AmbientLight (#3853) # Objective `PbrPlugin` calls `app.init_resource::<AmbientLight>()` twice. The second call won't do anything. ## Solution Remove the second call. commit 506642744c1839b76e3286b6885c467d80bdc71a Author: KDecay <[email protected]> Date: Wed Feb 2 21:47:29 2022 +0000 docs: Fix private doc links and enable CI test (#3743) # Objective Fixes #3566 ## Solution - [x] Fix broken links in private docs. - [x] Add the `--document-private-items` flag to the CI. ## Note The following was said by @killercup in #3566: > I don't have time to confirm this but I assume that linking to private items throws an error/warning when just running cargo doc, and --document-private-item might actually hide that warning. So to test this, you'd have to run it twice. I tested this and this is thankfully not the case. If you are linking to a private item you will get a warning no matter if you run `cargo doc` or `cargo doc --document-private-items`. ### Example I added `struct Test;` to `bevy_core/src/name.rs` and linked to it inside of a doc comment using ``[`Test`]``. After that I ran `cargo doc -p bevy_core --document-private-items` using `RUSTDOCFLAGS="-D warnings"` and got the following output (note the last sentence): ```rust error: public documentation for `Name` links to private item `Test` --> crates/bevy_core/src/name.rs:11:82 | 11 | /// Component used to identify an entity. Stores a hash for faster comparisons [`Test`] | ^^^^ this item is private | = note: `-D rustdoc::private-intra-doc-links` implied by `-D warnings` = note: this link resolves only because you passed `--document-private-items`, but will break without ``` commit 6cab36165f93fa240ae88298e897e687fee892aa Author: Andrew Jackson <[email protected]> Date: Wed Feb 2 21:29:48 2022 +0000 Update ClearColor Resource docs (#3842) # Objective - Update the `ClearColor` resource docs as described in #3837 so new users (like me) understand it better ## Solution - Update the docs to use what @alice-i-cecile described in #3837 I took this one up because I got confused by it this weekend. I didn't understand why the "background" was being set by a `ClearColor` resource. commit f991c73bdf2b3fa9ec5987ac5ecce67edafb99dd Author: jak6jak <[email protected]> Date: Wed Feb 2 02:44:51 2022 +0000 Add move sprite example. (#2414) ## Objective There is no bevy example that shows how to transform a sprite. At least as its singular purpose. This creates an example of how to use transform.translate to move a sprite up and down. The last pull request had issues that I couldn't fix so I created a new one ### Solution I created move_sprite example. Co-authored-by: Carter Anderson <[email protected]> commit ce752d25228f2982546f02566ed5bdceb8fc3184 Author: TheRawMeatball <[email protected]> Date: Wed Feb 2 02:29:33 2022 +0000 Increment last event count on next instead of iter (#2382) # Objective Currently, simply calling `iter` on an event reader will mark all of it's events as read, even if the returned iterator is never used ## Solution With this, the cursor will simply move to the last unread, but available event when iter is called, and incremented by one per `next` call. Co-authored-by: Carter Anderson <[email protected]> commit 6a499b125bf2f37e2f95bf7936da382bc3571622 Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed Feb 2 00:25:39 2022 +0000 Update gltf requirement from 0.16.0 to 1.0.0 (#3826) Updates the requirements on [gltf](https://github.com/gltf-rs/gltf) to permit the latest version. <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/gltf-rs/gltf/blob/master/CHANGELOG.md">gltf's changelog</a>.</em></p> <blockquote> <h2>[1.0.0] - 2022-01-29</h2> <h3>Added</h3> <ul> <li>Support for the <code>KHR_materials_specular</code> extension.</li> <li>Support for the <code>KHR_materials_variants</code> extension.</li> <li>Support for the <code>KHR_materials_volume</code> extension.</li> <li><code>ExactSizeIterator</code> implementation for <code>Joints</code> iterator.</li> </ul> <h3>Changed</h3> <ul> <li>The <code>mesh.primitives</code> property is now always serialized.</li> </ul> <h3>Fixed</h3> <ul> <li>Incorrect implementation of <code>Normalize<u16></code> and <code>Normalize<f32></code> for <code>u16</code>.</li> </ul> <h2>[0.16.0] - 2021-05-13</h2> <h3>Added</h3> <ul> <li>Support for the <code>KHR_texture_transform</code> extension.</li> <li>Support for the <code>KHR_materials_transmission_ior</code> extension.</li> </ul> <h3>Changed</h3> <ul> <li><code>Material::alpha_cutoff</code> is now optional.</li> </ul> <h3>Fixed</h3> <ul> <li>URIs with embedded data failing to import when using <code>import_slice</code>.</li> <li>Serialization of empty primitives object being skipped.</li> </ul> <h2>[0.15.2] - 2020-03-29</h2> <h3>Changed</h3> <ul> <li>All features are now exposed in the <a href="http://docs.rs/gltf">online documentation</a>.</li> <li>Primary iterators now implement <code>Iterator::nth</code> explicitly for improved performance.</li> </ul> <h3>Fixed</h3> <ul> <li>Compiler warnings regarding deprecation of <code>std::error::Error::description</code>.</li> </ul> <h2>[0.15.1] - 2020-03-15</h2> <h3>Added</h3> <ul> <li>New feature <code>guess_mime_type</code> which, as the name suggests, attempts to guess the MIME type of an image if it doesn't exactly match the standard.</li> </ul> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Commits</summary> <ul> <li>See full diff in <a href="https://github.com/gltf-rs/gltf/commits">compare view</a></li> </ul> </details> <br /> Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> commit c285a69f76d4ac9909d05f7956f2b1276512038a Author: Horváth Bálint <[email protected]> Date: Tue Feb 1 22:40:25 2022 +0000 Add the Inside version to the Collision enum (#2489) # Objective I think the 'collide' function inside the 'bevy/crates/bevy_sprite/src/collide_aabb.rs' file should return 'Some' if the two rectangles are fully overlapping or one is inside the other. This can happen on low-end machines when a lot of time passes between two frames because of a stutter, so a bullet for example gets inside its target. I can also think of situations where this is a valid use case even without stutters. ## Solution I added an 'Inside' version to the Collision enum declared in the file. And I use it, when the two rectangles are overlapping, but we can't say from which direction it happened. I gave a 'penetration depth' of minus Infinity to these cases, so that this variant only appears, when the two rectangles overlap from each side fully. I am not sure if this is the right thing to do. Fixes #1980 Co-authored-by: Carter Anderson <[email protected]> commit 4134577e646e0d1017064780bca34bb3fa096216 Author: Carter Anderson <[email protected]> Date: Mon Jan 31 02:30:05 2022 +0000 Fix Code of Conduct bolding in readme (#3822) commit 33ef5b5039ce4bea9b33199c1e5649dc858a6d4c Author: Robert Swain <[email protected]> Date: Mon Jan 31 01:22:17 2022 +0000 bevy_render: Only auto-disable mappable primary buffers for discrete GPUs (#3803) # Objective - While it is not safe to enable mappable primary buffers for all GPUs, it should be preferred for integrated GPUs where an integrated GPU is one that is sharing system memory. ## Solution - Auto-disable mappable primary buffers only for discrete GPUs. If the GPU is integrated and mappable primary buffers are supported, use them. commit ca029ef0ebf89dde45bf428110d2eb33d6585273 Author: sark <[email protected]> Date: Mon Jan 31 00:32:47 2022 +0000 Naga export (#3714) # Objective In order to create a glsl shader, we must provide the `naga::ShaderStage` type which is not exported by bevy, meaning a user would have to manually include naga just to access this type. `pub fn from_glsl(source: impl Into<Cow<'static, str>>, stage: naga::ShaderStage) -> Shader {` ## Solution Re-rexport naga::ShaderStage from `render_resources` commit 44d09dc46db356d22f3f232d16398c36db4e3d10 Author: François <[email protected]> Date: Fri Jan 28 16:17:54 2022 +0000 fix timer test to be less reliant on float precision (#3789) # Objective - Test is failing on nightly after the merge of https://github.com/rust-lang/rust/pull/90247 - It was relying on the precision of the duration of `1.0 / 3.0` ## Solution - Fix the test to be less reliant on float precision to have the same result commit 435fb7af4f983845d2fcc9e4221749f852431d11 Author: Charles Giguere <[email protected]> Date: Wed Jan 26 18:52:54 2022 +0000 Improve shader_material example documentation (#3601) # Objective While trying to learn how to use custom shaders, I had difficulty figuring out how to use a vertex shader. My confusion was mostly because all the other shader examples used a custom pipeline, but I didn't want a custom pipeline. After digging around I realised that I simply needed to add a function to the `impl Material` block. I also searched what was the default shader used, because it wasn't obvious to me where to find it. ## Solution Added a few comments explaining what is going on in the example and a link to the default shader. commit ac63c491fb0d6bd8852e0d7e57280d4c3da35faa Author: Cameron Hart <[email protected]> Date: Tue Jan 25 22:10:11 2022 +0000 Simple 2d rotation example (#3065) # Objective Some new bevy users are unfamiliar with quaternions and have trouble working with rotations in 2D. There has been an [issue](https://github.com/bitshifter/glam-rs/issues/226) raised with glam to add helpers to better support these users, however for now I feel could be better to provide examples of how to do this in Bevy as a starting point for new users. ## Solution I've added a 2d_rotation example which demonstrates 3 different rotation examples to try help get people started: - Rotating and translating a player ship based on keyboard input - An enemy ship type that rotates to face the player ship immediately - An enemy ship type that rotates to face the player at a fixed angular velocity I also have a standalone version of this example here https://github.com/bitshifter/bevy-2d-rotation-example but I think it would be more discoverable if it's included with Bevy. commit 6d76229c384053e03683cc629a6c5ee7d0c4f690 Author: luke.biel <[email protected]> Date: Mon Jan 24 23:44:08 2022 +0000 Fix a typo in shader_defs example (#3762) # Objective As in title, I'm already looking through these files so may as well rename `pipline` to `pipeline` commit 514754d6503b2416e5266a24b39c884ab5d90d2f Author: James Liu <[email protected]> Date: Sun Jan 23 18:00:43 2022 +0000 Add crate level docs to bevy_log and enable #![warn(missing_docs)] (#3520) This PR is part of the issue #3492. # Objective - Add crate level docs to the bevy_log documentation to achieve a 100% documentation coverage. - Add the #![warn(missing_docs)] lint to keep the documentation coverage for the future. # Solution - Add and update the bevy_log crate level docs - Add a note about panicking from multiple `LogPlugins` per process. - Add the #![warn(missing_docs)] lint. commit f5039a476d48ec19bd74c94e83e10772565c68f1 Author: Alice Cecile <[email protected]> Date: Sun Jan 23 14:24:37 2022 +0000 Mark .id() methods which return an `Entity` as must_use (#3750) # Objective - Calling .id() has no purpose unless you use the Entity returned - This is an easy source of confusion for beginners. - This is easily missed during refactors. ## Solution - Mark the appropriate methods as #[must_use] commit f3de12bc5e03c58a9b863943b8db84a321422bec Author: Daniel McNab <[email protected]> Date: Fri Jan 21 00:29:29 2022 +0000 Add a warning when `watch_for_changes` has no effect (#3684) # Objective - Users can get confused when they ask for watching to be unsupported, then find it isn't supported - Fixes https://github.com/bevyengine/bevy/issues/3683 ## Solution - Add a warning if the `watch_for_changes` call would do nothing commit f1f6fd349a95059b031171021ff17251fde78456 Author: Michael Dorst <[email protected]> Date: Fri Jan 21 00:12:32 2022 +0000 Remove `ComponentsError` (#3716) # Objective `ComponentsError` is unused and should be removed. Fixes #3707 ## Solution Remove `ComponentsError`. commit e30d600dbf4ea76cf8bc4f87ce830202a8e741d2 Author: Rose Peck <[email protected]> Date: Thu Jan 20 19:32:16 2022 +0000 Update docstrings for `text_system` and `text2d_system` (#3732) # Objective - Fixes #3562 ## Solution - The outdated reference to `TextGlyphs` has been removed, and replaced with a more accurate docstring. ## What was `TextGlyphs`? This is the real question of this Issue and PR. This is particulary interesting because not only is `TextGlyphs` not a type in bevy, but it _never was_. Indeed, this type never existed on main. Where did it come from? `TextGlyphs` was originally a tuple struct wrapping a `Vec<PositionedGlyph>`. It was first introduced back in commit https://github.com/bevyengine/bevy/pull/765/commits/ec390aec4ebe7192e3470dddf1e8af36f10453e6 in #765. At the time, position information was being stored on the text entities directly. However, after design review, [it was decided](https://github.com/bevyengine/bevy/pull/765#issuecomment-725047186) to instead store the glyphs in a `HashMap` owned by the `TextPipeline`. When this was done, the original type was not only removed, but abstracted behind a few layers of the `TextPipeline` API. Obviously, the original docstring wasn't updated accordingly. Later, as part of #1122, the incorrect docstring was swept up when copy/pasting `text_system` for `text2d`. (Although I don't blame @CleanCut for this; it took me like 3 hours to track all this down to find the original context.) commit cb2ba19d97ecb8f878c26357ade2ea7bcbd0cbc9 Author: François <[email protected]> Date: Tue Jan 18 01:28:09 2022 +0000 rename Texture to Image in doc of `from_buffer` function (#3713) This doc link was missed when changing the type name. Noticed in https://github.com/bevyengine/bevy/pull/3706 which will not be merged commit 55da315432074e32a28b1ef0ad39b8eadf92467a Author: Robert Swain <[email protected]> Date: Mon Jan 17 22:55:44 2022 +0000 bevy_render: Provide a way to opt-out of the built-in frustum culling (#3711) # Objective - Allow opting-out of the built-in frustum culling for cases where its behaviour would be incorrect - Make use of the this in the shader_instancing example that uses a custom instancing method. The built-in frustum culling breaks the custom instancing in the shader_instancing example if the camera is moved to: ```rust commands.spawn_bundle(PerspectiveCameraBundle { transform: Transform::from_xyz(12.0, 0.0, 15.0) .looking_at(Vec3::new(12.0, 0.0, 0.0), Vec3::Y), ..Default::default() }); ``` ...such that the Aabb of the cube Mesh that is at the origin goes completely out of view. This incorrectly (for the purpose of the custom instancing) culls the `Mesh` and so culls all instances even though some may be visible. ## Solution - Add a `NoFrustumCulling` marker component - Do not compute and add an `Aabb` to `Mesh` entities without an `Aabb` if they have a `NoFrustumCulling` marker component - Do not apply frustum culling to entities with the `NoFrustumCulling` marker component commit e88e394feb506d686b90b20090cc055f2c31baa9 Author: François <[email protected]> Date: Mon Jan 17 22:38:05 2022 +0000 Remove wasm specific examples (#3705) # Objective - There are wasm specific examples, which is misleading as now it works by default - I saw a few people on discord trying to work through those examples that are very limited ## Solution - Remove them and update the instructions commit 836ffeda31e0b0c85666332cbe58221fbcce8a65 Author: Zhe Chen <[email protected]> Date: Mon Jan 17 22:22:16 2022 +0000 Add missing dependencies for Fedora with Wayland (#3708) # Objective - The Linux dependencies document lacks packages for Fedora with Wayland. ## Solution - Add instructions to install packages for running Bevy apps in Fedora with Wayland. commit a9f2817c49fcc8037293c5ff5add1d23d9f2d620 Author: Robert Swain <[email protected]> Date: Mon Jan 17 22:22:15 2022 +0000 bevy_pbr: Do not panic when more than 256 point lights are added the scene (#3697) # Objective - Do not panic when mroe than 256 point lights are added the scene - Fixes https://github.com/bevyengine/bevy/issues/3682 ## Solution - Only iterate the first `MAX_POINT_LIGHTS` lights instead of as many as there are ## Open questions - Should we warn that there are more than the maximum allowed number of point lights in the scene? commit ef823d369ff69c626d94b4f4b20f6a22d8045136 Author: Robert Swain <[email protected]> Date: Mon Jan 17 22:03:14 2022 +0000 bevy_render: Do not automatically enable MAPPABLE_PRIMARY_BUFFERS (#3698) # Objective - When using `WgpuOptionsPriority::Functionality`, which is the default, wgpu::Features::MAPPABLE_PRIMARY_BUFFERS would be automatically enabled. This feature can and does have a significant negative impact on performance for discrete GPUs where resizable bar is not supported, which is a common case. As such, this feature should not be automatically enabled. - Fixes the performance regression part of https://github.com/bevyengine/bevy/issues/3686 and at least some, if not all cases of https://github.com/bevyengine/bevy/issues/3687 ## Solution - When using `WgpuOptionsPriority::Functionality`, use the adapter-supported features, enable `TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES` and disable `MAPPABLE_PRIMARY_BUFFERS` commit a3e43b6abe4594b257fa7ff9d305b49a97b3ead6 Author: Igor Shaposhnik <[email protected]> Date: Mon Jan 17 21:43:44 2022 +0000 Remove cargo-lipo from iOS ci job (#3671) # Objective `cargo-lipo` no more required since #3109 merged. Also remove unused `x11` feature from example. commit 8139022ecde5c4bc0156af0f93d34287ad6e4425 Author: Chris J G <[email protected]> Date: Mon Jan 17 21:30:17 2022 +0000 Change bevy_core::Name to implement Deref<Target = str> (#3681) # Objective Fixes #3613 [Link to issue](https://github.com/bevyengine/bevy/issues/3613) ## Solution Changed the Deref Target to `str` and changed the `deref()` function body so that a `&str` is returned by using `as_ref() `. commit e16ba80bd2929fff9da25b27a2d5c1e3dd8e7bff Author: Weasy <[email protected]> Date: Mon Jan 17 21:00:43 2022 +0000 Add bevy_bird SVG for simpleicons.org (#3672) # Objective Add an icon to [simpleicons.org](https://simpleicons.org/), so that we can use it with [shields.io](https://shields.io/) to make some nice shields/badges. ## Solution Create a bevy bird SVG according to this guideline https://github.com/simple-icons/simple-icons/blob/develop/CONTRIBUTING.md#icon-guidelines, meaning i made [bevy_icon_dark.svg](https://github.com/bevyengine/bevy-website/blob/master/static/assets/bevy_icon_dark.svg) monochromatic and ran through all the steps in the icon-guideline. The result looks like this: ![grafik](https://user-images.githubusercontent.com/11967542/149509545-0748af23-ff52-42e6-a5bc-c1c7ce43e1fe.png) We still need to open a PR in the https://github.com/simple-icons/simple-icons repo. commit d11cd6345229f1c2e0352e164bcbc0491c7cc319 Author: Linden Krouse <[email protected]> Date: Mon Jan 17 20:44:22 2022 +0000 Fixed doc comment with render Node input/output methods (#3642) Fixed doc comment where render Node input/output methods refered to using `RenderContext` for interaction instead of `RenderGraphContext` # Objective The doc comments for `Node` refer to `RenderContext` for slots instead of `RenderGraphContext`, which is only confusing because `Node::run` is passed both `RenderContext` and `RenderGraphContext` ## Solution Fixed the typo commit 3fcdc5a4926dcad89a3346977d862c505993d265 Author: Wybe Westra <[email protected]> Date: Sun Jan 16 21:09:15 2022 +0000 Expanded Msaa documentation. (#3693) - Added default value. - Links to the explanation of Msaa on wikipedia. - Added a short example to show how to use the struct on an app. Fixes #3167. commit 758fc5af6761d36c79115b93b5c20c03543646fa Author: Aleksey Smirnov <[email protected]> Date: Sun Jan 16 20:49:40 2022 +0000 Remove a couple of unnecessary full paths (#3699) commit e30199f7a9cf6429aed6c0b6f66fe76b791e90aa Author: James Liu <[email protected]> Date: Sun Jan 16 04:53:22 2022 +0000 Document bevy_tasks and enable #![warn(missing_docs)] (#3509) This PR is part of the issue #3492. # Objective - Add and update the bevy_tasks documentation to achieve a 100% documentation coverage (sans `prelude` module) - Add the #![warn(missing_docs)] lint to keep the documentation coverage for the future. ## Solution - Add and update the bevy_math documentation. - Add the #![warn(missing_docs)] lint. - Added doctest wherever there should be in the missing docs. commit 71814ca91bbd532a350db6dbcf2711fc7ce99ba5 Author: KDecay <[email protected]> Date: Sun Jan 16 02:40:25 2022 +0000 Added API guidelines to CONTRIBUTING.md (#3646) Closes #3497. I added the rust API guidelines (https://rust-lang.github.io/api-guidelines/about.html) to the `CONTRIBUTING.md` file. ## Note As noted in #3497 we should note any areas where we deliberately disagree as they arise. If we start adding these areas it might be a good idea to remove the mention of the `API guidelines` in the `CONTRIBUTING.md` file and move it to the `engine_style_guide.md`. That way we still have the connection between the `CONTRIBUTING.md` and the `API guidelines`, but we have more "space" to work with and can go into more detail about what we agree and disagree on. For now I would leave it this way, because it's one less click to get to the guidelines. Co-authored-by: KDecay <[email protected]> commit 8e1f660e1db77434d96626d3e40ecd0edfc71b54 Author: Ted Driggs <[email protected]> Date: Sat Jan 15 22:14:43 2022 +0000 Don't panic in macro shape validation (#3647) # Objective Emitting compile errors produces cleaner messages than panicking in a proc-macro. ## Solution - Replace match-with-panic code with call to new `bevy_macro_utils::get_named_struct_fields` function - Replace one use of match-with-panic for enums with inline match _Aside:_ I'm also the maintainer of [`darling`](https://docs.rs/darling), a crate which provides a serde-like API for parsing macro inputs. I avoided using it here because it seemed like overkill, but if there are plans to add lots more attributes/macros then that might be a good way of offloading macro error handling. commit c16d0c5a39f384e45a3043b30f0aace2b408c6a1 Author: François <[email protected]> Date: Sat Jan 15 20:29:58 2022 +0000 do not set cursor grab on window creation if not asked for (#3617) # Objective - On Safari mobile, calling `winit_window.set_cursor_grab(true)` fails as the API is not implemented (as there is no cursor on Safari mobile, the api doesn't make sense there). I don't know about other mobile browsers ``` [Error] Unhandled Promise Rejection: TypeError: getObject(arg0).exitPointerLock is not a function. (In 'getObject(arg0).exitPointerLock()', 'getObject(arg0).exitPointerLock' is undefined) (anonymous function) (rect.js:1089) wasm-stub <?>.wasm-function[web_sys::features::gen_Document::Document::exit_pointer_lock::h20ffc49be163fc45] <?>.wasm-function[winit::platform_impl::platform::backend::canvas::Canvas::set_cursor_grab::h6a9472cf55263e98] <?>.wasm-function[bevy_winit::winit_windows::WinitWindows::create_window::h9db5b3cbb24347c5] <?>.wasm-function[<bevy_winit::WinitPlugin as bevy_app::plugin::Plugin>::build::ha4a7c046b80c4280] <?>.wasm-function[bevy_app::plugin_group::PluginGroupBuilder::finish::h0e5bc78f71c37b2f] <?>.wasm-function[rect::main::h899852fd17f2d489] <?>.wasm-function[std::sys_common::backtrace::__rust_begin_short_backtrace::hfe38f282e8dda96b] <?>.wasm-function[std::rt::lang_start::{{closure}}::hc2f3b555ffc58618] <?>.wasm-function[std::rt::lang_start_internal::ha901ae30d88554f2] <?>.wasm-function[main] <?>.wasm-function[] wasm-stub 21261 (anonymous function) (rect.js:1664) asyncFunctionResume (anonymous function) promiseReactionJobWithoutPromise promiseReactionJob ``` ## Solution - Do not call the api to release cursor grab on window creation, as the cursor is not grabbed anyway at this point commit 2186eae89cd48f0e3606048b5463cbcf835079fb Author: Robert Swain <[email protected]> Date: Sat Jan 15 20:10:33 2022 +0000 bevy_crevice: Fix incorrect iterator usage in WriteStd430 impl for [T] (#3591) # Objective - Fix incorrect iterator usage in WriteStd430 impl for [T] - The first item was being written twice. This is correct in the WriteStd140 impl for [T]. ## Solution - See the code. commit 7c22f92ce42741610df2520f310dffa13287257f Author: Federico Rinaldi <[email protected]> Date: Fri Jan 14 23:14:42 2022 +0000 Document sub apps (#3403) Documentation added to: - `App::add_sub_app` ( - `App::update` (mentions that sub apps are updated here) ### Future work - An example for `add_sub_app` would be good, but I wasn't able to come up with a simple one. - Since `SubApp` is private, maybe the concept of sub applications could be introduced in the `App` struct-level documentation. commit f073b2d7f3d42561f081493e8a1c4bf337e1c7ae Author: dataphract <[email protected]> Date: Fri Jan 14 19:09:44 2022 +0000 document more of bevy_reflect (#3655) This adds documentation for: - The trait methods of `Reflect` and its subtraits - The `partial_eq` and `apply` functions for `Map` et al. - `DynamicList` and `DynamicMap` - `TypeRegistry` and related types & traits - `GetPath`, including an explanation of path string syntax among other things. Still to be documented are the various macros and `bevy_reflect::serde`. commit 3e8e6c56710a78216e0290bf194524429057f0c2 Author: François <[email protected]> Date: Fri Jan 14 19:09:42 2022 +0000 add an example using UI & states to create a game menu (#2960) adds an example using UI for something more related to a game than the current UI examples. Example with a game menu: * new game - will display settings for 5 seconds before returning to menu * preferences - can modify the settings, with two sub menus * quit - will quit the game I wanted a more complex UI example before starting the UI rewrite to have ground for comparison Co-authored-by: François <[email protected]> commit 39db8ecd03feebdef945048bab7e6551afd18735 Author: Troels Jessen <[email protected]> Date: Fri Jan 14 18:47:48 2022 +0000 Added docs for bevy_transform (#3516) # Objective bevy_transform needed documentation and warn(missing_docs) as requested by #3492 ## Solution warn(missing_docs) was activated and documentation was added to cover the crate Co-authored-by: Troels Jessen <[email protected]> commit 17bb812d5df45c01529183bc8c6be21e3916fad0 Author: François <[email protected]> Date: Fri Jan 14 18:21:22 2022 +0000 Ignore clippy 1.58 (#3667) - Work around #3666 until a proper fix is done - Also update duplicate dependencies list commit 7fd781e6703cc229ec5dae46ef9cc96ea6e7e52a Author: Nicholas French <[email protected]> Date: Thu Jan 13 01:50:54 2022 +0000 Fix documentation for QueryState::iter_manual (#3644) # Objective - Fixes #3616 ## Solution - As described in the issue, documentation for `iter_manual` was copied from `iter_combinations` and did not reflect the behavior of the method. I've pulled some information from #2351 to create a more accurate description. commit 84144c942992dedc200ccd9dae008acbfc2b767a Author: Isse <[email protected]> Date: Thu Jan 13 00:24:31 2022 +0000 Remove documentation warning on EntityCommands::insert that is no longer necessary (#3653) # Objective - Removes warning about accidently inserting bundles with `EntityCommands::insert`, but since a component now needs to implement `Component` it is unnecessary. commit bc499591c2d090e17c95d2c59bc6e16ba60a023d Author: Pascal Hertleif <[email protected]> Date: Tue Jan 11 01:08:39 2022 +0000 Use `use` instead of lots of full paths (#3564) Super tiny thing. Found this while reviewing #3479. # Objective - Simplify code - Fix the link in the doc comment ## Solution - Import a single item :) Co-authored-by: Pascal Hertleif <[email protected]> commit fc0f15f11e3b327c65deaaccf722a8064a1a300b Author: SuperSamus <[email protected]> Date: Mon Jan 10 17:05:13 2022 +0000 Documentation: simplify NixOS dependencies (#3527) # Objective The description of NixOS dependencies is extremely long and spends entire paragraphs just for simple line changes. With this PR it should be much simpler. ## Solution - Linking Vulkan in `build.rs` is less effective than adding it in LD_LIBRARY_PATH, so I removed the former (related to #1992); - I put a simple comment explaining the line in the list of dependencies, instead of making entire paragraphs; - Clang is not in an absolute path in `.cargo/config_fast_builds` anymore, so that there is no need to specify it in `docs/linux_dependencies.md` (didn't test if this breaks other distros, though I doubt it. Also, maybe it could also be done on Darwin for consistency?); - Also added optional wayland dependencies. A few notes: - The x11 libraries will be linked only during the compilation phase. This means that if you use the `x11` feature without these libraries in the environment (for example because you forget to enter the nix shell before compiling), the program will still compile successfully but won't run. You'll have to `cargo clean` and recompile with the x11 libraries in the environment. I don't know if this is important enough to be added to the documentation, but it's not specified anywhere, though I don't think it's specific to NixOS; - The wayland dependencies need to be put in LD_LIBRARY_PATH only in certain conditions (IIRC, only if using the `dynamic` feature) and the text doesn't specify it. Because putting them there doesn't increase the number of dependencies (they are already in buildInputs) or alter the performance, I doubt anyone will care; - Should I comment out what isn't needed by default? - ~I removed `cargo` from buildInputs. Ignoring the fact that it should be in nativeBuildInputs, having it in `shell.nix` allows to use stable Rust in case it's not in the system environment, but maybe the user wanted to use the version that was already in the system environment and will be caught by surprise. In my opinion, if someone is looking at a Bevy's documentation on NixOS, that user will either have Rust already in the system environment (eg. via rustup) or is capable to add the toolchain they want on shell.nix by themselves. This isn't exactly the place to explain how this works.~ ~EDIT: I replaced `cargo` with Rust from the [Oxalica overlay](https://github.com/oxalica/rust-overlay) in order to have the latest nightly.~ EDIT: Removed `cargo` from dependencies. See comments for details. commit 6bc5c609867908345f0b427cbd2725082883b31c Author: Alice Cecile <[email protected]> Date: Mon Jan 10 00:00:19 2022 +0000 Remove tests from example style guide (#3582) # Objective - Consensus has emerged that examples shouldn't have tests. ## Solution - Discourage tests in examples. commit 130953c717ffc1b05cf80d44dd82151b4c476555 Author: Michael Dorst <[email protected]> Date: Sun Jan 9 23:20:13 2022 +0000 Enable the `doc_markdown` clippy lint (#3457) # Objective CI should check for missing backticks in doc comments. Fixes #3435 ## Solution `clippy` has a lint for this: `doc_markdown`. This enables that lint in the CI script. Of course, enabling this lint in CI causes a bunch of lint errors, so I've gone through and fixed all of them. This was a huge edit that touched a ton of files, so I split the PR up by crate. When all of the following are merged, the CI should pass and this can be merged. + [x] #3467 + [x] #3468 + [x] #3470 + [x] #3469 + [x] #3471 + [x] #3472 + [x] #3473 + [x] #3474 + [x] #3475 + [x] #3476 + [x] #3477 + [x] #3478 + [x] #3479 + [x] #3480 + [x] #3481 + [x] #3482 + [x] #3483 + [x] #3484 + [x] #3485 + [x] #3486 commit 600ee7eee69aaf730bcf69f2f9fa83aaafb8a334 Author: François <[email protected]> Date: Sun Jan 9 18:52:18 2022 +0000 support all line endings in shader preprocessor (#3603) # Objective - Advance uses of shaders seems to often fail for Windows users - Bevy split lines on `'\n'` which messes with windows line endings ## Solution - Uses Rust built in https://doc.rust-lang.org/std/primitive.str.html#method.lines commit e56685370ba82003af60a491667fac209a0f7897 Author: Michael Dorst <[email protected]> Date: Sun Jan 9 11:09:46 2022 +0000 Fix `doc_markdown` lints in `bevy_render` (#3479) #3457 adds the `doc_markdown` clippy lint, which checks doc comments to make sure code identifiers are escaped with backticks. This causes a lot of lint errors, so this is one of a number of PR's that will fix those lint errors one crate at a time. This PR fixes lints in the `bevy_render` crate. commit 6f167aa3d60188952ea9bccad3b6725dd5085acc Author: MiniaczQ <[email protected]> Date: Sun Jan 9 03:48:27 2022 +0000 Documented `Events` (#3306) # Objective This PR extends the `Events` documentation by: - informing user about the possible race condition - explicitly explaining the unusual double buffer implementation Fixes #3305 Co-authored-by: MiniaczQ <[email protected]> Co-authored-by: MiniaczQ <[email protected]> commit 8c81e816764e60df5b6f304709259433b734f35c Author: Daniel Bearden <[email protected]> Date: Sat Jan 8 22:36:33 2022 +0000 Thread local example cleanup (#3586) # Objective Fixes #19…
Objective
Solution