From cb1477401b231ce962b997b85659efb87eb0aaa9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cs=C3=A1nyi=20Istv=C3=A1n?= Date: Wed, 20 May 2026 12:55:02 +0200 Subject: [PATCH] Update to Bevy 0.19 --- Cargo.toml | 8 ++++---- examples/cubes.rs | 2 +- examples/viewer.rs | 4 ++-- src/scene.rs | 8 ++++---- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 5495d81..606bdda 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bevy_obj" -version = "0.18.2" +version = "0.19.0" edition = "2024" license = "MIT OR Apache-2.0" repository = "https://github.com/AmionSky/bevy_obj" @@ -14,12 +14,12 @@ thiserror = "2.0.0" wobj = "0.3.0" [dependencies.bevy] -version = "0.18.0" +version = "0.19.0-rc" default-features = false features = ["bevy_asset", "bevy_mesh"] [dev-dependencies.bevy] -version = "0.18.0" +version = "0.19.0-rc" default-features = true [features] @@ -27,4 +27,4 @@ default = ["mesh", "scene"] # Support for loading OBJ file as a singular mesh mesh = [] # Support for loading OBJ file as a scene with MTL materials -scene = ["bevy/bevy_scene", "bevy/bevy_pbr", "bevy/bevy_log"] +scene = ["bevy/bevy_world_serialization", "bevy/bevy_pbr", "bevy/bevy_log"] diff --git a/examples/cubes.rs b/examples/cubes.rs index 8015b60..1e1b241 100644 --- a/examples/cubes.rs +++ b/examples/cubes.rs @@ -29,7 +29,7 @@ fn load_mesh( fn load_scene(mut commands: Commands, asset_server: Res) { // Spawn a spinning cube commands.spawn(( - SceneRoot(asset_server.load("cube.obj")), + WorldAssetRoot(asset_server.load("cube.obj")), Transform::from_xyz(1.7, 0.0, -0.5), Spin, )); diff --git a/examples/viewer.rs b/examples/viewer.rs index e5b9cfe..cb68262 100644 --- a/examples/viewer.rs +++ b/examples/viewer.rs @@ -25,7 +25,7 @@ fn spawn_obj( mut commands: Commands, asset_server: Res, obj_path: Query<&ObjPath, Changed>, - query: Query>, + query: Query>, ) { if let Ok(path) = obj_path.single() && let Some(path) = &path.0 @@ -40,7 +40,7 @@ fn spawn_obj( // Spawn new OBJ let scene = asset_server.load(path.clone()); - commands.spawn((SceneRoot(scene), Transform::IDENTITY)); + commands.spawn((WorldAssetRoot(scene), Transform::IDENTITY)); } else { warn!("Not an OBJ file: {:?}", path); } diff --git a/src/scene.rs b/src/scene.rs index 4e12f0e..bed1b37 100644 --- a/src/scene.rs +++ b/src/scene.rs @@ -14,7 +14,7 @@ pub struct ObjLoader; impl AssetLoader for ObjLoader { type Error = ObjError; type Settings = ObjSettings; - type Asset = Scene; + type Asset = WorldAsset; fn load( &self, @@ -57,7 +57,7 @@ fn resolve_path<'a>(source: &AssetPath<'a>, path: &Path) -> Result( bytes: &'a [u8], ctx: &'a mut LoadContext<'_>, settings: &'a ObjSettings, -) -> Result { +) -> Result { let obj = wobj::Obj::parse(bytes).map_err(ObjError::ObjParseError)?; let mut materials = HashSet::new(); @@ -234,7 +234,7 @@ async fn load_obj_as_scene<'a>( world.spawn(entity); } - Ok(Scene::new(world)) + Ok(WorldAsset::new(world)) } #[cfg(test)]