diff --git a/.helix/ignore b/.helix/ignore new file mode 100644 index 0000000..187d362 --- /dev/null +++ b/.helix/ignore @@ -0,0 +1 @@ +/images diff --git a/CHANGELOG.md b/CHANGELOG.md index e0333e7..bdfa212 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,32 @@ # Changelog ## Unreleased - XXXX-XX-XX -- Breaking: - - Add `enable_debug` option to `TweenCorePlugin` by [#75](https://github.com/Multirious/bevy_tween/pull/75) -- Migrate to Bevy 0.18 by [#75](https://github.com/Multirious/bevy_tween/pull/75) + +- Migrate to Bevy 0.18 by [#80](https://github.com/Multirious/bevy_tween/pull/80) + +- By [#78](https://github.com/Multirious/bevy_tween/pull/78) + Breaking: + - **All plugins** now have the generic parameter `TimeCtx` and field `schedule` with the constructor `in_schedule`. This is used to specify the time context and schedule to register all the systems in. + For example: + - `DefaultTweenPlugins::default()` remains default for `()` time context within `PostUpdate` schedule. + - `DefaultTweenPlugins::::in_schedule(FixedLast)` for `Fixed` time context within `FixedLast` schedule. + - **ALL** animation will not run without `bevy_time_runner::TimeContext` marker component with the complementary plugin registered. This also apply to all children of the animation entity. The library currently make sure that all animation spawned through **the framework automatically includes this component**, but if you do insert any animation components manually, you will have to make sure to include TimeContext component. Consult the docs for more details. + - Add `enable_debug` field to `TweenCorePlugin`. + - `BevyTweenRegisterSystems::add_tween_systems` now expects `schedule` parameter. + - Add `animation_in_time_context()` method to `AnimationBuilderExt` + - All tween systems has the generic parameter `TimeCtx` and changed query to only query for tweens entity with `TimeContext` component. + + Non-brekaing: + - Add `component_tween_system_with_time_context` which is the same as `component_tween_system` but has the generic parameter `TimeCtx` + - Add `component_dyn_tween_system_with_time_context` which is the same as `component_dyn_tween_system` but has the generic parameter `TimeCtx` + - Add `resource_tween_system_with_time_context` which is the same as `resource_tween_system` but has the generic parameter `TimeCtx` + + - Deprecated `TweenAppResource`. Though all plugins will continued to support it to remain compatible **except plugin groups**. + + Example: + - Add `time_context_animation` example. + +Internal: - Update flake by [#77](https://github.com/Multirious/bevy_tween/pull/77) - Use latest instead of a version for stableRust in flake.nix - `nix flake update` @@ -31,8 +54,8 @@ ### Breaking Changes - `interpolate` functions now take an additional `previous_value` argument, which you can now use to make delta tweens. -Still, you'd have to update everything that implements `Interpolator` to match the new signature. - - Now, if you want to interpolate yourself an interpolator that uses `previous_value`, you should query for `TweenPreviousValue` as well. This is a required component, so it'll always be on the tween's entity unless you explicitly remove it. + Still, you'd have to update everything that implements `Interpolator` to match the new signature. + - Now, if you want to interpolate yourself an interpolator that uses `previous_value`, you should query for `TweenPreviousValue` as well. This is a required component, so it'll always be on the tween's entity unless you explicitly remove it. ### Changes diff --git a/Cargo.lock b/Cargo.lock index 5c74b65..7728d2f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -26,9 +26,9 @@ checksum = "cf203f9d3bd8f29f98833d1fbef628df18f759248a547e7e01cfbf63cda36a99" [[package]] name = "accesskit_consumer" -version = "0.30.1" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdd06f5fea9819250fffd4debf926709f3593ac22f8c1541a2573e5ee0ca01cd" +checksum = "db81010a6895d8707f9072e6ce98070579b43b717193d2614014abd5cb17dd43" dependencies = [ "accesskit", "hashbrown 0.15.5", @@ -36,9 +36,9 @@ dependencies = [ [[package]] name = "accesskit_macos" -version = "0.22.1" +version = "0.22.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fbaf15815f39084e0cb24950c232f0e3634702c2dfbf182ae3b4919a4a1d45" +checksum = "a0089e5c0ac0ca281e13ea374773898d9354cc28d15af9f0f7394d44a495b575" dependencies = [ "accesskit", "accesskit_consumer", @@ -50,9 +50,9 @@ dependencies = [ [[package]] name = "accesskit_windows" -version = "0.29.1" +version = "0.29.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "792991159fa9ba57459de59e12e918bb90c5346fea7d40ac1a11f8632b41e63a" +checksum = "d2d63dd5041e49c363d83f5419a896ecb074d309c414036f616dc0b04faca971" dependencies = [ "accesskit", "accesskit_consumer", @@ -64,9 +64,9 @@ dependencies = [ [[package]] name = "accesskit_winit" -version = "0.29.1" +version = "0.29.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd9db0ea66997e3f4eae4a5f2c6b6486cf206642639ee629dbbb860ace1dec87" +checksum = "c8cfabe59d0eaca7412bfb1f70198dd31e3b0496fee7e15b066f9c36a1a140a0" dependencies = [ "accesskit", "accesskit_macos", @@ -95,9 +95,9 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "1.1.3" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301" dependencies = [ "memchr", ] @@ -109,7 +109,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef6978589202a00cd7e118380c448a08b6ed394c3a8df3a430d0898e3a42d046" dependencies = [ "android-properties", - "bitflags 2.9.4", + "bitflags 2.11.0", "cc", "cesu8", "jni", @@ -144,6 +144,12 @@ dependencies = [ "libc", ] +[[package]] +name = "anyhow" +version = "1.0.102" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c" + [[package]] name = "approx" version = "0.5.1" @@ -237,9 +243,9 @@ dependencies = [ [[package]] name = "async-executor" -version = "1.13.3" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "497c00e0fd83a72a79a39fcbd8e3e2f055d6f6c7e025f3b3d91f4f8e76527fb8" +checksum = "c96bf972d85afc50bf5ab8fe2d54d1586b4e0b46c97c50a0c9e71e2f7bcd812a" dependencies = [ "async-task", "concurrent-queue", @@ -262,9 +268,9 @@ dependencies = [ [[package]] name = "async-lock" -version = "3.4.1" +version = "3.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fd03604047cee9b6ce9de9f70c6cd540a0520c813cbd49bae61f33ab80ed1dc" +checksum = "290f7f2596bd5b78a9fec8088ccd89180d7f9f55b94b0576823bbbdc72ee8311" dependencies = [ "event-listener", "event-listener-strategy", @@ -403,7 +409,7 @@ dependencies = [ "ctrlc", "downcast-rs", "log", - "thiserror 2.0.17", + "thiserror 2.0.18", "variadics_please", "wasm-bindgen", "web-sys", @@ -429,7 +435,7 @@ dependencies = [ "bevy_reflect", "bevy_tasks", "bevy_utils", - "bitflags 2.9.4", + "bitflags 2.11.0", "blake3", "crossbeam-channel", "derive_more", @@ -443,7 +449,7 @@ dependencies = [ "ron", "serde", "stackfuture", - "thiserror 2.0.17", + "thiserror 2.0.18", "tracing", "uuid", "wasm-bindgen", @@ -485,7 +491,7 @@ dependencies = [ "downcast-rs", "serde", "smallvec", - "thiserror 2.0.17", + "thiserror 2.0.18", "wgpu-types", ] @@ -501,7 +507,7 @@ dependencies = [ "derive_more", "encase", "serde", - "thiserror 2.0.17", + "thiserror 2.0.18", "wgpu-types", ] @@ -527,11 +533,11 @@ dependencies = [ "bevy_transform", "bevy_utils", "bevy_window", - "bitflags 2.9.4", + "bitflags 2.11.0", "nonmax", "radsort", "smallvec", - "thiserror 2.0.17", + "thiserror 2.0.18", "tracing", ] @@ -576,7 +582,7 @@ dependencies = [ "bevy_reflect", "bevy_tasks", "bevy_utils", - "bitflags 2.9.4", + "bitflags 2.11.0", "bumpalo", "concurrent-queue", "derive_more", @@ -587,7 +593,7 @@ dependencies = [ "serde", "slotmap", "smallvec", - "thiserror 2.0.17", + "thiserror 2.0.18", "variadics_please", ] @@ -635,7 +641,7 @@ dependencies = [ "crossbeam-channel", "egui", "encase", - "getrandom", + "getrandom 0.3.4", "image", "itertools", "js-sys", @@ -725,7 +731,7 @@ dependencies = [ "bevy_platform", "bevy_reflect", "bevy_utils", - "bitflags 2.9.4", + "bitflags 2.11.0", "bytemuck", "futures-lite", "guillotiere", @@ -735,7 +741,7 @@ dependencies = [ "rectangle-pack", "ruzstd", "serde", - "thiserror 2.0.17", + "thiserror 2.0.18", "tracing", "wgpu-types", ] @@ -754,7 +760,7 @@ dependencies = [ "derive_more", "log", "smol_str", - "thiserror 2.0.17", + "thiserror 2.0.18", ] [[package]] @@ -770,7 +776,7 @@ dependencies = [ "bevy_reflect", "bevy_window", "log", - "thiserror 2.0.17", + "thiserror 2.0.18", ] [[package]] @@ -870,7 +876,7 @@ dependencies = [ "egui", "ron", "serde", - "thiserror 2.0.17", + "thiserror 2.0.18", ] [[package]] @@ -901,7 +907,7 @@ dependencies = [ "rand", "rand_distr", "serde", - "thiserror 2.0.17", + "thiserror 2.0.18", "variadics_please", ] @@ -921,11 +927,11 @@ dependencies = [ "bevy_platform", "bevy_reflect", "bevy_transform", - "bitflags 2.9.4", + "bitflags 2.11.0", "bytemuck", "derive_more", "hexasphere", - "thiserror 2.0.17", + "thiserror 2.0.18", "tracing", "wgpu-types", ] @@ -961,7 +967,7 @@ dependencies = [ "bevy_shader", "bevy_transform", "bevy_utils", - "bitflags 2.9.4", + "bitflags 2.11.0", "bytemuck", "derive_more", "fixedbitset", @@ -969,7 +975,7 @@ dependencies = [ "offset-allocator", "smallvec", "static_assertions", - "thiserror 2.0.17", + "thiserror 2.0.18", "tracing", ] @@ -1015,11 +1021,11 @@ dependencies = [ "bevy_transform", "bevy_utils", "bevy_window", - "bitflags 2.9.4", + "bitflags 2.11.0", "nonmax", "radsort", "smallvec", - "thiserror 2.0.17", + "thiserror 2.0.18", "tracing", ] @@ -1051,7 +1057,7 @@ dependencies = [ "serde", "smallvec", "smol_str", - "thiserror 2.0.17", + "thiserror 2.0.18", "uuid", "variadics_please", "wgpu-types", @@ -1098,7 +1104,7 @@ dependencies = [ "bevy_transform", "bevy_utils", "bevy_window", - "bitflags 2.9.4", + "bitflags 2.11.0", "bytemuck", "derive_more", "downcast-rs", @@ -1113,7 +1119,7 @@ dependencies = [ "offset-allocator", "send_wrapper", "smallvec", - "thiserror 2.0.17", + "thiserror 2.0.18", "tracing", "variadics_please", "wasm-bindgen", @@ -1145,7 +1151,7 @@ dependencies = [ "naga", "naga_oil", "serde", - "thiserror 2.0.17", + "thiserror 2.0.18", "tracing", "wgpu-types", ] @@ -1198,7 +1204,7 @@ dependencies = [ "bevy_text", "bevy_transform", "bevy_utils", - "bitflags 2.9.4", + "bitflags 2.11.0", "bytemuck", "derive_more", "fixedbitset", @@ -1272,7 +1278,7 @@ dependencies = [ "serde", "smallvec", "sys-locale", - "thiserror 2.0.17", + "thiserror 2.0.18", "tracing", "wgpu-types", ] @@ -1295,7 +1301,7 @@ dependencies = [ [[package]] name = "bevy_time_runner" version = "0.5.2" -source = "git+https://github.com/multirious/bevy_time_runner?branch=main#e3f116bcc94478783457be2a2cfc11f87c2db3e9" +source = "git+https://github.com/multirious/bevy_time_runner?branch=main#8949a9752052aad9cfa1e22027d17450d4d7f8cc" dependencies = [ "bevy_app", "bevy_ecs", @@ -1320,7 +1326,7 @@ dependencies = [ "bevy_utils", "derive_more", "serde", - "thiserror 2.0.17", + "thiserror 2.0.18", ] [[package]] @@ -1366,7 +1372,7 @@ dependencies = [ "derive_more", "smallvec", "taffy", - "thiserror 2.0.17", + "thiserror 2.0.18", "tracing", ] @@ -1451,25 +1457,26 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.9.4" +version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2261d10cca569e4643e526d8dc2e62e433cc8aba21ab764233731f8d369bf394" +checksum = "843867be96c8daad0d758b57df9392b6d8d271134fce549de6ce169ff98a92af" dependencies = [ "bytemuck", - "serde", + "serde_core", ] [[package]] name = "blake3" -version = "1.8.2" +version = "1.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3888aaa89e4b2a40fca9848e400f6a658a5a3978de7be858e209cafa8be9a4a0" +checksum = "2468ef7d57b3fb7e16b576e8377cdbde2320c60e1491e961d11da40fc4f02a2d" dependencies = [ "arrayref", "arrayvec", "cc", "cfg-if", "constant_time_eq", + "cpufeatures", ] [[package]] @@ -1487,6 +1494,15 @@ dependencies = [ "objc2 0.5.2", ] +[[package]] +name = "block2" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdeb9d870516001442e364c5220d3574d2da8dc765554b4a617230d33fa58ef5" +dependencies = [ + "objc2 0.6.3", +] + [[package]] name = "blocking" version = "1.6.2" @@ -1502,9 +1518,9 @@ dependencies = [ [[package]] name = "bstr" -version = "1.12.0" +version = "1.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "234113d19d0d7d613b40e86fb654acf958910802bcceab913a4f9e7cda03b1a4" +checksum = "63044e1ae8e69f3b5a92c736ca6269b8d12fa7efe39bf34ddb06d102cf0e2cab" dependencies = [ "memchr", "regex-automata", @@ -1513,15 +1529,15 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.19.0" +version = "3.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" +checksum = "5d20789868f4b01b2f2caec9f5c4e0213b41e3e5702a50157d699ae31ced2fcb" [[package]] name = "bytemuck" -version = "1.24.0" +version = "1.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fbdf580320f38b612e485521afda1ee26d10cc9884efaaa750d383e13e3c5f4" +checksum = "c8efb64bd706a16a1bdde310ae86b351e4d21550d98d056f22f8a7f7a2183fec" dependencies = [ "bytemuck_derive", ] @@ -1551,9 +1567,9 @@ checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495" [[package]] name = "bytes" -version = "1.10.1" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" +checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33" [[package]] name = "calloop" @@ -1561,7 +1577,7 @@ version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b99da2f8558ca23c71f4fd15dc57c906239752dd27ff3c00a1d56b685b7cbfec" dependencies = [ - "bitflags 2.9.4", + "bitflags 2.11.0", "log", "polling", "rustix 0.38.44", @@ -1571,9 +1587,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.2.40" +version = "1.2.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1d05d92f4b1fd76aad469d46cdd858ca761576082cd37df81416691e50199fb" +checksum = "aebf35691d1bfb0ac386a69bac2fde4dd276fb618cf8bf4f5318fe285e821bb2" dependencies = [ "find-msvc-tools", "jobserver", @@ -1589,9 +1605,9 @@ checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" [[package]] name = "cfg-if" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" [[package]] name = "cfg_aliases" @@ -1672,9 +1688,9 @@ checksum = "87ca1caa64ef4ed453e68bb3db612e51cf1b2f5b871337f0fcab1c8f87cc3dff" [[package]] name = "constant_time_eq" -version = "0.3.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c74b8349d32d297c9134b8c88677813a227df8f779daa29bfc29c183fe3dca6" +checksum = "3d52eff69cd5e647efe296129160853a42795992097e8af39800e1060caeea9b" [[package]] name = "constgebra" @@ -1685,6 +1701,15 @@ dependencies = [ "const_soft_float", ] +[[package]] +name = "convert_case" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "633458d4ef8c78b72454de2d54fd6ab2e60f9e02be22f3c6104cdc8a4e0fceb9" +dependencies = [ + "unicode-segmentation", +] + [[package]] name = "core-foundation" version = "0.9.4" @@ -1741,7 +1766,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d44a101f213f6c4cdc1853d4b78aef6db6bdfa3468798cc1d9912f4735013eb" dependencies = [ - "bitflags 2.9.4", + "bitflags 2.11.0", "core-foundation 0.10.1", "libc", ] @@ -1761,7 +1786,7 @@ version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4cadaea21e24c49c0c82116f2b465ae6a49d63c90e428b0f8d9ae1f638ac91f" dependencies = [ - "bitflags 2.9.4", + "bitflags 2.11.0", "fontdb", "harfrust", "linebender_resource_handle", @@ -1779,6 +1804,15 @@ dependencies = [ "unicode-segmentation", ] +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + [[package]] name = "crc32fast" version = "1.5.0" @@ -1826,13 +1860,13 @@ checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" [[package]] name = "ctrlc" -version = "3.5.0" +version = "3.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "881c5d0a13b2f1498e2306e82cbada78390e152d4b1378fb28a84f4dcd0dc4f3" +checksum = "e0b1fab2ae45819af2d0731d60f2afe17227ebb1a1538a236da84c93e9a60162" dependencies = [ - "dispatch", + "dispatch2", "nix", - "windows-sys 0.61.1", + "windows-sys 0.61.2", ] [[package]] @@ -1843,27 +1877,29 @@ checksum = "f27ae1dd37df86211c42e150270f82743308803d90a6f6e6651cd730d5e1732f" [[package]] name = "data-encoding" -version = "2.9.0" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a2330da5de22e8a3cb63252ce2abb30116bf5265e89c0e01bc17015ce30a476" +checksum = "d7a1e2f27636f116493b8b860f5546edb47c8d8f8ea73e1d2a20be88e28d1fea" [[package]] name = "derive_more" -version = "2.0.1" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "093242cf7570c207c83073cf82f79706fe7b8317e98620a47d5be7c3d8497678" +checksum = "d751e9e49156b02b44f9c1815bcb94b984cdcc4396ecc32521c739452808b134" dependencies = [ "derive_more-impl", ] [[package]] name = "derive_more-impl" -version = "2.0.1" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bda628edc44c4bb645fbe0f758797143e4e07926f7ebf4e9bdfbd3d2ce621df3" +checksum = "799a97264921d8623a957f6c3b9011f3b5492f557bbb7a5a19b7fa6d06ba8dcb" dependencies = [ + "convert_case", "proc-macro2", "quote", + "rustc_version", "syn", "unicode-xid", ] @@ -1880,7 +1916,9 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "89a09f22a6c6069a18470eb92d2298acf25463f14256d24778e1230d789a2aec" dependencies = [ - "bitflags 2.9.4", + "bitflags 2.11.0", + "block2 0.6.2", + "libc", "objc2 0.6.3", ] @@ -1901,9 +1939,9 @@ dependencies = [ [[package]] name = "document-features" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95249b50c6c185bee49034bcb378a49dc2b5dff0be90ff6616d31d64febab05d" +checksum = "d4b8a88685455ed29a21542a33abd9cb6510b6b129abadabdcef0f4c55bc8f61" dependencies = [ "litrs", ] @@ -1937,7 +1975,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a9b567d356674e9a5121ed3fedfb0a7c31e059fe71f6972b691bcd0bfc284e3" dependencies = [ "ahash", - "bitflags 2.9.4", + "bitflags 2.11.0", "emath", "epaint", "log", @@ -1970,7 +2008,7 @@ checksum = "6e3e0ff2ee0b7aa97428308dd9e1e42369cb22f5fb8dc1c55546637443a60f1e" dependencies = [ "const_panic", "encase_derive", - "thiserror 2.0.17", + "thiserror 2.0.18", ] [[package]] @@ -2025,9 +2063,9 @@ checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" [[package]] name = "erased-serde" -version = "0.4.8" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "259d404d09818dec19332e31d94558aeb442fea04c817006456c24b5460bbd4b" +checksum = "89e8918065695684b2b0702da20382d5ae6065cf3327bc2d6436bd49a71ce9f3" dependencies = [ "serde", "serde_core", @@ -2041,7 +2079,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.61.1", + "windows-sys 0.61.2", ] [[package]] @@ -2052,9 +2090,9 @@ checksum = "dea2df4cf52843e0452895c455a1a2cfbb842a1e7329671acf418fdc53ed4c59" [[package]] name = "euclid" -version = "0.22.11" +version = "0.22.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad9cdb4b747e485a12abb0e6566612956c7a1bafa3bdb8d682c5b6d403589e48" +checksum = "df61bf483e837f88d5c2291dcf55c67be7e676b3a51acc48db3a7b163b91ed63" dependencies = [ "num-traits", ] @@ -2117,9 +2155,9 @@ dependencies = [ [[package]] name = "find-msvc-tools" -version = "0.1.3" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0399f9d26e5191ce32c498bebd31e7a3ceabc2745f0ac54af3f335126c3f24b3" +checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" [[package]] name = "fixedbitset" @@ -2129,9 +2167,9 @@ checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99" [[package]] name = "flate2" -version = "1.1.3" +version = "1.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04bcaeafafdd3cd1cb5d986ff32096ad1136630207c49b9091e3ae541090d938" +checksum = "843fba2746e448b37e26a819579957415c8cef339bf08564fe8b7ddbd959573c" dependencies = [ "crc32fast", "miniz_oxide", @@ -2210,9 +2248,9 @@ checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" [[package]] name = "futures-channel" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" +checksum = "07bbe89c50d7a535e539b8c17bc0b49bdb77747034daa8087407d655f3f7cc1d" dependencies = [ "futures-core", ] @@ -2225,9 +2263,9 @@ checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d" [[package]] name = "futures-io" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" +checksum = "cecba35d7ad927e23624b22ad55235f2239cfa44fd10428eecbeba6d6a717718" [[package]] name = "futures-lite" @@ -2283,33 +2321,46 @@ dependencies = [ [[package]] name = "gethostname" -version = "1.0.2" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc257fdb4038301ce4b9cd1b3b51704509692bb3ff716a410cbd07925d9dae55" +checksum = "1bd49230192a3797a9a4d6abe9b3eed6f7fa4c8a8a4947977c6f80025f92cbd8" dependencies = [ - "rustix 1.1.2", - "windows-targets 0.52.6", + "rustix 1.1.3", + "windows-link 0.2.1", ] [[package]] name = "getrandom" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" dependencies = [ "cfg-if", "js-sys", "libc", "r-efi", - "wasi", + "wasip2", "wasm-bindgen", ] +[[package]] +name = "getrandom" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "139ef39800118c7683f2fd3c98c1b23c09ae076556b435f8e9064ae108aaeeec" +dependencies = [ + "cfg-if", + "libc", + "r-efi", + "wasip2", + "wasip3", +] + [[package]] name = "glam" -version = "0.30.8" +version = "0.30.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e12d847aeb25f41be4c0ec9587d624e9cd631bc007a8fd7ce3f5851e064c6460" +checksum = "19fc433e8437a212d1b6f1e68c7824af3aed907da60afa994e7f542d18d12aa9" dependencies = [ "bytemuck", "encase", @@ -2324,7 +2375,7 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fbcd2dba93594b227a1f57ee09b8b9da8892c34d55aa332e034a228d0fe6a171" dependencies = [ - "bitflags 2.9.4", + "bitflags 2.11.0", "gpu-alloc-types", ] @@ -2334,7 +2385,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "98ff03b468aa837d70984d55f5d3f846f6ec31fe34bbb97c4f85219caeee1ca4" dependencies = [ - "bitflags 2.9.4", + "bitflags 2.11.0", ] [[package]] @@ -2355,7 +2406,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b89c83349105e3732062a895becfc71a8f921bb71ecbbdd8ff99263e3b53a0ca" dependencies = [ - "bitflags 2.9.4", + "bitflags 2.11.0", "gpu-descriptor-types", "hashbrown 0.15.5", ] @@ -2366,7 +2417,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fdf242682df893b86f33a73828fb09ca4b2d3bb6cc95249707fc684d27484b91" dependencies = [ - "bitflags 2.9.4", + "bitflags 2.11.0", ] [[package]] @@ -2387,13 +2438,14 @@ dependencies = [ [[package]] name = "half" -version = "2.6.0" +version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "459196ed295495a68f7d7fe1d84f6c4b7ff0e21fe3017b2f283c6fac3ad803c9" +checksum = "6ea2d84b969582b4b1864a92dc5d27cd2b77b622a8d79306834f1be5ba20d84b" dependencies = [ "cfg-if", "crunchy", "num-traits", + "zerocopy", ] [[package]] @@ -2402,7 +2454,7 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e0caaee032384c10dd597af4579c67dee16650d862a9ccbe1233ff1a379abc07" dependencies = [ - "bitflags 2.9.4", + "bitflags 2.11.0", "bytemuck", "core_maths", "read-fonts 0.36.0", @@ -2450,6 +2502,12 @@ dependencies = [ "stable_deref_trait", ] +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + [[package]] name = "hermit-abi" version = "0.5.2" @@ -2473,11 +2531,17 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df" +[[package]] +name = "id-arena" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954" + [[package]] name = "image" -version = "0.25.8" +version = "0.25.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "529feb3e6769d234375c4cf1ee2ce713682b8e76538cb13f9fc23e1400a591e7" +checksum = "e6506c6c10786659413faa717ceebcb8f70731c0a60cbae39795fdf114519c1a" dependencies = [ "bytemuck", "byteorder-lite", @@ -2489,19 +2553,21 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.11.4" +version = "2.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b0f83760fb341a774ed326568e19f5a863af4a952def8c39f9ab92fd95b88e5" +checksum = "7714e70437a7dc3ac8eb7e6f8df75fd8eb422675fc7678aff7364301092b1017" dependencies = [ "equivalent", "hashbrown 0.16.1", + "serde", + "serde_core", ] [[package]] name = "inventory" -version = "0.3.21" +version = "0.3.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc61209c082fbeb19919bee74b176221b27223e27b65d781eb91af24eb1fb46e" +checksum = "009ae045c87e7082cb72dab0ccd01ae075dd00141ddc108f43a0ea150a9e7227" dependencies = [ "rustversion", ] @@ -2515,6 +2581,12 @@ dependencies = [ "either", ] +[[package]] +name = "itoa" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2" + [[package]] name = "jni" version = "0.21.1" @@ -2543,15 +2615,15 @@ version = "0.1.34" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33" dependencies = [ - "getrandom", + "getrandom 0.3.4", "libc", ] [[package]] name = "js-sys" -version = "0.3.85" +version = "0.3.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c942ebf8e95485ca0d52d97da7c5a2c387d0e7f0ba4c35e93bfcaee045955b3" +checksum = "93f0862381daaec758576dcc22eb7bbf4d7efd67328553f3b45a412a51a3fb21" dependencies = [ "once_cell", "wasm-bindgen", @@ -2563,7 +2635,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff7f53bdf698e7aa7ec916411bbdc8078135da11b66db5182675b2227f6c0d07" dependencies = [ - "bitflags 2.9.4", + "bitflags 2.11.0", ] [[package]] @@ -2572,11 +2644,17 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" +[[package]] +name = "leb128fmt" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" + [[package]] name = "libc" -version = "0.2.176" +version = "0.2.180" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58f929b4d672ea937a23a1ab494143d968337a5f47e56d0815df1e0890ddf174" +checksum = "bcc35a38544a891a5f7c865aca548a982ccb3b8650a5b06d0fd33a10283c56fc" [[package]] name = "libloading" @@ -2585,24 +2663,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55" dependencies = [ "cfg-if", - "windows-link 0.2.0", + "windows-link 0.2.1", ] [[package]] name = "libm" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" +checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" [[package]] name = "libredox" -version = "0.1.10" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "416f7e718bdb06000964960ffa43b4335ad4012ae8b99060261aa4a8088d5ccb" +checksum = "3d0b95e02c851351f877147b7deea7b1afb1df71b63aa5f8270716e0c5720616" dependencies = [ - "bitflags 2.9.4", + "bitflags 2.11.0", "libc", - "redox_syscall 0.5.18", + "redox_syscall 0.7.1", ] [[package]] @@ -2625,9 +2703,9 @@ checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039" [[package]] name = "litrs" -version = "0.4.2" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5e54036fe321fd421e10d732f155734c4e4afd610dd556d9a82833ab3ee0bed" +checksum = "11d3d7f243d5c5a8b9bb5d6dd2b1602c0cb0b9db1621bafc7ed66e35ff9fe092" [[package]] name = "lock_api" @@ -2640,9 +2718,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.28" +version = "0.4.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432" +checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" [[package]] name = "malloc_buf" @@ -2664,15 +2742,15 @@ dependencies = [ [[package]] name = "memchr" -version = "2.7.6" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" +checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79" [[package]] name = "memmap2" -version = "0.9.8" +version = "0.9.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "843a98750cd611cc2965a8213b53b43e715f13c37a9e096c6408e69990961db7" +checksum = "714098028fe011992e1c3962653c96b2d578c4b4bce9036e15ff220319b1e0e3" dependencies = [ "libc", ] @@ -2683,7 +2761,7 @@ version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "00c15a6f673ff72ddcc22394663290f870fb224c1bfce55734a75c414150e605" dependencies = [ - "bitflags 2.9.4", + "bitflags 2.11.0", "block", "core-graphics-types 0.2.0", "foreign-types", @@ -2704,9 +2782,9 @@ dependencies = [ [[package]] name = "moxcms" -version = "0.7.6" +version = "0.7.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cc7d85f3d741164e8972ad355e26ac6e51b20fcae5f911c7da8f2d8bbbb3f33" +checksum = "ac9557c559cd6fc9867e122e20d2cbefc9ca29d80d027a8e39310920ed2f0a97" dependencies = [ "num-traits", "pxfm", @@ -2720,7 +2798,7 @@ checksum = "066cf25f0e8b11ee0df221219010f213ad429855f57c494f995590c861a9a7d8" dependencies = [ "arrayvec", "bit-set", - "bitflags 2.9.4", + "bitflags 2.11.0", "cfg-if", "cfg_aliases", "codespan-reporting", @@ -2735,7 +2813,7 @@ dependencies = [ "pp-rs", "rustc-hash", "spirv", - "thiserror 2.0.17", + "thiserror 2.0.18", "unicode-ident", ] @@ -2751,7 +2829,7 @@ dependencies = [ "naga", "regex", "rustc-hash", - "thiserror 2.0.17", + "thiserror 2.0.18", "tracing", "unicode-ident", ] @@ -2762,7 +2840,7 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3f42e7bbe13d351b6bead8286a43aac9534b82bd3cc43e47037f012ebfd62d4" dependencies = [ - "bitflags 2.9.4", + "bitflags 2.11.0", "jni-sys", "log", "ndk-sys", @@ -2788,11 +2866,11 @@ dependencies = [ [[package]] name = "nix" -version = "0.30.1" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74523f3a35e05aba87a1d978330aef40f67b0304ac79c1c00b294c9830543db6" +checksum = "225e7cfe711e0ba79a68baeddb2982723e4235247aefce1482f2f16c27865b66" dependencies = [ - "bitflags 2.9.4", + "bitflags 2.11.0", "cfg-if", "cfg_aliases", "libc", @@ -2816,16 +2894,16 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bf23ab2b905654b4cb177e30b629937b3868311d4e1cba859f899c041046e69b" dependencies = [ - "windows-sys 0.61.1", + "windows-sys 0.61.2", ] [[package]] name = "nu-ansi-term" -version = "0.50.1" +version = "0.50.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4a28e057d01f97e61255210fcff094d74ed0466038633e95017f5beb68e4399" +checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.61.2", ] [[package]] @@ -2840,9 +2918,9 @@ dependencies = [ [[package]] name = "num_enum" -version = "0.7.4" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a973b4e44ce6cad84ce69d797acf9a044532e4184c4f267913d1b546a0727b7a" +checksum = "b1207a7e20ad57b847bbddc6776b968420d38292bbfe2089accff5e19e82454c" dependencies = [ "num_enum_derive", "rustversion", @@ -2850,9 +2928,9 @@ dependencies = [ [[package]] name = "num_enum_derive" -version = "0.7.4" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77e878c846a8abae00dd069496dbe8751b16ac1c3d6bd2a7283a938e8228f90d" +checksum = "ff32365de1b6743cb203b710788263c44a03de03802daf96092f2da4fe6ba4d7" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2900,8 +2978,8 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e4e89ad9e3d7d297152b17d39ed92cd50ca8063a89a9fa569046d41568891eff" dependencies = [ - "bitflags 2.9.4", - "block2", + "bitflags 2.11.0", + "block2 0.5.1", "libc", "objc2 0.5.2", "objc2-core-data", @@ -2916,7 +2994,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d49e936b501e5c5bf01fda3a9452ff86dc3ea98ad5f283e1455153142d97518c" dependencies = [ - "bitflags 2.9.4", + "bitflags 2.11.0", "objc2 0.6.3", "objc2-core-graphics", "objc2-foundation 0.3.2", @@ -2928,8 +3006,8 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "74dd3b56391c7a0596a295029734d3c1c5e7e510a4cb30245f8221ccea96b009" dependencies = [ - "bitflags 2.9.4", - "block2", + "bitflags 2.11.0", + "block2 0.5.1", "objc2 0.5.2", "objc2-core-location", "objc2-foundation 0.2.2", @@ -2941,7 +3019,7 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a5ff520e9c33812fd374d8deecef01d4a840e7b41862d849513de77e44aa4889" dependencies = [ - "block2", + "block2 0.5.1", "objc2 0.5.2", "objc2-foundation 0.2.2", ] @@ -2952,8 +3030,8 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "617fbf49e071c178c0b24c080767db52958f716d9eabdf0890523aeae54773ef" dependencies = [ - "bitflags 2.9.4", - "block2", + "bitflags 2.11.0", + "block2 0.5.1", "objc2 0.5.2", "objc2-foundation 0.2.2", ] @@ -2964,7 +3042,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536" dependencies = [ - "bitflags 2.9.4", + "bitflags 2.11.0", "dispatch2", "objc2 0.6.3", ] @@ -2975,7 +3053,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e022c9d066895efa1345f8e33e584b9f958da2fd4cd116792e15e07e4720a807" dependencies = [ - "bitflags 2.9.4", + "bitflags 2.11.0", "dispatch2", "objc2 0.6.3", "objc2-core-foundation", @@ -2988,7 +3066,7 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55260963a527c99f1819c4f8e3b47fe04f9650694ef348ffd2227e8196d34c80" dependencies = [ - "block2", + "block2 0.5.1", "objc2 0.5.2", "objc2-foundation 0.2.2", "objc2-metal", @@ -3000,7 +3078,7 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "000cfee34e683244f284252ee206a27953279d370e309649dc3ee317b37e5781" dependencies = [ - "block2", + "block2 0.5.1", "objc2 0.5.2", "objc2-contacts", "objc2-foundation 0.2.2", @@ -3018,8 +3096,8 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ee638a5da3799329310ad4cfa62fbf045d5f56e3ef5ba4149e7452dcf89d5a8" dependencies = [ - "bitflags 2.9.4", - "block2", + "bitflags 2.11.0", + "block2 0.5.1", "dispatch", "libc", "objc2 0.5.2", @@ -3031,7 +3109,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272" dependencies = [ - "bitflags 2.9.4", + "bitflags 2.11.0", "objc2 0.6.3", "objc2-core-foundation", ] @@ -3042,7 +3120,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "180788110936d59bab6bd83b6060ffdfffb3b922ba1396b312ae795e1de9d81d" dependencies = [ - "bitflags 2.9.4", + "bitflags 2.11.0", "objc2 0.6.3", "objc2-core-foundation", ] @@ -3053,7 +3131,7 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1a1ae721c5e35be65f01a03b6d2ac13a54cb4fa70d8a5da293d7b0020261398" dependencies = [ - "block2", + "block2 0.5.1", "objc2 0.5.2", "objc2-app-kit 0.2.2", "objc2-foundation 0.2.2", @@ -3065,8 +3143,8 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd0cba1276f6023976a406a14ffa85e1fdd19df6b0f737b063b95f6c8c7aadd6" dependencies = [ - "bitflags 2.9.4", - "block2", + "bitflags 2.11.0", + "block2 0.5.1", "objc2 0.5.2", "objc2-foundation 0.2.2", ] @@ -3077,8 +3155,8 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e42bee7bff906b14b167da2bac5efe6b6a07e6f7c0a21a7308d40c960242dc7a" dependencies = [ - "bitflags 2.9.4", - "block2", + "bitflags 2.11.0", + "block2 0.5.1", "objc2 0.5.2", "objc2-foundation 0.2.2", "objc2-metal", @@ -3100,8 +3178,8 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b8bb46798b20cd6b91cbd113524c490f1686f4c4e8f49502431415f3512e2b6f" dependencies = [ - "bitflags 2.9.4", - "block2", + "bitflags 2.11.0", + "block2 0.5.1", "objc2 0.5.2", "objc2-cloud-kit", "objc2-core-data", @@ -3121,7 +3199,7 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "44fa5f9748dbfe1ca6c0b79ad20725a11eca7c2218bceb4b005cb1be26273bfe" dependencies = [ - "block2", + "block2 0.5.1", "objc2 0.5.2", "objc2-foundation 0.2.2", ] @@ -3132,8 +3210,8 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "76cfcbf642358e8689af64cee815d139339f3ed8ad05103ed5eaf73db8d84cb3" dependencies = [ - "bitflags 2.9.4", - "block2", + "bitflags 2.11.0", + "block2 0.5.1", "objc2 0.5.2", "objc2-core-location", "objc2-foundation 0.2.2", @@ -3157,29 +3235,30 @@ checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" [[package]] name = "opener" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb9024962ab91e00c89d2a14352a8d0fc1a64346bf96f1839b45c09149564e47" +checksum = "a2fa337e0cf13357c13ef1dc108df1333eb192f75fc170bea03fcf1fd404c2ee" dependencies = [ "bstr", "normpath", - "windows-sys 0.60.2", + "windows-sys 0.61.2", ] [[package]] name = "orbclient" -version = "0.3.48" +version = "0.3.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba0b26cec2e24f08ed8bb31519a9333140a6599b867dac464bb150bdb796fd43" +checksum = "52ad2c6bae700b7aa5d1cc30c59bdd3a1c180b09dbaea51e2ae2b8e1cf211fdd" dependencies = [ + "libc", "libredox", ] [[package]] name = "ordered-float" -version = "5.0.0" +version = "5.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2c1f9f56e534ac6a9b8a4600bdf0f530fb393b5f393e7b4d03489c3cf0c3f01" +checksum = "7f4779c6901a562440c3786d08192c6fbda7c1c2060edd10006b05ee35d10f2d" dependencies = [ "num-traits", ] @@ -3219,7 +3298,7 @@ dependencies = [ "libc", "redox_syscall 0.5.18", "smallvec", - "windows-link 0.2.0", + "windows-link 0.2.1", ] [[package]] @@ -3279,11 +3358,11 @@ checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" [[package]] name = "png" -version = "0.18.0" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97baced388464909d42d89643fe4361939af9b7ce7a31ee32a168f832a70f2a0" +checksum = "60769b8b31b2a9f263dae2776c37b1b28ae246943cf719eb6946a1db05128a61" dependencies = [ - "bitflags 2.9.4", + "bitflags 2.11.0", "crc32fast", "fdeflate", "flate2", @@ -3300,21 +3379,21 @@ dependencies = [ "concurrent-queue", "hermit-abi", "pin-project-lite", - "rustix 1.1.2", - "windows-sys 0.61.1", + "rustix 1.1.3", + "windows-sys 0.61.2", ] [[package]] name = "portable-atomic" -version = "1.11.1" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483" +checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49" [[package]] name = "portable-atomic-util" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507" +checksum = "7a9db96d7fa8782dd8c15ce32ffe8680bbd1e978a43bf51a34d39483540495f5" dependencies = [ "portable-atomic", ] @@ -3343,6 +3422,16 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e8cf8e6a8aa66ce33f63993ffc4ea4271eb5b0530a9002db8455ea6050c77bfa" +[[package]] +name = "prettyplease" +version = "0.2.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" +dependencies = [ + "proc-macro2", + "syn", +] + [[package]] name = "proc-macro-crate" version = "3.4.0" @@ -3354,9 +3443,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.101" +version = "1.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de" +checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" dependencies = [ "unicode-ident", ] @@ -3369,9 +3458,9 @@ checksum = "3eb8486b569e12e2c32ad3e204dbaba5e4b5b216e9367044f25f1dba42341773" [[package]] name = "pxfm" -version = "0.1.24" +version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83f9b339b02259ada5c0f4a389b7fb472f933aa17ce176fd2ad98f28bb401fde" +checksum = "7186d3822593aa4393561d186d1393b3923e9d6163d3fbfd6e825e3e6cf3e6a8" dependencies = [ "num-traits", ] @@ -3384,9 +3473,9 @@ checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3" [[package]] name = "quote" -version = "1.0.41" +version = "1.0.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce25767e7b499d1b604768e7cde645d14cc8584231ea6b295e9c9eb22c02e1d1" +checksum = "21b2ebcf727b7760c461f091f9f0f539b77b8e87f2fd88131e7f1b433b3cece4" dependencies = [ "proc-macro2", ] @@ -3425,11 +3514,11 @@ dependencies = [ [[package]] name = "rand_core" -version = "0.9.3" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c" dependencies = [ - "getrandom", + "getrandom 0.3.4", ] [[package]] @@ -3450,9 +3539,9 @@ checksum = "c3d6831663a5098ea164f89cff59c6284e95f4e3c76ce9848d4529f5ccca9bde" [[package]] name = "rangemap" -version = "1.6.0" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f93e7e49bb0bf967717f7bd674458b3d6b0c5f48ec7e3038166026a69fc22223" +checksum = "973443cf09a9c8656b574a866ab68dfa19f0867d0340648c7d2f6a71b8a8ea68" [[package]] name = "raw-window-handle" @@ -3502,14 +3591,23 @@ version = "0.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" dependencies = [ - "bitflags 2.9.4", + "bitflags 2.11.0", +] + +[[package]] +name = "redox_syscall" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35985aa610addc02e24fc232012c86fd11f14111180f902b67e2d5331f8ebf2b" +dependencies = [ + "bitflags 2.11.0", ] [[package]] name = "regex" -version = "1.11.3" +version = "1.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b5288124840bee7b386bc413c487869b360b2b4ec421ea56425128692f2a82c" +checksum = "e10754a14b9137dd7b1e3e5b0493cc9171fdd105e0ab477f51b72e7f3ac0e276" dependencies = [ "aho-corasick", "memchr", @@ -3519,9 +3617,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.11" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "833eb9ce86d40ef33cb1306d8accf7bc8ec2bfea4355cbdebb3df68b40925cad" +checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f" dependencies = [ "aho-corasick", "memchr", @@ -3530,9 +3628,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.6" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "caf4aa5b0f434c91fe5c7f1ecb6a5ece2130b02ad2a590589dda5146df959001" +checksum = "a96887878f22d7bad8a3b6dc5b7440e0ada9a245242924394987b21cf2210a4c" [[package]] name = "renderdoc-sys" @@ -3546,7 +3644,7 @@ version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fd490c5b18261893f14449cbd28cb9c0b637aebf161cd77900bfdedaff21ec32" dependencies = [ - "bitflags 2.9.4", + "bitflags 2.11.0", "once_cell", "serde", "serde_derive", @@ -3581,7 +3679,7 @@ version = "0.38.44" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" dependencies = [ - "bitflags 2.9.4", + "bitflags 2.11.0", "errno", "libc", "linux-raw-sys 0.4.15", @@ -3590,15 +3688,15 @@ dependencies = [ [[package]] name = "rustix" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd15f8a2c5551a84d56efdc1cd049089e409ac19a3072d5037a17fd70719ff3e" +checksum = "146c9e247ccc180c1f61615433868c99f3de3ae256a30a43b49f67c2d9171f34" dependencies = [ - "bitflags 2.9.4", + "bitflags 2.11.0", "errno", "libc", "linux-raw-sys 0.11.0", - "windows-sys 0.61.1", + "windows-sys 0.61.2", ] [[package]] @@ -3609,9 +3707,9 @@ checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" [[package]] name = "ruzstd" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3640bec8aad418d7d03c72ea2de10d5c646a598f9883c7babc160d91e3c1b26c" +checksum = "e5ff0cc5e135c8870a775d3320910cd9b564ec036b4dc0b8741629020be63f01" dependencies = [ "twox-hash", ] @@ -3633,9 +3731,9 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "self_cell" -version = "1.2.0" +version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f7d95a54511e0c7be3f51e8867aa8cf35148d7b9445d44de2f943e2b206e749" +checksum = "b12e76d157a900eb52e81bc6e9f3069344290341720e9178cde2407113ac8d89" [[package]] name = "semver" @@ -3679,6 +3777,19 @@ dependencies = [ "syn", ] +[[package]] +name = "serde_json" +version = "1.0.149" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + [[package]] name = "sharded-slab" version = "0.1.7" @@ -3696,9 +3807,9 @@ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "simd-adler32" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" +checksum = "e320a6c5ad31d271ad523dcf3ad13e2767ad8b1cb8f047f75a8aeaf8da139da2" [[package]] name = "skrifa" @@ -3722,15 +3833,15 @@ dependencies = [ [[package]] name = "slab" -version = "0.4.11" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a2ae44ef20feb57a68b23d846850f861394c2e02dc425a50098ae8c90267589" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" [[package]] name = "slotmap" -version = "1.0.7" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbff4acf519f630b3a3ddcfaea6c06b42174d9a44bc70c620e9ed1649d58b82a" +checksum = "bdd58c3c93c3d278ca835519292445cb4b0d4dc59ccfdf7ceadaab3f8aeb4038" dependencies = [ "version_check", ] @@ -3765,20 +3876,23 @@ version = "0.3.0+sdk-1.3.268.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eda41003dc44290527a59b13432d4a0379379fa074b70174882adfbdfd917844" dependencies = [ - "bitflags 2.9.4", + "bitflags 2.11.0", ] [[package]] name = "stable_deref_trait" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" [[package]] name = "stackfuture" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6eae92052b72ef70dafa16eddbabffc77e5ca3574be2f7bc1127b36f0a7ad7f2" +checksum = "115beb9c69db2393ff10b75a1b8587a51716e5551d015001e55320ed279d32f9" +dependencies = [ + "const_panic", +] [[package]] name = "static_assertions" @@ -3805,9 +3919,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.116" +version = "2.0.117" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3df424c70518695237746f84cede799c9c58fcb37450d7b23716568cc8bc69cb" +checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99" dependencies = [ "proc-macro2", "quote", @@ -3855,11 +3969,11 @@ dependencies = [ [[package]] name = "thiserror" -version = "2.0.17" +version = "2.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8" +checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4" dependencies = [ - "thiserror-impl 2.0.17", + "thiserror-impl 2.0.18", ] [[package]] @@ -3875,9 +3989,9 @@ dependencies = [ [[package]] name = "thiserror-impl" -version = "2.0.17" +version = "2.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913" +checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" dependencies = [ "proc-macro2", "quote", @@ -3924,18 +4038,18 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "toml_datetime" -version = "0.7.2" +version = "0.7.5+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32f1085dec27c2b6632b04c80b3bb1b4300d6495d1e129693bdda7d91e72eec1" +checksum = "92e1cfed4a3038bc5a127e35a2d360f145e1f4b971b551a2ba5fd7aedf7e1347" dependencies = [ "serde_core", ] [[package]] name = "toml_edit" -version = "0.23.6" +version = "0.23.10+spec-1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3effe7c0e86fdff4f69cdd2ccc1b96f933e24811c5441d44904e8683e27184b" +checksum = "84c8b9f757e028cee9fa244aea147aab2a9ec09d5325a9b01e0a49730c2b5269" dependencies = [ "indexmap", "toml_datetime", @@ -3945,18 +4059,18 @@ dependencies = [ [[package]] name = "toml_parser" -version = "1.0.3" +version = "1.0.9+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cf893c33be71572e0e9aa6dd15e6677937abd686b066eac3f8cd3531688a627" +checksum = "702d4415e08923e7e1ef96cd5727c0dfed80b4d2fa25db9647fe5eb6f7c5a4c4" dependencies = [ "winnow", ] [[package]] name = "tracing" -version = "0.1.41" +version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" dependencies = [ "pin-project-lite", "tracing-attributes", @@ -3965,9 +4079,9 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.30" +version = "0.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903" +checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" dependencies = [ "proc-macro2", "quote", @@ -3976,9 +4090,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.34" +version = "0.1.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9d12581f227e93f094d3af2ae690a574abb8a2b9b7a96e7cfe9647b2b617678" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" dependencies = [ "once_cell", "valuable", @@ -4009,9 +4123,9 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.3.20" +version = "0.3.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2054a14f5307d601f88daf0553e1cbf472acc4f2c51afab632431cdcd72124d5" +checksum = "2f30143827ddab0d256fd843b7a66d164e9f271cfa0dde49142c5ca0ca291f1e" dependencies = [ "matchers", "nu-ansi-term", @@ -4071,9 +4185,9 @@ checksum = "5c1cb5db39152898a79168971543b1cb5020dff7fe43c8dc468b0885f5e29df5" [[package]] name = "unicode-ident" -version = "1.0.19" +version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f63a545481291138910575129486daeaf8ac54aee4387fe7906919f7830c7d9d" +checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" [[package]] name = "unicode-linebreak" @@ -4083,9 +4197,9 @@ checksum = "3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f" [[package]] name = "unicode-script" -version = "0.5.7" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb421b350c9aff471779e262955939f565ec18b86c15364e6bdf0d662ca7c1f" +checksum = "383ad40bb927465ec0ce7720e033cb4ca06912855fc35db31b5755d0de75b1ee" [[package]] name = "unicode-segmentation" @@ -4095,9 +4209,9 @@ checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" [[package]] name = "unicode-width" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a1a07cc7db3810833284e8d372ccdc6da29741639ecc70c9ec107df0fa6154c" +checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254" [[package]] name = "unicode-xid" @@ -4107,13 +4221,13 @@ checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" [[package]] name = "uuid" -version = "1.18.1" +version = "1.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f87b8aa10b915a06587d0dec516c282ff295b475d94abf425d62b57710070a2" +checksum = "b672338555252d43fd2240c714dc444b8c6fb0a5c5335e65a07bba7742735ddb" dependencies = [ - "getrandom", + "getrandom 0.4.1", "js-sys", - "serde", + "serde_core", "wasm-bindgen", ] @@ -4151,28 +4265,28 @@ dependencies = [ ] [[package]] -name = "wasi" -version = "0.14.7+wasi-0.2.4" +name = "wasip2" +version = "1.0.2+wasi-0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "883478de20367e224c0090af9cf5f9fa85bed63a95c1abf3afc5c083ebc06e8c" +checksum = "9517f9239f02c069db75e65f174b3da828fe5f5b945c4dd26bd25d89c03ebcf5" dependencies = [ - "wasip2", + "wit-bindgen", ] [[package]] -name = "wasip2" -version = "1.0.1+wasi-0.2.4" +name = "wasip3" +version = "0.4.0+wasi-0.3.0-rc-2026-01-06" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0562428422c63773dad2c345a1882263bbf4d65cf3f42e90921f787ef5ad58e7" +checksum = "5428f8bf88ea5ddc08faddef2ac4a67e390b88186c703ce6dbd955e1c145aca5" dependencies = [ "wit-bindgen", ] [[package]] name = "wasm-bindgen" -version = "0.2.108" +version = "0.2.110" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64024a30ec1e37399cf85a7ffefebdb72205ca1c972291c51512360d90bd8566" +checksum = "1de241cdc66a9d91bd84f097039eb140cdc6eec47e0cdbaf9d932a1dd6c35866" dependencies = [ "cfg-if", "once_cell", @@ -4183,9 +4297,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.58" +version = "0.4.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70a6e77fd0ae8029c9ea0063f87c46fde723e7d887703d74ad2616d792e51e6f" +checksum = "a42e96ea38f49b191e08a1bab66c7ffdba24b06f9995b39a9dd60222e5b6f1da" dependencies = [ "cfg-if", "futures-util", @@ -4197,9 +4311,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.108" +version = "0.2.110" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "008b239d9c740232e71bd39e8ef6429d27097518b6b30bdf9086833bd5b6d608" +checksum = "e12fdf6649048f2e3de6d7d5ff3ced779cdedee0e0baffd7dff5cdfa3abc8a52" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -4207,9 +4321,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.108" +version = "0.2.110" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5256bae2d58f54820e6490f9839c49780dff84c65aeab9e772f15d5f0e913a55" +checksum = "0e63d1795c565ac3462334c1e396fd46dbf481c40f51f5072c310717bc4fb309" dependencies = [ "bumpalo", "proc-macro2", @@ -4220,18 +4334,52 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.108" +version = "0.2.110" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f01b580c9ac74c8d8f0c0e4afb04eeef2acf145458e52c03845ee9cd23e3d12" +checksum = "e9f9cdac23a5ce71f6bf9f8824898a501e511892791ea2a0c6b8568c68b9cb53" dependencies = [ "unicode-ident", ] +[[package]] +name = "wasm-encoder" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "990065f2fe63003fe337b932cfb5e3b80e0b4d0f5ff650e6985b1048f62c8319" +dependencies = [ + "leb128fmt", + "wasmparser", +] + +[[package]] +name = "wasm-metadata" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb0e353e6a2fbdc176932bbaab493762eb1255a7900fe0fea1a2f96c296cc909" +dependencies = [ + "anyhow", + "indexmap", + "wasm-encoder", + "wasmparser", +] + +[[package]] +name = "wasmparser" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe" +dependencies = [ + "bitflags 2.11.0", + "hashbrown 0.15.5", + "indexmap", + "semver", +] + [[package]] name = "web-sys" -version = "0.3.85" +version = "0.3.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "312e32e551d92129218ea9a2452120f4aabc03529ef03e4d0d82fb2780608598" +checksum = "f2c7c5718134e770ee62af3b6b4a84518ec10101aad610c024b64d6ff29bb1ff" dependencies = [ "js-sys", "wasm-bindgen", @@ -4249,9 +4397,9 @@ dependencies = [ [[package]] name = "weezl" -version = "0.1.10" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a751b3277700db47d3e574514de2eced5e54dc8a5436a3bf7a0b248b2cee16f3" +checksum = "a28ac98ddc8b9274cb41bb4d9d4d5c425b6020c50c46f25559911905610b4a88" [[package]] name = "wgpu" @@ -4260,7 +4408,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfe68bac7cde125de7a731c3400723cadaaf1703795ad3f4805f187459cd7a77" dependencies = [ "arrayvec", - "bitflags 2.9.4", + "bitflags 2.11.0", "cfg-if", "cfg_aliases", "document-features", @@ -4286,7 +4434,7 @@ dependencies = [ "arrayvec", "bit-set", "bit-vec", - "bitflags 2.9.4", + "bitflags 2.11.0", "bytemuck", "cfg_aliases", "document-features", @@ -4301,7 +4449,7 @@ dependencies = [ "raw-window-handle", "rustc-hash", "smallvec", - "thiserror 2.0.17", + "thiserror 2.0.18", "wgpu-core-deps-apple", "wgpu-core-deps-windows-linux-android", "wgpu-hal", @@ -4336,7 +4484,7 @@ dependencies = [ "arrayvec", "ash", "bit-set", - "bitflags 2.9.4", + "bitflags 2.11.0", "block", "bytemuck", "cfg-if", @@ -4362,7 +4510,7 @@ dependencies = [ "raw-window-handle", "renderdoc-sys", "smallvec", - "thiserror 2.0.17", + "thiserror 2.0.18", "wgpu-types", "windows 0.58.0", "windows-core 0.58.0", @@ -4374,12 +4522,12 @@ version = "27.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "afdcf84c395990db737f2dd91628706cb31e86d72e53482320d368e52b5da5eb" dependencies = [ - "bitflags 2.9.4", + "bitflags 2.11.0", "bytemuck", "js-sys", "log", "serde", - "thiserror 2.0.17", + "thiserror 2.0.18", "web-sys", ] @@ -4389,7 +4537,7 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys 0.61.1", + "windows-sys 0.61.2", ] [[package]] @@ -4443,8 +4591,8 @@ version = "0.61.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" dependencies = [ - "windows-implement 0.60.1", - "windows-interface 0.59.2", + "windows-implement 0.60.2", + "windows-interface 0.59.3", "windows-link 0.1.3", "windows-result 0.3.4", "windows-strings 0.4.2", @@ -4474,9 +4622,9 @@ dependencies = [ [[package]] name = "windows-implement" -version = "0.60.1" +version = "0.60.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edb307e42a74fb6de9bf3a02d9712678b22399c87e6fa869d6dfcd8c1b7754e0" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" dependencies = [ "proc-macro2", "quote", @@ -4496,9 +4644,9 @@ dependencies = [ [[package]] name = "windows-interface" -version = "0.59.2" +version = "0.59.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0abd1ddbc6964ac14db11c7213d6532ef34bd9aa042c2e5935f59d7908b46a5" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" dependencies = [ "proc-macro2", "quote", @@ -4513,9 +4661,9 @@ checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" [[package]] name = "windows-link" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45e46c0661abb7180e7b9c281db115305d49ca1709ab8242adf09666d2173c65" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" [[package]] name = "windows-numerics" @@ -4597,16 +4745,16 @@ version = "0.60.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" dependencies = [ - "windows-targets 0.53.4", + "windows-targets 0.53.5", ] [[package]] name = "windows-sys" -version = "0.61.1" +version = "0.61.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f109e41dd4a3c848907eb83d5a42ea98b3769495597450cf6d153507b166f0f" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" dependencies = [ - "windows-link 0.2.0", + "windows-link 0.2.1", ] [[package]] @@ -4642,19 +4790,19 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.53.4" +version = "0.53.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d42b7b7f66d2a06854650af09cfdf8713e427a439c97ad65a6375318033ac4b" +checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3" dependencies = [ - "windows-link 0.2.0", - "windows_aarch64_gnullvm 0.53.0", - "windows_aarch64_msvc 0.53.0", - "windows_i686_gnu 0.53.0", - "windows_i686_gnullvm 0.53.0", - "windows_i686_msvc 0.53.0", - "windows_x86_64_gnu 0.53.0", - "windows_x86_64_gnullvm 0.53.0", - "windows_x86_64_msvc 0.53.0", + "windows-link 0.2.1", + "windows_aarch64_gnullvm 0.53.1", + "windows_aarch64_msvc 0.53.1", + "windows_i686_gnu 0.53.1", + "windows_i686_gnullvm 0.53.1", + "windows_i686_msvc 0.53.1", + "windows_x86_64_gnu 0.53.1", + "windows_x86_64_gnullvm 0.53.1", + "windows_x86_64_msvc 0.53.1", ] [[package]] @@ -4680,9 +4828,9 @@ checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" [[package]] name = "windows_aarch64_gnullvm" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764" +checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53" [[package]] name = "windows_aarch64_msvc" @@ -4698,9 +4846,9 @@ checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" [[package]] name = "windows_aarch64_msvc" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c" +checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006" [[package]] name = "windows_i686_gnu" @@ -4716,9 +4864,9 @@ checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" [[package]] name = "windows_i686_gnu" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3" +checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3" [[package]] name = "windows_i686_gnullvm" @@ -4728,9 +4876,9 @@ checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" [[package]] name = "windows_i686_gnullvm" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11" +checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c" [[package]] name = "windows_i686_msvc" @@ -4746,9 +4894,9 @@ checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" [[package]] name = "windows_i686_msvc" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d" +checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2" [[package]] name = "windows_x86_64_gnu" @@ -4764,9 +4912,9 @@ checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" [[package]] name = "windows_x86_64_gnu" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba" +checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499" [[package]] name = "windows_x86_64_gnullvm" @@ -4782,9 +4930,9 @@ checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" [[package]] name = "windows_x86_64_gnullvm" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57" +checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1" [[package]] name = "windows_x86_64_msvc" @@ -4800,9 +4948,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "windows_x86_64_msvc" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486" +checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" [[package]] name = "winit" @@ -4812,8 +4960,8 @@ checksum = "c66d4b9ed69c4009f6321f762d6e61ad8a2389cd431b97cb1e146812e9e6c732" dependencies = [ "android-activity", "atomic-waker", - "bitflags 2.9.4", - "block2", + "bitflags 2.11.0", + "block2 0.5.1", "bytemuck", "calloop", "cfg_aliases", @@ -4850,18 +4998,100 @@ dependencies = [ [[package]] name = "winnow" -version = "0.7.13" +version = "0.7.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21a0236b59786fed61e2a80582dd500fe61f18b5dca67a4a067d0bc9039339cf" +checksum = "5a5364e9d77fcdeeaa6062ced926ee3381faa2ee02d3eb83a5c27a8825540829" dependencies = [ "memchr", ] [[package]] name = "wit-bindgen" -version = "0.46.0" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5" +dependencies = [ + "wit-bindgen-rust-macro", +] + +[[package]] +name = "wit-bindgen-core" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea61de684c3ea68cb082b7a88508a8b27fcc8b797d738bfc99a82facf1d752dc" +dependencies = [ + "anyhow", + "heck", + "wit-parser", +] + +[[package]] +name = "wit-bindgen-rust" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7c566e0f4b284dd6561c786d9cb0142da491f46a9fbed79ea69cdad5db17f21" +dependencies = [ + "anyhow", + "heck", + "indexmap", + "prettyplease", + "syn", + "wasm-metadata", + "wit-bindgen-core", + "wit-component", +] + +[[package]] +name = "wit-bindgen-rust-macro" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c0f9bfd77e6a48eccf51359e3ae77140a7f50b1e2ebfe62422d8afdaffab17a" +dependencies = [ + "anyhow", + "prettyplease", + "proc-macro2", + "quote", + "syn", + "wit-bindgen-core", + "wit-bindgen-rust", +] + +[[package]] +name = "wit-component" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d66ea20e9553b30172b5e831994e35fbde2d165325bec84fc43dbf6f4eb9cb2" +dependencies = [ + "anyhow", + "bitflags 2.11.0", + "indexmap", + "log", + "serde", + "serde_derive", + "serde_json", + "wasm-encoder", + "wasm-metadata", + "wasmparser", + "wit-parser", +] + +[[package]] +name = "wit-parser" +version = "0.244.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59" +checksum = "ecc8ac4bc1dc3381b7f59c34f00b67e18f910c2c0f50015669dde7def656a736" +dependencies = [ + "anyhow", + "id-arena", + "indexmap", + "log", + "semver", + "serde", + "serde_derive", + "serde_json", + "unicode-xid", + "wasmparser", +] [[package]] name = "x11-dl" @@ -4885,7 +5115,7 @@ dependencies = [ "libc", "libloading", "once_cell", - "rustix 1.1.2", + "rustix 1.1.3", "x11rb-protocol", ] @@ -4901,7 +5131,7 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d039de8032a9a8856a6be89cea3e5d12fdd82306ab7c94d74e6deab2460651c5" dependencies = [ - "bitflags 2.9.4", + "bitflags 2.11.0", "dlib", "log", "once_cell", @@ -4928,24 +5158,30 @@ checksum = "6df3dc4292935e51816d896edcd52aa30bc297907c26167fec31e2b0c6a32524" [[package]] name = "zerocopy" -version = "0.8.27" +version = "0.8.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0894878a5fa3edfd6da3f88c4805f4c8558e2b996227a3d864f47fe11e38282c" +checksum = "db6d35d663eadb6c932438e763b262fe1a70987f9ae936e60158176d710cae4a" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.8.27" +version = "0.8.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831" +checksum = "4122cd3169e94605190e77839c9a40d40ed048d305bfdc146e7df40ab0f3e517" dependencies = [ "proc-macro2", "quote", "syn", ] +[[package]] +name = "zmij" +version = "1.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa" + [[package]] name = "zune-core" version = "0.4.12" diff --git a/Cargo.toml b/Cargo.toml index 85cf410..94aeb45 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -171,3 +171,7 @@ required-features = [ [[example]] name = "delta_tweens" path = "examples/demo/delta_tweens.rs" + +[[example]] +name = "time_context_animation" +path = "examples/demo/time_context_animation.rs" diff --git a/examples/animation/banner_bounce.rs b/examples/animation/banner_bounce.rs index 3964852..0985f9f 100644 --- a/examples/animation/banner_bounce.rs +++ b/examples/animation/banner_bounce.rs @@ -1,15 +1,15 @@ use std::f32::consts::PI; +use bevy::render::view::Hdr; use bevy::{ - color::{palettes::css::WHITE, Srgba}, - core_pipeline::{tonemapping::Tonemapping}, + color::{Srgba, palettes::css::WHITE}, + core_pipeline::tonemapping::Tonemapping, post_process::bloom::Bloom, prelude::*, window, }; -use bevy::render::view::Hdr; use bevy_tween::{ - combinator::{go, parallel, sequence, tween_exact, AnimationCommands}, + combinator::{AnimationCommands, go, parallel, sequence, tween_exact}, prelude::*, }; @@ -35,7 +35,7 @@ fn main() { }), ..default() }), - DefaultTweenPlugins, + DefaultTweenPlugins::default(), )) .add_systems(Startup, (animation, setup_camera)) .run(); @@ -205,7 +205,8 @@ fn animation(mut commands: Commands, asset_server: Res) { // ======================================================================== let mut bevy_tween_text_color = bevy_tween_text.state(white_color); let mut bevy_tween_text_angle_z = bevy_tween_text.state(PI); - let mut bevy_tween_text_scale = bevy_tween_text.state(Vec3::ZERO * SCALE_AS_F32); + let mut bevy_tween_text_scale = + bevy_tween_text.state(Vec3::ZERO * SCALE_AS_F32); let mut square_and_triangle_scale = square_and_triangle.state(Vec3::ZERO * SCALE_AS_F32); let mut square_and_triangle_alpha = square_and_triangle.state(1.); @@ -219,7 +220,8 @@ fn animation(mut commands: Commands, asset_server: Res) { cornering_right.state(cornering_right_tween_start); let mut cornering_left_translation = cornering_left.state(cornering_left_tween_start); - let mut dot_grid_scale = dot_grid.state(Vec3::new(0.01, 0.01, 0.) * SCALE_AS_F32); + let mut dot_grid_scale = + dot_grid.state(Vec3::new(0.01, 0.01, 0.) * SCALE_AS_F32); fn secs(secs: f32) -> Duration { Duration::from_secs_f32(secs) @@ -240,18 +242,21 @@ fn animation(mut commands: Commands, asset_server: Res) { tween_exact( secs(0.)..secs(9.), EaseKind::CircularOut, - bevy_tween_text_scale.with(scale_to(Vec3::ONE * SCALE_AS_F32)), + bevy_tween_text_scale + .with(scale_to(Vec3::ONE * SCALE_AS_F32)), ), tween_exact( secs(11.)..secs(11.5), EaseKind::SineOut, - bevy_tween_text_scale - .with(scale_to(Vec3::ONE * text_pop_scale * SCALE_AS_F32)), + bevy_tween_text_scale.with(scale_to( + Vec3::ONE * text_pop_scale * SCALE_AS_F32, + )), ), tween_exact( secs(11.5)..secs(12.), EaseKind::SineIn, - bevy_tween_text_scale.with(scale_to(Vec3::ZERO * SCALE_AS_F32)), + bevy_tween_text_scale + .with(scale_to(Vec3::ZERO * SCALE_AS_F32)), ), tween_exact( secs(10.)..secs(12.), @@ -275,7 +280,8 @@ fn animation(mut commands: Commands, asset_server: Res) { tween_exact( secs(0.)..secs(9.), EaseKind::CircularOut, - square_and_triangle_scale.with(scale_to(Vec3::ONE * SCALE_AS_F32)), + square_and_triangle_scale + .with(scale_to(Vec3::ONE * SCALE_AS_F32)), ), tween_exact( secs(4.)..secs(10.), @@ -353,8 +359,9 @@ fn animation(mut commands: Commands, asset_server: Res) { tween_exact( secs(11.5)..secs(12.), EaseKind::QuadraticInOut, - dot_grid_scale - .with(scale_to(Vec3::new(0.01, 0.01, 0.) * SCALE_AS_F32)), + dot_grid_scale.with(scale_to( + Vec3::new(0.01, 0.01, 0.) * SCALE_AS_F32, + )), ), ), go(secs(12.)), @@ -363,9 +370,11 @@ fn animation(mut commands: Commands, asset_server: Res) { type InterpolateSpriteAlpha = Box>; fn sprite_alpha(start: f32, end: f32) -> InterpolateSpriteAlpha { - Box::new(interpolate::closure(move |sprite: &mut Sprite, value, _| { - sprite.color = sprite.color.with_alpha(start.lerp(end, value)); - })) + Box::new(interpolate::closure( + move |sprite: &mut Sprite, value, _| { + sprite.color = sprite.color.with_alpha(start.lerp(end, value)); + }, + )) } fn sprite_alpha_to(to: f32) -> impl Fn(&mut f32) -> InterpolateSpriteAlpha { diff --git a/examples/animation/banner_triangle.rs b/examples/animation/banner_triangle.rs index 5d5acdb..73a4924 100644 --- a/examples/animation/banner_triangle.rs +++ b/examples/animation/banner_triangle.rs @@ -1,12 +1,12 @@ -use std::f32::consts::TAU; use bevy::prelude::*; use bevy::window::WindowResolution; use bevy_tween::{ - combinator::{parallel, tween_exact, AnimationCommands}, + combinator::{AnimationCommands, parallel, tween_exact}, interpolate::{angle_z, translation}, prelude::*, tween::{AnimationTarget, TargetComponent}, }; +use std::f32::consts::TAU; fn main() { App::new() @@ -20,7 +20,7 @@ fn main() { }), ..Default::default() }), - DefaultTweenPlugins, + DefaultTweenPlugins::default(), )) .add_systems(Startup, setup) .run(); diff --git a/examples/animation/thumbnail_triangle.rs b/examples/animation/thumbnail_triangle.rs index 562c8e8..47b3091 100644 --- a/examples/animation/thumbnail_triangle.rs +++ b/examples/animation/thumbnail_triangle.rs @@ -2,7 +2,7 @@ use std::f32::consts::TAU; use bevy::prelude::*; use bevy_tween::{ - combinator::{parallel, tween_exact, AnimationCommands}, + combinator::{AnimationCommands, parallel, tween_exact}, interpolate::angle_z, prelude::*, tween::TargetComponent, @@ -10,7 +10,7 @@ use bevy_tween::{ fn main() { App::new() - .add_plugins((DefaultPlugins, DefaultTweenPlugins)) + .add_plugins((DefaultPlugins, DefaultTweenPlugins::default())) .add_systems(Startup, setup) .run(); } diff --git a/examples/bevy_lookup_curve.rs b/examples/bevy_lookup_curve.rs index bf55b28..4099461 100644 --- a/examples/bevy_lookup_curve.rs +++ b/examples/bevy_lookup_curve.rs @@ -2,8 +2,8 @@ use bevy::prelude::*; use bevy_inspector_egui::bevy_egui::EguiPlugin; use bevy_tween::{ bevy_lookup_curve::{ - editor::LookupCurveEditor, Knot, KnotInterpolation, LookupCurve, - LookupCurvePlugin, + Knot, KnotInterpolation, LookupCurve, LookupCurvePlugin, + editor::LookupCurveEditor, }, combinator::tween, interpolate::translation, @@ -16,7 +16,7 @@ fn main() { App::new() .add_plugins(( DefaultPlugins, - DefaultTweenPlugins, + DefaultTweenPlugins::default(), EguiPlugin::default(), LookupCurvePlugin, )) diff --git a/examples/demo/click.rs b/examples/demo/click.rs index 63bc19d..58fe3ee 100644 --- a/examples/demo/click.rs +++ b/examples/demo/click.rs @@ -14,7 +14,7 @@ fn secs(secs: f32) -> Duration { fn main() { App::new() - .add_plugins((DefaultPlugins, DefaultTweenPlugins)) + .add_plugins((DefaultPlugins, DefaultTweenPlugins::default())) .add_systems(Startup, setup) .add_systems( Update, @@ -40,46 +40,45 @@ fn click_spawn_circle( ) { use interpolate::sprite_color; let circle_filled_image = asset_server.load("circle_filled.png"); - if let Some(coord) = coord.0 { - if key.just_pressed(MouseButton::Left) - || key.pressed(MouseButton::Right) - { - let start = Vec3::new(coord.x, coord.y, 1.); - let end = Vec3::new(0., 0., 0.); - let transform = Transform::from_translation(start); - let circle = AnimationTarget.into_target(); - let mut circle_transform = circle.transform_state(transform); - commands - .spawn(( - Sprite { - image: circle_filled_image, - ..default() - }, - transform, - AnimationTarget, - )) - .animation() - .insert(parallel(( - tween( - secs(2.), - EaseKind::ExponentialOut, - circle_transform.translation_to(end), - ), - tween( - secs(1.), - EaseKind::BackIn, - circle_transform.scale_to(Vec3::ZERO), - ), - tween( - secs(1.), - EaseKind::Linear, - circle.with(sprite_color( - into_color(WHITE), - into_color(DEEP_PINK), - )), - ), - ))); - } + if let Some(coord) = coord.0 + && (key.just_pressed(MouseButton::Left) + || key.pressed(MouseButton::Right)) + { + let start = Vec3::new(coord.x, coord.y, 1.); + let end = Vec3::new(0., 0., 0.); + let transform = Transform::from_translation(start); + let circle = AnimationTarget.into_target(); + let mut circle_transform = circle.transform_state(transform); + commands + .spawn(( + Sprite { + image: circle_filled_image, + ..default() + }, + transform, + AnimationTarget, + )) + .animation() + .insert(parallel(( + tween( + secs(2.), + EaseKind::ExponentialOut, + circle_transform.translation_to(end), + ), + tween( + secs(1.), + EaseKind::BackIn, + circle_transform.scale_to(Vec3::ZERO), + ), + tween( + secs(1.), + EaseKind::Linear, + circle.with(sprite_color( + into_color(WHITE), + into_color(DEEP_PINK), + )), + ), + ))); } } diff --git a/examples/demo/delta_tweens.rs b/examples/demo/delta_tweens.rs index 9511080..00c61e3 100644 --- a/examples/demo/delta_tweens.rs +++ b/examples/demo/delta_tweens.rs @@ -1,14 +1,9 @@ -use std::time::Duration; -use bevy::{ - prelude::*, -}; use bevy::color::palettes::basic::WHITE; use bevy::color::palettes::css::{BLUE, RED}; -use bevy_tween::{ - combinator::*, prelude::*, - tween::AnimationTarget, -}; -use bevy_tween::interpolate::{sprite_color_delta_to}; +use bevy::prelude::*; +use bevy_tween::interpolate::sprite_color_delta_to; +use bevy_tween::{combinator::*, prelude::*, tween::AnimationTarget}; +use std::time::Duration; fn secs(secs: f32) -> Duration { Duration::from_secs_f32(secs) @@ -16,11 +11,8 @@ fn secs(secs: f32) -> Duration { fn main() { App::new() - .add_plugins((DefaultPlugins, DefaultTweenPlugins)) - .add_systems(Startup, ( - setup, - spawn_circle_with_tweens - )) + .add_plugins((DefaultPlugins, DefaultTweenPlugins::default())) + .add_systems(Startup, (setup, spawn_circle_with_tweens)) .run(); } @@ -41,17 +33,17 @@ fn spawn_circle_with_tweens( let mut circle_transform_state = circle.transform_state(circle_transform); let mut circle_sprite_state = circle.state(WHITE.into()); - let mut circle_commands = commands - .spawn(( - Sprite { - image: circle_filled_image, - ..default() - }, - circle_transform, - AnimationTarget, - )); + let mut circle_commands = commands.spawn(( + Sprite { + image: circle_filled_image, + ..default() + }, + circle_transform, + AnimationTarget, + )); - circle_commands.animation() + circle_commands + .animation() .repeat(Repeat::Infinitely) .repeat_style(RepeatStyle::PingPong) .insert(parallel(( @@ -70,10 +62,10 @@ fn spawn_circle_with_tweens( EaseKind::Linear, circle_sprite_state.with(sprite_color_delta_to(BLUE.into())), ), - tween( - float_duration, - EaseKind::CubicIn, - circle_sprite_state.with(sprite_color_delta_to(RED.into())), - ) + tween( + float_duration, + EaseKind::CubicIn, + circle_sprite_state.with(sprite_color_delta_to(RED.into())), + ), ))); -} \ No newline at end of file +} diff --git a/examples/demo/entity_event.rs b/examples/demo/entity_event.rs index f024cf2..0d350d2 100644 --- a/examples/demo/entity_event.rs +++ b/examples/demo/entity_event.rs @@ -7,7 +7,7 @@ use bevy_tween::{ fn main() { App::new() - .add_plugins((MinimalPlugins, DefaultTweenPlugins)) + .add_plugins((MinimalPlugins, DefaultTweenPlugins::default())) .add_systems(Startup, setup) .add_observer(|trigger: On>| { println!("TweenEvent: {}", trigger.data) diff --git a/examples/demo/event.rs b/examples/demo/event.rs index f41c5e8..4505cee 100644 --- a/examples/demo/event.rs +++ b/examples/demo/event.rs @@ -9,7 +9,7 @@ use bevy_tween::{ fn main() { App::new() - .add_plugins((DefaultPlugins, DefaultTweenPlugins)) + .add_plugins((DefaultPlugins, DefaultTweenPlugins::default())) .add_systems(Startup, setup) .add_systems(Update, (effect_system, despawn_effect_system)) .run(); diff --git a/examples/demo/follow.rs b/examples/demo/follow.rs index 03ee19d..ca6ce1f 100644 --- a/examples/demo/follow.rs +++ b/examples/demo/follow.rs @@ -20,7 +20,7 @@ fn main() { App::new() .add_plugins(( DefaultPlugins, - DefaultTweenPlugins, + DefaultTweenPlugins::default(), EguiPlugin::default(), ResourceInspectorPlugin::::new(), )) diff --git a/examples/demo/hold.rs b/examples/demo/hold.rs index d902f4e..bda3819 100644 --- a/examples/demo/hold.rs +++ b/examples/demo/hold.rs @@ -1,11 +1,11 @@ use std::f32::consts::PI; +use bevy::window::CursorIcon; use bevy::{ color::palettes::css::{DEEP_PINK, WHITE}, prelude::*, window::{PrimaryWindow, SystemCursorIcon}, }; -use bevy::window::CursorIcon; use bevy_tween::{bevy_time_runner::TimeRunner, prelude::*}; use rand::prelude::*; @@ -16,7 +16,10 @@ mod interpolate { pub use bevy_tween::interpolate::*; pub fn custom_interpolators_plugin(app: &mut App) { - app.add_tween_systems(resource_tween_system::()); + app.add_tween_systems( + PostUpdate, + resource_tween_system::(), + ); } pub struct EffectIntensity { @@ -27,7 +30,12 @@ mod interpolate { impl Interpolator for EffectIntensity { type Item = super::EffectIntensitiy; - fn interpolate(&self, item: &mut Self::Item, value: f32, _previous_value: f32) { + fn interpolate( + &self, + item: &mut Self::Item, + value: f32, + _previous_value: f32, + ) { item.0 = self.start.lerp(self.end, value) } } @@ -52,7 +60,7 @@ fn main() { App::new() .add_plugins(( DefaultPlugins, - DefaultTweenPlugins, + DefaultTweenPlugins::default(), interpolate::custom_interpolators_plugin, )) .add_systems(Startup, setup) diff --git a/examples/demo/sprite_sheet.rs b/examples/demo/sprite_sheet.rs index 7b56541..eb455db 100644 --- a/examples/demo/sprite_sheet.rs +++ b/examples/demo/sprite_sheet.rs @@ -5,10 +5,9 @@ mod interpolate { use bevy::prelude::*; use bevy_tween::prelude::*; - pub use bevy_tween::interpolate::*; - pub fn custom_interpolators_plugin(app: &mut App) { app.add_tween_systems( + PostUpdate, bevy_tween::component_tween_system::(), ); } @@ -25,7 +24,12 @@ mod interpolate { impl Interpolator for AtlasIndex { type Item = Sprite; - fn interpolate(&self, item: &mut Self::Item, value: f32, _previous_value: f32) { + fn interpolate( + &self, + item: &mut Self::Item, + value: f32, + _previous_value: f32, + ) { let Some(texture_atlas) = &mut item.texture_atlas else { return; }; @@ -40,7 +44,7 @@ fn main() { App::new() .add_plugins(( DefaultPlugins.set(ImagePlugin::default_nearest()), - DefaultTweenPlugins, + DefaultTweenPlugins::default(), interpolate::custom_interpolators_plugin, )) .add_systems(Startup, setup) diff --git a/examples/demo/time_context_animation.rs b/examples/demo/time_context_animation.rs new file mode 100644 index 0000000..99ac1e8 --- /dev/null +++ b/examples/demo/time_context_animation.rs @@ -0,0 +1,52 @@ +use bevy::prelude::*; +use bevy_tween::{combinator::*, prelude::*, tween::AnimationTarget}; +use std::time::Duration; + +fn secs(secs: f32) -> Duration { + Duration::from_secs_f32(secs) +} + +fn main() { + App::new() + .add_plugins(( + DefaultPlugins, + DefaultTweenPlugins::::in_schedule(FixedLast), + )) + .insert_resource(Time::::from_seconds(0.25)) + .add_systems(Startup, (setup, spawn_circle_with_tweens)) + .run(); +} + +fn setup(mut commands: Commands) { + commands.spawn(Camera2d); +} + +fn spawn_circle_with_tweens( + mut commands: Commands, + asset_server: Res, +) { + let circle_filled_image = asset_server.load("circle_filled.png"); + let float_duration = secs(4.0); + let circle_transform = Transform::from_translation(Vec3::Y * -200.0); + let circle = AnimationTarget.into_target(); + let mut circle_transform_state = circle.transform_state(circle_transform); + + let mut circle_commands = commands.spawn(( + Sprite { + image: circle_filled_image, + ..default() + }, + circle_transform, + AnimationTarget, + )); + + circle_commands + .animation_in_time_context::() + .repeat(Repeat::Infinitely) + .repeat_style(RepeatStyle::PingPong) + .insert(tween( + float_duration, + EaseKind::CircularIn, + circle_transform_state.translation_delta_by(Vec3::Y * 400.0), + )); +} diff --git a/examples/entity_structure.rs b/examples/entity_structure.rs index 4c3b1e9..1246ac1 100644 --- a/examples/entity_structure.rs +++ b/examples/entity_structure.rs @@ -1,5 +1,5 @@ use bevy::prelude::*; -use bevy_tween::interpolate::{translation, AngleZ, Translation}; +use bevy_tween::interpolate::{AngleZ, Translation, translation}; use bevy_tween::prelude::*; use bevy_tween::{ bevy_time_runner::{TimeRunner, TimeSpan}, @@ -8,7 +8,7 @@ use bevy_tween::{ fn main() { App::new() - .add_plugins((DefaultPlugins, DefaultTweenPlugins)) + .add_plugins((DefaultPlugins, DefaultTweenPlugins::default())) .add_systems(Startup, setup) .run(); } @@ -48,18 +48,19 @@ fn setup(mut commands: Commands) { sprite(start_x, y), AnimationTarget, TimeRunner::new(Duration::from_secs(5)), + TimeContext::<()>::default(), TimeSpan::try_from(..Duration::from_secs(5)).unwrap(), EaseKind::QuadraticInOut, ComponentTween::new_target( TargetComponent::marker(), - translation(Vec3::new(start_x, y, 0.), Vec3::new(end_x, y, 0.)) + translation(Vec3::new(start_x, y, 0.), Vec3::new(end_x, y, 0.)), ), ComponentTween::new_target( TargetComponent::marker(), AngleZ { start: angle_start, end: angle_end, - delta: false + delta: false, }, ), )); @@ -84,6 +85,7 @@ fn setup(mut commands: Commands) { sprite(start_x, y), AnimationTarget, TimeRunner::new(Duration::from_secs(5)), + TimeContext::<()>::default(), )) .with_children(|c| { c.spawn(( @@ -91,14 +93,17 @@ fn setup(mut commands: Commands) { EaseKind::QuadraticInOut, ComponentTween::new_target( TargetComponent::marker(), - translation(Vec3::new(start_x, y, 0.), Vec3::new(end_x, y, 0.)) + translation( + Vec3::new(start_x, y, 0.), + Vec3::new(end_x, y, 0.), + ), ), ComponentTween::new_target( TargetComponent::marker(), AngleZ { start: angle_start, end: angle_end, - delta: false + delta: false, }, ), )); @@ -124,18 +129,22 @@ fn setup(mut commands: Commands) { .with_children(|c| { c.spawn(( TimeRunner::new(Duration::from_secs(5)), + TimeContext::<()>::default(), TimeSpan::try_from(..Duration::from_secs(5)).unwrap(), EaseKind::QuadraticInOut, ComponentTween::new_target( TargetComponent::marker(), - translation(Vec3::new(start_x, y, 0.), Vec3::new(end_x, y, 0.)) + translation( + Vec3::new(start_x, y, 0.), + Vec3::new(end_x, y, 0.), + ), ), ComponentTween::new_target( TargetComponent::marker(), AngleZ { start: angle_start, end: angle_end, - delta: false + delta: false, }, ), )); @@ -160,29 +169,32 @@ fn setup(mut commands: Commands) { commands .spawn((sprite(start_x, y), AnimationTarget)) .with_children(|c| { - c.spawn(TimeRunner::new(Duration::from_secs(5))) - .with_children(|c| { - c.spawn(( - TimeSpan::try_from(..Duration::from_secs(5)).unwrap(), - EaseKind::QuadraticInOut, - ComponentTween::new_target( - TargetComponent::marker(), - Translation { - start: Vec3::new(start_x, y, 0.), - end: Vec3::new(end_x, y, 0.), - delta: false - }, - ), - ComponentTween::new_target( - TargetComponent::marker(), - AngleZ { - start: angle_start, - end: angle_end, - delta: false - }, - ), - )); - }); + c.spawn(( + TimeRunner::new(Duration::from_secs(5)), + TimeContext::<()>::default(), + )) + .with_children(|c| { + c.spawn(( + TimeSpan::try_from(..Duration::from_secs(5)).unwrap(), + EaseKind::QuadraticInOut, + ComponentTween::new_target( + TargetComponent::marker(), + Translation { + start: Vec3::new(start_x, y, 0.), + end: Vec3::new(end_x, y, 0.), + delta: false, + }, + ), + ComponentTween::new_target( + TargetComponent::marker(), + AngleZ { + start: angle_start, + end: angle_end, + delta: false, + }, + ), + )); + }); }); // equivalent to // @@ -205,21 +217,27 @@ fn setup(mut commands: Commands) { let sprite = commands.spawn(sprite(start_x, y)).id(); commands - .spawn(TimeRunner::new(Duration::from_secs(5))) + .spawn(( + TimeRunner::new(Duration::from_secs(5)), + TimeContext::<()>::default(), + )) .with_children(|c| { c.spawn(( TimeSpan::try_from(..Duration::from_secs(5)).unwrap(), EaseKind::QuadraticInOut, ComponentTween::new_target( sprite, - translation(Vec3::new(start_x, y, 0.), Vec3::new(end_x, y, 0.)) + translation( + Vec3::new(start_x, y, 0.), + Vec3::new(end_x, y, 0.), + ), ), ComponentTween::new_target( sprite, AngleZ { start: angle_start, end: angle_end, - delta: false + delta: false, }, ), )); diff --git a/examples/interpolator.rs b/examples/interpolator.rs index 2db688d..e468897 100644 --- a/examples/interpolator.rs +++ b/examples/interpolator.rs @@ -19,11 +19,14 @@ mod interpolate { }; pub fn interpolators_plugin(app: &mut App) { - app.add_tween_systems(( - component_dyn_tween_system::(), - component_tween_system::(), - component_tween_system::(), - )); + app.add_tween_systems( + PostUpdate, + ( + component_dyn_tween_system::(), + component_tween_system::(), + component_tween_system::(), + ), + ); } pub struct CircleRadius { @@ -34,7 +37,12 @@ mod interpolate { impl Interpolator for CircleRadius { type Item = Circle; - fn interpolate(&self, item: &mut Self::Item, value: f32, _previous_value: f32) { + fn interpolate( + &self, + item: &mut Self::Item, + value: f32, + _previous_value: f32, + ) { item.radius = self.start.lerp(self.end, value); } } @@ -51,7 +59,12 @@ mod interpolate { impl Interpolator for CircleHue { type Item = Circle; - fn interpolate(&self, item: &mut Self::Item, value: f32, _previous_value: f32) { + fn interpolate( + &self, + item: &mut Self::Item, + value: f32, + _previous_value: f32, + ) { item.hue = self.start.lerp(self.end, value); } } @@ -66,7 +79,7 @@ fn main() { App::new() .add_plugins(( MinimalPlugins, - DefaultTweenPlugins, + DefaultTweenPlugins::default(), interpolate::interpolators_plugin, )) .add_systems(Startup, setup) diff --git a/src/combinator.rs b/src/combinator.rs index 5588820..8a2a718 100644 --- a/src/combinator.rs +++ b/src/combinator.rs @@ -1,295 +1,353 @@ -//! Combinator framework - -use std::time::Duration; - -use bevy::{ecs::system::EntityCommands, prelude::*}; -use bevy_time_runner::{ - Repeat, RepeatStyle, SkipTimeRunner, TimeDirection, TimeRunner, TimeSpan, -}; - -mod animation_combinators; -mod state; -pub use animation_combinators::*; -pub use state::{TargetState, TransformTargetState, TransformTargetStateExt}; - -/// Commands to use within an animation combinator -pub struct AnimationCommands<'r, 'a> { - child_builder: &'r mut ChildSpawnerCommands<'a>, -} - -impl<'r, 'a> AnimationCommands<'r, 'a> { - pub(crate) fn new( - child_builder: &'r mut ChildSpawnerCommands<'a>, - ) -> AnimationCommands<'r, 'a> { - AnimationCommands { child_builder } - } - - /// Spawn an entity as a child. - /// Currently always spawn as a child of animation root that should contains [`bevy_time_runner::TimeRunner`]. - pub fn spawn(&mut self, bundle: impl Bundle) -> EntityCommands<'_> { - self.child_builder.spawn(bundle) - } -} - -/// Extension trait for types that can be used to make an animation. -pub trait AnimationBuilderExt { - /// Construct [`AnimationBuilder`] from [`Self`] - fn animation(&mut self) -> AnimationBuilder<'_>; -} - -impl AnimationBuilderExt for EntityCommands<'_> { - /// Construct [`AnimationBuilder`] from [`EntityCommands`]. - /// Use this entity as the animator. - /// Tweens will be spawned as children of this entity. - fn animation(&mut self) -> AnimationBuilder<'_> { - AnimationBuilder::new(self.reborrow()) - } -} - -impl AnimationBuilderExt for Commands<'_, '_> { - /// Construct [`AnimationBuilder`] from [`Commands`]. - /// This will automatically spawn an entity as the animator. - fn animation(&mut self) -> AnimationBuilder<'_> { - AnimationBuilder::new(self.spawn_empty()) - } -} - -impl AnimationBuilderExt for ChildSpawnerCommands<'_> { - /// Construct [`AnimationBuilder`] from [`ChildSpawnerCommands`]. - /// This will automatically spawn a child entity as the animator. - fn animation(&mut self) -> AnimationBuilder<'_> { - AnimationBuilder::new(self.spawn_empty()) - } -} - -/// Configure [`TimeRunner`] through a builder API and add animation entities -pub struct AnimationBuilder<'a> { - entity_commands: EntityCommands<'a>, - time_runner: Option, - custom_length: Option, - skipped: bool, -} -impl<'a> AnimationBuilder<'a> { - /// Create new [`AnimationBuilder`] - pub fn new(entity_commands: EntityCommands<'a>) -> AnimationBuilder<'a> { - AnimationBuilder { - entity_commands, - time_runner: None, - custom_length: None, - skipped: false, - } - } - - /// Get the inner [`EntityCommands`] - pub fn entity_commands(&mut self) -> &mut EntityCommands<'a> { - &mut self.entity_commands - } - - /// Get the inner building [`TimeRunner`] - pub fn time_runner(&self) -> &Option { - &self.time_runner - } - - /// Get the inner building [`TimeRunner`] mutably - pub fn time_runner_mut(&mut self) -> &mut Option { - &mut self.time_runner - } - - /// Configure [`TimeRunner`]'s [`Repeat`] - pub fn repeat(mut self, repeat: Repeat) -> Self { - let time_runner = self.time_runner_or_default(); - match TimeRunner::repeat(time_runner) { - Some((_, repeat_style)) => { - time_runner.set_repeat(Some((repeat, repeat_style))); - } - None => { - time_runner.set_repeat(Some((repeat, RepeatStyle::default()))); - } - } - self - } - - /// Configure [`TimeRunner`]'s [`RepeatStyle`] - pub fn repeat_style(mut self, repeat_style: RepeatStyle) -> Self { - let time_runner = self.time_runner_or_default(); - match TimeRunner::repeat(time_runner) { - Some((repeat, _)) => { - time_runner.set_repeat(Some((repeat, repeat_style))); - } - None => { - time_runner - .set_repeat(Some((Repeat::Infinitely, repeat_style))); - } - } - self - } - - /// Configure [`TimeRunner`]'s `paused`. Note that pausing only pauses the timer - /// but not the animation it self. - pub fn paused(mut self, paused: bool) -> Self { - self.time_runner_or_default().set_paused(paused); - self - } - - /// Skip [`TimeRunner`] from inserting [`TimeSpanProgress`](bevy_time_runner::TimeSpanProgress) which is a signal - /// for an animation entity to execute animation code. - pub fn skipped(mut self, skipped: bool) -> Self { - self.skipped = skipped; - self - } - - /// [`Self::paused`] and [`Self::skipped`] - pub fn disabled(self, disabled: bool) -> Self { - self.paused(disabled).skipped(disabled) - } - - /// Use custom duration instead of determined by [`insert`](Self::insert). - pub fn length(mut self, duration: Duration) -> Self { - self.custom_length = Some(duration); - self - } - - /// Configure [`TimeRunner`]'s time scale to adjust animation speed. - /// Negative scale cause animation play in the opposite of [`TimeDirection`] and - /// [`Repeat`] counter will tick backward. - pub fn time_scale(mut self, scale: f32) -> Self { - self.time_runner_or_default().set_time_scale(scale); - self - } - - /// Configure [`TimeRunner`]'s direction to play animation backward or forward. - pub fn direction(mut self, direction: TimeDirection) -> Self { - self.time_runner_or_default().set_direction(direction); - self - } - - fn time_runner_or_default(&mut self) -> &mut TimeRunner { - self.time_runner.get_or_insert_with(TimeRunner::default) - } - - /// Add animations from a closure. Animation entities will be subjected - /// as a children of this entity. - /// [`TimeRunner`]'s length is determined by last `&mut Duration` value unless use - /// [`Self::length`]. - /// It's also possible to use combinator like [`go`], [`forward`], and [`backward`] - /// as the last combinator to customize the length. - pub fn insert(self, animation: F) -> EntityCommands<'a> - where - F: FnOnce(&mut AnimationCommands, &mut Duration), - { - let AnimationBuilder { - mut entity_commands, - time_runner, - custom_length, - skipped, - } = self; - let mut dur = Duration::ZERO; - entity_commands.with_children(|c| { - let mut a = AnimationCommands::new(c); - animation(&mut a, &mut dur); - }); - let mut time_runner = time_runner.unwrap_or_default(); - match custom_length { - Some(length) => { - time_runner.set_length(length); - } - None => { - time_runner.set_length(dur); - } - } - entity_commands.insert(time_runner); - if skipped { - entity_commands.insert(SkipTimeRunner); - } - entity_commands - } - - /// Insert tween components directly to this entity. - /// Can be used to create a simple animation quickly. - /// [`TimeRunner`]'s length is determined by provided `duration` unless use - /// [`Self::length`] - pub fn insert_tween_here( - self, - duration: Duration, - interpolation: I, - tweens: T, - ) -> EntityCommands<'a> - where - I: Bundle, - T: Bundle, - { - let AnimationBuilder { - mut entity_commands, - time_runner, - custom_length, - skipped, - } = self; - let mut time_runner = time_runner.unwrap_or_default(); - match custom_length { - Some(length) => { - time_runner.set_length(length); - } - None => { - time_runner.set_length(duration); - } - } - - entity_commands.insert(( - TimeSpan::try_from(Duration::ZERO..duration).unwrap(), - interpolation, - tweens, - time_runner, - )); - if skipped { - entity_commands.insert(SkipTimeRunner); - } - entity_commands - } - - /// Insert tween components directly to this entity. - /// Can be used to create a simple animation quickly. - /// [`TimeRunner`]'s length is determined by provided `duration` unless use - /// [`Self::length`] - /// - /// # Note - /// - /// If the entity does not exist when this command is executed, - /// the resulting error will be ignored. - pub fn try_insert_tween_here( - self, - duration: Duration, - interpolation: I, - tweens: T, - ) -> EntityCommands<'a> - where - I: Bundle, - T: Bundle, - { - let AnimationBuilder { - mut entity_commands, - time_runner, - custom_length, - skipped, - } = self; - let mut time_runner = time_runner.unwrap_or_default(); - match custom_length { - Some(length) => { - time_runner.set_length(length); - } - None => { - time_runner.set_length(duration); - } - } - - entity_commands.try_insert(( - TimeSpan::try_from(Duration::ZERO..duration).unwrap(), - interpolation, - tweens, - time_runner, - )); - if skipped { - entity_commands.try_insert(SkipTimeRunner); - } - entity_commands - } -} +//! Combinator framework + +use std::time::Duration; + +use bevy::{ecs::system::EntityCommands, prelude::*}; +use bevy_time_runner::{ + Repeat, RepeatStyle, SkipTimeRunner, TimeContext, TimeDirection, + TimeRunner, TimeSpan, +}; + +mod animation_combinators; +mod state; +pub use animation_combinators::*; +pub use state::{TargetState, TransformTargetState, TransformTargetStateExt}; + +/// Commands to use within an animation combinator +pub struct AnimationCommands<'r, 'a> { + child_builder: &'r mut ChildSpawnerCommands<'a>, +} + +impl<'r, 'a> AnimationCommands<'r, 'a> { + pub(crate) fn new( + child_builder: &'r mut ChildSpawnerCommands<'a>, + ) -> AnimationCommands<'r, 'a> { + AnimationCommands { child_builder } + } + + /// Spawn an entity as a child. + /// Currently always spawn as a child of animation root that should contains [`bevy_time_runner::TimeRunner`]. + pub fn spawn(&mut self, bundle: impl Bundle) -> EntityCommands<'_> { + self.child_builder.spawn(bundle) + } +} + +/// Extension trait for types that can be used to make an animation. +pub trait AnimationBuilderExt { + /// Construct [`AnimationBuilder`] from [`Self`] + fn animation(&mut self) -> AnimationBuilder<'_>; + + /// Construct [`AnimationBuilder`] from [`Self`] within the specified time context. + fn animation_in_time_context( + &mut self, + ) -> AnimationBuilder<'_, TimeCtx> + where + TimeCtx: Default + Send + Sync + 'static; +} + +impl AnimationBuilderExt for EntityCommands<'_> { + /// Construct [`AnimationBuilder`] from [`EntityCommands`]. + /// Use this entity as the animator. + /// Tweens will be spawned as children of this entity. + fn animation(&mut self) -> AnimationBuilder<'_> { + self.animation_in_time_context() + } + + /// Construct [`AnimationBuilder`] from [`EntityCommands`]. + /// Use this entity as the animator. + /// Tweens will be spawned as children of this entity and only runs within the specified time context. + fn animation_in_time_context( + &mut self, + ) -> AnimationBuilder<'_, TimeCtx> + where + TimeCtx: Default + Send + Sync + 'static, + { + AnimationBuilder::new(self.reborrow()) + } +} + +impl AnimationBuilderExt for Commands<'_, '_> { + /// Construct [`AnimationBuilder`] from [`Commands`]. + /// This will automatically spawn an entity as the animator. + fn animation(&mut self) -> AnimationBuilder<'_> { + self.animation_in_time_context() + } + + /// Construct [`AnimationBuilder`] from [`Commands`]. + /// This will automatically spawn an entity as the animator and only runs within the specified time context. + fn animation_in_time_context( + &mut self, + ) -> AnimationBuilder<'_, TimeCtx> + where + TimeCtx: Default + Send + Sync + 'static, + { + AnimationBuilder::new(self.spawn_empty()) + } +} + +impl AnimationBuilderExt for ChildSpawnerCommands<'_> { + /// Construct [`AnimationBuilder`] from [`ChildSpawnerCommands`]. + /// This will automatically spawn a child entity as the animator. + fn animation(&mut self) -> AnimationBuilder<'_> { + self.animation_in_time_context() + } + + /// Construct [`AnimationBuilder`] from [`ChildSpawnerCommands`]. + /// This will automatically spawn a child entity as the animator and only runs within the specified time context. + fn animation_in_time_context( + &mut self, + ) -> AnimationBuilder<'_, TimeCtx> + where + TimeCtx: Default + Send + Sync + 'static, + { + AnimationBuilder::new(self.spawn_empty()) + } +} + +/// Configure [`TimeRunner`] through a builder API and add animation entities +pub struct AnimationBuilder<'a, TimeCtx = ()> +where + TimeCtx: Default + Send + Sync + 'static, +{ + entity_commands: EntityCommands<'a>, + time_runner: Option, + time_context_marker: Option>, + custom_length: Option, + skipped: bool, +} +impl<'a, TimeCtx> AnimationBuilder<'a, TimeCtx> +where + TimeCtx: Default + Send + Sync + 'static, +{ + /// Create new [`AnimationBuilder`] + pub fn new( + entity_commands: EntityCommands<'a>, + ) -> AnimationBuilder<'a, TimeCtx> { + AnimationBuilder { + entity_commands, + time_runner: None, + time_context_marker: None, + custom_length: None, + skipped: false, + } + } + + /// Get the inner [`EntityCommands`] + pub fn entity_commands(&mut self) -> &mut EntityCommands<'a> { + &mut self.entity_commands + } + + /// Get the inner building [`TimeRunner`] + pub fn time_runner(&self) -> &Option { + &self.time_runner + } + + /// Get the inner building [`TimeRunner`] mutably + pub fn time_runner_mut(&mut self) -> &mut Option { + &mut self.time_runner + } + + /// Configure [`TimeRunner`]'s [`Repeat`] + pub fn repeat(mut self, repeat: Repeat) -> Self { + let time_runner = self.time_runner_or_default(); + match TimeRunner::repeat(time_runner) { + Some((_, repeat_style)) => { + time_runner.set_repeat(Some((repeat, repeat_style))); + } + None => { + time_runner.set_repeat(Some((repeat, RepeatStyle::default()))); + } + } + self + } + + /// Configure [`TimeRunner`]'s [`RepeatStyle`] + pub fn repeat_style(mut self, repeat_style: RepeatStyle) -> Self { + let time_runner = self.time_runner_or_default(); + match TimeRunner::repeat(time_runner) { + Some((repeat, _)) => { + time_runner.set_repeat(Some((repeat, repeat_style))); + } + None => { + time_runner + .set_repeat(Some((Repeat::Infinitely, repeat_style))); + } + } + self + } + + /// Configure [`TimeRunner`]'s `paused`. Note that pausing only pauses the timer + /// but not the animation it self. + pub fn paused(mut self, paused: bool) -> Self { + self.time_runner_or_default().set_paused(paused); + self + } + + /// Skip [`TimeRunner`] from inserting [`TimeSpanProgress`](bevy_time_runner::TimeSpanProgress) which is a signal + /// for an animation entity to execute animation code. + pub fn skipped(mut self, skipped: bool) -> Self { + self.skipped = skipped; + self + } + + /// [`Self::paused`] and [`Self::skipped`] + pub fn disabled(self, disabled: bool) -> Self { + self.paused(disabled).skipped(disabled) + } + + /// Use custom duration instead of determined by [`insert`](Self::insert). + pub fn length(mut self, duration: Duration) -> Self { + self.custom_length = Some(duration); + self + } + + /// Configure [`TimeRunner`]'s time scale to adjust animation speed. + /// Negative scale cause animation play in the opposite of [`TimeDirection`] and + /// [`Repeat`] counter will tick backward. + pub fn time_scale(mut self, scale: f32) -> Self { + self.time_runner_or_default().set_time_scale(scale); + self + } + + /// Configure [`TimeRunner`]'s direction to play animation backward or forward. + pub fn direction(mut self, direction: TimeDirection) -> Self { + self.time_runner_or_default().set_direction(direction); + self + } + + fn time_runner_or_default(&mut self) -> &mut TimeRunner { + self.time_runner.get_or_insert_with(TimeRunner::default) + } + + /// Add animations from a closure. Animation entities will be subjected + /// as a children of this entity. + /// [`TimeRunner`]'s length is determined by last `&mut Duration` value unless use + /// [`Self::length`]. + /// It's also possible to use combinator like [`go`], [`forward`], and [`backward`] + /// as the last combinator to customize the length. + pub fn insert(self, animation: F) -> EntityCommands<'a> + where + F: FnOnce(&mut AnimationCommands, &mut Duration), + { + let AnimationBuilder { + mut entity_commands, + time_runner, + time_context_marker, + custom_length, + skipped, + } = self; + let mut dur = Duration::ZERO; + entity_commands.with_children(|c| { + let mut a = AnimationCommands::new(c); + animation(&mut a, &mut dur); + }); + let mut time_runner = time_runner.unwrap_or_default(); + match custom_length { + Some(length) => { + time_runner.set_length(length); + } + None => { + time_runner.set_length(dur); + } + } + entity_commands + .insert((time_runner, time_context_marker.unwrap_or_default())); + if skipped { + entity_commands.insert(SkipTimeRunner); + } + entity_commands + } + + /// Insert tween components directly to this entity. + /// Can be used to create a simple animation quickly. + /// [`TimeRunner`]'s length is determined by provided `duration` unless use + /// [`Self::length`] + pub fn insert_tween_here( + self, + duration: Duration, + interpolation: I, + tweens: T, + ) -> EntityCommands<'a> + where + I: Bundle, + T: Bundle, + { + let AnimationBuilder { + mut entity_commands, + time_runner, + time_context_marker, + custom_length, + skipped, + } = self; + let mut time_runner = time_runner.unwrap_or_default(); + match custom_length { + Some(length) => { + time_runner.set_length(length); + } + None => { + time_runner.set_length(duration); + } + } + + entity_commands.insert(( + TimeSpan::try_from(Duration::ZERO..duration).unwrap(), + interpolation, + tweens, + time_runner, + time_context_marker.unwrap_or_default(), + )); + if skipped { + entity_commands.insert(SkipTimeRunner); + } + entity_commands + } + + /// Insert tween components directly to this entity. + /// Can be used to create a simple animation quickly. + /// [`TimeRunner`]'s length is determined by provided `duration` unless use + /// [`Self::length`] + /// + /// # Note + /// + /// If the entity does not exist when this command is executed, + /// the resulting error will be ignored. + pub fn try_insert_tween_here( + self, + duration: Duration, + interpolation: I, + tweens: T, + ) -> EntityCommands<'a> + where + I: Bundle, + T: Bundle, + { + let AnimationBuilder { + mut entity_commands, + time_runner, + time_context_marker, + custom_length, + skipped, + } = self; + let mut time_runner = time_runner.unwrap_or_default(); + match custom_length { + Some(length) => { + time_runner.set_length(length); + } + None => { + time_runner.set_length(duration); + } + } + + entity_commands.try_insert(( + TimeSpan::try_from(Duration::ZERO..duration).unwrap(), + interpolation, + tweens, + time_runner, + time_context_marker.unwrap_or_default(), + )); + if skipped { + entity_commands.try_insert(SkipTimeRunner); + } + entity_commands + } +} diff --git a/src/interpolate.rs b/src/interpolate.rs index 84acf1d..70ee153 100644 --- a/src/interpolate.rs +++ b/src/interpolate.rs @@ -76,6 +76,8 @@ mod transform; #[cfg(feature = "bevy_ui")] mod ui; +use std::marker::PhantomData; + pub use transform::*; #[cfg(feature = "bevy_sprite")] @@ -84,7 +86,9 @@ pub use sprite::*; #[cfg(feature = "bevy_ui")] pub use ui::*; -use crate::{tween, BevyTweenRegisterSystems}; +use crate::{BevyTweenRegisterSystems, tween}; +use bevy::ecs::schedule::{InternedScheduleLabel, ScheduleLabel}; + use bevy::prelude::*; /// Alias for an `Interpolator` as a boxed trait object. @@ -95,7 +99,8 @@ pub type CurrentValue = f32; /// A marker type for the tweens previous value, for ease of closure readability pub type PreviousValue = f32; -type InterpolatorClosure = Box; +type InterpolatorClosure = + Box; /// Create boxed closure in order to be used with dynamic [`Interpolator`] pub fn closure(f: F) -> InterpolatorClosure @@ -120,7 +125,12 @@ pub trait Interpolator: Send + Sync + 'static { /// The value should be already sampled from an [`Interpolation`] /// /// [`Interpolation`]: crate::interpolation::Interpolation - fn interpolate(&self, item: &mut Self::Item, value: CurrentValue, previous_value: PreviousValue); + fn interpolate( + &self, + item: &mut Self::Item, + value: CurrentValue, + previous_value: PreviousValue, + ); } // /// Reflect [`Interpolator`] trait @@ -209,44 +219,103 @@ pub trait Interpolator: Send + Sync + 'static { /// - [`AngleZ`] /// - [`SpriteColor`] and [`ColorMaterial`] if `"bevy_sprite"` feature is enabled. /// - [`BackgroundColor`] and [`BorderColor`] if `"bevy_ui"` feature is enabled. -pub struct DefaultInterpolatorsPlugin; -impl Plugin for DefaultInterpolatorsPlugin { - /// # Panics - /// - /// Panics if [`TweenAppResource`] does not exist in world. - /// - /// [`TweenAppResource`]: crate::TweenAppResource +pub struct DefaultInterpolatorsPlugin +where + TimeCtx: Default + Send + Sync + 'static, +{ + /// Register all systems from this plugin to the specified schedule. + pub schedule: InternedScheduleLabel, + marker: PhantomData, +} + +impl Plugin for DefaultInterpolatorsPlugin +where + TimeCtx: Default + Send + Sync + 'static, +{ fn build(&self, app: &mut App) { - app.add_tween_systems(( - tween::component_tween_system::(), - tween::component_tween_system::(), - tween::component_tween_system::(), - tween::component_tween_system::(), - )) - .register_type::>() - .register_type::>() - .register_type::>() - .register_type::>(); + app.register_type::>() + .register_type::>() + .register_type::>() + .register_type::>(); #[cfg(feature = "bevy_sprite")] - app.add_tween_systems(( - tween::component_tween_system::(), - )) - .register_type::>(); + app.register_type::>(); #[cfg(feature = "bevy_ui")] - app.add_tween_systems(( - tween::component_tween_system::(), - tween::component_tween_system::(), - )) - .register_type::>() + app.register_type::>() .register_type::>(); #[cfg(all(feature = "bevy_sprite", feature = "bevy_asset",))] - app.add_tween_systems(( - tween::asset_tween_system::(), - )) - .register_type::>(); + app.register_type::>(); + + #[allow(deprecated)] + let schedule = app + .world() + .get_resource::() + .map(|a| a.schedule) + .unwrap_or(self.schedule); + + app.add_tween_systems( + schedule, + ( + tween::component_tween_system_with_time_context::(), + tween::component_tween_system_with_time_context::(), + tween::component_tween_system_with_time_context::(), + tween::component_tween_system_with_time_context::(), + ), + ); + + #[cfg(feature = "bevy_sprite")] + app.add_tween_systems( + schedule, + tween::component_tween_system_with_time_context::< + SpriteColor, + TimeCtx, + >(), + ); + + #[cfg(feature = "bevy_ui")] + app.add_tween_systems( + schedule, + ( + tween::component_tween_system_with_time_context::< + ui::BackgroundColor, + TimeCtx, + >(), + tween::component_tween_system_with_time_context::< + ui::BorderColor, + TimeCtx, + >(), + ), + ); + + #[cfg(all(feature = "bevy_sprite", feature = "bevy_asset",))] + app.add_tween_systems( + schedule, + tween::asset_tween_system::(), + ); + } +} + +impl DefaultInterpolatorsPlugin +where + TimeCtx: Default + Send + Sync + 'static, +{ + /// Register all systems from this plugin to the specified schedule. + pub fn in_schedule(schedule: impl ScheduleLabel) -> Self { + Self { + schedule: schedule.intern(), + marker: PhantomData, + } + } +} + +impl Default for DefaultInterpolatorsPlugin<()> { + fn default() -> Self { + Self { + schedule: PostUpdate.intern(), + marker: Default::default(), + } } } @@ -259,36 +328,88 @@ impl Plugin for DefaultInterpolatorsPlugin { /// - [`BackgroundColor`] and [`BorderColor`] components if `"bevy_ui"` feature is enabled. /// /// [`ColorMaterial`]: bevy::sprite_render::ColorMaterial -pub struct DefaultDynInterpolatorsPlugin; -impl Plugin for DefaultDynInterpolatorsPlugin { - /// # Panics - /// - /// Panics if [`TweenAppResource`] does not exist in world. - /// - /// [`TweenAppResource`]: crate::TweenAppResource +pub struct DefaultDynInterpolatorsPlugin +where + TimeCtx: Default + Send + Sync + 'static, +{ + /// Register all systems from this plugin to the specified schedule. + pub schedule: InternedScheduleLabel, + marker: PhantomData, +} + +impl Plugin for DefaultDynInterpolatorsPlugin +where + TimeCtx: Default + Send + Sync + 'static, +{ fn build(&self, app: &mut App) { - app.add_tween_systems(tween::component_tween_system::< - BoxedInterpolator, - >()); + #[allow(deprecated)] + let schedule = app + .world() + .get_resource::() + .map(|a| a.schedule) + .unwrap_or(self.schedule); + + app.add_tween_systems( + schedule, + tween::component_tween_system_with_time_context::< + BoxedInterpolator, + TimeCtx, + >(), + ); #[cfg(feature = "bevy_sprite")] - app.add_tween_systems(tween::component_tween_system::< - BoxedInterpolator, - >()); + app.add_tween_systems( + schedule, + tween::component_tween_system_with_time_context::< + BoxedInterpolator, + TimeCtx, + >(), + ); #[cfg(feature = "bevy_ui")] - app.add_tween_systems(( - tween::component_tween_system::< - BoxedInterpolator, - >(), - tween::component_tween_system::< - BoxedInterpolator, - >(), - )); + app.add_tween_systems( + schedule, + ( + tween::component_tween_system_with_time_context::< + BoxedInterpolator, + TimeCtx, + >(), + tween::component_tween_system_with_time_context::< + BoxedInterpolator, + TimeCtx, + >(), + ), + ); #[cfg(all(feature = "bevy_sprite", feature = "bevy_asset"))] - app.add_tween_systems(tween::asset_tween_system::< - BoxedInterpolator, - >()); + app.add_tween_systems( + schedule, + tween::asset_tween_system::< + BoxedInterpolator, + TimeCtx, + >(), + ); + } +} + +impl DefaultDynInterpolatorsPlugin +where + TimeCtx: Default + Send + Sync + 'static, +{ + /// Register all systems from this plugin to the specified schedule. + pub fn in_schedule(schedule: impl ScheduleLabel) -> Self { + Self { + schedule: schedule.intern(), + marker: PhantomData, + } + } +} + +impl Default for DefaultDynInterpolatorsPlugin<()> { + fn default() -> Self { + Self { + schedule: PostUpdate.intern(), + marker: Default::default(), + } } } diff --git a/src/interpolation.rs b/src/interpolation.rs index 0aff946..0cedd85 100644 --- a/src/interpolation.rs +++ b/src/interpolation.rs @@ -11,8 +11,11 @@ use bevy::math::curve::EaseFunction; use bevy::prelude::*; +use bevy_time_runner::TimeContext; +use std::marker::PhantomData; -use crate::{tween::TweenInterpolationValue, TweenSystemSet}; +use crate::{TweenSystemSet, tween::TweenInterpolationValue}; +use bevy::ecs::schedule::{InternedScheduleLabel, ScheduleLabel}; use bevy_time_runner::TimeSpanProgress; #[cfg(feature = "serde")] use serde::{Deserialize, Serialize}; @@ -31,25 +34,54 @@ pub trait Interpolation { } /// Plugin for [`EaseKind`] -pub struct EaseKindPlugin; +pub struct EaseKindPlugin +where + TimeCtx: Default + Send + Sync + 'static, +{ + /// Register all systems from this plugin to the specified schedule. + pub schedule: InternedScheduleLabel, + marker: PhantomData, +} -impl Plugin for EaseKindPlugin { - /// # Panics - /// - /// Panics if [`TweenAppResource`] does not exist in world. - /// - /// [`TweenAppResource`]: crate::TweenAppResource +impl EaseKindPlugin +where + TimeCtx: Default + Send + Sync + 'static, +{ + /// Register all systems from this plugin to the specified schedule. + pub fn in_schedule(schedule: impl ScheduleLabel) -> Self { + Self { + schedule: schedule.intern(), + marker: PhantomData, + } + } +} + +impl Plugin for EaseKindPlugin +where + TimeCtx: Default + Send + Sync + 'static, +{ fn build(&self, app: &mut App) { - let app_resource = app + #[allow(deprecated)] + let schedule = app .world() .get_resource::() - .expect("`TweenAppResource` to be is inserted to world"); + .map(|a| a.schedule) + .unwrap_or(self.schedule); + app.register_type::(); app.add_systems( - app_resource.schedule, - sample_interpolations_system:: + schedule, + sample_interpolations_system:: .in_set(TweenSystemSet::UpdateInterpolationValue), - ) - .register_type::(); + ); + } +} + +impl Default for EaseKindPlugin<()> { + fn default() -> Self { + Self { + schedule: PostUpdate.intern(), + marker: Default::default(), + } } } @@ -407,26 +439,56 @@ impl From for EaseKind { /// not with [`DefaultTweenPlugins`] to reduce unused system. /// /// [`DefaultTweenPlugins`]: crate::DefaultTweenPlugins -pub struct EaseClosurePlugin; -impl Plugin for EaseClosurePlugin { - /// # Panics - /// - /// Panics if [`TweenAppResource`] does not exist in world. - /// - /// [`TweenAppResource`]: crate::TweenAppResource +pub struct EaseClosurePlugin +where + TimeCtx: Default + Send + Sync + 'static, +{ + /// Register all systems from this plugin to the specified schedule. + pub schedule: InternedScheduleLabel, + marker: PhantomData, +} + +impl EaseClosurePlugin +where + TimeCtx: Default + Send + Sync + 'static, +{ + /// Register all systems from this plugin to the specified schedule. + pub fn in_schedule(schedule: impl ScheduleLabel) -> Self { + Self { + schedule: schedule.intern(), + marker: PhantomData, + } + } +} + +impl Plugin for EaseClosurePlugin +where + TimeCtx: Default + Send + Sync + 'static, +{ fn build(&self, app: &mut App) { - let app_resource = app + #[allow(deprecated)] + let schedule = app .world() .get_resource::() - .expect("`TweenAppResource` to be is inserted to world"); + .map(|a| a.schedule) + .unwrap_or(self.schedule); app.add_systems( - app_resource.schedule, - sample_interpolations_system:: + schedule, + sample_interpolations_system:: .in_set(TweenSystemSet::UpdateInterpolationValue), ); } } +impl Default for EaseClosurePlugin<()> { + fn default() -> Self { + Self { + schedule: PostUpdate.intern(), + marker: Default::default(), + } + } +} + /// Use a custom easing function via a closure. /// /// See [`EaseKind`]. @@ -456,15 +518,19 @@ impl Interpolation for EaseClosure { /// [`TimeSpanProgress`] component then insert [`TweenInterpolationValue`]. /// Remove [`TweenInterpolationValue`] if [`TimeSpanProgress`] is removed. #[allow(clippy::type_complexity)] -pub fn sample_interpolations_system( +pub fn sample_interpolations_system( mut commands: Commands, query: Query< (Entity, &I, &TimeSpanProgress), - Or<(Changed, Changed)>, + ( + Or<(Changed, Changed)>, + With>, + ), >, mut removed: RemovedComponents, ) where I: Interpolation + Component, + TimeCtx: Default + Send + Sync + 'static, { query.iter().for_each(|(entity, interpolator, progress)| { if progress.now_percentage.is_nan() { @@ -486,7 +552,7 @@ pub fn sample_interpolations_system( mod easing_functions { use core::f32::consts::{FRAC_PI_2, FRAC_PI_3, PI}; - use bevy::math::{ops, FloatPow}; + use bevy::math::{FloatPow, ops}; #[inline] pub(crate) fn linear(t: f32) -> f32 { diff --git a/src/interpolation/bevy_lookup_curve.rs b/src/interpolation/bevy_lookup_curve.rs index 0203f96..714f6cf 100644 --- a/src/interpolation/bevy_lookup_curve.rs +++ b/src/interpolation/bevy_lookup_curve.rs @@ -10,23 +10,47 @@ //! - [`sample_lookup_curve_system`] use super::*; +use crate::InternedScheduleLabel; use ::bevy_lookup_curve::{LookupCache, LookupCurve}; use bevy::platform::collections::HashSet; use tracing::error; -/// Use [`bevy_lookup_curve`](::bevy_lookup_curve) for interpolation. -pub struct BevyLookupCurveInterpolationPlugin; - -impl Plugin for BevyLookupCurveInterpolationPlugin { +/// Use [`bevy_lookup_curve`](::bevy_lookup_curve) for interpolation +pub struct BevyLookupCurveInterpolationPlugin +where + TimeCtx: Default + Send + Sync + 'static, +{ + /// Register all systems from this plugin to the specified schedule. + pub schedule: InternedScheduleLabel, + marker: PhantomData, +} +impl BevyLookupCurveInterpolationPlugin +where + TimeCtx: Default + Send + Sync + 'static, +{ + /// Register all systems from this plugin to the specified schedule. + pub fn in_schedule(schedule: impl ScheduleLabel) -> Self { + Self { + schedule: schedule.intern(), + marker: PhantomData, + } + } +} +impl Plugin for BevyLookupCurveInterpolationPlugin +where + TimeCtx: Default + Send + Sync + 'static, +{ fn build(&self, app: &mut App) { - let app_resource = app + #[allow(deprecated)] + let schedule = app .world() .get_resource::() - .expect("`TweenAppResource` to be inserted to world"); + .map(|a| a.schedule) + .unwrap_or(self.schedule); app.add_systems( - app_resource.schedule, + schedule, ( - sample_lookup_curve_system + sample_lookup_curve_system:: .in_set(TweenSystemSet::UpdateInterpolationValue), // sample_interpolations_mut_system:: // .in_set(TweenSystemSet::UpdateInterpolationValue), @@ -35,6 +59,15 @@ impl Plugin for BevyLookupCurveInterpolationPlugin { } } +impl Default for BevyLookupCurveInterpolationPlugin<()> { + fn default() -> Self { + Self { + schedule: PostUpdate.intern(), + marker: Default::default(), + } + } +} + /// Wrapper for [`LookupCache`] to make it a component #[derive(Clone, Debug, Component, Reflect)] #[reflect(Component)] @@ -46,7 +79,7 @@ pub struct LookupCurveHandle(pub Handle); /// Interpolation system for [`LookupCurveHandle`] #[allow(clippy::type_complexity)] -pub fn sample_lookup_curve_system( +pub fn sample_lookup_curve_system( mut commands: Commands, mut query: Query< ( @@ -55,12 +88,17 @@ pub fn sample_lookup_curve_system( Option<&mut LookupCurveCache>, &TimeSpanProgress, ), - Or<(Changed, Changed)>, + ( + Or<(Changed, Changed)>, + With>, + ), >, mut removed: RemovedComponents, lookup_curve: Res>, mut last_handle_error: Local>>, -) { +) where + TimeCtx: Default + Send + Sync + 'static, +{ let mut handle_error = HashSet::new(); query .iter_mut() diff --git a/src/lib.rs b/src/lib.rs index 8766802..2ba71cd 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -8,7 +8,7 @@ //! //! fn main() { //! App::default() -//! .add_plugins((DefaultPlugins, DefaultTweenPlugins)) +//! .add_plugins((DefaultPlugins, DefaultTweenPlugins::default())) //! .run(); //! } //! ``` @@ -361,6 +361,7 @@ use bevy::ecs::schedule::{InternedScheduleLabel, ScheduleLabel}; use bevy::ecs::system::ScheduleSystem; use bevy::{app::PluginGroupBuilder, prelude::*}; +use std::marker::PhantomData; mod utils; @@ -382,7 +383,9 @@ pub mod prelude { pub use crate::interpolate::{self, BoxedInterpolator, Interpolator}; pub use crate::interpolation::EaseKind; - pub use crate::bevy_time_runner::{Repeat, RepeatStyle, TimeDirection}; + pub use crate::bevy_time_runner::{ + Repeat, RepeatStyle, TimeContext, TimeDirection, + }; pub use crate::combinator::{AnimationBuilderExt, TransformTargetStateExt}; @@ -418,38 +421,102 @@ pub use tween::resource_tween_system; pub use tween_event::tween_event_system; /// Default plugins for using crate. -/// -/// Plugins: -/// - [`TweenCorePlugin`] -/// - [`interpolate::DefaultInterpolatorsPlugin`] -/// - [`interpolate::DefaultDynInterpolatorsPlugin`] -/// - [`interpolation::EaseKindPlugin`] -/// - [`tween_event::DefaultTweenEventPlugins`] -pub struct DefaultTweenPlugins; - -impl PluginGroup for DefaultTweenPlugins { +pub struct DefaultTweenPlugins +where + TimeCtx: Default + Send + Sync + 'static, +{ + /// Register all systems from this plugin to the specified schedule. + pub schedule: InternedScheduleLabel, + /// Enable debug information and warnings. + /// + /// This currently is passed to [`bevy_time_runner::TimeRunnerPlugin::enable_debug`] field. + pub enable_debug: bool, + /// A marker for the plugins time context + marker: PhantomData, +} + +impl PluginGroup for DefaultTweenPlugins +where + TimeCtx: Default + Send + Sync + 'static, +{ fn build(self) -> bevy::app::PluginGroupBuilder { - #[allow(clippy::let_and_return)] + let mut tween_core_plugin = + TweenCorePlugin::::in_schedule(self.schedule); + tween_core_plugin.enable_debug = self.enable_debug; let group = PluginGroupBuilder::start::() - .add(TweenCorePlugin::default()) - .add(interpolate::DefaultInterpolatorsPlugin) - .add(interpolate::DefaultDynInterpolatorsPlugin) - .add(interpolation::EaseKindPlugin) - .add_group(tween_event::DefaultTweenEventPlugins); + .add(tween_core_plugin) + .add_group(tween_event::DefaultTweenEventPlugins::::in_schedule( + self.schedule, + )) + .add( + interpolation::EaseKindPlugin::::in_schedule( + self.schedule, + ) + ) + .add( + interpolate::DefaultInterpolatorsPlugin::::in_schedule( + self.schedule, + ) + ) + .add( + interpolate::DefaultDynInterpolatorsPlugin::::in_schedule( + self.schedule, + ) + ) + .add( + SystemSetsRegistraitonPlugin { + schedule: self.schedule, + } + ); + #[cfg(feature = "bevy_lookup_curve")] - let group = group.add(interpolation::bevy_lookup_curve::BevyLookupCurveInterpolationPlugin); + let group = group.add(interpolation::bevy_lookup_curve::BevyLookupCurveInterpolationPlugin::::in_schedule(self.schedule)); + group } } +impl DefaultTweenPlugins +where + TimeCtx: Default + Send + Sync + 'static, +{ + /// Register all systems from this plugin to the specified schedule. + pub fn in_schedule(schedule: impl ScheduleLabel) -> Self { + Self { + marker: PhantomData, + schedule: schedule.intern(), + enable_debug: true, + } + } +} + +impl Default for DefaultTweenPlugins<()> { + fn default() -> Self { + Self { + schedule: PostUpdate.intern(), + enable_debug: true, + marker: PhantomData, + } + } +} + /// This resource will be used while initializing tween plugin and systems. /// [`BevyTweenRegisterSystems`] for example. -#[derive(Resource, Clone)] +#[derive(Clone)] +#[deprecated( + // TODO: since = "...", + note = "This resource became less practical after generic_time_context (#78) PR" +)] +#[doc(hidden)] pub struct TweenAppResource { /// Configured schedule for tween systems. pub schedule: InternedScheduleLabel, } +#[allow(deprecated)] +impl Resource for TweenAppResource {} + +#[allow(deprecated)] impl Default for TweenAppResource { fn default() -> Self { TweenAppResource { @@ -467,51 +534,85 @@ impl Default for TweenAppResource { /// /// [`UpdateInterpolationValue`]: [`TweenSystemSet::UpdateInterpolationValue`] /// [`ApplyTween`]: [`TweenSystemSet::ApplyTween`] -pub struct TweenCorePlugin { - /// See [`TweenAppResource`] - pub app_resource: TweenAppResource, +pub struct TweenCorePlugin +where + TimeCtx: Default + Send + Sync + 'static, +{ + /// The schedule to register the core time-runner plugin in + schedule: InternedScheduleLabel, /// Enable debug information and warnings. /// /// This currently is passed to [`bevy_time_runner::TimeRunnerPlugin::enable_debug`] field. pub enable_debug: bool, + /// A marker for the plugins time context + marker: PhantomData, } -impl Plugin for TweenCorePlugin { +impl Plugin for TweenCorePlugin +where + TimeCtx: Default + Send + Sync + 'static, +{ fn build(&self, app: &mut App) { if !app.is_plugin_added::() { - app.add_plugins(bevy_time_runner::TimeRunnerPlugin { - schedule: self.app_resource.schedule, - enable_debug: self.enable_debug, - }); + let mut time_runner_plugin = + bevy_time_runner::TimeRunnerPlugin::::in_schedule( + self.schedule, + ); + time_runner_plugin.enable_debug = self.enable_debug; + app.add_plugins(time_runner_plugin); } - app.configure_sets( - self.app_resource.schedule, - ( - TweenSystemSet::UpdateInterpolationValue, - TweenSystemSet::ApplyTween, - ) - .chain() - .after(bevy_time_runner::TimeRunnerSet::Progress), - ) - .insert_resource(self.app_resource.clone()) - .register_type::() - .register_type::(); - } - fn cleanup(&self, app: &mut App) { - app.world_mut().remove_resource::(); + app.register_type::() + .register_type::(); } } -impl Default for TweenCorePlugin { +impl TweenCorePlugin +where + TimeCtx: Default + Send + Sync + 'static, +{ + /// Constructor for schedule + pub fn in_schedule(schedule: impl ScheduleLabel) -> Self { + Self { + marker: PhantomData, + schedule: schedule.intern(), + ..default() + } + } +} +impl Default for TweenCorePlugin +where + TimeCtx: Default + Send + Sync + 'static, +{ fn default() -> Self { Self { - app_resource: Default::default(), + schedule: PostUpdate.intern(), enable_debug: true, + marker: PhantomData, } } } +/// A plugin for registering the system sets in specific schedule +struct SystemSetsRegistraitonPlugin { + /// The schedule to register the sets in + schedule: InternedScheduleLabel, +} + +impl Plugin for SystemSetsRegistraitonPlugin { + fn build(&self, app: &mut App) { + app.configure_sets( + self.schedule, + ( + TweenSystemSet::UpdateInterpolationValue, + TweenSystemSet::ApplyTween, + ) + .chain() + .after(bevy_time_runner::TimeRunnerSet::Progress), + ); + } +} + /// Enum of SystemSet in this crate. /// See [`TweenCorePlugin`] for default system configuration. #[derive(Debug, SystemSet, Clone, Copy, PartialEq, Eq, Hash)] @@ -532,33 +633,27 @@ pub enum TweenSystemSet { ApplyTween, } -/// Helper trait to add systems by this crate to your app and avoid mistake -/// from forgetting to use the intended schedule and set. +/// Helper trait to add systems by this crate to your app +/// for different schedules pub trait BevyTweenRegisterSystems { /// Register tween systems fn add_tween_systems( &mut self, + schedule: impl ScheduleLabel, tween_systems: impl IntoScheduleConfigs, ) -> &mut Self; } impl BevyTweenRegisterSystems for App { - /// Register tween systems in schedule configured in [`TweenAppResource`] + /// Register tween systems in schedule /// in set [`TweenSystemSet::ApplyTween`] - /// - /// # Panics - /// - /// Panics if [`TweenAppResource`] does not exist in world. fn add_tween_systems( &mut self, + schedule: impl ScheduleLabel, tween_systems: impl IntoScheduleConfigs, ) -> &mut Self { - let app_resource = self - .world() - .get_resource::() - .expect("`TweenAppResource` to be is inserted to world"); self.add_systems( - app_resource.schedule, + schedule, tween_systems.in_set(TweenSystemSet::ApplyTween), ) } diff --git a/src/tween.rs b/src/tween.rs index 5f812d1..c2cbc02 100644 --- a/src/tween.rs +++ b/src/tween.rs @@ -137,11 +137,14 @@ //! use bevy_tween::component_tween_system; //! use my_interpolate::*; //! -//! App::new().add_tween_systems(( -//! component_tween_system::(), -//! component_tween_system::(), -//! component_tween_system::(), -//! )); +//! App::new().add_tween_systems( +//! PostUpdate, +//! ( +//! component_tween_system::(), +//! component_tween_system::(), +//! component_tween_system::(), +//! ) +//! ); //! } //! # } //! ``` @@ -198,7 +201,7 @@ //! // One system to rule them all //! // Note that we're only using the `Foo` type, not `FooA`, `FooB`, //! // and `FooC`! -//! App::new().add_tween_systems(component_dyn_tween_system::()); +//! App::new().add_tween_systems(PostUpdate, component_dyn_tween_system::()); //! // `component_dyn_tween_system` is just an alias for //! // `component_tween_system::>>` //! } @@ -214,7 +217,8 @@ use bevy::prelude::*; use crate::combinator::TargetState; -use crate::interpolate::{Interpolator, PreviousValue, CurrentValue}; +use crate::interpolate::{CurrentValue, Interpolator, PreviousValue}; +use bevy_time_runner::{TimeContext, TimeSpanProgress}; mod systems; #[cfg(feature = "bevy_asset")] @@ -223,11 +227,12 @@ pub use systems::{ }; pub use systems::{ apply_component_tween_system, component_dyn_tween_system, - component_tween_system, + component_dyn_tween_system_with_time_context, component_tween_system, + component_tween_system_with_time_context, }; pub use systems::{ apply_resource_tween_system, resource_dyn_tween_system, - resource_tween_system, + resource_tween_system, resource_tween_system_with_time_context, }; /// Skip a tween from tweening. @@ -236,7 +241,7 @@ pub use systems::{ pub struct SkipTween; /// Automatically managed by an [`Interpolation`] such as [`EaseKind`] and -/// [`EaseClosure`] when a tween has the component [`TimeSpanProgress`](bevy_time_runner::TimeSpanProgress). +/// [`EaseClosure`] when a tween has the component [`TimeSpanProgress`]. /// See [`sample_interpolations_system`] /// /// [`sample_interpolations_system`]: crate::interpolation::sample_interpolations_system @@ -261,9 +266,7 @@ pub struct Tween { } /// Tracks the tween's previous value -#[derive( - Debug, Default, Component, Clone, Copy, Reflect, -)] +#[derive(Debug, Default, Component, Clone, Copy, Reflect)] #[reflect(Component)] pub struct TweenPreviousValue(pub f32); @@ -791,20 +794,21 @@ pub type DefaultTweenEventsPlugin = #[doc(hidden)] #[allow(deprecated)] #[allow(clippy::type_complexity)] -pub fn tween_event_system( +pub fn tween_event_system( commands: Commands, q_tween_event_data: Query< ( Entity, &TweenEventData, - &bevy_time_runner::TimeSpanProgress, + &TimeSpanProgress, Option<&TweenInterpolationValue>, ), - Without, + (Without, With>), >, event_writer: MessageWriter>, ) where Data: Clone + Send + Sync + 'static, + TimeCtx: Default + Send + Sync + 'static, { crate::tween_event::tween_event_system( commands, diff --git a/src/tween/systems.rs b/src/tween/systems.rs index 35277b3..96c45be 100644 --- a/src/tween/systems.rs +++ b/src/tween/systems.rs @@ -1,9 +1,7 @@ use super::*; -use bevy::{ - ecs::{ - component::Mutable, query::QueryEntityError, schedule::ScheduleConfigs, - system::ScheduleSystem, - } +use bevy::ecs::{ + component::Mutable, query::QueryEntityError, schedule::ScheduleConfigs, + system::ScheduleSystem, }; use bevy::platform::collections::{HashMap, HashSet}; use std::any::type_name; @@ -16,7 +14,19 @@ where I: Interpolator + Send + Sync + 'static, I::Item: Component, { - apply_component_tween_system::.into_configs() + apply_component_tween_system::.into_configs() +} + +/// Alias for [`apply_component_tween_system`] and may contains more systems +/// in the future. +pub fn component_tween_system_with_time_context() +-> ScheduleConfigs +where + I: Interpolator + Send + Sync + 'static, + I::Item: Component, + TimeCtx: Default + Send + Sync + 'static, +{ + apply_component_tween_system::.into_configs() } /// [`QueryEntityError`] but implemented hash [`Hash`] @@ -105,23 +115,31 @@ impl core::fmt::Display for QueryEntityErrorWithoutWorld { /// /// // Generic interpolator: /// app.add_tween_systems( -/// bevy_tween::tween::apply_component_tween_system::, +/// PostUpdate, +/// bevy_tween::tween::apply_component_tween_system::, /// ); /// /// // Dynamic interpolator: /// app.add_tween_systems( +/// PostUpdate, /// bevy_tween::tween::apply_component_tween_system::< /// BoxedInterpolator, +/// () /// >, /// ); /// } /// ``` #[allow(clippy::type_complexity)] -pub fn apply_component_tween_system( +pub fn apply_component_tween_system( q_animation_target: Query<(Option<&ChildOf>, Has)>, mut q_tween: Query< - (Entity, &Tween, &TweenInterpolationValue, &mut TweenPreviousValue), - Without, + ( + Entity, + &Tween, + &TweenInterpolationValue, + &mut TweenPreviousValue, + ), + (Without, With>), >, mut q_component: Query<&mut I::Item>, mut last_entity_error: Local>, @@ -129,6 +147,7 @@ pub fn apply_component_tween_system( ) where I: Interpolator + Send + Sync + 'static, I::Item: Component, + TimeCtx: Default + Send + Sync + 'static, { let mut entity_error = HashMap::default(); let mut search_error = HashSet::default(); @@ -246,7 +265,21 @@ pub fn component_dyn_tween_system() -> ScheduleConfigs where C: Component, { - apply_component_tween_system::>> + apply_component_tween_system::>, ()> + .into_configs() +} + +/// System alias for [`component_tween_system`] that uses boxed dynamic [`Interpolator`]. (`Box>()` for consistency +pub fn component_dyn_tween_system_with_time_context() +-> ScheduleConfigs +where + C: Component, + TimeCtx: Default + Send + Sync + 'static, +{ + apply_component_tween_system::>, TimeCtx> .into_configs() } @@ -257,7 +290,19 @@ where I: Interpolator + Send + Sync + 'static, I::Item: Resource, { - apply_resource_tween_system::.into_configs() + apply_resource_tween_system::.into_configs() +} + +/// Alias for [`apply_resource_tween_system`] and may contains more systems +/// in the future. +pub fn resource_tween_system_with_time_context() +-> ScheduleConfigs +where + I: Interpolator + Send + Sync + 'static, + I::Item: Resource, + TimeCtx: Default + Send + Sync + 'static, +{ + apply_resource_tween_system::.into_configs() } /// Apply any [`Tween`] with the [`Interpolator`] that [`TargetResource`] with @@ -296,30 +341,39 @@ where /// /// // Generic interpolator: /// app.add_tween_systems( +/// PostUpdate, /// bevy_tween::tween::apply_resource_tween_system::< /// InterpolateScreenFade, +/// (), /// >, /// ); /// /// // Dynamic interpolator: /// app.add_tween_systems( +/// PostUpdate, /// bevy_tween::tween::apply_resource_tween_system::< /// BoxedInterpolator, +/// (), /// >, /// ); /// } /// ``` #[allow(clippy::type_complexity)] -pub fn apply_resource_tween_system( +pub fn apply_resource_tween_system( mut q_tween: Query< - (&Tween, &TweenInterpolationValue, &mut TweenPreviousValue), - Without, + ( + &Tween, + &TweenInterpolationValue, + &mut TweenPreviousValue, + ), + (Without, With>), >, resource: Option>, mut last_error: Local, ) where I: Interpolator, I::Item: Resource, + TimeCtx: Default + Send + Sync + 'static, { let Some(mut resource) = resource else { if !*last_error { @@ -332,33 +386,41 @@ pub fn apply_resource_tween_system( return; }; *last_error = false; - q_tween.iter_mut().for_each(|(tween, ease_value, mut previous_value)| { - tween.interpolator.interpolate(&mut resource, ease_value.0, previous_value.0); - previous_value.0 = ease_value.0; - }) + q_tween + .iter_mut() + .for_each(|(tween, ease_value, mut previous_value)| { + tween.interpolator.interpolate( + &mut resource, + ease_value.0, + previous_value.0, + ); + previous_value.0 = ease_value.0; + }) } /// System alias for [`apply_resource_tween_system`] that uses boxed dynamic [`Interpolator`]. (`Box>()` for consistency -pub fn resource_dyn_tween_system() -> ScheduleConfigs +pub fn resource_dyn_tween_system() -> ScheduleConfigs where R: Resource, + TimeCtx: Default + Send + Sync + 'static, { - apply_resource_tween_system::>> + apply_resource_tween_system::>, TimeCtx> .into_configs() } /// Alias for [`apply_asset_tween_system`] and may contains more systems /// in the future. #[cfg(feature = "bevy_asset")] -pub fn asset_tween_system() -> ScheduleConfigs +pub fn asset_tween_system() -> ScheduleConfigs where I: Interpolator + Send + Sync + 'static, I::Item: Asset, + TimeCtx: Default + Send + Sync + 'static, { - apply_asset_tween_system::.into_configs() + apply_asset_tween_system::.into_configs() } /// Apply any [`Tween`] with the [`Interpolator`] that [`TargetAsset`] with @@ -397,23 +459,30 @@ where /// /// // Generic interpolator: /// app.add_tween_systems( -/// bevy_tween::tween::apply_asset_tween_system::, +/// PostUpdate, +/// bevy_tween::tween::apply_asset_tween_system::, /// ); /// /// // Dynamic interpolator: /// app.add_tween_systems( +/// PostUpdate, /// bevy_tween::tween::apply_asset_tween_system::< /// BoxedInterpolator, +/// (), /// >, /// ); /// } /// ``` #[cfg(feature = "bevy_asset")] #[allow(clippy::type_complexity)] -pub fn apply_asset_tween_system( +pub fn apply_asset_tween_system( mut q_tween: Query< - (&Tween, I>, &TweenInterpolationValue, &mut TweenPreviousValue), - Without, + ( + &Tween, I>, + &TweenInterpolationValue, + &mut TweenPreviousValue, + ), + (Without, With>), >, asset: Option>>, mut last_resource_error: Local, @@ -421,6 +490,7 @@ pub fn apply_asset_tween_system( ) where I: Interpolator, I::Item: Asset, + TimeCtx: Default + Send + Sync + 'static, { let mut asset_error = HashSet::default(); @@ -486,9 +556,11 @@ pub fn apply_asset_tween_system( /// This currently exists for backward compatibility and there's not really any big reason to deprecate it just yet. /// You might want to use `asset_tween_system::>()` for consistency #[cfg(feature = "bevy_asset")] -pub fn asset_dyn_tween_system() -> ScheduleConfigs +pub fn asset_dyn_tween_system() -> ScheduleConfigs where A: Asset, + TimeCtx: Default + Send + Sync + 'static, { - apply_asset_tween_system::>>.into_configs() + apply_asset_tween_system::>, TimeCtx> + .into_configs() } diff --git a/src/tween_event.rs b/src/tween_event.rs index f6fe514..830b0d1 100644 --- a/src/tween_event.rs +++ b/src/tween_event.rs @@ -25,35 +25,57 @@ //! See [`DefaultTweenEventPlugins`] for default events which is also added in //! [`DefaultTweenPlugins`](crate::DefaultTweenPlugins) +use bevy_time_runner::TimeContext; use std::marker::PhantomData; -use bevy::{app::PluginGroupBuilder, prelude::*}; +use bevy::{ + app::PluginGroupBuilder, + ecs::schedule::{InternedScheduleLabel, ScheduleLabel}, + prelude::*, +}; use bevy_time_runner::TimeSpanProgress; use crate::tween::{SkipTween, TweenInterpolationValue}; -/// Plugin for simple generic event that fires at a specific time span. -#[derive(Default)] -pub struct TweenEventPlugin +/// A plugin for registering the tween event system for tween of type Data for the specified schedule +pub struct TweenEventPlugin where Data: Send + Sync + 'static + Clone, + TimeCtx: Default + Send + Sync + 'static, { - marker: PhantomData, + /// Register all systems from this plugin to the specified schedule. + pub schedule: InternedScheduleLabel, + marker: PhantomData<(Data, TimeCtx)>, } - -impl Plugin for TweenEventPlugin +impl TweenEventPlugin +where + Data: Send + Sync + 'static + Clone, + TimeCtx: Default + Send + Sync + 'static, +{ + /// Register all systems from this plugin to the specified schedule. + pub fn in_schedule(schedule: impl ScheduleLabel) -> Self { + Self { + schedule: schedule.intern(), + marker: PhantomData, + } + } +} +impl Plugin for TweenEventPlugin where Data: Send + Sync + 'static + Clone, + TimeCtx: Default + Send + Sync + 'static, { fn build(&self, app: &mut App) { - let app_resource = app + #[allow(deprecated)] + let schedule = app .world() .get_resource::() - .expect("`TweenAppResource` resource doesn't exist"); + .map(|a| a.schedule) + .unwrap_or(self.schedule); app.add_systems( - app_resource.schedule, - (tween_event_system::) + schedule, + (tween_event_system::) .in_set(crate::TweenSystemSet::ApplyTween), ) .add_message::>(); @@ -63,15 +85,49 @@ where /// Default tween event plugins: /// - `TweenEventPlugin::<()>::default()`, /// - `TweenEventPlugin::<&'static str>::default()` -pub struct DefaultTweenEventPlugins; +pub struct DefaultTweenEventPlugins +where + TimeCtx: Default + Send + Sync + 'static, +{ + /// Register all systems from this plugin to the specified schedule. + pub schedule: InternedScheduleLabel, + marker: PhantomData, +} -impl PluginGroup for DefaultTweenEventPlugins { +impl PluginGroup for DefaultTweenEventPlugins +where + TimeCtx: Default + Send + Sync + 'static, +{ #[allow(unused)] #[allow(clippy::let_and_return)] fn build(self) -> PluginGroupBuilder { PluginGroupBuilder::start::() - .add(TweenEventPlugin::<()>::default()) - .add(TweenEventPlugin::<&'static str>::default()) + .add(TweenEventPlugin::<(), TimeCtx>::in_schedule(self.schedule)) + .add(TweenEventPlugin::<&'static str, TimeCtx>::in_schedule( + self.schedule, + )) + } +} + +impl DefaultTweenEventPlugins +where + TimeCtx: Default + Send + Sync + 'static, +{ + /// Register all systems from this plugin to the specified schedule. + pub fn in_schedule(schedule: impl ScheduleLabel) -> Self { + Self { + schedule: schedule.intern(), + marker: PhantomData, + } + } +} + +impl Default for DefaultTweenEventPlugins<()> { + fn default() -> Self { + Self { + schedule: PostUpdate.intern(), + marker: Default::default(), + } } } @@ -120,7 +176,7 @@ pub struct TweenEvent { /// and [`TweenEventData`] exist in the same entity and data is `Some`, /// cloning the data. #[allow(clippy::type_complexity)] -pub fn tween_event_system( +pub fn tween_event_system( mut commands: Commands, q_tween_event_data: Query< ( @@ -129,11 +185,12 @@ pub fn tween_event_system( &TimeSpanProgress, Option<&TweenInterpolationValue>, ), - Without, + (Without, With>), >, mut event_writer: MessageWriter>, ) where Data: Clone + Send + Sync + 'static, + TimeCtx: Default + Send + Sync + 'static, { q_tween_event_data.iter().for_each( |(entity, event_data, progress, interpolation_value)| {