-
Notifications
You must be signed in to change notification settings - Fork 103
chore: bevy 0.17.0 #285
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
Closed
Closed
chore: bevy 0.17.0 #285
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -135,5 +135,5 @@ fn match_action(action: Action, b: &mut WithSvg<BuilderImpl>) { | |
| Action::Close => { | ||
| b.close(); | ||
| } | ||
| }; | ||
| } | ||
| } | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,8 +4,13 @@ | |
| //! boilerplate. | ||
|
|
||
| use bevy::{ | ||
| asset::{uuid_handle, RenderAssetUsages}, | ||
| prelude::*, | ||
| render::{mesh::Indices, render_asset::RenderAssetUsages, render_resource::PrimitiveTopology}, | ||
| camera::primitives::{Aabb, MeshAabb}, | ||
| mesh::Indices, | ||
| render::{ | ||
| render_resource::PrimitiveTopology, | ||
| }, | ||
| }; | ||
| use lyon_tessellation::{self as tess, BuffersBuilder}; | ||
|
|
||
|
|
@@ -16,7 +21,7 @@ use crate::{ | |
| }; | ||
|
|
||
| pub(crate) const COLOR_MATERIAL_HANDLE: Handle<ColorMaterial> = | ||
| Handle::weak_from_u128(0x7CC6_61A1_0CD6_C147_129A_2C01_882D_9580); | ||
| uuid_handle!("7cc661a1-0cd6-c147-129a-2c01882d9580"); | ||
|
|
||
| /// A plugin that provides resources and a system to draw shapes in Bevy with | ||
| /// less boilerplate. | ||
|
|
@@ -30,19 +35,23 @@ impl Plugin for ShapePlugin { | |
| .insert_resource(StrokeTessellator(stroke_tess)) | ||
| .configure_sets( | ||
| PostUpdate, | ||
| BuildShapes.after(bevy::transform::TransformSystem::TransformPropagate), | ||
| BuildShapes | ||
| .after(bevy::transform::TransformSystems::Propagate) | ||
| .before(bevy::asset::AssetEventSystems), | ||
| ) | ||
| .add_systems(PostUpdate, mesh_shapes_system.in_set(BuildShapes)); | ||
|
|
||
| app.world_mut() | ||
| if let Err(e) = app.world_mut() | ||
| .resource_mut::<Assets<ColorMaterial>>() | ||
| .insert( | ||
| &COLOR_MATERIAL_HANDLE, | ||
| ColorMaterial { | ||
| color: Color::WHITE, | ||
| ..default() | ||
| }, | ||
| ); | ||
| ) { | ||
| error!("Failed to add resource: {:?}", e); | ||
| } | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -59,17 +68,21 @@ fn mesh_shapes_system( | |
| mut meshes: ResMut<Assets<Mesh>>, | ||
| mut fill_tess: ResMut<FillTessellator>, | ||
| mut stroke_tess: ResMut<StrokeTessellator>, | ||
| mut query: Query<(&Shape, &mut Mesh2d), Changed<Shape>>, | ||
| mut query: Query<(&Shape, &mut Mesh2d, Option<&mut Aabb>), Changed<Shape>>, | ||
| ) { | ||
| for (shape, mut mesh) in &mut query { | ||
| for (shape, mut mesh, aabb) in &mut query { | ||
| let mut buffers = VertexBuffers::new(); | ||
| if let Some(fill_mode) = shape.fill { | ||
| fill(&mut fill_tess, &shape.path, fill_mode, &mut buffers); | ||
| } | ||
| if let Some(stroke_mode) = shape.stroke { | ||
| stroke(&mut stroke_tess, &shape.path, stroke_mode, &mut buffers); | ||
| } | ||
| mesh.0 = meshes.add(build_mesh(&buffers)); | ||
| let m = build_mesh(&buffers); | ||
| if let (Some(mut aabb), Some(new_aabb)) = (aabb, m.compute_aabb()) { | ||
| *aabb = new_aabb; | ||
| } | ||
| mesh.0 = meshes.add(m); | ||
|
Comment on lines
+81
to
+85
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this fixing or working around a bug that's documented somewhere? I'm surprised that modern Bevy isn't automatically recomputing the |
||
| } | ||
| } | ||
|
|
||
|
|
||
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
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.
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.
This error message is inaccurate, the error is coming from
insertonAssets.The docs mention that this method will not fail for uuid assets, so the error could be safely ignored.
Although it might be appropriate to use the fallible version of
resource_mut. I think this could be missing if a user fails to add rendering features/plugins.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.
Is the code compiling without errors for you?
Uh oh!
There was an error while loading. Please reload this page.
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.
Are you referencing the error you commented about earlier, or something about this particular review feedback?
I suppose either way, the answer is yes.
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.
never mind, seems to have fixed itself