From c4e83655f38a8137e93cbaee29f4ab1ea5892b8a Mon Sep 17 00:00:00 2001 From: Mark Moissette Date: Sat, 11 Nov 2023 22:58:00 +0100 Subject: [PATCH] chore(bevy_gltf_components): Update to Bevy 0.12 (#32) * chore(bevy_gltf_components): updated code for bevy_main/ v0.12 * refactor(examples): cleanups & tweaks * added compatibility tables --- Cargo.lock | 565 ++++++++++-------- Cargo.toml | 11 +- README.md | 2 - assets/advanced/assets_game.assets.ron | 2 +- assets/animation/assets_game.assets.ron | 2 +- crates/bevy_gltf_blueprints/Cargo.toml | 8 +- crates/bevy_gltf_blueprints/README.md | 19 +- .../src/spawn_from_blueprints.rs | 5 +- crates/bevy_gltf_components/Cargo.toml | 6 +- crates/bevy_gltf_components/README.md | 18 +- .../src/gltf_to_components.rs | 306 +++++----- .../bevy_gltf_components/src/process_gltfs.rs | 35 +- examples/advanced/assets/assets_game.rs | 2 +- examples/advanced/core/mod.rs | 60 +- examples/advanced/game/in_game.rs | 57 +- examples/advanced/game/in_main_menu.rs | 9 +- examples/advanced/game/mod.rs | 7 +- examples/advanced/game/picking.rs | 9 +- examples/advanced/main.rs | 10 +- examples/animation/assets/assets_game.rs | 2 +- examples/animation/core/mod.rs | 1 - examples/animation/game/in_game.rs | 10 +- examples/animation/main.rs | 10 +- examples/basic/game.rs | 4 +- examples/basic/main.rs | 31 +- 25 files changed, 636 insertions(+), 555 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5a1cf78..a0755f6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -20,24 +20,24 @@ checksum = "c71b1793ee61086797f5c80b6efa2b8ffa6d5dd703f118545808a7f2e27f7046" [[package]] name = "accesskit" -version = "0.11.2" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76eb1adf08c5bcaa8490b9851fd53cca27fa9880076f178ea9d29f05196728a8" +checksum = "ca8410747ed85a17c4a1e9ed3f5a74d3e7bdcc876cf9a18ff40ae21d645997b2" [[package]] name = "accesskit_consumer" -version = "0.15.2" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04bb4d9e4772fe0d47df57d0d5dbe5d85dd05e2f37ae1ddb6b105e76be58fb00" +checksum = "8c17cca53c09fbd7288667b22a201274b9becaa27f0b91bf52a526db95de45e6" dependencies = [ "accesskit", ] [[package]] name = "accesskit_macos" -version = "0.9.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "134d0acf6acb667c89d3332999b1a5df4edbc8d6113910f392ebb73f2b03bb56" +checksum = "cd3b6ae1eabbfbced10e840fd3fce8a93ae84f174b3e4ba892ab7bcb42e477a7" dependencies = [ "accesskit", "accesskit_consumer", @@ -47,23 +47,23 @@ dependencies = [ [[package]] name = "accesskit_windows" -version = "0.14.3" +version = "0.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9eac0a7f2d7cd7a93b938af401d3d8e8b7094217989a7c25c55a953023436e31" +checksum = "afcae27ec0974fc7c3b0b318783be89fd1b2e66dd702179fe600166a38ff4a0b" dependencies = [ "accesskit", "accesskit_consumer", - "arrayvec", "once_cell", "paste", + "static_assertions", "windows 0.48.0", ] [[package]] name = "accesskit_winit" -version = "0.14.4" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "825d23acee1bd6d25cbaa3ca6ed6e73faf24122a774ec33d52c5c86c6ab423c0" +checksum = "88e39fcec2e10971e188730b7a76bab60647dacc973d4591855ebebcadfaa738" dependencies = [ "accesskit", "accesskit_macos", @@ -209,6 +209,12 @@ dependencies = [ "x11rb", ] +[[package]] +name = "arrayref" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545" + [[package]] name = "arrayvec" version = "0.7.4" @@ -224,6 +230,16 @@ dependencies = [ "libloading 0.7.4", ] +[[package]] +name = "async-broadcast" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c48ccdbf6ca6b121e0f586cbc0e73ae440e56c67c30fa0873b4e110d9c26d2b" +dependencies = [ + "event-listener", + "futures-core", +] + [[package]] name = "async-channel" version = "1.9.0" @@ -249,6 +265,18 @@ dependencies = [ "slab", ] +[[package]] +name = "async-fs" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "279cf904654eeebfa37ac9bb1598880884924aab82e290aa65c9e77a0e142e06" +dependencies = [ + "async-lock", + "autocfg", + "blocking", + "futures-lite", +] + [[package]] name = "async-lock" version = "2.8.0" @@ -264,6 +292,12 @@ version = "4.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4eb2cdb97421e01129ccb49169d8279ed21e829929144f4a22a6e54ac549ca1" +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + [[package]] name = "autocfg" version = "1.1.0" @@ -299,18 +333,18 @@ checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" [[package]] name = "bevy" -version = "0.11.3" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91c6d3ec4f89e85294dc97334c5b271ddc301fdf67ac9bb994fe44d9273e6ed7" +checksum = "329e344f835f5a9a4c46a6d1d57371f726aa2c482d1bd669b2b9c4eb1ee91fd7" dependencies = [ "bevy_internal", ] [[package]] name = "bevy-inspector-egui" -version = "0.20.0" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "452f1258251b85c06c5bc9df9ea994d8f3b8c0696f346d43878eec52fce8a09c" +checksum = "d65b98d6fca1209c36c4d403c377f303aad22d940281fe1a9e431217516f0622" dependencies = [ "bevy-inspector-egui-derive", "bevy_app", @@ -336,9 +370,9 @@ dependencies = [ [[package]] name = "bevy-inspector-egui-derive" -version = "0.20.0" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a60a8d711fa10879a4e7d10127077505ba9890cead8d1f5ecedc64d14b22b6c" +checksum = "ec800b7cf98151b5dbff80f0eb6dffcb4bcfceef6e457888b395ead4eb7e75ba" dependencies = [ "proc-macro2", "quote", @@ -347,9 +381,9 @@ dependencies = [ [[package]] name = "bevy_a11y" -version = "0.11.3" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "132c9e35a77c5395951f6d25fa2c52ee92296353426df4f961e60f3ff47e2e42" +checksum = "271b812e5734f5056a400f7d64592dd82d6c0e6179389c2f066f433ab8bc7692" dependencies = [ "accesskit", "bevy_app", @@ -359,9 +393,9 @@ dependencies = [ [[package]] name = "bevy_animation" -version = "0.11.3" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f44eae3f1c35a87e38ad146f72317f19ce7616dad8bbdfb88ee752c1282d28c5" +checksum = "ab94187a1253433e14f175293d8a86ec1c2822fda2a17807908f11ec21f45f00" dependencies = [ "bevy_app", "bevy_asset", @@ -378,9 +412,9 @@ dependencies = [ [[package]] name = "bevy_app" -version = "0.11.3" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f557a7d59e1e16892d7544fc37316506ee598cb5310ef0365125a30783c11531" +checksum = "172d532ea812e5954fa814dae003c207f2a0b20c6e50431787c94a7159677ece" dependencies = [ "bevy_derive", "bevy_ecs", @@ -394,26 +428,29 @@ dependencies = [ [[package]] name = "bevy_asset" -version = "0.11.3" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9714af523da4cdf58c42a317e5ed40349708ad954a18533991fd64c8ae0a6f68" +checksum = "ccb2b67984088b23e223cfe9ec1befd89a110665a679acb06839bc4334ed37d6" dependencies = [ - "anyhow", - "async-channel", + "async-broadcast", + "async-fs", + "async-lock", "bevy_app", - "bevy_diagnostic", + "bevy_asset_macros", "bevy_ecs", "bevy_log", "bevy_reflect", "bevy_tasks", "bevy_utils", "bevy_winit", + "blake3", "crossbeam-channel", "downcast-rs", - "fastrand 1.9.0", + "futures-io", + "futures-lite", "js-sys", - "notify", "parking_lot", + "ron", "serde", "thiserror", "wasm-bindgen", @@ -423,9 +460,9 @@ dependencies = [ [[package]] name = "bevy_asset_loader" -version = "0.17.0" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67504fe2bfe56b0c58a2e042a7f5b1dd242a9b9f28e78e3fe63e2c3d62692bea" +checksum = "3d797cc907daa293a2776fea1517ed79f9e54d9901dfd35410743cbe536d4c2b" dependencies = [ "anyhow", "bevy", @@ -437,22 +474,33 @@ dependencies = [ [[package]] name = "bevy_asset_loader_derive" -version = "0.17.0" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf0d73cdac61fd6f9cb4df9c936ffe6d1343a63470c91c6a6823e1664d298fcb" +checksum = "d43820afc6e2a7a9e09adb5f13a760bd9a973f391c106411f0bf229d9958c61d" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.38", +] + +[[package]] +name = "bevy_asset_macros" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b3245193e90fc8abcf1059a467cb224501dcda083d114c67c10ac66b7171e3a" +dependencies = [ + "bevy_macro_utils", + "proc-macro2", + "quote", + "syn 2.0.38", ] [[package]] name = "bevy_audio" -version = "0.11.3" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4de308bd63a2f7a0b77ffeb7cf00cc185ec01393c5db2091fe03964f97152749" +checksum = "478de80ff25cb7decbcb22797774d1597e8c32914e81431c67d64faadc08f84a" dependencies = [ - "anyhow", "bevy_app", "bevy_asset", "bevy_derive", @@ -462,27 +510,27 @@ dependencies = [ "bevy_transform", "bevy_utils", "oboe", - "parking_lot", "rodio", ] [[package]] name = "bevy_common_assets" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0e5659f20aeaa1703e76d87c62d66f92aaa56e431fbed71bb38345b576aa6f0" +checksum = "9397adf1558aa3f08e20aa567538a7238b451362fc8c6b678d409c040c221799" dependencies = [ "anyhow", "bevy", "ron", "serde", + "thiserror", ] [[package]] name = "bevy_core" -version = "0.11.3" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d5272321be5fcf5ce2fb16023bc825bb10dfcb71611117296537181ce950f48" +checksum = "025e6800b73048092a55c3611e9327ad4c4c17b60517ec1c0086bb40b4b19ea8" dependencies = [ "bevy_app", "bevy_ecs", @@ -496,15 +544,16 @@ dependencies = [ [[package]] name = "bevy_core_pipeline" -version = "0.11.3" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67382fa9c96ce4f4e5833ed7cedd9886844a8f3284b4a717bd4ac738dcdea0c3" +checksum = "2e4b08a2d53ba62d9ec1fca3f7f4e0f556e9f59e1c8e63a4b7c2a18c0701152c" dependencies = [ "bevy_app", "bevy_asset", "bevy_core", "bevy_derive", "bevy_ecs", + "bevy_log", "bevy_math", "bevy_reflect", "bevy_render", @@ -517,9 +566,9 @@ dependencies = [ [[package]] name = "bevy_derive" -version = "0.11.3" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a44e4e2784a81430199e4157e02903a987a32127c773985506f020e7d501b62e" +checksum = "24bf40259be12a1a24d9fd536f5ff18d31eeb5665b77e2732899783be6edc5d6" dependencies = [ "bevy_macro_utils", "quote", @@ -528,9 +577,9 @@ dependencies = [ [[package]] name = "bevy_diagnostic" -version = "0.11.3" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6babb230dc383c98fdfc9603e3a7a2a49e1e2879dbe8291059ef37dca897932e" +checksum = "41b5a99a9fb6cd7d1eb1714fad193944a0317f0887a15cccb8309c8d37951132" dependencies = [ "bevy_app", "bevy_core", @@ -543,9 +592,9 @@ dependencies = [ [[package]] name = "bevy_ecs" -version = "0.11.3" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "266144b36df7e834d5198049e037ecdf2a2310a76ce39ed937d1b0a6a2c4e8c6" +checksum = "ae11a1f467c372b50e9d4b55e78370f5420c9db7416200cc441cc84f08174dd3" dependencies = [ "async-channel", "bevy_ecs_macros", @@ -564,9 +613,9 @@ dependencies = [ [[package]] name = "bevy_ecs_macros" -version = "0.11.3" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7157a9c3be038d5008ee3f114feb6cf6b39c1d3d32ee21a7cacb8f81fccdfa80" +checksum = "f642c2b67c4d0daf8edf15074f6351457eb487a34b3de1290c760d8f3ac9ec16" dependencies = [ "bevy_macro_utils", "proc-macro2", @@ -576,9 +625,9 @@ dependencies = [ [[package]] name = "bevy_editor_pls" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad89c9f0101deb1740a0ed851230ebe358f4e8e2e8fa11e486fe3382d509db5f" +checksum = "170e3ee3293f70be7fa1b82e8ffe52dcb190c68b2f0ef4847afe65626b417ad7" dependencies = [ "bevy", "bevy_editor_pls_core", @@ -589,9 +638,9 @@ dependencies = [ [[package]] name = "bevy_editor_pls_core" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c20ee315c228079cced43eff70f610d39808f15ec6856bb08f0179ed3421ac54" +checksum = "b9bab331de653d7d976a1fb0ab3ae8eff1dc821c5991c09bdbe945e70234839c" dependencies = [ "bevy", "bevy-inspector-egui", @@ -601,9 +650,9 @@ dependencies = [ [[package]] name = "bevy_editor_pls_default_windows" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d03b3131877fb7af66d7a3b9597b2bc05e02c6a978c91ead74a6c4bf3d01372b" +checksum = "b833e3b3d5c69b92527e766b470b27cb4745406e2087be19be81b595cc48792c" dependencies = [ "bevy", "bevy-inspector-egui", @@ -617,9 +666,9 @@ dependencies = [ [[package]] name = "bevy_egui" -version = "0.22.0" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb1c1f6ad293c60fd8559c4502cda5e832e92b0e0f3d994929b33f24d4352d70" +checksum = "85450af551b7e1cb766f710763b60a12a82ffd6323945a8f776c6334c59ccdc1" dependencies = [ "arboard", "bevy", @@ -630,9 +679,9 @@ dependencies = [ [[package]] name = "bevy_encase_derive" -version = "0.11.3" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0ac0f55ad6bca1be7b0f35bbd5fc95ed3d31e4e9db158fee8e5327f59006001" +checksum = "65b9fb5a62c4e3ab70caaa839470d35fa932001b1b34b08bc7f7f1909bd2b3a7" dependencies = [ "bevy_macro_utils", "encase_derive_impl", @@ -640,9 +689,9 @@ dependencies = [ [[package]] name = "bevy_gilrs" -version = "0.11.3" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65f4d79c55829f8016014593a42453f61a564ffb06ef79460d25696ccdfac67b" +checksum = "ad31cc2c84315e0759d793d6c5bcb7d8789bbc16359c98d1b766e708c1bbae49" dependencies = [ "bevy_app", "bevy_ecs", @@ -656,9 +705,9 @@ dependencies = [ [[package]] name = "bevy_gizmos" -version = "0.11.3" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e286a3e7276431963f4aa29165ea5429fa7dbbc6d5c5ba0c531e7dd44ecc88a2" +checksum = "87d1cc978b91f416b23eb16f00e69f95c3a04582021827d8082e92d4725cc510" dependencies = [ "bevy_app", "bevy_asset", @@ -676,11 +725,10 @@ dependencies = [ [[package]] name = "bevy_gltf" -version = "0.11.3" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f07494a733dca032e71a20f4b1f423de765da49cbff34406ae6cd813f9b50c41" +checksum = "6f933745c0c86e2c07948def581259b466f99708328657054e956275430ccfd7" dependencies = [ - "anyhow", "base64 0.13.1", "bevy_animation", "bevy_app", @@ -707,15 +755,15 @@ dependencies = [ [[package]] name = "bevy_gltf_blueprints" -version = "0.2.1" +version = "0.3.0" dependencies = [ "bevy", - "bevy_gltf_components 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "bevy_gltf_components 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "bevy_gltf_components" -version = "0.1.3" +version = "0.2.0" dependencies = [ "bevy", "ron", @@ -724,9 +772,9 @@ dependencies = [ [[package]] name = "bevy_gltf_components" -version = "0.1.3" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5601991afc3e35b8e643c6e2a9c6345b966c250e981659ab8762ce8c381ed9a6" +checksum = "cd745a2988c631286404e12d184d4a30a634fbbba1deceaaa1ca7fcbc607cc7a" dependencies = [ "bevy", "ron", @@ -741,7 +789,7 @@ dependencies = [ "bevy_asset_loader", "bevy_editor_pls", "bevy_gltf_blueprints", - "bevy_gltf_components 0.1.3", + "bevy_gltf_components 0.2.0", "bevy_rapier3d", "rand", "ron", @@ -750,9 +798,9 @@ dependencies = [ [[package]] name = "bevy_hierarchy" -version = "0.11.3" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "103f8f58416ac6799b8c7f0b418f1fac9eba44fa924df3b0e16b09256b897e3d" +checksum = "64fa240011fce8ee23f9b46e5a26a628a31d7860d6d2e4e0e361bb3ea6d5a703" dependencies = [ "bevy_app", "bevy_core", @@ -765,9 +813,9 @@ dependencies = [ [[package]] name = "bevy_input" -version = "0.11.3" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffbd935401101ac8003f3c3aea70788c65ad03f7a32716a10608bedda7a648bc" +checksum = "9e86e241b3a10b79f65a69205552546723b855d3d4c1bd8261637c076144d32f" dependencies = [ "bevy_app", "bevy_ecs", @@ -780,9 +828,9 @@ dependencies = [ [[package]] name = "bevy_internal" -version = "0.11.3" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0e35a9b2bd29aa784b3cc416bcbf2a298f69f00ca51fd042ea39d9af7fad37e" +checksum = "55124e486814c4d3632d5cfad9c4f4e46d052c028593ec46fef5bfbfb0f840b1" dependencies = [ "bevy_a11y", "bevy_animation", @@ -819,9 +867,9 @@ dependencies = [ [[package]] name = "bevy_log" -version = "0.11.3" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07dcc615ff4f617b06c3f9522fca3c55d56f9644db293318f8ab68fcdea5d4fe" +checksum = "011417debf7868b45932bb97fc0d5bfdeaf9304e324aa94840e2f1e6deeed69d" dependencies = [ "android_log-sys", "bevy_app", @@ -835,21 +883,22 @@ dependencies = [ [[package]] name = "bevy_macro_utils" -version = "0.11.3" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23ddc18d489b4e57832d4958cde7cd2f349f0ad91e5892ac9e2f2ee16546b981" +checksum = "cf6fba87c6d069fcbcd8a48625ca8ab4392ad40d2b260863ce7d641a0f42986d" dependencies = [ + "proc-macro2", "quote", "rustc-hash", "syn 2.0.38", - "toml_edit", + "toml_edit 0.20.7", ] [[package]] name = "bevy_math" -version = "0.11.3" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78286a81fead796dc4b45ab14f4f02fe29a94423d3587bcfef872b2a8e0a474b" +checksum = "752764558a1f429c20704c3b836a019fa308961c43fdfef4f08e339d456c96be" dependencies = [ "glam", "serde", @@ -857,18 +906,18 @@ dependencies = [ [[package]] name = "bevy_mikktspace" -version = "0.11.3" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6cfc2a21ea47970a9b1f0f4735af3256a8f204815bd756110051d10f9d909497" +checksum = "b596c41a56f2268ec7cde560edc588bc7b5886e4b49c8b27c4dcc9f7c743424c" dependencies = [ "glam", ] [[package]] name = "bevy_mod_debugdump" -version = "0.8.1" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85741df1a1a2aa03ecd2d9f70ba8787846c6b2b91b82ef85f71ed56f87591b15" +checksum = "4db8601f41ea570b7d32f3177292a608196c59bdf3298001a9e202d5e7439438" dependencies = [ "bevy_app", "bevy_ecs", @@ -881,9 +930,9 @@ dependencies = [ [[package]] name = "bevy_pbr" -version = "0.11.3" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63ca796a619e61cd43a0a3b11fde54644f7f0732a1fba1eef5d406248c6eba85" +checksum = "eeb6a35a78d355cc21c10f277dcd171eca65e30a90e76eb89f4dacf606621fe1" dependencies = [ "bevy_app", "bevy_asset", @@ -898,24 +947,27 @@ dependencies = [ "bevy_window", "bitflags 2.4.1", "bytemuck", + "fixedbitset", "naga_oil", "radsort", + "smallvec", + "thread_local", ] [[package]] name = "bevy_ptr" -version = "0.11.3" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72c7586401a46f7d8e436028225c1df5288f2e0082d066b247a82466fea155c6" +checksum = "308a02679f6ce21ef71de20fae6d6a2016c07baa21d8e8d0558e6b7851e8adf2" [[package]] name = "bevy_rapier3d" -version = "0.22.0" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12402872b857ba490f1040ab6212915bd9bf25f8584b31f2c43cef41b33f3be4" +checksum = "c3f0a2641af76c9eb17da0dcb0fb20cd9d615b93b67be0b85f1867487e956b5a" dependencies = [ "bevy", - "bitflags 1.3.2", + "bitflags 2.4.1", "log", "nalgebra", "rapier3d", @@ -924,9 +976,9 @@ dependencies = [ [[package]] name = "bevy_reflect" -version = "0.11.3" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0778197a1eb3e095a71417c74b7152ede02975cdc95b5ea4ddc5251ed00a2eb5" +checksum = "cdd56914a8ad57621d7a1a099f7e6b1f7482c9c76cedc9c3d4c175a203939c5d" dependencies = [ "bevy_math", "bevy_ptr", @@ -935,8 +987,6 @@ dependencies = [ "downcast-rs", "erased-serde", "glam", - "once_cell", - "parking_lot", "serde", "smallvec", "smol_str", @@ -945,12 +995,11 @@ dependencies = [ [[package]] name = "bevy_reflect_derive" -version = "0.11.3" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "342a4b2d09db22c48607d23ad59a056aff1ee004549050a51d490d375ba29528" +checksum = "25f627907c40ac552f798423447fc331fc1ddacd94c5f7a2a70942eb06bc8447" dependencies = [ "bevy_macro_utils", - "bit-set", "proc-macro2", "quote", "syn 2.0.38", @@ -959,11 +1008,10 @@ dependencies = [ [[package]] name = "bevy_render" -version = "0.11.3" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39df4824b760928c27afc7b00fb649c7a63c9d76661ab014ff5c86537ee906cb" +checksum = "90d777f4c51bd58e9e40777c6cb8dde0778df7e2c5298b3f9e3455bd12a9856c" dependencies = [ - "anyhow", "async-channel", "bevy_app", "bevy_asset", @@ -994,8 +1042,6 @@ dependencies = [ "ktx2", "naga", "naga_oil", - "parking_lot", - "regex", "ruzstd", "serde", "smallvec", @@ -1004,14 +1050,13 @@ dependencies = [ "wasm-bindgen", "web-sys", "wgpu", - "wgpu-hal", ] [[package]] name = "bevy_render_macros" -version = "0.11.3" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bd08c740aac73363e32fb45af869b10cec65bcb76fe3e6cd0f8f7eebf4c36c9" +checksum = "35b00c3d0abff94a729460fc9aa95c2ceac71b49b3041166bb5ba3098e9657e7" dependencies = [ "bevy_macro_utils", "proc-macro2", @@ -1021,11 +1066,10 @@ dependencies = [ [[package]] name = "bevy_scene" -version = "0.11.3" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd47e1263506153bef3a8be97fe2d856f206d315668c4f97510ca6cc181d9681" +checksum = "ba6294396a6375f0b14341d8003408c10aa040e3f833ac8bd49677170ec55d73" dependencies = [ - "anyhow", "bevy_app", "bevy_asset", "bevy_derive", @@ -1043,9 +1087,9 @@ dependencies = [ [[package]] name = "bevy_sprite" -version = "0.11.3" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68a8ca824fad75c6ef74cfbbba0a4ce3ccc435fa23d6bf3f003f260548813397" +checksum = "b4f7d1f88a6e5497fdafd95c20984a1d1b5517bc39d51600b4988cd60c51837a" dependencies = [ "bevy_app", "bevy_asset", @@ -1062,15 +1106,16 @@ dependencies = [ "bytemuck", "fixedbitset", "guillotiere", + "radsort", "rectangle-pack", "thiserror", ] [[package]] name = "bevy_tasks" -version = "0.11.3" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c73bbb847c83990d3927005090df52f8ac49332e1643d2ad9aac3cd2974e66bf" +checksum = "3a45be906618192515bc613e46546150089adbb4a82178dc462045acd1e89e92" dependencies = [ "async-channel", "async-executor", @@ -1082,12 +1127,11 @@ dependencies = [ [[package]] name = "bevy_text" -version = "0.11.3" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "692288ab7b0a9f8b38058964c52789fc6bcb63703b23de51cce90ec41bfca355" +checksum = "c136af700af4f87c94f68d6e019528c371bf09ebf4a8ff7468bb3c73806b34f5" dependencies = [ "ab_glyph", - "anyhow", "bevy_app", "bevy_asset", "bevy_ecs", @@ -1105,9 +1149,9 @@ dependencies = [ [[package]] name = "bevy_time" -version = "0.11.3" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d58d6dbae9c8225d8c0e0f04d2c5dbb71d22adc01ecd5ab3cebc364139e4a6d" +checksum = "b29709cadf22d318a0b7c79f763e9c5ac414292bd0e850066fa935959021b276" dependencies = [ "bevy_app", "bevy_ecs", @@ -1120,9 +1164,9 @@ dependencies = [ [[package]] name = "bevy_transform" -version = "0.11.3" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b9b0ac0149a57cd846cb357a35fc99286f9848e53d4481954608ac9552ed2d4" +checksum = "70262c51e915b6224129206d23823364e650cf5eb5f4b6ce3ee379f608c180d2" dependencies = [ "bevy_app", "bevy_ecs", @@ -1130,13 +1174,14 @@ dependencies = [ "bevy_math", "bevy_reflect", "serde", + "thiserror", ] [[package]] name = "bevy_ui" -version = "0.11.3" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59b6d295a755e5b79e869a09e087029d72974562a521ec7ccfba7141fa948a32" +checksum = "cd5ecbf2dceaab118769dd870e34d780bfde556af561fd10d8d613b0f237297e" dependencies = [ "bevy_a11y", "bevy_app", @@ -1164,15 +1209,16 @@ dependencies = [ [[package]] name = "bevy_utils" -version = "0.11.3" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d9484e32434ea84dc548cff246ce0c6f756c1336f5ea03f24ac120a48595c7" +checksum = "c8e75d4a34ef0b15dffd1ee9079ef1f0f5139527e192b9d5708b3e158777c753" dependencies = [ "ahash", "bevy_utils_proc_macros", "getrandom", "hashbrown 0.14.2", "instant", + "nonmax", "petgraph", "thiserror", "tracing", @@ -1181,9 +1227,9 @@ dependencies = [ [[package]] name = "bevy_utils_proc_macros" -version = "0.11.3" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5391b242c36f556db01d5891444730c83aa9dd648b6a8fd2b755d22cb3bddb57" +checksum = "f7dfd3735a61a1b681ed1e176afe4eae731bbb03e51ad871e9eb39e76a2d170e" dependencies = [ "proc-macro2", "quote", @@ -1192,10 +1238,11 @@ dependencies = [ [[package]] name = "bevy_window" -version = "0.11.3" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd584c0da7c4ada6557b09f57f30fb7cff21ccedc641473fc391574b4c9b7944" +checksum = "e60d1830b3fbd7db5bfea7ac9fcd0f5e1d1af88c91ab469e697ab176d8b3140b" dependencies = [ + "bevy_a11y", "bevy_app", "bevy_ecs", "bevy_input", @@ -1208,9 +1255,9 @@ dependencies = [ [[package]] name = "bevy_winit" -version = "0.11.3" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfdc044abdb95790c20053e6326760f0a2985f0dcd78613d397bf35f16039d53" +checksum = "7f8294e78c6a1f9c34d36501a377c5d20bf0fa23a0958187bb270187741448ba" dependencies = [ "accesskit_winit", "approx", @@ -1284,6 +1331,19 @@ dependencies = [ "serde", ] +[[package]] +name = "blake3" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0231f06152bf547e9c2b5194f247cd97aacf6dcd8b15d8e5ec0663f64580da87" +dependencies = [ + "arrayref", + "arrayvec", + "cc", + "cfg-if", + "constant_time_eq", +] + [[package]] name = "block" version = "0.1.6" @@ -1309,6 +1369,22 @@ dependencies = [ "objc2-encode", ] +[[package]] +name = "blocking" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c36a4d0d48574b3dd360b4b7d95cc651d2b6557b6402848a27d4b228a473e2a" +dependencies = [ + "async-channel", + "async-lock", + "async-task", + "fastrand 2.0.1", + "futures-io", + "futures-lite", + "piper", + "tracing", +] + [[package]] name = "bstr" version = "1.7.0" @@ -1480,6 +1556,12 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "87ca1caa64ef4ed453e68bb3db612e51cf1b2f5b871337f0fcab1c8f87cc3dff" +[[package]] +name = "constant_time_eq" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7144d30dcf0fafbce74250a3963025d8d52177934239851c917d29f1df280c2" + [[package]] name = "constgebra" version = "0.1.3" @@ -1514,7 +1596,7 @@ dependencies = [ "bitflags 1.3.2", "core-foundation", "core-graphics-types", - "foreign-types", + "foreign-types 0.3.2", "libc", ] @@ -1652,12 +1734,12 @@ dependencies = [ [[package]] name = "d3d12" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8f0de2f5a8e7bd4a9eec0e3c781992a4ce1724f68aec7d7a3715344de8b39da" +checksum = "e16e44ab292b1dddfdaf7be62cfd8877df52f2f3fde5858d95bab606be259f20" dependencies = [ - "bitflags 1.3.2", - "libloading 0.7.4", + "bitflags 2.4.1", + "libloading 0.8.1", "winapi", ] @@ -1862,18 +1944,6 @@ dependencies = [ "simd-adler32", ] -[[package]] -name = "filetime" -version = "0.2.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4029edd3e734da6fe05b6cd7bd2960760a616bd2ddd0d59a0124746d6272af0" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall 0.3.5", - "windows-sys 0.48.0", -] - [[package]] name = "fixedbitset" version = "0.4.2" @@ -1902,7 +1972,28 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" dependencies = [ - "foreign-types-shared", + "foreign-types-shared 0.1.1", +] + +[[package]] +name = "foreign-types" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965" +dependencies = [ + "foreign-types-macros", + "foreign-types-shared 0.3.1", +] + +[[package]] +name = "foreign-types-macros" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.38", ] [[package]] @@ -1911,6 +2002,12 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" +[[package]] +name = "foreign-types-shared" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" + [[package]] name = "form_urlencoded" version = "1.2.0" @@ -1920,15 +2017,6 @@ dependencies = [ "percent-encoding", ] -[[package]] -name = "fsevent-sys" -version = "4.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76ee7a02da4d231650c7cea31349b889be2f45ddb3ef3032d2ec8185f6313fd2" -dependencies = [ - "libc", -] - [[package]] name = "futures-core" version = "0.3.29" @@ -2094,21 +2182,21 @@ dependencies = [ [[package]] name = "gpu-alloc" -version = "0.5.4" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22beaafc29b38204457ea030f6fb7a84c9e4dd1b86e311ba0542533453d87f62" +checksum = "fbcd2dba93594b227a1f57ee09b8b9da8892c34d55aa332e034a228d0fe6a171" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.4.1", "gpu-alloc-types", ] [[package]] name = "gpu-alloc-types" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54804d0d6bc9d7f26db4eaec1ad10def69b599315f487d32c334a80d1efe67a5" +checksum = "98ff03b468aa837d70984d55f5d3f846f6ec31fe34bbb97c4f85219caeee1ca4" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.4.1", ] [[package]] @@ -2275,26 +2363,6 @@ version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a257582fdcde896fd96463bf2d40eefea0580021c0712a0e2b028b60b47a837a" -[[package]] -name = "inotify" -version = "0.9.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8069d3ec154eb856955c1c0fbffefbf5f3c40a104ec912d4797314c1801abff" -dependencies = [ - "bitflags 1.3.2", - "inotify-sys", - "libc", -] - -[[package]] -name = "inotify-sys" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e05c02b5e89bff3b946cedeca278abc628fe811e604f027c45a8aa3cf793d0eb" -dependencies = [ - "libc", -] - [[package]] name = "instant" version = "0.1.12" @@ -2408,26 +2476,6 @@ dependencies = [ "pkg-config", ] -[[package]] -name = "kqueue" -version = "1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7447f1ca1b7b563588a205fe93dea8df60fd981423a768bc1c0ded35ed147d0c" -dependencies = [ - "kqueue-sys", - "libc", -] - -[[package]] -name = "kqueue-sys" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed9625ffda8729b85e45cf04090035ac368927b8cebc34898e7c120f52e4838b" -dependencies = [ - "bitflags 1.3.2", - "libc", -] - [[package]] name = "ktx2" version = "0.3.0" @@ -2581,16 +2629,17 @@ dependencies = [ [[package]] name = "metal" -version = "0.24.0" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de11355d1f6781482d027a3b4d4de7825dcedb197bf573e0596d00008402d060" +checksum = "623b5e6cefd76e58f774bd3cc0c6f5c7615c58c03a97815245a25c3c9bdee318" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.4.1", "block", "core-graphics-types", - "foreign-types", + "foreign-types 0.5.0", "log", "objc", + "paste", ] [[package]] @@ -2623,12 +2672,12 @@ dependencies = [ [[package]] name = "naga" -version = "0.12.3" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbcc2e0513220fd2b598e6068608d4462db20322c0e77e47f6f488dfcfc279cb" +checksum = "c1ceaaa4eedaece7e4ec08c55c640ba03dbb73fb812a6570a59bcf1930d0f70e" dependencies = [ "bit-set", - "bitflags 1.3.2", + "bitflags 2.4.1", "codespan-reporting", "hexf-parse", "indexmap 1.9.3", @@ -2644,9 +2693,9 @@ dependencies = [ [[package]] name = "naga_oil" -version = "0.8.2" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8be942a5c21c58b9b0bf4d9b99db3634ddb7a916f8e1d1d0b71820cc4150e56b" +checksum = "a1fa9518ff79ae8a98c3abe3897d873a85561d1b5642981c2245c1c4b9b2429d" dependencies = [ "bit-set", "codespan-reporting", @@ -2655,7 +2704,7 @@ dependencies = [ "naga", "once_cell", "regex", - "regex-syntax 0.6.29", + "regex-syntax 0.7.5", "rustc-hash", "thiserror", "tracing", @@ -2759,6 +2808,12 @@ dependencies = [ "minimal-lexical", ] +[[package]] +name = "nonmax" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99756f5493e135528f0cd660ac67b4c3a542bb65a3565efe92bb2c2317eb3669" + [[package]] name = "normpath" version = "1.1.1" @@ -2768,25 +2823,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "notify" -version = "6.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6205bd8bb1e454ad2e27422015fb5e4f2bcc7e08fa8f27058670d208324a4d2d" -dependencies = [ - "bitflags 2.4.1", - "crossbeam-channel", - "filetime", - "fsevent-sys", - "inotify", - "kqueue", - "libc", - "log", - "mio", - "walkdir", - "windows-sys 0.48.0", -] - [[package]] name = "ntapi" version = "0.4.1" @@ -3145,6 +3181,17 @@ version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" +[[package]] +name = "piper" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "668d31b1c4eba19242f2088b2bf3316b82ca31082a8335764db4e083db7485d4" +dependencies = [ + "atomic-waker", + "fastrand 2.0.1", + "futures-io", +] + [[package]] name = "pkg-config" version = "0.3.27" @@ -3192,7 +3239,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" dependencies = [ "once_cell", - "toml_edit", + "toml_edit 0.19.15", ] [[package]] @@ -3380,6 +3427,12 @@ version = "0.6.29" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" +[[package]] +name = "regex-syntax" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" + [[package]] name = "regex-syntax" version = "0.8.2" @@ -3765,6 +3818,17 @@ dependencies = [ "winnow", ] +[[package]] +name = "toml_edit" +version = "0.20.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70f427fce4d84c72b5b732388bf4a9f4531b53f74e2887e3ecb2481f68f66d81" +dependencies = [ + "indexmap 2.1.0", + "toml_datetime", + "winnow", +] + [[package]] name = "tracing" version = "0.1.40" @@ -4065,9 +4129,9 @@ checksum = "9193164d4de03a926d909d3bc7c30543cecb35400c02114792c2cae20d5e2dbb" [[package]] name = "wgpu" -version = "0.16.3" +version = "0.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "480c965c9306872eb6255fa55e4b4953be55a8b64d57e61d7ff840d3dcc051cd" +checksum = "ed547920565c56c7a29afb4538ac5ae5048865a5d2f05bff3ad4fbeb921a9a2c" dependencies = [ "arrayvec", "cfg-if", @@ -4089,9 +4153,9 @@ dependencies = [ [[package]] name = "wgpu-core" -version = "0.16.1" +version = "0.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f478237b4bf0d5b70a39898a66fa67ca3a007d79f2520485b8b0c3dfc46f8c2" +checksum = "0f8a44dd301a30ceeed3c27d8c0090433d3da04d7b2a4042738095a424d12ae7" dependencies = [ "arrayvec", "bit-vec", @@ -4112,9 +4176,9 @@ dependencies = [ [[package]] name = "wgpu-hal" -version = "0.16.2" +version = "0.17.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ecb3258078e936deee14fd4e0febe1cfe9bbb5ffef165cb60218d2ee5eb4448" +checksum = "9a80bf0e3c77399bb52850cb0830af9bad073d5cfcb9dd8253bef8125c42db17" dependencies = [ "android_system_properties", "arrayvec", @@ -4124,7 +4188,6 @@ dependencies = [ "block", "core-graphics-types", "d3d12", - "foreign-types", "glow", "gpu-alloc", "gpu-allocator", @@ -4154,9 +4217,9 @@ dependencies = [ [[package]] name = "wgpu-types" -version = "0.16.1" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0c153280bb108c2979eb5c7391cb18c56642dd3c072e55f52065e13e2a1252a" +checksum = "ee64d7398d0c2f9ca48922c902ef69c42d000c759f3db41e355f4a570b052b67" dependencies = [ "bitflags 2.4.1", "js-sys", diff --git a/Cargo.toml b/Cargo.toml index cc0edd7..3f19ff7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,16 +10,15 @@ members = [ "crates/bevy_gltf_blueprints", ] - [dev-dependencies] -bevy="0.11" -bevy_rapier3d = { version = "0.22.0", features = [ "serde-serialize", "debug-render-3d", "enhanced-determinism"] } -bevy_editor_pls = { version = "0.5.0" } -bevy_asset_loader = { version = "0.17.0", features = ["standard_dynamic_assets" ]} #version = "0.16", +bevy="0.12" +bevy_asset_loader = { version = "0.18", features = ["standard_dynamic_assets" ]} +bevy_rapier3d = { version = "0.23.0", features = [ "serde-serialize", "debug-render-3d", "enhanced-determinism"] } +bevy_editor_pls = { version = "0.6" } rand = "0.8.5" [dependencies] -bevy = { version = "0.11", default-features = false, features = ["bevy_asset", "bevy_scene", "bevy_gltf"] } +bevy = { version = "0.12", default-features = false, features = ["bevy_asset", "bevy_scene", "bevy_gltf"] } bevy_gltf_components = { path = "crates/bevy_gltf_components" } bevy_gltf_blueprints = { path = "crates/bevy_gltf_blueprints" } diff --git a/README.md b/README.md index c64c093..036b58e 100644 --- a/README.md +++ b/README.md @@ -128,11 +128,9 @@ you will get a warning **per entity** ## Limitations / issues - some components have to be defined in ```text``` in Blender, might try using the AppTypeRegistry and some Python code on the Blender side for a nicer UI (although this loses the "fast & easy, no tooling" approach) - Some of `bevy_rapier`/physics code / ways to define colliders could perhaps be done better within Blender (currently it also goes via RON) -- there seem to be some random system ordering issues that I am still investigating (only when replacing proxy components, no breaking bugs, just restarting your Bevy app is enough) ## Future work - I have a number of other tools/ code helpers that I have not yet included here, because they need cleanup/ might make this example too complex - * simplified animation logic: ie instead of having to manually specify the animations you need from a gltf file, it is integrated with the spawning system above, which creates a ```Animations``` component in all entities that have an ```AnimationPlayer``` and you can simply query for both to easilly control your animations per entity. ## Credits diff --git a/assets/advanced/assets_game.assets.ron b/assets/advanced/assets_game.assets.ron index f21a754..bbdd7a7 100644 --- a/assets/advanced/assets_game.assets.ron +++ b/assets/advanced/assets_game.assets.ron @@ -1,5 +1,5 @@ ({ - "world":File (path: "advanced/models/World.glb#Scene0"), + "world":File (path: "advanced/models/World.glb"), "models": Folder ( path: "advanced/models/library", ), diff --git a/assets/animation/assets_game.assets.ron b/assets/animation/assets_game.assets.ron index 2102b73..37a84e6 100644 --- a/assets/animation/assets_game.assets.ron +++ b/assets/animation/assets_game.assets.ron @@ -1,5 +1,5 @@ ({ - "world":File (path: "animation/models/Level1.glb#Scene0"), + "world":File (path: "animation/models/Level1.glb"), "models": Folder ( path: "animation/models/library", ), diff --git a/crates/bevy_gltf_blueprints/Cargo.toml b/crates/bevy_gltf_blueprints/Cargo.toml index dad8da0..2a6597b 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.2.1" +version = "0.3.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" @@ -11,8 +11,8 @@ edition = "2021" license = "MIT OR Apache-2.0" [dev-dependencies] -bevy = { version = "0.11", default-features = false, features = ["bevy_asset", "bevy_scene", "bevy_gltf", "bevy_animation", "animation"] } +bevy = { version = "0.12", default-features = false, features = ["bevy_asset", "bevy_scene", "bevy_gltf", "bevy_animation", "animation"] } [dependencies] -bevy_gltf_components = "0.1" -bevy = { version = "0.11", default-features = false, features = ["bevy_asset", "bevy_scene", "bevy_gltf", "bevy_animation", "animation"] } +bevy_gltf_components = "0.2" +bevy = { version = "0.12", 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 7c8d6aa..baabd54 100644 --- a/crates/bevy_gltf_blueprints/README.md +++ b/crates/bevy_gltf_blueprints/README.md @@ -25,8 +25,8 @@ Here's a minimal usage example: ```toml # Cargo.toml [dependencies] -bevy="0.11" -bevy_gltf_blueprints = { version = "0.2"} +bevy="0.12" +bevy_gltf_blueprints = { version = "0.3"} ``` @@ -64,7 +64,7 @@ fn spawn_blueprint( Add the following to your `[dependencies]` section in `Cargo.toml`: ```toml -bevy_gltf_blueprints = "0.2" +bevy_gltf_blueprints = "0.3" ``` Or use `cargo add`: @@ -246,6 +246,19 @@ https://github.com/kaosat-dev/Blender_bevy_components_workflow/tree/main/example https://github.com/kaosat-dev/Blender_bevy_components_workflow/tree/main/examples/animation +## Compatible Bevy versions + +The main branch is compatible with the latest Bevy release, while the branch `bevy_main` tries to track the `main` branch of Bevy (PRs updating the tracked commit are welcome). + +Compatibility of `bevy_gltf_blueprints` versions: +| `bevy_gltf_blueprints` | `bevy` | +| :-- | :-- | +| `0.3` | `0.12` | +| `0.1 -0.2` | `0.11` | +| branch `main` | `0.12` | +| branch `bevy_main` | `main` | + + ## License This crate, all its code, contents & assets is Dual-licensed under either of diff --git a/crates/bevy_gltf_blueprints/src/spawn_from_blueprints.rs b/crates/bevy_gltf_blueprints/src/spawn_from_blueprints.rs index 022797f..c13ee20 100644 --- a/crates/bevy_gltf_blueprints/src/spawn_from_blueprints.rs +++ b/crates/bevy_gltf_blueprints/src/spawn_from_blueprints.rs @@ -58,14 +58,15 @@ pub(crate) fn spawn_from_blueprints( Path::new(&blueprints_config.library_folder).join(Path::new(model_file_name.as_str())); debug!("attempting to spawn {:?}", model_path); - let scene: Handle = asset_server.load(model_path); + let model_handle: Handle = asset_server.load(model_path); let world = game_world.single_mut(); let world = world.1[0]; // FIXME: dangerous hack because our gltf data have a single child like this, but might not always be the case let gltf = assets_gltf - .get(&scene) + .get(&model_handle) .expect("this gltf should have been loaded"); + // WARNING we work under the assumtion that there is ONLY ONE named scene, and that the first one is the right one let main_scene_name = gltf .named_scenes diff --git a/crates/bevy_gltf_components/Cargo.toml b/crates/bevy_gltf_components/Cargo.toml index 037db67..d7ba122 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.1.3" +version = "0.2.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" @@ -11,9 +11,9 @@ edition = "2021" license = "MIT OR Apache-2.0" [dev-dependencies] -bevy = { version = "0.11", default-features = false, features = ["bevy_asset", "bevy_scene", "bevy_gltf"] } +bevy = { version = "0.12", default-features = false, features = ["bevy_asset", "bevy_scene", "bevy_gltf"] } [dependencies] -bevy = { version = "0.11", default-features = false, features = ["bevy_asset", "bevy_scene", "bevy_gltf"] } +bevy = { version = "0.12", 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 55d8dcf..9b63d1e 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.11" -bevy_gltf_components = { version = "0.1"} +bevy="0.12" +bevy_gltf_components = { version = "0.2"} ``` @@ -88,6 +88,20 @@ Typically , the order of systems should be https://github.com/kaosat-dev/Blender_bevy_components_workflow/tree/main/examples/basic + +## Compatible Bevy versions + +The main branch is compatible with the latest Bevy release, while the branch `bevy_main` tries to track the `main` branch of Bevy (PRs updating the tracked commit are welcome). + +Compatibility of `bevy_gltf_components` versions: +| `bevy_gltf_components` | `bevy` | +| :-- | :-- | +| `0.2` | `0.12` | +| `0.1` | `0.11` | +| branch `main` | `0.12` | +| branch `bevy_main` | `main` | + + ## License This crate, all its code, contents & assets is Dual-licensed under either of diff --git a/crates/bevy_gltf_components/src/gltf_to_components.rs b/crates/bevy_gltf_components/src/gltf_to_components.rs index 1083cdd..82c774e 100644 --- a/crates/bevy_gltf_components/src/gltf_to_components.rs +++ b/crates/bevy_gltf_components/src/gltf_to_components.rs @@ -5,24 +5,167 @@ use serde::de::DeserializeSeed; use bevy::ecs::{entity::Entity, reflect::ReflectComponent}; use bevy::gltf::{Gltf, GltfExtras}; -use bevy::prelude::{debug, info, warn, Assets, Name, Parent, ResMut}; -use bevy::reflect::serde::UntypedReflectDeserializer; -use bevy::reflect::{Reflect, TypeInfo, TypeRegistryInternal}; +use bevy::reflect::serde::UntypedReflectDeserializer; // ReflectSerializer +use bevy::reflect::{Reflect, TypeInfo, TypeRegistry}; use bevy::scene::Scene; use bevy::utils::HashMap; +use bevy::{ + log::{debug, info, warn}, + prelude::{Assets, Name, Parent, ResMut}, +}; use super::capitalize_first_letter; +pub fn ronstring_to_reflect_component( + ron_string: &String, + type_registry: &TypeRegistry, +) -> Vec> { + let lookup: HashMap = ron::from_str(ron_string.as_str()).unwrap(); + let mut components: Vec> = Vec::new(); + for (key, value) in lookup.into_iter() { + let type_string = key.replace("component: ", "").trim().to_string(); + let capitalized_type_name = capitalize_first_letter(type_string.as_str()); + + let mut parsed_value: String; + match value.clone() { + Value::String(str) => { + parsed_value = str; + } + _ => parsed_value = ron::to_string(&value).unwrap().to_string(), + } + + if let Some(type_registration) = + type_registry.get_with_short_type_path(capitalized_type_name.as_str()) + { + debug!("TYPE INFO {:?}", type_registration.type_info()); + match type_registration.type_info() { + TypeInfo::TupleStruct(info) => { + // we handle tupple strucs with only one field differently, as Blender's custom properties with custom ui (float, int, bool, etc) always give us a tupple struct + if info.field_len() == 1 { + let field = info + .field_at(0) + .expect("we should always have at least one field here"); + let field_name = field.type_path(); + // TODO: find a way to cast with typeId instead of this matching + /*match field.type_id(){ + TypeId::of::() => { + println!("WE HAVE A f32"); + } + } + Vec3 => { + println!("WE HAVE A VEC3"); + let bla:Vec3 = ron::from_str(&parsed_value).unwrap(); + println!("bla {}", bla) + } + _ =>{} + }*/ + + let mut formated = parsed_value.clone(); + match field_name { + "f32" => { + formated = parsed_value.parse::().unwrap().to_string(); + } + "f64" => { + formated = parsed_value.parse::().unwrap().to_string(); + } + "u8" => { + formated = parsed_value.parse::().unwrap().to_string(); + } + "u16" => { + formated = parsed_value.parse::().unwrap().to_string(); + } + "u32" => { + formated = parsed_value.parse::().unwrap().to_string(); + } + "u64" => { + formated = parsed_value.parse::().unwrap().to_string(); + } + "u128" => { + formated = parsed_value.parse::().unwrap().to_string(); + } + "glam::Vec2" => { + let parsed: Vec = ron::from_str(&parsed_value).unwrap(); + formated = format!("(x:{},y:{})", parsed[0], parsed[1]); + } + "glam::Vec3" => { + let parsed: Vec = ron::from_str(&parsed_value).unwrap(); + formated = + format!("(x:{},y:{},z:{})", parsed[0], parsed[1], parsed[2]); + } + "bevy_render::color::Color" => { + let parsed: Vec = ron::from_str(&parsed_value).unwrap(); + if parsed.len() == 3 { + formated = format!( + "Rgba(red:{},green:{},blue:{}, alpha: 1.0)", + parsed[0], parsed[1], parsed[2] + ); + } + if parsed.len() == 4 { + formated = format!( + "Rgba(red:{},green:{},blue:{}, alpha:{})", + parsed[0], parsed[1], parsed[2], parsed[3] + ); + } + } + _ => {} + } + + parsed_value = format!("({formated})"); + } + } + _ => {} + } + + // println!("parsed value {}",parsed_value); + if parsed_value.is_empty() { + parsed_value = "()".to_string(); + } + + let ron_string = format!( + "{{ \"{}\":{} }}", + type_registration.type_info().type_path(), + parsed_value + ); + + // usefull to determine what an entity looks like Serialized + /*let test_struct = Enemy::default(); + let serializer = ReflectSerializer::new(&test_struct, &type_registry); + let serialized = + ron::ser::to_string_pretty(&serializer, ron::ser::PrettyConfig::default()).unwrap(); + println!("serialized Component {}", serialized);*/ + + debug!("component data ron string {}", ron_string); + let mut deserializer = ron::Deserializer::from_str(ron_string.as_str()).unwrap(); + let reflect_deserializer = UntypedReflectDeserializer::new(type_registry); + let component = reflect_deserializer.deserialize(&mut deserializer).expect( + format!( + "failed to deserialize component {} with value: {:?}", + key, value + ) + .as_str(), + ); + + debug!("component {:?}", component); + debug!("real type {:?}", component.get_represented_type_info()); + + components.push(component); + debug!("found type registration for {}", capitalized_type_name); + } else { + warn!("no type registration for {}", capitalized_type_name); + } + } + components +} + /// main function: injects components into each entity in gltf files that have gltf_extras, using reflection pub fn gltf_extras_to_components( gltf: &mut Gltf, scenes: &mut ResMut>, - type_registry: impl Deref, - gltf_name: &str, + type_registry: impl Deref, ) { let mut added_components = 0; for (_name, scene) in &gltf.named_scenes { - debug!("gltf: {:?} scene name {:?}", gltf_name, _name); + debug!("gltf: scene name {:?}", _name); let scene = scenes.get_mut(scene).unwrap(); @@ -81,16 +224,22 @@ pub fn gltf_extras_to_components( } for component in components { let mut entity_mut = scene.world.entity_mut(entity); - debug!("------adding {} {:?}", component.type_name(), component); + debug!( + "------adding {} {:?}", + component.get_represented_type_info().unwrap().type_path(), + component + ); + let component_type_path = + component.get_represented_type_info().unwrap().type_path(); type_registry - .get_with_name(component.type_name()) + .get_with_type_path(component_type_path) .unwrap() // Component was successfully deserialized, it has to be in the registry .data::() .unwrap() // Hopefully, the component deserializer ensures those are components .insert(&mut entity_mut, &*component); - // info!("all components {:?}", scene.world.entity(entity).archetype().components()); + // debug!("all components {:?}", scene.world.entity(entity).archetype().components()); // scene.world.components(). // TODO: how can we insert any additional components "by hand" here ? } @@ -103,142 +252,5 @@ pub fn gltf_extras_to_components( } } } - info!("done extracting gltf_extras /n"); -} - -pub fn ronstring_to_reflect_component( - ron_string: &String, - type_registry: &TypeRegistryInternal, -) -> Vec> { - let lookup: HashMap = ron::from_str(ron_string.as_str()).unwrap(); - let mut components: Vec> = Vec::new(); - for (key, value) in lookup.into_iter() { - let type_string = key.replace("component: ", "").trim().to_string(); - let capitalized_type_name = capitalize_first_letter(type_string.as_str()); - - let mut parsed_value: String; - match value.clone() { - Value::String(str) => { - parsed_value = str; - } - _ => parsed_value = ron::to_string(&value).unwrap().to_string(), - } - - if let Some(type_registration) = - type_registry.get_with_short_name(capitalized_type_name.as_str()) - { - // println!("TYPE INFO {:?}", type_registration.type_info()); - match type_registration.type_info() { - TypeInfo::TupleStruct(info) => { - // we handle tupple strucs with only one field differently, as Blender's custom properties with custom ui (float, int, bool, etc) always give us a tupple struct - if info.field_len() == 1 { - let field = info - .field_at(0) - .expect("we should always have at least one field here"); - let field_name = field.type_name(); - // TODO: find a way to cast with typeId instead of this matching - /*match field.type_id(){ - TypeId::of::() => { - println!("WE HAVE A f32"); - } - } - Vec3 => { - println!("WE HAVE A VEC3"); - let bla:Vec3 = ron::from_str(&parsed_value).unwrap(); - println!("bla {}", bla) - } - _ =>{} - }*/ - let mut formated = parsed_value.clone(); - match field_name { - "f32" => { - formated = parsed_value.parse::().unwrap().to_string(); - } - "f64" => { - formated = parsed_value.parse::().unwrap().to_string(); - } - "u8" => { - formated = parsed_value.parse::().unwrap().to_string(); - } - "u16" => { - formated = parsed_value.parse::().unwrap().to_string(); - } - "u32" => { - formated = parsed_value.parse::().unwrap().to_string(); - } - "u64" => { - formated = parsed_value.parse::().unwrap().to_string(); - } - "u128" => { - formated = parsed_value.parse::().unwrap().to_string(); - } - "glam::f32::vec2::Vec2" => { - let parsed: Vec = ron::from_str(&parsed_value).unwrap(); - formated = format!("(x:{},y:{})", parsed[0], parsed[1]); - } - "glam::f32::vec3::Vec3" => { - let parsed: Vec = ron::from_str(&parsed_value).unwrap(); - formated = - format!("(x:{},y:{},z:{})", parsed[0], parsed[1], parsed[2]); - } - "bevy_render::color::Color" => { - let parsed: Vec = ron::from_str(&parsed_value).unwrap(); - if parsed.len() == 3 { - formated = format!( - "Rgba(red:{},green:{},blue:{}, alpha: 1.0)", - parsed[0], parsed[1], parsed[2] - ); - } - if parsed.len() == 4 { - formated = format!( - "Rgba(red:{},green:{},blue:{}, alpha:{})", - parsed[0], parsed[1], parsed[2], parsed[3] - ); - } - } - _ => {} - } - - parsed_value = format!("({formated})"); - } - } - _ => {} - } - - // println!("parsed value {}",parsed_value); - if parsed_value.is_empty() { - parsed_value = "()".to_string(); - } - - let ron_string = format!( - "{{ \"{}\":{} }}", - type_registration.type_name(), - parsed_value - ); - - // usefull to determine what an entity looks like Serialized - /*let test_struct = TuppleTestStr::default(); - let serializer = ReflectSerializer::new(&test_struct, &type_registry); - let serialized = - ron::ser::to_string_pretty(&serializer, ron::ser::PrettyConfig::default()).unwrap(); - println!("serialized Component {}", serialized);*/ - - // println!("component data ron string {}", ron_string); - let mut deserializer = ron::Deserializer::from_str(ron_string.as_str()).unwrap(); - let reflect_deserializer = UntypedReflectDeserializer::new(type_registry); - let component = reflect_deserializer.deserialize(&mut deserializer).expect( - format!( - "failed to deserialize component {} with value: {:?}", - key, value - ) - .as_str(), - ); - - components.push(component); - debug!("found type registration for {}", capitalized_type_name); - } else { - warn!("no type registration for {}", capitalized_type_name); - } - } - components + info!("done injecting components from gltf_extras /n"); } diff --git a/crates/bevy_gltf_components/src/process_gltfs.rs b/crates/bevy_gltf_components/src/process_gltfs.rs index 10e5ea0..1353a47 100644 --- a/crates/bevy_gltf_components/src/process_gltfs.rs +++ b/crates/bevy_gltf_components/src/process_gltfs.rs @@ -2,7 +2,7 @@ use bevy::gltf::Gltf; use bevy::utils::HashSet; use bevy::{asset::LoadState, prelude::*}; -use super::gltf_extras_to_components; +use crate::gltf_extras_to_components; #[derive(Resource)] /// component to keep track of gltfs' loading state @@ -18,7 +18,7 @@ impl GltfLoadingTracker { loading_gltfs: HashSet::new(), } } - pub fn add_scene(&mut self, handle: Handle) { + pub fn add_gltf(&mut self, handle: Handle) { self.loading_gltfs.insert(handle); } } @@ -26,10 +26,14 @@ impl GltfLoadingTracker { pub fn track_new_gltf( mut tracker: ResMut, mut events: EventReader>, + asset_server: Res, ) { - for event in events.iter() { - if let AssetEvent::Created { handle } = event { - tracker.add_scene(handle.clone()); + for event in events.read() { + if let AssetEvent::Added { id } = event { + let handle = asset_server + .get_id_handle(*id) + .expect("this gltf should have been loaded"); + tracker.add_gltf(handle.clone()); debug!("gltf created {:?}", handle.clone()); } } @@ -38,21 +42,23 @@ pub fn track_new_gltf( pub fn process_loaded_scenes( mut gltfs: ResMut>, - mut scenes: ResMut>, mut tracker: ResMut, + mut scenes: ResMut>, app_type_registry: Res, asset_server: Res, ) { let mut loaded_gltfs = Vec::new(); for gltf in &tracker.loading_gltfs { - info!( + debug!( "checking for loaded gltfs {:?}", asset_server.get_load_state(gltf) ); - if asset_server.get_load_state(gltf.clone()) == LoadState::Loaded { - debug!("Adding scene to processing list"); - loaded_gltfs.push(gltf.clone()); + if let Some(load_state) = asset_server.get_load_state(gltf.clone()) { + if load_state == LoadState::Loaded { + debug!("Adding scene to processing list"); + loaded_gltfs.push(gltf.clone()); + } } } @@ -60,14 +66,7 @@ pub fn process_loaded_scenes( for gltf_handle in &loaded_gltfs { if let Some(gltf) = gltfs.get_mut(gltf_handle) { - // TODO this is a temporary workaround for library management - if let Some(asset_path) = asset_server.get_handle_path(gltf_handle) { - let gltf_name = asset_path.path().file_stem().unwrap().to_str().unwrap(); - gltf_extras_to_components(gltf, &mut scenes, &*type_registry, gltf_name); - //gltf_extras_to_prefab_infos(gltf, &mut scenes, &*type_registry, gltf_name); - } else { - gltf_extras_to_components(gltf, &mut scenes, &*type_registry, ""); - } + gltf_extras_to_components(gltf, &mut scenes, &*type_registry); } tracker.loading_gltfs.remove(gltf_handle); tracker.loaded_gltfs.insert(gltf_handle.clone()); diff --git a/examples/advanced/assets/assets_game.rs b/examples/advanced/assets/assets_game.rs index b7bb336..b8e0665 100644 --- a/examples/advanced/assets/assets_game.rs +++ b/examples/advanced/assets/assets_game.rs @@ -6,7 +6,7 @@ use bevy_asset_loader::prelude::*; #[derive(AssetCollection, Resource)] pub struct GameAssets { #[asset(key = "world")] - pub world: Handle, + pub world: Handle, #[asset(key = "models", collection(typed, mapped))] pub models: HashMap>, diff --git a/examples/advanced/core/mod.rs b/examples/advanced/core/mod.rs index a3f81b1..52e2adf 100644 --- a/examples/advanced/core/mod.rs +++ b/examples/advanced/core/mod.rs @@ -1,5 +1,4 @@ pub mod camera; -use bevy_rapier3d::prelude::Velocity; pub use camera::*; pub mod lighting; @@ -11,61 +10,12 @@ pub use relationships::*; pub mod physics; pub use physics::*; -// pub mod blueprints; -// pub use blueprints::*; - -pub mod save_load; -pub use save_load::*; +// pub mod save_load; +// pub use save_load::*; use bevy::prelude::*; use bevy_gltf_blueprints::*; -use rand::Rng; - -fn spawn_test( - keycode: Res>, - mut commands: Commands, - - mut game_world: Query<(Entity, &Children), With>, -) { - if keycode.just_pressed(KeyCode::T) { - let world = game_world.single_mut(); - let world = world.1[0]; - - let mut rng = rand::thread_rng(); - let range = 5.5; - let x: f32 = rng.gen_range(-range..range); - let y: f32 = rng.gen_range(-range..range); - - let mut rng = rand::thread_rng(); - let range = 0.8; - let vel_x: f32 = rng.gen_range(-range..range); - let vel_y: f32 = rng.gen_range(2.0..2.5); - let vel_z: f32 = rng.gen_range(-range..range); - - let name_index: u64 = rng.gen(); - - let new_entity = commands - .spawn(( - BluePrintBundle { - blueprint: BlueprintName("Health_Pickup".to_string()), - transform: TransformBundle::from_transform(Transform::from_xyz(x, 2.0, y)), - ..Default::default() - }, - bevy::prelude::Name::from(format!("test{}", name_index)), - // BlueprintName("Health_Pickup".to_string()), - // SpawnHere, - // TransformBundle::from_transform(Transform::from_xyz(x, 2.0, y)), - Velocity { - linvel: Vec3::new(vel_x, vel_y, vel_z), - angvel: Vec3::new(0.0, 0.0, 0.0), - }, - )) - .id(); - commands.entity(world).add_child(new_entity); - } -} - pub struct CorePlugin; impl Plugin for CorePlugin { fn build(&self, app: &mut App) { @@ -73,12 +23,10 @@ impl Plugin for CorePlugin { LightingPlugin, CameraPlugin, PhysicsPlugin, - SaveLoadPlugin, + // SaveLoadPlugin, BlueprintsPlugin { library_folder: "advanced/models/library".into(), }, - )) - // just for testing - .add_systems(Update, spawn_test); + )); } } diff --git a/examples/advanced/game/in_game.rs b/examples/advanced/game/in_game.rs index 0374a1e..2500bbb 100644 --- a/examples/advanced/game/in_game.rs +++ b/examples/advanced/game/in_game.rs @@ -4,11 +4,15 @@ use crate::{ assets::GameAssets, state::{GameState, InAppRunning}, }; -use bevy_gltf_blueprints::GameWorldTag; +use bevy_gltf_blueprints::{BluePrintBundle, BlueprintName, GameWorldTag}; + +use bevy_rapier3d::prelude::Velocity; +use rand::Rng; pub fn setup_game( mut commands: Commands, game_assets: Res, + models: Res>, mut next_game_state: ResMut>, ) { println!("setting up all stuff"); @@ -20,7 +24,12 @@ pub fn setup_game( commands.spawn(( SceneBundle { - scene: game_assets.world.clone(), + // note: because of this issue https://github.com/bevyengine/bevy/issues/10436, "world" is now a gltf file instead of a scene + scene: models + .get(game_assets.world.id()) + .expect("main level should have been loaded") + .scenes[0] + .clone(), ..default() }, bevy::prelude::Name::from("world"), @@ -30,3 +39,47 @@ pub fn setup_game( next_game_state.set(GameState::InGame) } + +pub fn spawn_test( + keycode: Res>, + mut commands: Commands, + + mut game_world: Query<(Entity, &Children), With>, +) { + if keycode.just_pressed(KeyCode::T) { + let world = game_world.single_mut(); + let world = world.1[0]; + + let mut rng = rand::thread_rng(); + let range = 5.5; + let x: f32 = rng.gen_range(-range..range); + let y: f32 = rng.gen_range(-range..range); + + let mut rng = rand::thread_rng(); + let range = 0.8; + let vel_x: f32 = rng.gen_range(-range..range); + let vel_y: f32 = rng.gen_range(2.0..2.5); + let vel_z: f32 = rng.gen_range(-range..range); + + let name_index: u64 = rng.gen(); + + let new_entity = commands + .spawn(( + BluePrintBundle { + blueprint: BlueprintName("Health_Pickup".to_string()), + transform: TransformBundle::from_transform(Transform::from_xyz(x, 2.0, y)), + ..Default::default() + }, + bevy::prelude::Name::from(format!("test{}", name_index)), + // BlueprintName("Health_Pickup".to_string()), + // SpawnHere, + // TransformBundle::from_transform(Transform::from_xyz(x, 2.0, y)), + Velocity { + linvel: Vec3::new(vel_x, vel_y, vel_z), + angvel: Vec3::new(0.0, 0.0, 0.0), + }, + )) + .id(); + commands.entity(world).add_child(new_entity); + } +} diff --git a/examples/advanced/game/in_main_menu.rs b/examples/advanced/game/in_main_menu.rs index 1720ebd..cecd13a 100644 --- a/examples/advanced/game/in_main_menu.rs +++ b/examples/advanced/game/in_main_menu.rs @@ -1,9 +1,6 @@ use bevy::prelude::*; -use crate::{ - core::save_load::{LoadRequest, SaveRequest}, - state::{AppState, GameState, InMainMenu}, -}; +use crate::state::{AppState, GameState, InMainMenu}; pub fn setup_main_menu(mut commands: Commands) { commands.spawn((Camera2dBundle::default(), InMainMenu)); @@ -97,8 +94,8 @@ pub fn main_menu( mut next_app_state: ResMut>, // mut next_game_state: ResMut>, - mut save_requested_events: EventWriter, - mut load_requested_events: EventWriter, + // mut save_requested_events: EventWriter, + // mut load_requested_events: EventWriter, ) { if keycode.just_pressed(KeyCode::Return) { next_app_state.set(AppState::AppLoading); diff --git a/examples/advanced/game/mod.rs b/examples/advanced/game/mod.rs index 6587259..3443c45 100644 --- a/examples/advanced/game/mod.rs +++ b/examples/advanced/game/mod.rs @@ -70,7 +70,7 @@ pub fn test_collision_events( mut collision_events: EventReader, mut contact_force_events: EventReader, ) { - for collision_event in collision_events.iter() { + for collision_event in collision_events.read() { println!("collision"); match collision_event { CollisionEvent::Started(_entity1, _entity2, _) => { @@ -82,7 +82,7 @@ pub fn test_collision_events( } } - for contact_force_event in contact_force_events.iter() { + for contact_force_event in contact_force_events.read() { println!("Received contact force event: {:?}", contact_force_event); } } @@ -102,7 +102,8 @@ impl Plugin for GamePlugin { ( // insert_dependant_component::, player_move_demo, //.run_if(in_state(AppState::Running)), - // test_collision_events + // test_collision_events + spawn_test, ) .run_if(in_state(GameState::InGame)), ) diff --git a/examples/advanced/game/picking.rs b/examples/advanced/game/picking.rs index 23988c8..6731bbb 100644 --- a/examples/advanced/game/picking.rs +++ b/examples/advanced/game/picking.rs @@ -1,5 +1,6 @@ use super::Player; use bevy::prelude::*; +use bevy_gltf_blueprints::GltfBlueprintsSet; #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] @@ -27,11 +28,7 @@ pub fn picking( pub struct PickingPlugin; impl Plugin for PickingPlugin { fn build(&self, app: &mut App) { - app.register_type::().add_systems( - Update, - ( - picking, //.run_if(in_state(AppState::Running)), - ), - ); + app.register_type::() + .add_systems(Update, (picking.after(GltfBlueprintsSet::AfterSpawn),)); } } diff --git a/examples/advanced/main.rs b/examples/advanced/main.rs index b2253d9..6edba33 100644 --- a/examples/advanced/main.rs +++ b/examples/advanced/main.rs @@ -1,4 +1,4 @@ -use bevy::{asset::ChangeWatcher, prelude::*}; +use bevy::prelude::*; use bevy_editor_pls::prelude::*; mod core; @@ -19,13 +19,7 @@ use test_components::*; fn main() { App::new() .add_plugins(( - DefaultPlugins.set(AssetPlugin { - // This tells the AssetServer to watch for changes to assets. - // It enables our scenes to automatically reload in game when we modify their files. - // practical in our case to be able to edit the shaders without needing to recompile - // watch_for_changes: ChangeWatcher::with_delay(Duration::from_millis(50)), : FIXME: breaks scene save/loading - ..default() - }), + DefaultPlugins.set(AssetPlugin::default()), // editor EditorPlugin::default(), // our custom plugins diff --git a/examples/animation/assets/assets_game.rs b/examples/animation/assets/assets_game.rs index b7bb336..b8e0665 100644 --- a/examples/animation/assets/assets_game.rs +++ b/examples/animation/assets/assets_game.rs @@ -6,7 +6,7 @@ use bevy_asset_loader::prelude::*; #[derive(AssetCollection, Resource)] pub struct GameAssets { #[asset(key = "world")] - pub world: Handle, + pub world: Handle, #[asset(key = "models", collection(typed, mapped))] pub models: HashMap>, diff --git a/examples/animation/core/mod.rs b/examples/animation/core/mod.rs index 002690b..b625369 100644 --- a/examples/animation/core/mod.rs +++ b/examples/animation/core/mod.rs @@ -1,5 +1,4 @@ pub mod camera; -use bevy_rapier3d::prelude::Velocity; pub use camera::*; pub mod lighting; diff --git a/examples/animation/game/in_game.rs b/examples/animation/game/in_game.rs index 30ee9de..19c3f16 100644 --- a/examples/animation/game/in_game.rs +++ b/examples/animation/game/in_game.rs @@ -17,9 +17,10 @@ use super::{Fox, Player, Robot}; pub fn setup_game( mut commands: Commands, game_assets: Res, + models: Res>, + mut next_game_state: ResMut>, ) { - println!("setting up all stuff"); commands.insert_resource(AmbientLight { color: Color::WHITE, brightness: 0.2, @@ -28,7 +29,12 @@ pub fn setup_game( commands.spawn(( SceneBundle { - scene: game_assets.world.clone(), + // note: because of this issue https://github.com/bevyengine/bevy/issues/10436, "world" is now a gltf file instead of a scene + scene: models + .get(game_assets.world.id()) + .expect("main level should have been loaded") + .scenes[0] + .clone(), ..default() }, bevy::prelude::Name::from("world"), diff --git a/examples/animation/main.rs b/examples/animation/main.rs index b2253d9..6edba33 100644 --- a/examples/animation/main.rs +++ b/examples/animation/main.rs @@ -1,4 +1,4 @@ -use bevy::{asset::ChangeWatcher, prelude::*}; +use bevy::prelude::*; use bevy_editor_pls::prelude::*; mod core; @@ -19,13 +19,7 @@ use test_components::*; fn main() { App::new() .add_plugins(( - DefaultPlugins.set(AssetPlugin { - // This tells the AssetServer to watch for changes to assets. - // It enables our scenes to automatically reload in game when we modify their files. - // practical in our case to be able to edit the shaders without needing to recompile - // watch_for_changes: ChangeWatcher::with_delay(Duration::from_millis(50)), : FIXME: breaks scene save/loading - ..default() - }), + DefaultPlugins.set(AssetPlugin::default()), // editor EditorPlugin::default(), // our custom plugins diff --git a/examples/basic/game.rs b/examples/basic/game.rs index 4364ee9..e62d5cc 100644 --- a/examples/basic/game.rs +++ b/examples/basic/game.rs @@ -63,7 +63,7 @@ pub fn test_collision_events( mut collision_events: EventReader, mut contact_force_events: EventReader, ) { - for collision_event in collision_events.iter() { + for collision_event in collision_events.read() { println!("collision"); match collision_event { CollisionEvent::Started(_entity1, _entity2, _) => { @@ -75,7 +75,7 @@ pub fn test_collision_events( } } - for contact_force_event in contact_force_events.iter() { + for contact_force_event in contact_force_events.read() { println!("Received contact force event: {:?}", contact_force_event); } } diff --git a/examples/basic/main.rs b/examples/basic/main.rs index 1a9f109..be50b9f 100644 --- a/examples/basic/main.rs +++ b/examples/basic/main.rs @@ -1,8 +1,7 @@ -use bevy::{asset::ChangeWatcher, gltf::Gltf, prelude::*}; +use bevy::{gltf::Gltf, prelude::*}; use bevy_editor_pls::prelude::*; use bevy_gltf_components::ComponentsFromGltfPlugin; use bevy_rapier3d::prelude::*; -use std::time::Duration; mod core; use crate::core::*; @@ -28,13 +27,7 @@ enum AppState { fn main() { App::new() .add_plugins(( - DefaultPlugins.set(AssetPlugin { - // This tells the AssetServer to watch for changes to assets. - // It enables our scenes to automatically reload in game when we modify their files. - // practical in our case to be able to edit the shaders without needing to recompile - watch_for_changes: ChangeWatcher::with_delay(Duration::from_millis(50)), - ..default() - }), + DefaultPlugins.set(AssetPlugin::default()), // editor EditorPlugin::default(), // physics @@ -53,33 +46,33 @@ fn main() { } #[derive(Resource)] -struct AssetLoadHelper(Handle); +pub struct MyGltf(pub Handle); + // we preload the data here, but this is for DEMO PURPOSES ONLY !! Please use https://github.com/NiklasEi/bevy_asset_loader or a similar logic to seperate loading / pre processing // of assets from the spawning -// AssetLoadHelper is also just for the same purpose, you do not need it in a real scenario +// MyGltf is also just for the same purpose, you do not need it in a real scenario // the states here are also for demo purposes only, fn setup(mut commands: Commands, asset_server: Res) { - let tmp: Handle = asset_server.load("basic/models/level1.glb#Scene0"); - commands.insert_resource(AssetLoadHelper(tmp)); + commands.insert_resource(MyGltf(asset_server.load("basic/models/level1.glb"))); } fn spawn_level( mut commands: Commands, scene_markers: Query<&LoadedMarker>, - preloaded_scene: Res, - mut asset_event_reader: EventReader>, mut next_state: ResMut>, + models: Res>, ) { - if let Some(asset_event) = asset_event_reader.iter().next() { + if let Some(asset_event) = asset_event_reader.read().next() { match asset_event { - AssetEvent::Created { handle: _ } => { - info!("GLTF loaded"); + AssetEvent::Added { id } => { + info!("GLTF loaded/ added {:?}", asset_event); + let my_gltf = models.get(*id).unwrap(); if scene_markers.is_empty() { info!("spawning scene"); commands.spawn(( SceneBundle { - scene: preloaded_scene.0.clone(), + scene: my_gltf.scenes[0].clone(), ..default() }, LoadedMarker,