-
Notifications
You must be signed in to change notification settings - Fork 13
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
Update to Bevy 0.12 #206
Update to Bevy 0.12 #206
Conversation
Signed-off-by: Luca Della Vedova <lucadv@intrinsic.ai>
Signed-off-by: Luca Della Vedova <lucadv@intrinsic.ai>
Signed-off-by: Luca Della Vedova <lucadv@intrinsic.ai>
Signed-off-by: Luca Della Vedova <lucadv@intrinsic.ai>
Signed-off-by: Luca Della Vedova <lucadv@intrinsic.ai>
Signed-off-by: Luca Della Vedova <lucadv@intrinsic.ai>
Signed-off-by: Luca Della Vedova <lucadv@intrinsic.ai>
Signed-off-by: Luca Della Vedova <lucadv@intrinsic.ai>
b4a620f
to
6b0a837
Compare
Signed-off-by: Luca Della Vedova <lucadv@intrinsic.ai>
Signed-off-by: Luca Della Vedova <lucadv@intrinsic.ai>
Signed-off-by: Luca Della Vedova <lucadv@intrinsic.ai>
Signed-off-by: Luca Della Vedova <lucadv@intrinsic.ai>
Signed-off-by: Luca Della Vedova <lucadv@intrinsic.ai>
Signed-off-by: Luca Della Vedova <lucadv@intrinsic.ai>
There is currently a regression in workcell editor mode where the cursor is always displayed, currently investigating |
Signed-off-by: Luca Della Vedova <lucadv@intrinsic.ai>
Signed-off-by: Luca Della Vedova <lucadv@intrinsic.ai>
Signed-off-by: Luca Della Vedova <lucadv@intrinsic.ai>
This PR is now ready for review. Since this migration added a lot more deprecation warnings with the deprecation of event.iter() I took the chance to clear out all the trivial warnings from the codebase so we can avoid introducing new ones (they would get drowned in the 100+ existing warnings). |
Signed-off-by: Luca Della Vedova <lucadv@intrinsic.ai>
Signed-off-by: Luca Della Vedova <lucadv@intrinsic.ai>
f15ef77
to
24c1c72
Compare
Signed-off-by: Luca Della Vedova <lucadv@intrinsic.ai>
Signed-off-by: Michael X. Grey <mxgrey@intrinsic.ai>
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 just leaving two very minor nitpicks around variable naming and documentation, and one suggestion for us to think about a Model
bundle refactor in a future PR.
Thanks for the massive migration effort here, and for staying on top of these valuable developments in Bevy. It's great to see a PR that has an overall negative number of new lines.
@@ -305,7 +309,7 @@ impl FromWorld for CameraControls { | |||
(2, HOVERED_OUTLINE_LAYER), | |||
(3, XRAY_RENDER_LAYER), | |||
] | |||
.map(|(order, layer)| { | |||
.map(|(order, _layer)| { |
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 change actually flagged to me that we have a bug here. Inside this block is a line
.insert(RenderLayers::layer(XRAY_RENDER_LAYER))
That line should've been
.insert(RenderLayers::layer(layer))
As a result we weren't rendering outlines correctly in orthographic mode.
This is a good example of why we need to clean up the warnings in this codebase, so we're not drowning out things that could help us fix bugs 😬
I've pushed a fix for this.
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.
Good find! I did notice that outline were not rendered in ortographic mode but thought it was due to the top-down perspective, nice to have addressed that
rmf_site_editor/src/sdf_loader.rs
Outdated
load_context: &'a mut LoadContext<'b>, | ||
uri: &'a str, | ||
) -> Result<AssetSource, SdfError> { | ||
let path = load_context.asset_path().to_string(); |
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.
It takes a lot of cognitive load when reading through this function to understand the differences between uri
and path
, and why they're used differently. It would be nice to give them more distinct variable names (e.g. asset_uri
and sdf_model_path
) and maybe a little documentation about what's going on here and why, e.g. an example input for each branch to make it clear what kind of case it's covering.
The terseness of the Rust language can be both a blessing and a curse at the same time.
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.
Good point, I added examples in the documentation and did a minor cleanup (removing one else condition that would never happen) in 3ab3f03
rmf_site_editor/src/sdf_loader.rs
Outdated
fn spawn_geometry<'a, 'b>( | ||
world: &'a mut World, | ||
geometry: &'a SdfGeometry, | ||
visual_name: &'a str, |
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.
Should this be geometry_name
since it also gets used for collisions, not just visuals?
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.
rmf_site_editor/src/sdf_loader.rs
Outdated
SdfGeometry::Mesh(mesh) => Some( | ||
world | ||
.spawn(Model { | ||
name: NameInSite(visual_name.to_owned()), |
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.
NameInSite
was meant to represent names that are unique within the site. If I understand correctly this is parsing visual and collision geometries, which doesn't actually align very well with how the Model
bundle was originally meant to be used.
We can leave this as-is for now since we don't yet have any particular need for NameInSite
s to be unique, but perhaps we can think about how to refactor the Model
bundle in a future PR. We should probably introduce a NameInModel
, or possibly a more general NameInTree { tree: Entity, name: String }
component.
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.
Fully agree, Model
served well in the early days of the codebase when each model was a single GLB file but since we started to parse SDFs with hierarchies, include primitive shapes, split of collision and visual meshes, it became very complex.
Ideally the perfect design would allow granularity to encapsulate all the components of a Model
into a top level object (for example to know where to fetch a model if it comes from fuel) but at the same time would allow inspecting its parts (toggling visual / collision meshes, plus some other features needed in workcells that work with individual submeshes)
Signed-off-by: Luca Della Vedova <lucadv@intrinsic.ai>
Signed-off-by: Luca Della Vedova <lucadv@intrinsic.ai>
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.
Thanks for the added documentation! It's much more clear what's going on in sdf loading now.
Signed-off-by: Luca Della Vedova <lucadv@intrinsic.ai> Signed-off-by: Reuben Thomas <reubenthomas123@gmail.com>
New feature implementation
Implemented feature
Closes #192, #128.
Update to Bevy 0.12.
Implementation description
Apart from the usual changed APIs, Bevy 0.12 introduced a virtual rewrite of the asset system that allowed a significant refactor and cleanup of the way we handle assets.
Specifically, the most important feature is support for multiple asset sources, which allows us to split the sources into separate structures, with two main consequences:
AssetSource
enum is a lot cleaner, we can split out the sources that don't necessarily make sense for models (i.e.Bundled
, used for icons andOSMTile
used for open street map tiles) and put them in their own asset source.Specifically for
Bundled
assets, the new asset system introduced a builtinembedded://
asset source that does exactly the same so we can get rid of more code.Because of #128, it was necessary to move out of
surf
. Luckily a new crate came up recently, ehttp which is actively maintained, does the job perfectly fine and is very lightweight (our dependency count decreased by about 100 crates by switching!)