Skip to content
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

Start 0.5 -> 0.6 Migration guide #185

Merged
merged 14 commits into from
Jan 8, 2022
Merged

Start 0.5 -> 0.6 Migration guide #185

merged 14 commits into from
Jan 8, 2022

Conversation

MinerSebas
Copy link
Contributor

@MinerSebas MinerSebas commented Jul 10, 2021

@alice-i-cecile
Copy link
Member

This PR is pretty noisy because it contains a number of other commits in its history; can you rebase?

@MinerSebas
Copy link
Contributor Author

I actually rebased the PR onto Master to get the changes from #191, as I locally use Zola 0.14.
The problem is that I am Targeting the migration-guide branch instead of master.
When the migration-guide branch was created 0.13 was still the latest version.

### QuerySet declare "QueryState" instead of "Query"
<!-- Adapt for ParamSet instead, if https://github.com/bevyengine/bevy/pull/2765 is merged -->

Due to the [System Param Lifetime Split](#system-param-lifetime-split), {{rust_type(type="struct" crate="bevy_ecs" mod="system" name="QuerySet" version="0.6.0" no_mod=true plural=true)}} now need to specify their Queries with {{rust_type(type="struct" crate="bevy_ecs" mod="query" version="0.6.0" name="QuerySet" no_mod=true)}} instead of {{rust_type(type="struct" crate="bevy_ecs" mod="system" version="0.6.0" name="Query" no_mod=true)}}.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a typo here it says:

Due to the System Param Lifetime Split, QuerySets now need to specify their Queries with QuerySet instead of Query .

It should say:
"... Queries with QueryState instead of Query."

@rparrett
Copy link
Contributor

rparrett commented Dec 14, 2021

My rough notes from the migration process so far for a 2d game.

[ ] Handle<Texture> -> Handle<Image>
[ ] NodeBundle.material -> .color (UiColor(Color))
[ ] ImageBundle.material -> .image (Handle<Image>)
[X] SpriteBundle.material -> .texture (Handle<Image>)
[X] Visible -> Visibility 
    (and is_transparent is no longer a thing? Are things just always transparent now?)
[ ] q0_mut() -> q0(), etc
[X] SpriteBundle: Textureless sprites are spawned differently now
    (see breakout example diff from default renderer pr)
    (also cover custom_size here? when is it more appropriate to use that?)
[ ] TextureAtlasSprite: index is now usize, not u32

edit: Checking these off when PRs are opened covering them

@inodentry
Copy link
Contributor

inodentry commented Dec 24, 2021

@rparrett

For 3d, is_transparent is obsoleted by the new AlphaMode field in the Standard Material, where you can choose between Opaque, Cutout (threshold value), or Blend (full transparency).

For 2d, yeah, sprites and UI are always assumed transparent. Which makes sense, because they practically always are.

@BorisBoutillier
Copy link

. mp3 is no more the default , ogg now is.
So migration of projects using mp3 must now explicitely add the features=["mp3"] in their Cargo.toml

@ramirezmike
Copy link
Contributor

Things I've noticed so far that hasn't been listed

  1. The casting functions for IVec, DVec, UVec, Vec have all been changed from being named after their inner elements' cast target to what the entire Vec is being casted into.

For example

// 05
let xyz: Vec3 = Vec3::new(0.0, 0.0, 0.0);
let xyz: IVec3 = xyz.as_i32();

// 06
let xyz: Vec3 = Vec3::new(0.0, 0.0, 0.0);
let xyz: IVec3 = xyz.as_ivec3();

This affects all the different dimensions of the math vectors (i.e., Vec2, Vec3 and Vec4).

  1. I was going to mention that the Visible struct had been removed from TextBundle. But... actually it looks like it was re-added yesterday 👍 Just going to mention it in case someone else is not quite on latest.

  2. roughness in StandardMaterial was renamed to perceptual_roughness

@rparrett
Copy link
Contributor

rparrett commented Jan 3, 2022

In glam 15, PartialOrd and Ord impls were removed for vector types. Users upgrading to bevy 0.6 may see errors like this if they were trying to compare vectors.

error[E0369]: binary operation `<` cannot be applied to type `bevy::prelude::Vec2`
 --> src/main.rs:6:10
  |
6 |     if a < b {
  |        - ^ - bevy::prelude::Vec2
  |        |
  |        bevy::prelude::Vec2

In these cases, it's likely that the user was shooting themselves in the foot, because these impls were only comparing the vectors one-dimensionally.

@CGMossa
Copy link

CGMossa commented Jan 5, 2022

I think the PointLight example is missing a ..Default::default() or something, as there are more fields than the ones present in the example.

@cart cart changed the base branch from migration-guide to master January 8, 2022 05:44
@cart cart merged commit 8cb29a3 into bevyengine:master Jan 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants