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

Upgrade to Bevy 0.15 #221

Merged
merged 13 commits into from
Nov 30, 2024
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ Pair this with a crate like [`egui_dock`](https://docs.rs/egui_dock/latest/egui_

| bevy | bevy-inspector-egui |
| ---- | ------------------- |
| 0.15 | 0.28 |
| 0.14 | 0.27 |
| 0.14 | 0.26 |
| 0.14 | 0.25 |
Expand Down
6 changes: 3 additions & 3 deletions crates/bevy-inspector-egui-derive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ quote = "1.0"
proc-macro2 = "1.0"

[dev-dependencies]
bevy_ecs = { version = "0.14.0", default-features = false }
bevy_math = { version = "0.14.0", default-features = false }
bevy_reflect = { version = "0.14.0", default-features = false }
bevy_ecs = { version = "0.15.0-rc.3", default-features = false }
bevy_math = { version = "0.15.0-rc.3", default-features = false }
bevy_reflect = { version = "0.15.0-rc.3", default-features = false }
bevy-inspector-egui = { path = "../bevy-inspector-egui" }
51 changes: 29 additions & 22 deletions crates/bevy-inspector-egui/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bevy-inspector-egui"
version = "0.27.0"
version = "0.28.0"
edition = "2021"
repository = "https://github.com/jakobhellermann/bevy-inspector-egui/"
readme = "README.md"
Expand All @@ -16,7 +16,13 @@ categories = [
]

[features]
default = ["bevy_pbr", "bevy_render", "egui_clipboard", "egui_open_url"]
default = [
"bevy_pbr",
"bevy_image",
"bevy_render",
"egui_clipboard",
"egui_open_url",
]
bevy_render = ["dep:bevy_render", "dep:bevy_core_pipeline", "bevy_egui/render"]
egui_clipboard = ["bevy_egui/manage_clipboard"]
egui_open_url = ["bevy_egui/open_url"]
Expand All @@ -29,26 +35,27 @@ features = ["winit/x11"]
winit = { version = "0.30.0", default-features = false }

bevy-inspector-egui-derive = { version = "0.27.0", path = "../bevy-inspector-egui-derive" }
bevy_app = { version = "0.14.0" }
bevy_asset = { version = "0.14.0" }
bevy_color = { version = "0.14.0" }
bevy_core = { version = "0.14.0" }
bevy_ecs = { version = "0.14.0" }
bevy_hierarchy = { version = "0.14.0" }
bevy_log = { version = "0.14.0" }
bevy_math = { version = "0.14.0" }
bevy_reflect = { version = "0.14.0" }
bevy_state = { version = "0.14.0" }
bevy_time = { version = "0.14.0" }
bevy_utils = { version = "0.14.0" }
bevy_window = { version = "0.14.0" }

bevy_render = { version = "0.14", optional = true }
bevy_core_pipeline = { version = "0.14", optional = true }
bevy_pbr = { version = "0.14", optional = true }
bevy_app = { version = "0.15.0" }
bevy_asset = { version = "0.15.0" }
bevy_color = { version = "0.15.0" }
bevy_core = { version = "0.15.0" }
bevy_ecs = { version = "0.15.0" }
bevy_hierarchy = { version = "0.15.0" }
bevy_log = { version = "0.15.0" }
bevy_math = { version = "0.15.0" }
bevy_reflect = { version = "0.15.0" }
bevy_state = { version = "0.15.0" }
bevy_time = { version = "0.15.0" }
bevy_utils = { version = "0.15.0" }
bevy_window = { version = "0.15.0" }

bevy_render = { version = "0.15.0", optional = true }
bevy_core_pipeline = { version = "0.15.0", optional = true }
bevy_pbr = { version = "0.15.0", optional = true }
bevy_image = { version = "0.15.0", optional = true }

egui = "0.29"
bevy_egui = { version = "0.30", default-features = false }
bevy_egui = { version = "0.31", default-features = false }

bytemuck = "1.16.0"
image = { version = "0.25", default-features = false }
Expand All @@ -58,9 +65,10 @@ smallvec = "1.10"
fuzzy-matcher = "0.3.7"

[dev-dependencies]
bevy = { version = "0.14.0", default-features = false, features = [
bevy = { version = "0.15.0", default-features = false, features = [
"x11",
"bevy_winit",
"bevy_window",
"bevy_pbr",
"bevy_sprite",
"bevy_core_pipeline",
Expand Down Expand Up @@ -122,4 +130,3 @@ path = "examples/integrations/side_panel.rs"

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(egui_dock_gizmo)'] }

Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ fn main() {
}

fn setup(mut commands: Commands, mut ui_data: ResMut<UiData>) {
let entity = commands.spawn(PbrBundle::default()).id();
let entity = commands.spawn(Mesh3d::default()).id();
ui_data.entity = Some(entity);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,31 +62,29 @@ fn setup(
mut materials: ResMut<Assets<StandardMaterial>>,
) {
// plane
commands.spawn(PbrBundle {
mesh: meshes.add(Plane3d::default().mesh().size(5.0, 5.0)),
material: materials.add(Color::srgb(0.3, 0.5, 0.3)),
..default()
});
commands.spawn((
Mesh3d(meshes.add(Plane3d::default().mesh().size(5.0, 5.0))),
MeshMaterial3d(materials.add(Color::srgb(0.3, 0.5, 0.3))),
Transform::from_xyz(0.0, 0.5, 0.0),
));
// cube
commands.spawn(PbrBundle {
mesh: meshes.add(Cuboid::new(1.0, 1.0, 1.0)),
material: materials.add(Color::srgb(0.8, 0.7, 0.6)),
transform: Transform::from_xyz(0.0, 0.5, 0.0),
..default()
});
commands.spawn((
Mesh3d(meshes.add(Cuboid::new(1.0, 1.0, 1.0))),
MeshMaterial3d(materials.add(Color::srgb(0.8, 0.7, 0.6))),
Transform::from_xyz(0.0, 0.5, 0.0),
));
// light
commands.spawn(PointLightBundle {
point_light: PointLight {
commands.spawn((
PointLight {
intensity: 2_000_000.0,
shadows_enabled: true,
..default()
},
transform: Transform::from_xyz(4.0, 8.0, 4.0),
..default()
});
Transform::from_xyz(4.0, 8.0, 4.0),
));
// camera
commands.spawn(Camera3dBundle {
transform: Transform::from_xyz(-2.0, 2.5, 5.0).looking_at(Vec3::ZERO, Vec3::Y),
..default()
});
commands.spawn((
Camera3d::default(),
Transform::from_xyz(-2.0, 2.5, 5.0).looking_at(Vec3::ZERO, Vec3::Y),
));
}
105 changes: 48 additions & 57 deletions crates/bevy-inspector-egui/examples/integrations/egui_dock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use std::any::TypeId;
use bevy_egui::EguiSet;
use bevy_reflect::TypeRegistry;
use bevy_render::camera::{CameraProjection, Viewport};
use bevy_window::PrimaryWindow;
use bevy_window::{PrimaryWindow, Window};
use egui_dock::{DockArea, DockState, NodeIndex, Style};

#[cfg(egui_dock_gizmo)]
Expand Down Expand Up @@ -411,71 +411,67 @@ fn setup(
// left - red
let mut transform = Transform::from_xyz(-box_offset, box_offset, 0.0);
transform.rotate(Quat::from_rotation_z(std::f32::consts::FRAC_PI_2));
commands.spawn(PbrBundle {
mesh: meshes.add(Cuboid::new(box_size, box_thickness, box_size)),
transform,
material: materials.add(StandardMaterial {

commands.spawn((
Mesh3d(meshes.add(Cuboid::new(box_size, box_thickness, box_size))),
MeshMaterial3d(materials.add(StandardMaterial {
base_color: Color::srgb(0.63, 0.065, 0.05),
..Default::default()
}),
..Default::default()
});
})),
transform,
));
// right - green
let mut transform = Transform::from_xyz(box_offset, box_offset, 0.0);
transform.rotate(Quat::from_rotation_z(std::f32::consts::FRAC_PI_2));
commands.spawn(PbrBundle {
mesh: meshes.add(Cuboid::new(box_size, box_thickness, box_size)),
commands.spawn((
Mesh3d(meshes.add(Cuboid::new(box_size, box_thickness, box_size))),
transform,
material: materials.add(StandardMaterial {
MeshMaterial3d(materials.add(StandardMaterial {
base_color: Color::srgb(0.14, 0.45, 0.091),
..Default::default()
}),
..Default::default()
});
})),
));
// bottom - white
commands.spawn(PbrBundle {
mesh: meshes.add(Cuboid::new(
commands.spawn((
Mesh3d(meshes.add(Cuboid::new(
box_size + 2.0 * box_thickness,
box_thickness,
box_size,
)),
material: materials.add(StandardMaterial {
))),
MeshMaterial3d(materials.add(StandardMaterial {
base_color: Color::srgb(0.725, 0.71, 0.68),
..Default::default()
}),
..Default::default()
});
})),
));
// top - white
let transform = Transform::from_xyz(0.0, 2.0 * box_offset, 0.0);
commands.spawn(PbrBundle {
mesh: meshes.add(Cuboid::new(
commands.spawn((
Mesh3d(meshes.add(Cuboid::new(
box_size + 2.0 * box_thickness,
box_thickness,
box_size,
)),
))),
transform,
material: materials.add(StandardMaterial {
MeshMaterial3d(materials.add(StandardMaterial {
base_color: Color::srgb(0.725, 0.71, 0.68),
..Default::default()
}),
..Default::default()
});
})),
));
// back - white
let mut transform = Transform::from_xyz(0.0, box_offset, -box_offset);
transform.rotate(Quat::from_rotation_x(std::f32::consts::FRAC_PI_2));
commands.spawn(PbrBundle {
mesh: meshes.add(Cuboid::new(
commands.spawn((
Mesh3d(meshes.add(Cuboid::new(
box_size + 2.0 * box_thickness,
box_thickness,
box_size + 2.0 * box_thickness,
)),
))),
transform,
material: materials.add(StandardMaterial {
MeshMaterial3d(materials.add(StandardMaterial {
base_color: Color::srgb(0.725, 0.71, 0.68),
..Default::default()
}),
..Default::default()
});
})),
));

// ambient light
commands.insert_resource(AmbientLight {
Expand All @@ -484,48 +480,43 @@ fn setup(
});
// top light
commands
.spawn(PbrBundle {
mesh: meshes.add(Plane3d::default().mesh().size(0.4, 0.4)),
transform: Transform::from_matrix(Mat4::from_scale_rotation_translation(
.spawn((
Mesh3d(meshes.add(Plane3d::default().mesh().size(0.4, 0.4))),
Transform::from_matrix(Mat4::from_scale_rotation_translation(
Vec3::ONE,
Quat::from_rotation_x(std::f32::consts::PI),
Vec3::new(0.0, box_size + 0.5 * box_thickness, 0.0),
)),
material: materials.add(StandardMaterial {
MeshMaterial3d(materials.add(StandardMaterial {
base_color: Color::WHITE,
emissive: LinearRgba::WHITE * 100.0,
..Default::default()
}),
..Default::default()
})
})),
))
.with_children(|builder| {
builder.spawn(PointLightBundle {
point_light: PointLight {
builder.spawn((
PointLight {
color: Color::WHITE,
intensity: 25000.0,
..Default::default()
},
transform: Transform::from_translation((box_thickness + 0.05) * Vec3::Y),
..Default::default()
});
Transform::from_translation((box_thickness + 0.05) * Vec3::Y),
));
});
// directional light
commands.spawn(DirectionalLightBundle {
directional_light: DirectionalLight {
commands.spawn((
DirectionalLight {
illuminance: 2000.0,
..default()
},
transform: Transform::from_rotation(Quat::from_rotation_x(-std::f32::consts::PI / 2.0)),
..Default::default()
});
Transform::from_rotation(Quat::from_rotation_x(-std::f32::consts::PI / 2.0)),
));

// camera
commands.spawn((
Camera3dBundle {
transform: Transform::from_xyz(0.0, box_offset, 4.0)
.looking_at(Vec3::new(0.0, box_offset, 0.0), Vec3::Y),
..Default::default()
},
Camera3d::default(),
Transform::from_xyz(0.0, box_offset, 4.0)
.looking_at(Vec3::new(0.0, box_offset, 0.0), Vec3::Y),
MainCamera,
// PickRaycastSource,
));
Expand Down
35 changes: 14 additions & 21 deletions crates/bevy-inspector-egui/examples/integrations/side_panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ struct Rotator;

fn rotator_system(time: Res<Time>, mut query: Query<&mut Transform, With<Rotator>>) {
for mut transform in &mut query {
transform.rotate_x(3.0 * time.delta_seconds());
transform.rotate_x(3.0 * time.delta_secs());
}
}

Expand All @@ -86,31 +86,24 @@ fn setup(
// parent cube
commands
.spawn((
PbrBundle {
mesh: cube_handle.clone(),
material: cube_material_handle.clone(),
transform: Transform::from_xyz(0.0, 0.0, 1.0),
..default()
},
Mesh3d(cube_handle.clone()),
MeshMaterial3d(cube_material_handle.clone()),
Transform::from_xyz(0.0, 0.0, 1.0),
Rotator,
))
.with_children(|parent| {
// child cube
parent.spawn(PbrBundle {
mesh: cube_handle,
material: cube_material_handle,
transform: Transform::from_xyz(0.0, 0.0, 3.0),
..default()
});
parent.spawn((
Mesh3d(cube_handle),
MeshMaterial3d(cube_material_handle),
Transform::from_xyz(0.0, 0.0, 3.0),
));
});
// light
commands.spawn(PointLightBundle {
transform: Transform::from_xyz(4.0, 5.0, -4.0),
..default()
});
commands.spawn((PointLight::default(), Transform::from_xyz(4.0, 5.0, -4.0)));
// camera
commands.spawn(Camera3dBundle {
transform: Transform::from_xyz(5.0, 10.0, 10.0).looking_at(Vec3::ZERO, Vec3::Y),
..default()
});
commands.spawn((
Camera3d::default(),
Transform::from_xyz(5.0, 10.0, 10.0).looking_at(Vec3::ZERO, Vec3::Y),
));
}
Loading