From cc2718ffd2646c0cb653c3d9080f98d699472f32 Mon Sep 17 00:00:00 2001 From: "kaosat.dev" Date: Tue, 20 Feb 2024 14:50:27 +0100 Subject: [PATCH] chore(crates): updated crates to Bevy 0.13 * updated deps * updated / changed code where relevant * updated README files * bumped version numbers for upcoming release * updated rust-toolchain --- crates/bevy_gltf_blueprints/Cargo.toml | 10 +++++----- crates/bevy_gltf_blueprints/README.md | 7 ++++--- .../src/copy_components.rs | 5 ++++- crates/bevy_gltf_blueprints/src/materials.rs | 2 +- crates/bevy_gltf_components/Cargo.toml | 6 +++--- crates/bevy_gltf_components/README.md | 11 ++++++----- .../bevy_gltf_components/src/process_gltfs.rs | 18 +++++++++++++----- .../src/ronstring_to_reflect_component.rs | 3 +-- crates/bevy_gltf_save_load/Cargo.toml | 9 +++++---- crates/bevy_gltf_save_load/README.md | 13 +++++++------ crates/bevy_gltf_save_load/src/lib.rs | 6 +++--- crates/bevy_registry_export/Cargo.toml | 12 ++++++------ crates/bevy_registry_export/README.md | 11 ++++++----- rust-toolchain.toml | 2 +- 14 files changed, 65 insertions(+), 50 deletions(-) diff --git a/crates/bevy_gltf_blueprints/Cargo.toml b/crates/bevy_gltf_blueprints/Cargo.toml index dc328a0..b70b40e 100644 --- a/crates/bevy_gltf_blueprints/Cargo.toml +++ b/crates/bevy_gltf_blueprints/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bevy_gltf_blueprints" -version = "0.7.3" +version = "0.8.0" authors = ["Mark 'kaosat-dev' Moissette"] description = "Adds the ability to define Blueprints/Prefabs for [Bevy](https://bevyengine.org/) inside gltf files and spawn them in Bevy." homepage = "https://github.com/kaosat-dev/Blender_bevy_components_workflow" @@ -14,9 +14,9 @@ license = "MIT OR Apache-2.0" workspace = true [dev-dependencies] -bevy = { version = "0.12", default-features = false, features = ["bevy_asset", "bevy_scene", "bevy_gltf", "bevy_animation", "animation"] } +bevy = { version = "0.13", default-features = false, features = ["bevy_asset", "bevy_scene", "bevy_gltf", "bevy_animation", "animation"] } [dependencies] -bevy_gltf_components = "0.3" -#bevy_gltf_components = { path = "../bevy_gltf_components" } -bevy = { version = "0.12", default-features = false, features = ["bevy_asset", "bevy_scene", "bevy_gltf", "bevy_animation", "animation"] } +#bevy_gltf_components = "0.3" +bevy_gltf_components = { path = "../bevy_gltf_components" } +bevy = { version = "0.13", default-features = false, features = ["bevy_asset", "bevy_scene", "bevy_gltf", "bevy_animation", "animation"] } diff --git a/crates/bevy_gltf_blueprints/README.md b/crates/bevy_gltf_blueprints/README.md index a4914ab..fe5baa9 100644 --- a/crates/bevy_gltf_blueprints/README.md +++ b/crates/bevy_gltf_blueprints/README.md @@ -26,7 +26,7 @@ Here's a minimal usage example: # Cargo.toml [dependencies] bevy="0.12" -bevy_gltf_blueprints = { version = "0.7"} +bevy_gltf_blueprints = { version = "0.8"} ``` @@ -64,7 +64,7 @@ fn spawn_blueprint( Add the following to your `[dependencies]` section in `Cargo.toml`: ```toml -bevy_gltf_blueprints = "0.7" +bevy_gltf_blueprints = "0.8" ``` Or use `cargo add`: @@ -346,9 +346,10 @@ The main branch is compatible with the latest Bevy release, while the branch `be Compatibility of `bevy_gltf_blueprints` versions: | `bevy_gltf_blueprints` | `bevy` | | :-- | :-- | +| `0.8` | `0.13` | | `0.3 - 0.7` | `0.12` | | `0.1 - 0.2` | `0.11` | -| branch `main` | `0.12` | +| branch `main` | `0.13` | | branch `bevy_main` | `main` | diff --git a/crates/bevy_gltf_blueprints/src/copy_components.rs b/crates/bevy_gltf_blueprints/src/copy_components.rs index 93feba9..e68cd3d 100644 --- a/crates/bevy_gltf_blueprints/src/copy_components.rs +++ b/crates/bevy_gltf_blueprints/src/copy_components.rs @@ -78,6 +78,9 @@ impl CopyComponents { }; for (component, type_id) in components { + let type_registry: &AppTypeRegistry = world.resource(); + let type_registry = type_registry.clone(); + let type_registry = type_registry.read(); let source = component .reflect(world.get_entity(self.source).unwrap()) .unwrap() @@ -90,7 +93,7 @@ impl CopyComponents { // println!("contains typeid {:?} {}", type_id, destination.contains_type_id(type_id)); // we only want to copy components that are NOT already in the destination (ie no overwriting existing components) if !destination.contains_type_id(type_id) { - component.insert(&mut destination, &*source); + component.insert(&mut destination, &*source, &type_registry); } } } diff --git a/crates/bevy_gltf_blueprints/src/materials.rs b/crates/bevy_gltf_blueprints/src/materials.rs index f375b8a..9fd8567 100644 --- a/crates/bevy_gltf_blueprints/src/materials.rs +++ b/crates/bevy_gltf_blueprints/src/materials.rs @@ -30,7 +30,7 @@ pub struct MaterialInfo { pub(crate) fn materials_inject( mut blueprints_config: ResMut, material_infos: Query<(&MaterialInfo, &Children), Added>, - with_materials_and_meshes: Query<( + with_materials_and_meshes: Query<(), ( With, With>, With>, diff --git a/crates/bevy_gltf_components/Cargo.toml b/crates/bevy_gltf_components/Cargo.toml index 9897ec7..33c73d9 100644 --- a/crates/bevy_gltf_components/Cargo.toml +++ b/crates/bevy_gltf_components/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bevy_gltf_components" -version = "0.3.2" +version = "0.4.0" authors = ["Mark 'kaosat-dev' Moissette"] description = "Allows you to define [Bevy](https://bevyengine.org/) components direclty inside gltf files and instanciate the components on the Bevy side." homepage = "https://github.com/kaosat-dev/Blender_bevy_components_workflow" @@ -14,9 +14,9 @@ license = "MIT OR Apache-2.0" workspace = true [dev-dependencies] -bevy = { version = "0.12", default-features = false, features = ["bevy_asset", "bevy_scene", "bevy_gltf"] } +bevy = { version = "0.13", default-features = false, features = ["bevy_asset", "bevy_scene", "bevy_gltf"] } [dependencies] -bevy = { version = "0.12", default-features = false, features = ["bevy_asset", "bevy_scene", "bevy_gltf"] } +bevy = { version = "0.13", default-features = false, features = ["bevy_asset", "bevy_scene", "bevy_gltf"] } serde = "1.0.188" ron = "0.8.1" diff --git a/crates/bevy_gltf_components/README.md b/crates/bevy_gltf_components/README.md index 7a6243d..01c8c75 100644 --- a/crates/bevy_gltf_components/README.md +++ b/crates/bevy_gltf_components/README.md @@ -23,8 +23,8 @@ Here's a minimal usage example: ```toml # Cargo.toml [dependencies] -bevy="0.12" -bevy_gltf_components = { version = "0.3"} +bevy="0.13" +bevy_gltf_components = { version = "0.4"} ``` @@ -60,7 +60,7 @@ bevy_gltf_components = { version = "0.3"} Add the following to your `[dependencies]` section in `Cargo.toml`: ```toml -bevy_gltf_components = "0.3" +bevy_gltf_components = "0.4" ``` Or use `cargo add`: @@ -71,7 +71,7 @@ cargo add bevy_gltf_components ## Configuration -starting with version 0.3, this plugin is configurable +starting with version 0.4, this plugin is configurable Use the default configuration: ```rust no_run @@ -117,9 +117,10 @@ The main branch is compatible with the latest Bevy release, while the branch `be Compatibility of `bevy_gltf_components` versions: | `bevy_gltf_components` | `bevy` | | :-- | :-- | +| `0.4` | `0.13` | | `0.2 - 0.3` | `0.12` | | `0.1` | `0.11` | -| branch `main` | `0.12` | +| branch `main` | `0.13` | | branch `bevy_main` | `main` | diff --git a/crates/bevy_gltf_components/src/process_gltfs.rs b/crates/bevy_gltf_components/src/process_gltfs.rs index bce34bc..5cb2d10 100644 --- a/crates/bevy_gltf_components/src/process_gltfs.rs +++ b/crates/bevy_gltf_components/src/process_gltfs.rs @@ -32,6 +32,7 @@ pub fn add_components_from_gltf_extras(world: &mut World) { let type_registry: &AppTypeRegistry = world.resource(); let type_registry = type_registry.read(); + let reflect_components = ronstring_to_reflect_component( &extra.value, &type_registry, @@ -68,20 +69,27 @@ pub fn add_components_from_gltf_extras(world: &mut World) { } for (entity, components) in entity_components { + let type_registry: &AppTypeRegistry = world.resource(); + let type_registry = type_registry.clone(); + let type_registry = type_registry.read(); + if !components.is_empty() { debug!("--entity {:?}, components {}", entity, components.len()); } - for (component, type_registration) in components { - let mut entity_mut = world.entity_mut(entity); + for (component, type_registration) in components { debug!( "------adding {} {:?}", component.get_represented_type_info().unwrap().type_path(), component ); - type_registration + + { + let mut entity_mut = world.entity_mut(entity); + type_registration .data::() - .unwrap() - .insert(&mut entity_mut, &*component); // TODO: how can we insert any additional components "by hand" here ? + .expect("Unable to reflect component") + .insert(&mut entity_mut, &*component, &type_registry); // TODO: how can we insert any additional components "by hand" here ? + } } } } diff --git a/crates/bevy_gltf_components/src/ronstring_to_reflect_component.rs b/crates/bevy_gltf_components/src/ronstring_to_reflect_component.rs index 4bae651..97167cd 100644 --- a/crates/bevy_gltf_components/src/ronstring_to_reflect_component.rs +++ b/crates/bevy_gltf_components/src/ronstring_to_reflect_component.rs @@ -113,7 +113,7 @@ pub fn ronstring_to_reflect_component( println!("serialized Component {}", serialized);*/ debug!("component data ron string {}", ron_string); - let mut deserializer = ron::Deserializer::from_str(ron_string.as_str()).unwrap(); + let mut deserializer = ron::Deserializer::from_str(ron_string.as_str()).expect("deserialzer should have been generated from string"); let reflect_deserializer = UntypedReflectDeserializer::new(type_registry); let component = reflect_deserializer .deserialize(&mut deserializer) @@ -126,7 +126,6 @@ pub fn ronstring_to_reflect_component( debug!("component {:?}", component); debug!("real type {:?}", component.get_represented_type_info()); - components.push((component, type_registration.clone())); debug!("found type registration for {}", capitalized_type_name); } else { diff --git a/crates/bevy_gltf_save_load/Cargo.toml b/crates/bevy_gltf_save_load/Cargo.toml index 23800fb..06d9ff8 100644 --- a/crates/bevy_gltf_save_load/Cargo.toml +++ b/crates/bevy_gltf_save_load/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bevy_gltf_save_load" -version = "0.2.1" +version = "0.3.0" authors = ["Mark 'kaosat-dev' Moissette"] description = "Save & load your bevy games" homepage = "https://github.com/kaosat-dev/Blender_bevy_components_workflow" @@ -14,8 +14,9 @@ license = "MIT OR Apache-2.0" workspace = true [dev-dependencies] -bevy = { version = "0.12", default-features = false, features = ["bevy_asset", "bevy_scene", "bevy_gltf"] } +bevy = { version = "0.13", default-features = false, features = ["bevy_asset", "bevy_scene", "bevy_gltf"] } [dependencies] -bevy = { version = "0.12", default-features = false, features = ["bevy_asset", "bevy_scene", "bevy_gltf"] } -bevy_gltf_blueprints = "0.7" +bevy = { version = "0.13", default-features = false, features = ["bevy_asset", "bevy_scene", "bevy_gltf"] } +#bevy_gltf_blueprints = "0.7" +bevy_gltf_blueprints = { path = "../bevy_gltf_blueprints" } diff --git a/crates/bevy_gltf_save_load/README.md b/crates/bevy_gltf_save_load/README.md index e68daac..d7aa20e 100644 --- a/crates/bevy_gltf_save_load/README.md +++ b/crates/bevy_gltf_save_load/README.md @@ -34,8 +34,8 @@ Here's a minimal usage example: ```toml # Cargo.toml [dependencies] -bevy="0.12" -bevy_gltf_save_load = "0.1" +bevy="0.13" +bevy_gltf_save_load = "0.3" bevy_gltf_blueprints = "0.6" // also needed ``` @@ -141,8 +141,8 @@ take a look at the [example]('https://github.com/kaosat-dev/Blender_bevy_compone Add the following to your `[dependencies]` section in `Cargo.toml`: ```toml -bevy_gltf_save_load = "0.1" -bevy_gltf_blueprints = "0.6" // also needed, as bevy_gltf_save_load does not re-export it at this time +bevy_gltf_save_load = "0.3" +bevy_gltf_blueprints = "0.8" // also needed, as bevy_gltf_save_load does not re-export it at this time ``` @@ -299,8 +299,9 @@ The main branch is compatible with the latest Bevy release, while the branch `be Compatibility of `bevy_gltf_save_load` versions: | `bevy_gltf_save_load` | `bevy` | | :-- | :-- | -| `0.1 ` | `0.12` | -| branch `main` | `0.12` | +| `0.3 ` | `0.13` | +| `0.1 - 0.2` | `0.12` | +| branch `main` | `0.13` | | branch `bevy_main` | `main` | diff --git a/crates/bevy_gltf_save_load/src/lib.rs b/crates/bevy_gltf_save_load/src/lib.rs index 00c45b9..6a5725f 100644 --- a/crates/bevy_gltf_save_load/src/lib.rs +++ b/crates/bevy_gltf_save_load/src/lib.rs @@ -92,15 +92,15 @@ impl Plugin for SaveLoadPlugin { Update, (unload_world, apply_deferred, load_game) .chain() - .run_if(resource_exists::()) - .run_if(not(resource_exists::())) + .run_if(resource_exists::) + .run_if(not(resource_exists::)) .in_set(LoadingSet::Load), ) .add_systems( Update, (load_static, apply_deferred, cleanup_loaded_scene) .chain() - .run_if(resource_exists::()) + .run_if(resource_exists::) // .run_if(in_state(AppState::LoadingGame)) .in_set(LoadingSet::Load), ); diff --git a/crates/bevy_registry_export/Cargo.toml b/crates/bevy_registry_export/Cargo.toml index 5cee292..2ffe820 100644 --- a/crates/bevy_registry_export/Cargo.toml +++ b/crates/bevy_registry_export/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bevy_registry_export" -version = "0.1.1" +version = "0.2.0" authors = ["Mark 'kaosat-dev' Moissette", "Pascal 'Killercup' Hertleif"] description = "Allows you to define [Bevy](https://bevyengine.org/) components direclty inside gltf files and instanciate the components on the Bevy side." homepage = "https://github.com/kaosat-dev/Blender_bevy_components_workflow" @@ -11,11 +11,11 @@ edition = "2021" license = "MIT OR Apache-2.0" [dev-dependencies] -bevy = { version = "0.12", default-features = false, features = ["bevy_asset", "bevy_scene", "bevy_gltf"] } +bevy = { version = "0.13", default-features = false, features = ["bevy_asset", "bevy_scene", "bevy_gltf"] } [dependencies] -bevy = { version = "0.12", default-features = false, features = ["bevy_scene"] } -bevy_reflect = { version = "0.12.1", default-features = false } -bevy_app = { version = "0.12.1", default-features = false, features = ["bevy_reflect"] } -bevy_ecs = { version = "0.12.1", default-features = false, features = ["bevy_reflect"] } +bevy = { version = "0.13", default-features = false, features = ["bevy_scene"] } +bevy_reflect = { version = "0.13", default-features = false } +bevy_app = { version = "0.13", default-features = false, features = ["bevy_reflect"] } +bevy_ecs = { version = "0.13", default-features = false, features = ["bevy_reflect"] } serde_json = "1.0.108" \ No newline at end of file diff --git a/crates/bevy_registry_export/README.md b/crates/bevy_registry_export/README.md index df85616..0052701 100644 --- a/crates/bevy_registry_export/README.md +++ b/crates/bevy_registry_export/README.md @@ -17,8 +17,8 @@ Here's a minimal usage example: ```toml # Cargo.toml [dependencies] -bevy="0.12" -bevy_registry_export = "0.1" +bevy="0.13" +bevy_registry_export = "0.2" ``` ```rust no_run @@ -44,7 +44,7 @@ take a look at the [example]('https://github.com/kaosat-dev/Blender_bevy_compone Add the following to your `[dependencies]` section in `Cargo.toml`: ```toml -bevy_registry_export = "0.1" +bevy_registry_export = "0.2" ``` @@ -112,8 +112,9 @@ The main branch is compatible with the latest Bevy release, while the branch `be Compatibility of `bevy_registry_export` versions: | `bevy_registry_export` | `bevy` | `bevy_components (Blender add-on)` | | :-- | :-- |:-- | -| `0.1 ` | `0.12` | `0.1.0` | -| branch `main` | `0.12` | `0.1.0` | +| `0.1 ` | `0.13` | `0.1 - 0.2` | +| `0.1 ` | `0.12` | `0.1 - 0.2` | +| branch `main` | `0.13` | `0.1.0` | | branch `bevy_main` | `main` | `n/a` | diff --git a/rust-toolchain.toml b/rust-toolchain.toml index ffcfdc7..e5e7c12 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,2 +1,2 @@ [toolchain] -channel = '1.75.0' +channel = '1.76.0'