From 5d7d7c95d0bb3bf42517be94827af4652f195787 Mon Sep 17 00:00:00 2001 From: Maksymilian Mozolewski Date: Sat, 9 Nov 2024 15:34:58 +0000 Subject: [PATCH 01/12] Bevy 0.15 Support (#139) * bump bevy to 0.15.0-rc.2 * migrate asset loaders * Upgrade reflection API's * bump codegen & codegen new files * Fix errors + regen * pin git again * fix more errors * bump macro tests * clippy fixes to bevy api gen * more bevy api gen clippy fixes * Update game of life examples * fix clippy * fix more clippy * fix more clippy * bump versions to alpha --- .github/workflows/bevy_api_gen.yml | 10 +- Cargo.toml | 55 +- check.sh | 2 +- crates/bevy_api_gen/Cargo.toml | 5 +- crates/bevy_api_gen/readme.md | 14 +- crates/bevy_api_gen/rust-toolchain.toml | 2 +- crates/bevy_api_gen/src/bin/driver.rs | 1 + crates/bevy_api_gen/src/bin/main.rs | 1 + crates/bevy_api_gen/src/context.rs | 14 +- crates/bevy_api_gen/src/lib.rs | 4 +- crates/bevy_api_gen/src/meta.rs | 2 +- .../bevy_api_gen/src/modifying_file_loader.rs | 8 +- .../bevy_api_gen/src/passes/cache_traits.rs | 11 +- .../src/passes/find_methods_and_fields.rs | 9 +- .../src/passes/find_trait_impls.rs | 4 +- crates/bevy_api_gen/src/template.rs | 3 +- crates/bevy_event_priority/Cargo.toml | 2 +- crates/bevy_mod_scripting_common/Cargo.toml | 2 +- crates/bevy_mod_scripting_core/Cargo.toml | 4 +- crates/bevy_script_api/Cargo.toml | 8 +- crates/bevy_script_api/src/common/bevy/mod.rs | 33 +- crates/bevy_script_api/src/common/std.rs | 8 +- crates/bevy_script_api/src/lua/bevy/mod.rs | 6 +- crates/bevy_script_api/src/lua/std.rs | 8 +- crates/bevy_script_api/src/lua/util.rs | 63 +- .../src/providers/bevy_a11y.rs | 69 + .../bevy_script_api/src/providers/bevy_ecs.rs | 130 +- .../src/providers/bevy_hierarchy.rs | 45 +- .../src/providers/bevy_input.rs | 985 +- .../src/providers/bevy_math.rs | 1482 ++- .../src/providers/bevy_reflect.rs | 8009 +++++++++++------ .../src/providers/bevy_time.rs | 64 +- .../src/providers/bevy_transform.rs | 177 +- .../src/providers/bevy_window.rs | 640 +- crates/bevy_script_api/src/providers/mod.rs | 4 + crates/bevy_script_api/src/rhai/std.rs | 20 +- crates/bevy_script_api/src/sub_reflect.rs | 145 +- .../bevy_mod_scripting_lua/Cargo.toml | 2 +- .../bevy_mod_scripting_lua/src/assets.rs | 30 +- .../bevy_mod_scripting_lua/src/docs.rs | 6 +- .../bevy_mod_scripting_lua_derive/Cargo.toml | 4 +- .../bevy_mod_scripting_rhai/Cargo.toml | 2 +- .../bevy_mod_scripting_rhai/src/assets.rs | 12 +- .../bevy_mod_scripting_rhai_derive/Cargo.toml | 4 +- .../bevy_mod_scripting_rune/Cargo.toml | 2 +- .../bevy_mod_scripting_rune/src/assets.rs | 27 +- crates/macro_tests/Cargo.toml | 2 +- examples/lua/game_of_life.rs | 23 +- examples/rhai/game_of_life.rs | 23 +- makefile | 10 +- 50 files changed, 7903 insertions(+), 4293 deletions(-) create mode 100644 crates/bevy_script_api/src/providers/bevy_a11y.rs diff --git a/.github/workflows/bevy_api_gen.yml b/.github/workflows/bevy_api_gen.yml index 417087bf7f..2a916bce8f 100644 --- a/.github/workflows/bevy_api_gen.yml +++ b/.github/workflows/bevy_api_gen.yml @@ -25,7 +25,7 @@ jobs: - uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: nightly-2024-05-20 + toolchain: nightly-2024-11-05 override: true - name: Rust Cache uses: Swatinem/rust-cache@v2.7.3 @@ -52,7 +52,7 @@ jobs: with: profile: minimal components: rustfmt - toolchain: nightly-2024-05-20 + toolchain: nightly-2024-11-05 override: true - name: Rust Cache uses: Swatinem/rust-cache@v2.7.3 @@ -75,7 +75,7 @@ jobs: rm -rf crates - uses: actions-rs/toolchain@v1 with: - toolchain: nightly-2024-05-20 + toolchain: nightly-2024-11-05 components: clippy override: true - name: Rust Cache @@ -98,7 +98,7 @@ jobs: rm -rf crates - uses: actions-rs/toolchain@v1 with: - toolchain: nightly-2024-05-20 + toolchain: nightly-2024-11-05 override: true - name: Rust Cache uses: Swatinem/rust-cache@v2.7.3 @@ -120,7 +120,7 @@ jobs: rm -rf crates - uses: actions-rs/toolchain@v1 with: - toolchain: nightly-2024-05-20 + toolchain: nightly-2024-11-05 override: true - name: Rust Cache uses: Swatinem/rust-cache@v2.7.3 diff --git a/Cargo.toml b/Cargo.toml index 9a9b42fa48..8d83969bd5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bevy_mod_scripting" -version = "0.7.1" +version = "0.8.0-alpha.0" authors = ["Maksymilian Mozolewski "] edition = "2021" license = "MIT OR Apache-2.0" @@ -63,16 +63,16 @@ rune = ["bevy_mod_scripting_rune"] [dependencies] bevy = { workspace = true } bevy_mod_scripting_core = { workspace = true } -bevy_mod_scripting_lua = { path = "crates/languages/bevy_mod_scripting_lua", version = "0.7.1", optional = true } -bevy_mod_scripting_rhai = { path = "crates/languages/bevy_mod_scripting_rhai", version = "0.7.1", optional = true } -bevy_mod_scripting_rune = { path = "crates/languages/bevy_mod_scripting_rune", version = "0.7.1", optional = true } -bevy_script_api = { path = "crates/bevy_script_api", version = "0.7.1", optional = true } +bevy_mod_scripting_lua = { path = "crates/languages/bevy_mod_scripting_lua", version = "0.8.0-alpha.0", optional = true } +bevy_mod_scripting_rhai = { path = "crates/languages/bevy_mod_scripting_rhai", version = "0.8.0-alpha.0", optional = true } +bevy_mod_scripting_rune = { path = "crates/languages/bevy_mod_scripting_rune", version = "0.8.0-alpha.0", optional = true } +bevy_script_api = { path = "crates/bevy_script_api", version = "0.8.0-alpha.0", optional = true } [workspace.dependencies] -bevy = { version = "0.14.2", default-features = false } -bevy_mod_scripting_core = { path = "crates/bevy_mod_scripting_core", version = "0.7.1" } -bevy_mod_scripting_common = { path = "crates/bevy_mod_scripting_common", version = "0.7.1" } +bevy = { version = "0.15.0-rc.2", default-features = false } +bevy_mod_scripting_core = { path = "crates/bevy_mod_scripting_core", version = "0.8.0-alpha.0" } +bevy_mod_scripting_common = { path = "crates/bevy_mod_scripting_common", version = "0.8.0-alpha.0" } [dev-dependencies] bevy = { workspace = true, default-features = true } @@ -111,25 +111,26 @@ codegen-units = 8 incremental = false debug = false -[[example]] -name = "console_integration_lua" -path = "examples/lua/console_integration.rs" -required-features = [ - "lua54", - "lua_script_api", - "bevy/file_watcher", - "bevy/multi_threaded", -] - -[[example]] -name = "console_integration_rhai" -path = "examples/rhai/console_integration.rs" -required-features = [ - "rhai", - "rhai_script_api", - "bevy/file_watcher", - "bevy/multi_threaded", -] +# TODO: bump once bevy is released and the lib is updated +# [[example]] +# name = "console_integration_lua" +# path = "examples/lua/console_integration.rs" +# required-features = [ +# "lua54", +# "lua_script_api", +# "bevy/file_watcher", +# "bevy/multi_threaded", +# ] + +# [[example]] +# name = "console_integration_rhai" +# path = "examples/rhai/console_integration.rs" +# required-features = [ +# "rhai", +# "rhai_script_api", +# "bevy/file_watcher", +# "bevy/multi_threaded", +# ] [[example]] name = "complex_game_loop_lua" diff --git a/check.sh b/check.sh index c731dd4c03..eb7a8f5488 100755 --- a/check.sh +++ b/check.sh @@ -4,7 +4,7 @@ CURRENT_DIR=$(basename "$PWD") if [[ "$CURRENT_DIR" == "bevy_api_gen" ]]; then - cargo +nightly-2024-05-20 clippy --all-targets --message-format=json + cargo +nightly-2024-11-05 clippy --all-targets --message-format=json else cargo clippy --workspace --all-targets --message-format=json --features="lua54 lua_script_api rhai rhai_script_api teal rune bevy/file_watcher bevy/multi_threaded" fi diff --git a/crates/bevy_api_gen/Cargo.toml b/crates/bevy_api_gen/Cargo.toml index 8a06e6f3f2..501fca03d5 100644 --- a/crates/bevy_api_gen/Cargo.toml +++ b/crates/bevy_api_gen/Cargo.toml @@ -37,17 +37,16 @@ source = "discover" rustc_private = true [rust-analyzer.check] -overrideCommand = ["cargo", "+nightly-2024-05-20", "a", "--message-format=json"] +overrideCommand = ["cargo", "+nightly-2024-11-05", "a", "--message-format=json"] [dependencies] log = "0.4" env_logger = "0.11" -rustc_plugin = "=0.10.0-nightly-2024-05-20" +rustc_plugin = { git = "https://github.com/makspll/rustc_plugin", branch = "feature/rust-1.82.0" } indexmap = "2" tempdir = "0.3" cargo_metadata = "0.18" -rustc_data_structures = "0.0.1" serde_json = "1" serde = "1" clap = { version = "4", features = ["derive", "string"] } diff --git a/crates/bevy_api_gen/readme.md b/crates/bevy_api_gen/readme.md index d8fe50e518..93f556bb94 100644 --- a/crates/bevy_api_gen/readme.md +++ b/crates/bevy_api_gen/readme.md @@ -8,7 +8,7 @@ bevy_api_gen is a Cargo plugin that generates reflection-powered wrappers for Be To install bevy_api_gen, use the following command: ```bash -cargo +nightly-2024-05-20 install bevy_api_gen +cargo +nightly-2024-11-05 install bevy_api_gen ``` # Usage @@ -18,17 +18,17 @@ cargo +nightly-2024-05-20 install bevy_api_gen To run the main codegen process, use the following command: ```bash -cargo +nightly-2024-05-20 bevy-api-gen generate +cargo +nightly-2024-11-05 bevy-api-gen generate ``` -This will perform all parts of the process and generate meta as well as .rs files for each crate in your workspace in your `/target/plugin-nightly-2024-05-20/bevy_api_gen` directory +This will perform all parts of the process and generate meta as well as .rs files for each crate in your workspace in your `/target/plugin-nightly-2024-11-05/bevy_api_gen` directory ## Collect After generating all the files, you can 'collect' them in a mod.rs file like so: ```bash -cargo +nightly-2024-05-20 bevy-api-gen collect +cargo +nightly-2024-11-05 bevy-api-gen collect ``` ## List Types @@ -36,7 +36,7 @@ cargo +nightly-2024-05-20 bevy-api-gen collect To see a list of all `Reflect` implementing types in your workspace run: ```bash -cargo +nightly-2024-05-20 bevy-api-gen list-types > all_types.txt +cargo +nightly-2024-11-05 bevy-api-gen list-types > all_types.txt ``` ## List Templates @@ -44,7 +44,7 @@ cargo +nightly-2024-05-20 bevy-api-gen list-types > all_types.txt To see the list of all templates which you can override use: ```bash -cargo +nightly-2024-05-20 bevy-api-gen list-templates +cargo +nightly-2024-11-05 bevy-api-gen list-templates ``` ## Print Template @@ -52,5 +52,5 @@ cargo +nightly-2024-05-20 bevy-api-gen list-templates You can also print any of the templates to stdout: ```bash -cargo +nightly-2024-05-20 bevy-api-gen print item.tera +cargo +nightly-2024-11-05 bevy-api-gen print item.tera ``` \ No newline at end of file diff --git a/crates/bevy_api_gen/rust-toolchain.toml b/crates/bevy_api_gen/rust-toolchain.toml index 2a12ab9a2b..0d5ae08dc0 100644 --- a/crates/bevy_api_gen/rust-toolchain.toml +++ b/crates/bevy_api_gen/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] components = ["clippy", "rust-src", "rustc-dev", "llvm-tools"] -channel = "nightly-2024-05-20" +channel = "nightly-2024-11-05" diff --git a/crates/bevy_api_gen/src/bin/driver.rs b/crates/bevy_api_gen/src/bin/driver.rs index 0136073b8e..492f0673fb 100644 --- a/crates/bevy_api_gen/src/bin/driver.rs +++ b/crates/bevy_api_gen/src/bin/driver.rs @@ -1,3 +1,4 @@ +#![feature(rustc_private)] use bevy_api_gen::*; fn main() { diff --git a/crates/bevy_api_gen/src/bin/main.rs b/crates/bevy_api_gen/src/bin/main.rs index 626e1169a1..658afed6a0 100644 --- a/crates/bevy_api_gen/src/bin/main.rs +++ b/crates/bevy_api_gen/src/bin/main.rs @@ -1,3 +1,4 @@ +#![feature(rustc_private)] use std::{ collections::HashMap, env, diff --git a/crates/bevy_api_gen/src/context.rs b/crates/bevy_api_gen/src/context.rs index dd18021df5..498a958c42 100644 --- a/crates/bevy_api_gen/src/context.rs +++ b/crates/bevy_api_gen/src/context.rs @@ -138,13 +138,13 @@ impl CachedTraits { .all(|t| self.std_source_traits.contains_key(*t)) } - pub(crate) fn missing_std_source_traits(&self) -> Vec { - STD_SOURCE_TRAITS - .iter() - .filter(|t| !self.std_source_traits.contains_key(**t)) - .map(|s| (*s).to_owned()) - .collect() - } + // pub(crate) fn missing_std_source_traits(&self) -> Vec { + // STD_SOURCE_TRAITS + // .iter() + // .filter(|t| !self.std_source_traits.contains_key(**t)) + // .map(|s| (*s).to_owned()) + // .collect() + // } } #[derive(Clone, Debug)] diff --git a/crates/bevy_api_gen/src/lib.rs b/crates/bevy_api_gen/src/lib.rs index f16b9bee3a..23d294032e 100644 --- a/crates/bevy_api_gen/src/lib.rs +++ b/crates/bevy_api_gen/src/lib.rs @@ -1,15 +1,13 @@ #![feature(rustc_private, let_chains)] #![deny(rustc::internal)] + extern crate rustc_ast; extern crate rustc_driver; extern crate rustc_errors; extern crate rustc_hir; -extern crate rustc_hir_analysis; extern crate rustc_infer; extern crate rustc_interface; -extern crate rustc_lint; extern crate rustc_middle; -extern crate rustc_session; extern crate rustc_span; extern crate rustc_trait_selection; diff --git a/crates/bevy_api_gen/src/meta.rs b/crates/bevy_api_gen/src/meta.rs index 3f85dd3039..a9861da384 100644 --- a/crates/bevy_api_gen/src/meta.rs +++ b/crates/bevy_api_gen/src/meta.rs @@ -94,7 +94,7 @@ impl MetaLoader { let cache = self.cache.borrow(); if cache.contains_key(crate_name) { trace!("Loading meta from cache for: {}", crate_name); - return cache.get(crate_name).cloned(); + cache.get(crate_name).cloned() } else { trace!("Loading meta from filesystem for: {}", crate_name); drop(cache); diff --git a/crates/bevy_api_gen/src/modifying_file_loader.rs b/crates/bevy_api_gen/src/modifying_file_loader.rs index a8c01d85cf..7fab22dd3b 100644 --- a/crates/bevy_api_gen/src/modifying_file_loader.rs +++ b/crates/bevy_api_gen/src/modifying_file_loader.rs @@ -1,7 +1,11 @@ -use std::io; +use std::{ + io, + sync::atomic::{AtomicBool, Ordering}, +}; use log::trace; -use rustc_data_structures::sync::{AtomicBool, Lrc, Ordering}; +use rustc_middle::ty::data_structures::Lrc; +// use rustc_data_structures::sync::{AtomicBool, Lrc}; use rustc_span::source_map::{FileLoader, RealFileLoader}; /// Injects extern statements into the first loaded file (crate root) diff --git a/crates/bevy_api_gen/src/passes/cache_traits.rs b/crates/bevy_api_gen/src/passes/cache_traits.rs index bdbd956815..12e2972bfe 100644 --- a/crates/bevy_api_gen/src/passes/cache_traits.rs +++ b/crates/bevy_api_gen/src/passes/cache_traits.rs @@ -66,11 +66,12 @@ pub(crate) fn cache_traits(ctxt: &mut BevyCtxt<'_>, _args: &Args) -> bool { .join(", ") ); - panic!( - "Could not find traits: [{}] in crate: {}, did bootstrapping go wrong?", - ctxt.cached_traits.missing_std_source_traits().join(", "), - tcx.crate_name(LOCAL_CRATE) - ) + // TODO: figure out why some crates are missing std::fmt::Display etc + // panic!( + // "Could not find traits: [{}] in crate: {}, did bootstrapping go wrong?", + // ctxt.cached_traits.missing_std_source_traits().join(", "), + // tcx.crate_name(LOCAL_CRATE) + // ) } true diff --git a/crates/bevy_api_gen/src/passes/find_methods_and_fields.rs b/crates/bevy_api_gen/src/passes/find_methods_and_fields.rs index ab016de1f2..8034681a41 100644 --- a/crates/bevy_api_gen/src/passes/find_methods_and_fields.rs +++ b/crates/bevy_api_gen/src/passes/find_methods_and_fields.rs @@ -6,7 +6,9 @@ use rustc_hir::{ Safety, }; use rustc_infer::infer::TyCtxtInferExt; -use rustc_middle::ty::{AdtKind, AssocKind, FieldDef, FnSig, ParamEnv, Ty, TyCtxt, TyKind}; +use rustc_middle::ty::{ + AdtKind, AssocKind, FieldDef, FnSig, ParamEnv, Ty, TyCtxt, TyKind, TypingMode, +}; use rustc_span::Symbol; use rustc_trait_selection::infer::InferCtxtExt; @@ -86,7 +88,6 @@ pub(crate) fn find_methods_and_fields(ctxt: &mut BevyCtxt<'_>, _args: &Args) -> let mut all_impls = ctxt .tcx .inherent_impls(def_id) - .unwrap() .iter() .chain(trait_impls_for_ty.iter().flatten()) .collect::>(); @@ -390,7 +391,7 @@ fn type_is_supported_as_non_proxy_return_val<'tcx>( ) -> bool { trace!("Checkign type is supported as non proxy return val: '{ty:?}' with param_env: '{param_env:?}'"); if let TyKind::Ref(region, _, _) = ty.kind() { - if !region.get_name().is_some_and(|rn| rn.as_str() == "'static") { + if region.get_name().is_none_or(|rn| rn.as_str() != "'static") { return false; } } @@ -410,7 +411,7 @@ pub(crate) fn impls_trait<'tcx>( trait_did: DefId, ) -> bool { tcx.infer_ctxt() - .build() + .build(TypingMode::non_body_analysis()) .type_implements_trait(trait_did, [ty], param_env) .must_apply_modulo_regions() } diff --git a/crates/bevy_api_gen/src/passes/find_trait_impls.rs b/crates/bevy_api_gen/src/passes/find_trait_impls.rs index 65f65e31df..9541869012 100644 --- a/crates/bevy_api_gen/src/passes/find_trait_impls.rs +++ b/crates/bevy_api_gen/src/passes/find_trait_impls.rs @@ -6,7 +6,7 @@ use rustc_infer::{ infer::{InferCtxt, TyCtxtInferExt}, traits::{Obligation, ObligationCause}, }; -use rustc_middle::ty::Ty; +use rustc_middle::ty::{Ty, TypingMode}; use rustc_span::DUMMY_SP; use rustc_trait_selection::traits::ObligationCtxt; @@ -105,7 +105,7 @@ fn type_impl_of_trait( //TODO: false negatives coming from this inference let ty = tcx.type_of(reflect_ty_did).instantiate_identity(); - let infcx = tcx.infer_ctxt().build(); + let infcx = tcx.infer_ctxt().build(TypingMode::non_body_analysis()); let result = impl_matches(&infcx, ty, impl_did); log::trace!("Result: {:#?}", result); if result { diff --git a/crates/bevy_api_gen/src/template.rs b/crates/bevy_api_gen/src/template.rs index ce8774e162..e9219d0013 100644 --- a/crates/bevy_api_gen/src/template.rs +++ b/crates/bevy_api_gen/src/template.rs @@ -195,9 +195,8 @@ pub(crate) fn configure_tera_env(tera: &mut Tera, crate_name: &str) { let file = syn::parse_file(&str) .map_err(|e| tera::Error::msg(e.to_string())) - .map_err(|e| { + .inspect_err(|_| { log::error!("prettyplease error on input: ```\n{}\n```", str); - e })?; let out = prettyplease::unparse(&file); diff --git a/crates/bevy_event_priority/Cargo.toml b/crates/bevy_event_priority/Cargo.toml index d8e2608495..f13818d2b2 100644 --- a/crates/bevy_event_priority/Cargo.toml +++ b/crates/bevy_event_priority/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bevy_event_priority" -version = "0.7.1" +version = "0.8.0-alpha.0" authors = ["Maksymilian Mozolewski "] edition = "2021" license = "MIT OR Apache-2.0" diff --git a/crates/bevy_mod_scripting_common/Cargo.toml b/crates/bevy_mod_scripting_common/Cargo.toml index 01ed7aa501..a9f4032eea 100644 --- a/crates/bevy_mod_scripting_common/Cargo.toml +++ b/crates/bevy_mod_scripting_common/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bevy_mod_scripting_common" -version = "0.7.1" +version = "0.8.0-alpha.0" authors = ["Maksymilian Mozolewski "] edition = "2021" license = "MIT OR Apache-2.0" diff --git a/crates/bevy_mod_scripting_core/Cargo.toml b/crates/bevy_mod_scripting_core/Cargo.toml index 68847b7a87..402f7c2798 100644 --- a/crates/bevy_mod_scripting_core/Cargo.toml +++ b/crates/bevy_mod_scripting_core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bevy_mod_scripting_core" -version = "0.7.1" +version = "0.8.0-alpha.0" authors = ["Maksymilian Mozolewski "] edition = "2021" license = "MIT OR Apache-2.0" @@ -32,7 +32,7 @@ bevy = { workspace = true, default-features = false, features = [ "bevy_text", "bevy_sprite", ] } -bevy_event_priority = { path = "../bevy_event_priority", version = "0.7.1" } +bevy_event_priority = { path = "../bevy_event_priority", version = "0.8.0-alpha.0" } thiserror = "1.0.31" paste = "1.0.7" parking_lot = "0.12.1" diff --git a/crates/bevy_script_api/Cargo.toml b/crates/bevy_script_api/Cargo.toml index d4ed591fc4..caaf350d5b 100644 --- a/crates/bevy_script_api/Cargo.toml +++ b/crates/bevy_script_api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bevy_script_api" -version = "0.7.1" +version = "0.8.0-alpha.0" authors = ["Maksymilian Mozolewski "] edition = "2021" license = "MIT OR Apache-2.0" @@ -35,8 +35,8 @@ parking_lot = "0.12.1" paste = "1.0.7" thiserror = "1.0.32" # lua -bevy_mod_scripting_lua = { path = "../languages/bevy_mod_scripting_lua", version = "0.7.1", optional = true } -bevy_mod_scripting_lua_derive = { path = "../languages/bevy_mod_scripting_lua_derive", version = "0.7.1", optional = true } -bevy_mod_scripting_rhai = { path = "../languages/bevy_mod_scripting_rhai", version = "0.7.1", optional = true } +bevy_mod_scripting_lua = { path = "../languages/bevy_mod_scripting_lua", version = "0.8.0-alpha.0", optional = true } +bevy_mod_scripting_lua_derive = { path = "../languages/bevy_mod_scripting_lua_derive", version = "0.8.0-alpha.0", optional = true } +bevy_mod_scripting_rhai = { path = "../languages/bevy_mod_scripting_rhai", version = "0.8.0-alpha.0", optional = true } smol_str = "0.2" allocator-api2 = "0.2" diff --git a/crates/bevy_script_api/src/common/bevy/mod.rs b/crates/bevy_script_api/src/common/bevy/mod.rs index ba45a35bd2..6df4b72e6e 100644 --- a/crates/bevy_script_api/src/common/bevy/mod.rs +++ b/crates/bevy_script_api/src/common/bevy/mod.rs @@ -7,12 +7,12 @@ use bevy::{ world::{Command, EntityRef, World}, }, prelude::{ - AppTypeRegistry, BuildWorldChildren, Children, DespawnChildrenRecursive, DespawnRecursive, + AppTypeRegistry, BuildChildren, Children, DespawnChildrenRecursive, DespawnRecursive, Entity, Parent, ReflectComponent, ReflectDefault, ReflectResource, }, reflect::{ - DynamicArray, DynamicEnum, DynamicList, DynamicMap, DynamicStruct, DynamicTuple, - DynamicTupleStruct, TypeRegistration, + DynamicArray, DynamicEnum, DynamicList, DynamicMap, DynamicSet, DynamicStruct, + DynamicTuple, DynamicTupleStruct, TypeRegistration, }, }; use bevy_mod_scripting_core::{prelude::ScriptError, world::WorldPointer}; @@ -169,15 +169,15 @@ impl ScriptWorld { pub fn push_child(&self, parent: Entity, child: Entity) { let mut w = self.write(); - if let Some(mut entity) = w.get_entity_mut(parent) { - entity.push_children(&[child]); + if let Ok(mut entity) = w.get_entity_mut(parent) { + entity.add_children(&[child]); } } pub fn remove_children(&self, parent: Entity, children: &[Entity]) { let mut w = self.write(); - if let Some(mut entity) = w.get_entity_mut(parent) { + if let Ok(mut entity) = w.get_entity_mut(parent) { entity.remove_children(children); } } @@ -185,19 +185,19 @@ impl ScriptWorld { pub fn insert_children(&self, parent: Entity, index: usize, children: &[Entity]) { let mut w = self.write(); - if let Some(mut entity) = w.get_entity_mut(parent) { + if let Ok(mut entity) = w.get_entity_mut(parent) { entity.insert_children(index, children); } } pub fn despawn_children_recursive(&self, entity: Entity) { let mut w = self.write(); - DespawnChildrenRecursive { entity }.apply(&mut w); + DespawnChildrenRecursive { entity, warn: true }.apply(&mut w); } pub fn despawn_recursive(&self, entity: Entity) { let mut w = self.write(); - DespawnRecursive { entity }.apply(&mut w); + DespawnRecursive { entity, warn: true }.apply(&mut w); } pub fn get_type_by_name(&self, type_name: &str) -> Option { @@ -225,7 +225,7 @@ impl ScriptWorld { let mut entity_ref = w .get_entity_mut(entity) - .ok_or_else(|| ScriptError::Other(format!("Entity is not valid {:#?}", entity)))?; + .map_err(|e| ScriptError::Other(format!("Entity is not valid {:#?}. {e}", entity)))?; let component_data = comp_type.data::().ok_or_else(|| { ScriptError::Other(format!("Not a component {}", comp_type.short_name())) @@ -243,13 +243,14 @@ impl ScriptWorld { bevy::reflect::TypeInfo::List(_) => component_data.insert(&mut entity_ref, &DynamicList::default(), ®istry_lock), bevy::reflect::TypeInfo::Array(_) => component_data.insert(&mut entity_ref, &DynamicArray::new(Box::new([])), ®istry_lock), bevy::reflect::TypeInfo::Map(_) => component_data.insert(&mut entity_ref, &DynamicMap::default(), ®istry_lock), - bevy::reflect::TypeInfo::Value(_) => component_data.insert(&mut entity_ref, + bevy::reflect::TypeInfo::Set(_) => component_data.insert(&mut entity_ref, &DynamicSet::default(), ®istry_lock), + bevy::reflect::TypeInfo::Opaque(_) => component_data.insert(&mut entity_ref, comp_type.data::().ok_or_else(|| ScriptError::Other(format!("Component {} is a value or dynamic type with no `ReflectDefault` type_data, cannot instantiate sensible value",comp_type.short_name())))? .default() - .as_ref(), + .as_partial_reflect(), ®istry_lock), - bevy::reflect::TypeInfo::Enum(_) => component_data.insert(&mut entity_ref, &DynamicEnum::default(), ®istry_lock) + bevy::reflect::TypeInfo::Enum(_) => component_data.insert(&mut entity_ref, &DynamicEnum::default(), ®istry_lock), }; // if we do not drop the lock here, line below will complain registry is still borrowed at drop drop(registry_lock); @@ -273,7 +274,7 @@ impl ScriptWorld { let entity_ref = w .get_entity(entity) - .ok_or_else(|| ScriptError::Other(format!("Entity is not valid {:#?}", entity)))?; + .map_err(|e| ScriptError::Other(format!("Entity is not valid {:#?}. {e}", entity)))?; let component_data = comp_type.data::().ok_or_else(|| { ScriptError::Other(format!("Not a component {}", comp_type.short_name())) @@ -296,7 +297,7 @@ impl ScriptWorld { let entity_ref = w .get_entity(entity) - .ok_or_else(|| ScriptError::Other(format!("Entity is not valid {:#?}", entity)))?; + .map_err(|e| ScriptError::Other(format!("Entity is not valid {:#?}. {e}", entity)))?; Ok(component_data.reflect(entity_ref).is_some()) } @@ -310,7 +311,7 @@ impl ScriptWorld { let mut entity_ref = w .get_entity_mut(entity) - .ok_or_else(|| ScriptError::Other(format!("Entity is not valid {:#?}", entity)))?; + .map_err(|e| ScriptError::Other(format!("Entity is not valid {:#?}. {e}", entity)))?; let component_data = comp_type.data::().ok_or_else(|| { ScriptError::Other(format!("Not a component {}", comp_type.short_name())) diff --git a/crates/bevy_script_api/src/common/std.rs b/crates/bevy_script_api/src/common/std.rs index 0f4c929c2e..f3da1234ff 100644 --- a/crates/bevy_script_api/src/common/std.rs +++ b/crates/bevy_script_api/src/common/std.rs @@ -1,6 +1,6 @@ use std::marker::PhantomData; -use bevy::reflect::{FromReflect, GetTypeRegistration, TypePath}; +use bevy::reflect::{FromReflect, GetTypeRegistration, TypePath, Typed}; use crate::{error::ReflectionError, ReflectReference, ValueIndex}; @@ -26,7 +26,7 @@ impl std::fmt::Debug for ScriptVec { } } -impl std::fmt::Display +impl std::fmt::Display for ScriptVec { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { @@ -41,7 +41,7 @@ impl std::f } } -impl ScriptVec { +impl ScriptVec { pub fn new_ref(ref_: ReflectReference) -> Self { Self { ref_, @@ -118,7 +118,7 @@ impl Iterator for ScriptVecIterator { } } -impl IntoIterator for ScriptVec { +impl IntoIterator for ScriptVec { type Item = ReflectReference; type IntoIter = ScriptVecIterator; diff --git a/crates/bevy_script_api/src/lua/bevy/mod.rs b/crates/bevy_script_api/src/lua/bevy/mod.rs index 8b2068b235..54715102b7 100644 --- a/crates/bevy_script_api/src/lua/bevy/mod.rs +++ b/crates/bevy_script_api/src/lua/bevy/mod.rs @@ -9,7 +9,7 @@ use crate::lua::{ }; use crate::providers::bevy_ecs::LuaEntity; use crate::{impl_from_lua_with_clone, impl_tealr_type}; -use bevy::hierarchy::BuildWorldChildren; +use bevy::hierarchy::BuildChildren; use bevy::prelude::{AppTypeRegistry, ReflectResource}; use bevy_mod_scripting_core::prelude::*; use bevy_mod_scripting_lua::{prelude::IntoLua, tealr}; @@ -288,8 +288,8 @@ impl TealData for LuaWorld { .map(|e| e.inner()) .collect::, _>>()?; - if let Some(mut entity) = w.get_entity_mut(parent.inner()?) { - entity.push_children(&children); + if let Ok(mut entity) = w.get_entity_mut(parent.inner()?) { + entity.add_children(&children); } Ok(()) diff --git a/crates/bevy_script_api/src/lua/std.rs b/crates/bevy_script_api/src/lua/std.rs index 6dddbe93cb..945b4c16b6 100644 --- a/crates/bevy_script_api/src/lua/std.rs +++ b/crates/bevy_script_api/src/lua/std.rs @@ -106,7 +106,8 @@ impl< + GetTypeRegistration + TypePath + for<'a> FromLuaProxy<'a> - + Clone, + + Clone + + bevy::reflect::Typed, > LuaProxyable for Option { fn ref_to_lua(self_: ReflectReference, lua: &Lua) -> mlua::Result { @@ -246,6 +247,7 @@ impl< + GetTypeRegistration + TypePath + LuaProxyable + + bevy::reflect::Typed + for<'a> FromLuaProxy<'a> + for<'a> IntoLuaProxy<'a> + std::fmt::Debug, @@ -274,6 +276,7 @@ impl< + GetTypeRegistration + TypePath + LuaProxyable + + bevy::reflect::Typed + for<'a> FromLuaProxy<'a> + for<'a> IntoLuaProxy<'a> + std::fmt::Debug, @@ -294,6 +297,7 @@ impl< + GetTypeRegistration + TypePath + LuaProxyable + + bevy::reflect::Typed + for<'a> FromLuaProxy<'a> + for<'a> IntoLuaProxy<'a>, > TealData for LuaVec @@ -384,6 +388,7 @@ impl< + GetTypeRegistration + TypePath + LuaProxyable + + bevy::reflect::Typed + for<'a> FromLuaProxy<'a> + for<'a> IntoLuaProxy<'a> + std::fmt::Debug, @@ -446,6 +451,7 @@ impl< + GetTypeRegistration + TypePath + LuaProxyable + + bevy::reflect::Typed + std::fmt::Debug, > FromLuaProxy<'lua> for Vec { diff --git a/crates/bevy_script_api/src/lua/util.rs b/crates/bevy_script_api/src/lua/util.rs index 2a96a3e538..6c611e0b81 100644 --- a/crates/bevy_script_api/src/lua/util.rs +++ b/crates/bevy_script_api/src/lua/util.rs @@ -287,6 +287,12 @@ macro_rules! impl_tealr_generic{ } + impl ::bevy::reflect::Typed for $name { + fn type_info() -> &'static ::bevy::reflect::TypeInfo { + panic!("This should never be called, I am a dummy implementation") + } + } + impl ::bevy::reflect::TypePath for $name { fn short_type_path() -> &'static str{ panic!("This should never be called, I am a dummy implementation") @@ -297,69 +303,94 @@ macro_rules! impl_tealr_generic{ } } - impl ::bevy::reflect::Reflect for $name { - fn try_apply(&mut self, _: &(dyn bevy::prelude::Reflect + 'static)) -> std::result::Result<(), bevy::reflect::ApplyError> { + impl ::bevy::reflect::PartialReflect for $name { + fn get_represented_type_info(&self) -> std::option::Option<&'static bevy::reflect::TypeInfo> { panic!("This should never be called, I am a dummy implementation"); } - fn into_any(self: Box) -> Box { + fn into_partial_reflect(self: Box) -> Box { panic!("This should never be called, I am a dummy implementation"); } - fn as_any(&self) -> &dyn std::any::Any { + fn as_partial_reflect(&self) -> &dyn ::bevy::reflect::PartialReflect { panic!("This should never be called, I am a dummy implementation"); } - fn as_any_mut(&mut self) -> &mut dyn std::any::Any { + fn as_partial_reflect_mut(&mut self) -> &mut dyn ::bevy::reflect::PartialReflect { panic!("This should never be called, I am a dummy implementation"); } - fn as_reflect(&self) -> &dyn ::bevy::reflect::Reflect { + fn try_into_reflect(self: Box) -> std::result::Result, std::boxed::Box<(dyn bevy::prelude::PartialReflect + 'static)>> { panic!("This should never be called, I am a dummy implementation"); } - fn as_reflect_mut(&mut self) -> &mut dyn ::bevy::reflect::Reflect { + fn try_as_reflect(&self) -> std::option::Option<&(dyn bevy::prelude::Reflect + 'static)> { panic!("This should never be called, I am a dummy implementation"); } - fn apply(&mut self, _: &dyn ::bevy::reflect::Reflect) { + fn try_as_reflect_mut(&mut self) -> std::option::Option<&mut (dyn bevy::prelude::Reflect + 'static)> { panic!("This should never be called, I am a dummy implementation"); } - fn set(&mut self, _: Box) -> Result<(), Box> { + fn try_apply(&mut self, _value: &dyn ::bevy::prelude::PartialReflect) -> std::result::Result<(), ::bevy::reflect::ApplyError> { panic!("This should never be called, I am a dummy implementation"); } - fn reflect_ref(&self) -> bevy::reflect::ReflectRef { + fn reflect_ref(&self) -> ::bevy::reflect::ReflectRef { panic!("This should never be called, I am a dummy implementation"); } - fn reflect_mut(&mut self) -> bevy::reflect::ReflectMut { + fn reflect_mut(&mut self) -> ::bevy::reflect::ReflectMut { panic!("This should never be called, I am a dummy implementation"); } - fn clone_value(&self) -> Box { + fn reflect_owned(self: Box) -> ::bevy::reflect::ReflectOwned { panic!("This should never be called, I am a dummy implementation"); } - fn into_reflect(self: Box) -> Box { + fn clone_value(&self) -> Box { panic!("This should never be called, I am a dummy implementation"); } + } - fn reflect_owned(self: Box) -> ::bevy::reflect::ReflectOwned { + + impl ::bevy::reflect::Reflect for $name { + + fn into_any(self: Box) -> Box { panic!("This should never be called, I am a dummy implementation"); } - fn get_represented_type_info(&self) -> std::option::Option<&'static bevy::reflect::TypeInfo> { + fn as_any(&self) -> &dyn std::any::Any { + panic!("This should never be called, I am a dummy implementation"); + } + + fn as_any_mut(&mut self) -> &mut dyn std::any::Any { + panic!("This should never be called, I am a dummy implementation"); + } + + fn as_reflect(&self) -> &dyn ::bevy::reflect::Reflect { + panic!("This should never be called, I am a dummy implementation"); + } + + fn as_reflect_mut(&mut self) -> &mut dyn ::bevy::reflect::Reflect { + panic!("This should never be called, I am a dummy implementation"); + } + + fn set(&mut self, _: Box) -> Result<(), Box> { + panic!("This should never be called, I am a dummy implementation"); + } + + fn into_reflect(self: Box) -> Box { panic!("This should never be called, I am a dummy implementation"); } } impl ::bevy::reflect::FromReflect for $name { - fn from_reflect(_: &(dyn bevy::prelude::Reflect + 'static)) -> std::option::Option { + fn from_reflect(_: &(dyn bevy::prelude::PartialReflect + 'static)) -> std::option::Option { panic!("This should never be called, I am a dummy implementation"); } + } impl ::bevy::reflect::GetTypeRegistration for $name { diff --git a/crates/bevy_script_api/src/providers/bevy_a11y.rs b/crates/bevy_script_api/src/providers/bevy_a11y.rs new file mode 100644 index 0000000000..b6ef3788e4 --- /dev/null +++ b/crates/bevy_script_api/src/providers/bevy_a11y.rs @@ -0,0 +1,69 @@ +// @generated by cargo bevy-api-gen generate, modify the templates not this file +#![allow(clippy::all)] +#![allow(unused, deprecated, dead_code)] +#![cfg_attr(rustfmt, rustfmt_skip)] +use super::bevy_ecs::*; +use super::bevy_reflect::*; +extern crate self as bevy_script_api; +use bevy_script_api::{ + lua::RegisterForeignLuaType, ReflectedValue, common::bevy::GetWorld, +}; +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy(derive(), remote = "bevy::a11y::Focus", functions[])] +struct Focus(ReflectedValue); +#[derive(Default)] +pub(crate) struct Globals; +impl bevy_mod_scripting_lua::tealr::mlu::ExportInstances for Globals { + fn add_instances< + 'lua, + T: bevy_mod_scripting_lua::tealr::mlu::InstanceCollector<'lua>, + >(self, instances: &mut T) -> bevy_mod_scripting_lua::tealr::mlu::mlua::Result<()> { + Ok(()) + } +} +pub struct BevyA11YAPIProvider; +impl bevy_mod_scripting_core::hosts::APIProvider for BevyA11YAPIProvider { + type APITarget = std::sync::Mutex; + type ScriptContext = std::sync::Mutex; + type DocTarget = bevy_mod_scripting_lua::docs::LuaDocFragment; + fn attach_api( + &mut self, + ctx: &mut Self::APITarget, + ) -> Result<(), bevy_mod_scripting_core::error::ScriptError> { + let ctx = ctx.get_mut().expect("Unable to acquire lock on Lua context"); + bevy_mod_scripting_lua::tealr::mlu::set_global_env(Globals, ctx) + .map_err(|e| bevy_mod_scripting_core::error::ScriptError::Other( + e.to_string(), + )) + } + fn get_doc_fragment(&self) -> Option { + Some( + bevy_mod_scripting_lua::docs::LuaDocFragment::new( + "BevyA11YAPI", + |tw| { + tw.document_global_instance::() + .expect("Something went wrong documenting globals") + .process_type::() + }, + ), + ) + } + fn setup_script( + &mut self, + script_data: &bevy_mod_scripting_core::hosts::ScriptData, + ctx: &mut Self::ScriptContext, + ) -> Result<(), bevy_mod_scripting_core::error::ScriptError> { + Ok(()) + } + fn setup_script_runtime( + &mut self, + world_ptr: bevy_mod_scripting_core::world::WorldPointer, + _script_data: &bevy_mod_scripting_core::hosts::ScriptData, + ctx: &mut Self::ScriptContext, + ) -> Result<(), bevy_mod_scripting_core::error::ScriptError> { + Ok(()) + } + fn register_with_app(&self, app: &mut bevy::app::App) { + app.register_foreign_lua_type::(); + } +} diff --git a/crates/bevy_script_api/src/providers/bevy_ecs.rs b/crates/bevy_script_api/src/providers/bevy_ecs.rs index 465b5fa8e3..003a862146 100644 --- a/crates/bevy_script_api/src/providers/bevy_ecs.rs +++ b/crates/bevy_script_api/src/providers/bevy_ecs.rs @@ -85,38 +85,73 @@ use bevy_script_api::{ r#" #[lua(kind="MetaMethod", metamethod="ToString")] fn index(&self) -> String { - format!("{}", _self) + format!("{:?}", _self) } "#] )] struct Entity {} #[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy(derive(), remote = "bevy::ecs::world::OnAdd", functions[])] +#[proxy( + derive(), + remote = "bevy::ecs::world::OnAdd", + functions[r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] struct OnAdd {} #[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy(derive(), remote = "bevy::ecs::world::OnInsert", functions[])] +#[proxy( + derive(), + remote = "bevy::ecs::world::OnInsert", + functions[r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] struct OnInsert {} #[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy(derive(), remote = "bevy::ecs::world::OnRemove", functions[])] +#[proxy( + derive(), + remote = "bevy::ecs::world::OnRemove", + functions[r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] struct OnRemove {} #[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(), + remote = "bevy::ecs::world::OnReplace", + functions[r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct OnReplace {} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] #[proxy( derive(clone), remote = "bevy::ecs::component::ComponentId", functions[r#" -/// Creates a new [`ComponentId`]. -/// The `index` is a unique value associated with each type of component in a given world. -/// Usually, this value is taken from a counter incremented for each type of component registered with the world. - #[lua(kind = "Function", output(proxy))] - fn new(index: usize) -> bevy::ecs::component::ComponentId; + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); "#, r#" -/// Returns the index of the current component. - #[lua(kind = "Method")] - fn index(self) -> usize; + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::ecs::component::ComponentId; "#, r#" @@ -131,15 +166,19 @@ struct OnRemove {} "#, r#" +/// Creates a new [`ComponentId`]. +/// The `index` is a unique value associated with each type of component in a given world. +/// Usually, this value is taken from a counter incremented for each type of component registered with the world. - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::ecs::component::ComponentId; + #[lua(kind = "Function", output(proxy))] + fn new(index: usize) -> bevy::ecs::component::ComponentId; "#, r#" +/// Returns the index of the current component. - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(kind = "Method")] + fn index(self) -> usize; "#, r#" @@ -156,13 +195,8 @@ struct ComponentId(); remote = "bevy::ecs::component::Tick", functions[r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &component::Tick) -> bool; + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); "#, r#" @@ -208,8 +242,13 @@ struct ComponentId(); "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &component::Tick) -> bool; "#, r#" @@ -311,12 +350,6 @@ struct ComponentTicks {} )] fn eq(&self, #[proxy] other: &identifier::Identifier) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::ecs::identifier::Identifier; - "#, r#" /// Returns the value of the low segment of the [`Identifier`]. @@ -348,6 +381,12 @@ struct ComponentTicks {} #[lua(kind = "Function", output(proxy))] fn from_bits(value: u64) -> bevy::ecs::identifier::Identifier; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::ecs::identifier::Identifier; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -369,6 +408,27 @@ struct Identifier {} "#] )] struct EntityHash {} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::ecs::removal_detection::RemovedComponentEntity", + functions[r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::ecs::removal_detection::RemovedComponentEntity; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct RemovedComponentEntity(); +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy(derive(), remote = "bevy::ecs::system::SystemIdMarker", functions[])] +struct SystemIdMarker {} #[derive(Default)] pub(crate) struct Globals; impl bevy_mod_scripting_lua::tealr::mlu::ExportInstances for Globals { @@ -428,6 +488,7 @@ impl bevy_mod_scripting_core::hosts::APIProvider for BevyEcsAPIProvider { .process_type::() .process_type::() .process_type::() + .process_type::() .process_type::() .process_type::< bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< @@ -446,6 +507,8 @@ impl bevy_mod_scripting_core::hosts::APIProvider for BevyEcsAPIProvider { >, >() .process_type::() + .process_type::() + .process_type::() }, ), ) @@ -470,10 +533,15 @@ impl bevy_mod_scripting_core::hosts::APIProvider for BevyEcsAPIProvider { app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); + app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); + app.register_foreign_lua_type::< + bevy::ecs::removal_detection::RemovedComponentEntity, + >(); + app.register_foreign_lua_type::(); } } diff --git a/crates/bevy_script_api/src/providers/bevy_hierarchy.rs b/crates/bevy_script_api/src/providers/bevy_hierarchy.rs index e064a5cc5f..e1bfc68d25 100644 --- a/crates/bevy_script_api/src/providers/bevy_hierarchy.rs +++ b/crates/bevy_script_api/src/providers/bevy_hierarchy.rs @@ -33,11 +33,46 @@ struct Children(); derive(), remote = "bevy::hierarchy::prelude::Parent", functions[r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &components::parent::Parent) -> bool; + +"#, + r#" /// Gets the [`Entity`] ID of the parent. #[lua(kind = "Method", output(proxy))] fn get(&self) -> bevy::ecs::entity::Entity; +"#, + r#" + + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct Parent(); +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::hierarchy::HierarchyEvent", + functions[r#" + + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); + "#, r#" @@ -47,13 +82,13 @@ struct Children(); composite = "eq", metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &components::parent::Parent) -> bool; + fn eq(&self, #[proxy] other: &events::HierarchyEvent) -> bool; "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::hierarchy::HierarchyEvent; "#, r#" @@ -63,7 +98,7 @@ fn index(&self) -> String { } "#] )] -struct Parent(); +struct HierarchyEvent {} #[derive(Default)] pub(crate) struct Globals; impl bevy_mod_scripting_lua::tealr::mlu::ExportInstances for Globals { @@ -98,6 +133,7 @@ impl bevy_mod_scripting_core::hosts::APIProvider for BevyHierarchyAPIProvider { .expect("Something went wrong documenting globals") .process_type::() .process_type::() + .process_type::() }, ), ) @@ -120,5 +156,6 @@ impl bevy_mod_scripting_core::hosts::APIProvider for BevyHierarchyAPIProvider { fn register_with_app(&self, app: &mut bevy::app::App) { app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); + app.register_foreign_lua_type::(); } } diff --git a/crates/bevy_script_api/src/providers/bevy_input.rs b/crates/bevy_script_api/src/providers/bevy_input.rs index d06224cc9a..973bde558b 100644 --- a/crates/bevy_script_api/src/providers/bevy_input.rs +++ b/crates/bevy_script_api/src/providers/bevy_input.rs @@ -11,96 +11,76 @@ use bevy_script_api::{ }; #[derive(bevy_mod_scripting_lua_derive::LuaProxy)] #[proxy( - derive(clone), + derive(), remote = "bevy::input::gamepad::Gamepad", - functions[r#" + functions[ + // r#" +// /// Returns the USB vendor ID as assigned by the USB-IF, if available. - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); +// #[lua(kind = "Method")] +// fn vendor_id(&self) -> std::option::Option; -"#, - r#" +// "#, +// r#" +// /// Returns the USB product ID as assigned by the [vendor], if available. +// /// [vendor]: Self::vendor_id - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::gamepad::Gamepad; +// #[lua(kind = "Method")] +// fn product_id(&self) -> std::option::Option; -"#, +// "#, r#" +/// Returns the left stick as a [`Vec2`] - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &gamepad::Gamepad) -> bool; + #[lua(kind = "Method", output(proxy))] + fn left_stick(&self) -> bevy::math::Vec2; "#, r#" -/// Creates a new [`Gamepad`]. +/// Returns the right stick as a [`Vec2`] - #[lua(kind = "Function", output(proxy))] - fn new(id: usize) -> bevy::input::gamepad::Gamepad; + #[lua(kind = "Method", output(proxy))] + fn right_stick(&self) -> bevy::math::Vec2; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct Gamepad { - id: usize, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::input::gamepad::GamepadAxis", - functions[r#" +/// Returns the directional pad as a [`Vec2`] - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &gamepad::GamepadAxis) -> bool; + #[lua(kind = "Method", output(proxy))] + fn dpad(&self) -> bevy::math::Vec2; "#, - r#" -/// Creates a new [`GamepadAxis`]. -/// # Examples -/// ``` -/// # use bevy_input::gamepad::{GamepadAxis, GamepadAxisType, Gamepad}; -/// # -/// let gamepad_axis = GamepadAxis::new( -/// Gamepad::new(1), -/// GamepadAxisType::LeftStickX, -/// ); -/// ``` +// r#" +// /// Returns `true` if the [`GamepadButton`] has been pressed. - #[lua(kind = "Function", output(proxy))] - fn new( - #[proxy] - gamepad: bevy::input::gamepad::Gamepad, - #[proxy] - axis_type: bevy::input::gamepad::GamepadAxisType, - ) -> bevy::input::gamepad::GamepadAxis; +// #[lua(kind = "Method")] +// fn pressed(&self, #[proxy] button_type: bevy::input::gamepad::GamepadButton) -> bool; -"#, - r#" +// "#, +// r#" +// /// Returns `true` if the [`GamepadButton`] has been pressed during the current frame. +// /// Note: This function does not imply information regarding the current state of [`ButtonInput::pressed`] or [`ButtonInput::just_released`]. - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::gamepad::GamepadAxis; +// #[lua(kind = "Method")] +// fn just_pressed( +// &self, +// #[proxy] +// button_type: bevy::input::gamepad::GamepadButton, +// ) -> bool; -"#, - r#" +// "#, +// r#" +// /// Returns `true` if the [`GamepadButton`] has been released during the current frame. +// /// Note: This function does not imply information regarding the current state of [`ButtonInput::pressed`] or [`ButtonInput::just_pressed`]. - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); +// #[lua(kind = "Method")] +// fn just_released( +// &self, +// #[proxy] +// button_type: bevy::input::gamepad::GamepadButton, +// ) -> bool; -"#, +// "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] fn index(&self) -> String { @@ -108,21 +88,22 @@ fn index(&self) -> String { } "#] )] -struct GamepadAxis { - #[lua(output(proxy))] - gamepad: bevy::input::gamepad::Gamepad, - #[lua(output(proxy))] - axis_type: bevy::input::gamepad::GamepadAxisType, -} +struct Gamepad {} #[derive(bevy_mod_scripting_lua_derive::LuaProxy)] #[proxy( derive(clone), - remote = "bevy::input::gamepad::GamepadAxisType", + remote = "bevy::input::gamepad::GamepadAxis", functions[r#" #[lua(as_trait = "std::cmp::Eq", kind = "Method")] fn assert_receiver_is_total_eq(&self) -> (); +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::gamepad::GamepadAxis; + "#, r#" @@ -132,13 +113,7 @@ struct GamepadAxis { composite = "eq", metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &gamepad::GamepadAxisType) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::gamepad::GamepadAxisType; + fn eq(&self, #[proxy] other: &gamepad::GamepadAxis) -> bool; "#, r#" @@ -148,7 +123,7 @@ fn index(&self) -> String { } "#] )] -struct GamepadAxisType {} +struct GamepadAxis {} #[derive(bevy_mod_scripting_lua_derive::LuaProxy)] #[proxy( derive(clone), @@ -175,27 +150,6 @@ struct GamepadAxisType {} #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] fn clone(&self) -> bevy::input::gamepad::GamepadButton; -"#, - r#" -/// Creates a new [`GamepadButton`]. -/// # Examples -/// ``` -/// # use bevy_input::gamepad::{GamepadButton, GamepadButtonType, Gamepad}; -/// # -/// let gamepad_button = GamepadButton::new( -/// Gamepad::new(1), -/// GamepadButtonType::South, -/// ); -/// ``` - - #[lua(kind = "Function", output(proxy))] - fn new( - #[proxy] - gamepad: bevy::input::gamepad::Gamepad, - #[proxy] - button_type: bevy::input::gamepad::GamepadButtonType, - ) -> bevy::input::gamepad::GamepadButton; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -204,37 +158,15 @@ fn index(&self) -> String { } "#] )] -struct GamepadButton { - #[lua(output(proxy))] - gamepad: bevy::input::gamepad::Gamepad, - #[lua(output(proxy))] - button_type: bevy::input::gamepad::GamepadButtonType, -} +struct GamepadButton {} #[derive(bevy_mod_scripting_lua_derive::LuaProxy)] #[proxy( derive(clone), - remote = "bevy::input::gamepad::GamepadButtonType", + remote = "bevy::input::gamepad::GamepadSettings", functions[r#" #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::gamepad::GamepadButtonType; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &gamepad::GamepadButtonType) -> bool; + fn clone(&self) -> bevy::input::gamepad::GamepadSettings; "#, r#" @@ -244,7 +176,17 @@ fn index(&self) -> String { } "#] )] -struct GamepadButtonType {} +struct GamepadSettings { + #[lua(output(proxy))] + default_button_settings: bevy::input::gamepad::ButtonSettings, + #[lua(output(proxy))] + default_axis_settings: bevy::input::gamepad::AxisSettings, + #[lua(output(proxy))] + default_button_axis_settings: bevy::input::gamepad::ButtonAxisSettings, + button_settings: ReflectedValue, + axis_settings: ReflectedValue, + button_axis_settings: ReflectedValue, +} #[derive(bevy_mod_scripting_lua_derive::LuaProxy)] #[proxy( derive(clone), @@ -254,6 +196,12 @@ struct GamepadButtonType {} #[lua(as_trait = "std::cmp::Eq", kind = "Method")] fn assert_receiver_is_total_eq(&self) -> (); +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::keyboard::KeyCode; + "#, r#" @@ -265,12 +213,6 @@ struct GamepadButtonType {} )] fn eq(&self, #[proxy] other: &keyboard::KeyCode) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::keyboard::KeyCode; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -362,12 +304,6 @@ struct TouchInput { #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] fn clone(&self) -> bevy::input::keyboard::KeyboardFocusLost; -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - "#, r#" @@ -379,6 +315,12 @@ struct TouchInput { )] fn eq(&self, #[proxy] other: &keyboard::KeyboardFocusLost) -> bool; +"#, + r#" + + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -394,6 +336,12 @@ struct KeyboardFocusLost {} remote = "bevy::input::keyboard::KeyboardInput", functions[r#" + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::keyboard::KeyboardInput; + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -408,12 +356,6 @@ struct KeyboardFocusLost {} #[lua(as_trait = "std::cmp::Eq", kind = "Method")] fn assert_receiver_is_total_eq(&self) -> (); -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::keyboard::KeyboardInput; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -429,27 +371,82 @@ struct KeyboardInput { logical_key: bevy::input::keyboard::Key, #[lua(output(proxy))] state: bevy::input::ButtonState, + repeat: bool, #[lua(output(proxy))] window: bevy::ecs::entity::Entity, } #[derive(bevy_mod_scripting_lua_derive::LuaProxy)] #[proxy( derive(clone), - remote = "bevy::input::mouse::MouseButtonInput", + remote = "bevy::input::mouse::AccumulatedMouseMotion", functions[r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::mouse::AccumulatedMouseMotion; + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &mouse::AccumulatedMouseMotion) -> bool; "#, r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct AccumulatedMouseMotion { + #[lua(output(proxy))] + delta: bevy::math::Vec2, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::input::mouse::AccumulatedMouseScroll", + functions[r#" #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::mouse::MouseButtonInput; + fn clone(&self) -> bevy::input::mouse::AccumulatedMouseScroll; "#, r#" + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &mouse::AccumulatedMouseScroll) -> bool; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct AccumulatedMouseScroll { + #[lua(output(proxy))] + unit: bevy::input::mouse::MouseScrollUnit, + #[lua(output(proxy))] + delta: bevy::math::Vec2, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::input::mouse::MouseButtonInput", + functions[r#" + #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -458,6 +455,18 @@ struct KeyboardInput { )] fn eq(&self, #[proxy] other: &mouse::MouseButtonInput) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::mouse::MouseButtonInput; + +"#, + r#" + + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -551,6 +560,19 @@ struct MouseWheel { #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] fn clone(&self) -> bevy::input::gamepad::GamepadAxisChangedEvent; +"#, + r#" +/// Creates a new [`GamepadAxisChangedEvent`] + + #[lua(kind = "Function", output(proxy))] + fn new( + #[proxy] + entity: bevy::ecs::entity::Entity, + #[proxy] + axis: bevy::input::gamepad::GamepadAxis, + value: f32, + ) -> bevy::input::gamepad::GamepadAxisChangedEvent; + "#, r#" @@ -562,19 +584,6 @@ struct MouseWheel { )] fn eq(&self, #[proxy] other: &gamepad::GamepadAxisChangedEvent) -> bool; -"#, - r#" -/// Creates a [`GamepadAxisChangedEvent`]. - - #[lua(kind = "Function", output(proxy))] - fn new( - #[proxy] - gamepad: bevy::input::gamepad::Gamepad, - #[proxy] - axis_type: bevy::input::gamepad::GamepadAxisType, - value: f32, - ) -> bevy::input::gamepad::GamepadAxisChangedEvent; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -585,9 +594,9 @@ fn index(&self) -> String { )] struct GamepadAxisChangedEvent { #[lua(output(proxy))] - gamepad: bevy::input::gamepad::Gamepad, + entity: bevy::ecs::entity::Entity, #[lua(output(proxy))] - axis_type: bevy::input::gamepad::GamepadAxisType, + axis: bevy::input::gamepad::GamepadAxis, value: f32, } #[derive(bevy_mod_scripting_lua_derive::LuaProxy)] @@ -596,12 +605,6 @@ struct GamepadAxisChangedEvent { remote = "bevy::input::gamepad::GamepadButtonChangedEvent", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::gamepad::GamepadButtonChangedEvent; - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -612,14 +615,22 @@ struct GamepadAxisChangedEvent { "#, r#" -/// Creates a [`GamepadButtonChangedEvent`]. + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::gamepad::GamepadButtonChangedEvent; + +"#, + r#" +/// Creates a new [`GamepadButtonChangedEvent`] #[lua(kind = "Function", output(proxy))] fn new( #[proxy] - gamepad: bevy::input::gamepad::Gamepad, + entity: bevy::ecs::entity::Entity, #[proxy] - button_type: bevy::input::gamepad::GamepadButtonType, + button: bevy::input::gamepad::GamepadButton, + #[proxy] + state: bevy::input::ButtonState, value: f32, ) -> bevy::input::gamepad::GamepadButtonChangedEvent; @@ -633,19 +644,32 @@ fn index(&self) -> String { )] struct GamepadButtonChangedEvent { #[lua(output(proxy))] - gamepad: bevy::input::gamepad::Gamepad, + entity: bevy::ecs::entity::Entity, + #[lua(output(proxy))] + button: bevy::input::gamepad::GamepadButton, #[lua(output(proxy))] - button_type: bevy::input::gamepad::GamepadButtonType, + state: bevy::input::ButtonState, value: f32, } #[derive(bevy_mod_scripting_lua_derive::LuaProxy)] #[proxy( derive(clone), - remote = "bevy::input::gamepad::GamepadButtonInput", + remote = "bevy::input::gamepad::GamepadButtonStateChangedEvent", functions[r#" + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &gamepad::GamepadButtonStateChangedEvent) -> bool; + +"#, + r#" + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::gamepad::GamepadButtonInput; + fn clone(&self) -> bevy::input::gamepad::GamepadButtonStateChangedEvent; "#, r#" @@ -655,14 +679,17 @@ struct GamepadButtonChangedEvent { "#, r#" +/// Creates a new [`GamepadButtonStateChangedEvent`] - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &gamepad::GamepadButtonInput) -> bool; + #[lua(kind = "Function", output(proxy))] + fn new( + #[proxy] + entity: bevy::ecs::entity::Entity, + #[proxy] + button: bevy::input::gamepad::GamepadButton, + #[proxy] + state: bevy::input::ButtonState, + ) -> bevy::input::gamepad::GamepadButtonStateChangedEvent; "#, r#" @@ -672,7 +699,9 @@ fn index(&self) -> String { } "#] )] -struct GamepadButtonInput { +struct GamepadButtonStateChangedEvent { + #[lua(output(proxy))] + entity: bevy::ecs::entity::Entity, #[lua(output(proxy))] button: bevy::input::gamepad::GamepadButton, #[lua(output(proxy))] @@ -681,31 +710,43 @@ struct GamepadButtonInput { #[derive(bevy_mod_scripting_lua_derive::LuaProxy)] #[proxy( derive(clone), - remote = "bevy::input::gamepad::GamepadConnectionEvent", + remote = "bevy::input::gamepad::GamepadConnection", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::gamepad::GamepadConnectionEvent; - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", composite = "eq", metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &gamepad::GamepadConnectionEvent) -> bool; + fn eq(&self, #[proxy] other: &gamepad::GamepadConnection) -> bool; + +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::gamepad::GamepadConnection; "#, r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct GamepadConnection {} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::input::gamepad::GamepadConnectionEvent", + functions[r#" /// Creates a [`GamepadConnectionEvent`]. #[lua(kind = "Function", output(proxy))] fn new( #[proxy] - gamepad: bevy::input::gamepad::Gamepad, + gamepad: bevy::ecs::entity::Entity, #[proxy] connection: bevy::input::gamepad::GamepadConnection, ) -> bevy::input::gamepad::GamepadConnectionEvent; @@ -724,6 +765,23 @@ struct GamepadButtonInput { #[lua(kind = "Method")] fn disconnected(&self) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::gamepad::GamepadConnectionEvent; + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &gamepad::GamepadConnectionEvent) -> bool; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -734,7 +792,7 @@ fn index(&self) -> String { )] struct GamepadConnectionEvent { #[lua(output(proxy))] - gamepad: bevy::input::gamepad::Gamepad, + gamepad: bevy::ecs::entity::Entity, #[lua(output(proxy))] connection: bevy::input::gamepad::GamepadConnection, } @@ -744,9 +802,77 @@ struct GamepadConnectionEvent { remote = "bevy::input::gamepad::GamepadEvent", functions[r#" + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &gamepad::GamepadEvent) -> bool; + +"#, + r#" + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] fn clone(&self) -> bevy::input::gamepad::GamepadEvent; +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct GamepadEvent {} +// #[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +// #[proxy( +// derive(clone), +// remote = "bevy::input::gamepad::GamepadInfo", +// functions[r#" + +// #[lua( +// as_trait = "std::cmp::PartialEq", +// kind = "MetaFunction", +// composite = "eq", +// metamethod = "Eq", +// )] +// fn eq(&self, #[proxy] other: &gamepad::GamepadInfo) -> bool; + +// "#, +// r#" + +// #[lua(as_trait = "std::cmp::Eq", kind = "Method")] +// fn assert_receiver_is_total_eq(&self) -> (); + +// "#, +// r#" + +// #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] +// fn clone(&self) -> bevy::input::gamepad::GamepadInfo; + +// "#, +// r#" +// #[lua(kind="MetaMethod", metamethod="ToString")] +// fn index(&self) -> String { +// format!("{:?}", _self) +// } +// "#] +// )] +// struct GamepadInfo { +// name: std::string::String, +// vendor_id: std::option::Option, +// product_id: std::option::Option, +// } +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::input::gamepad::GamepadInput", + functions[r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::gamepad::GamepadInput; + "#, r#" @@ -756,7 +882,13 @@ struct GamepadConnectionEvent { composite = "eq", metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &gamepad::GamepadEvent) -> bool; + fn eq(&self, #[proxy] other: &gamepad::GamepadInput) -> bool; + +"#, + r#" + + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); "#, r#" @@ -766,29 +898,151 @@ fn index(&self) -> String { } "#] )] -struct GamepadEvent {} +struct GamepadInput {} #[derive(bevy_mod_scripting_lua_derive::LuaProxy)] #[proxy( - derive(), - remote = "bevy::input::gamepad::GamepadSettings", + derive(clone), + remote = "bevy::input::gamepad::GamepadRumbleRequest", + functions[r#" +/// Get the [`Entity`] associated with this request. + + #[lua(kind = "Method", output(proxy))] + fn gamepad(&self) -> bevy::ecs::entity::Entity; + +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::gamepad::GamepadRumbleRequest; + +"#] +)] +struct GamepadRumbleRequest {} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::input::gamepad::RawGamepadAxisChangedEvent", functions[r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::gamepad::RawGamepadAxisChangedEvent; + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &gamepad::RawGamepadAxisChangedEvent) -> bool; + +"#, + r#" +/// Creates a [`RawGamepadAxisChangedEvent`]. + + #[lua(kind = "Function", output(proxy))] + fn new( + #[proxy] + gamepad: bevy::ecs::entity::Entity, + #[proxy] + axis_type: bevy::input::gamepad::GamepadAxis, + value: f32, + ) -> bevy::input::gamepad::RawGamepadAxisChangedEvent; + +"#, + r#" #[lua(kind="MetaMethod", metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct GamepadSettings { +struct RawGamepadAxisChangedEvent { #[lua(output(proxy))] - default_button_settings: bevy::input::gamepad::ButtonSettings, + gamepad: bevy::ecs::entity::Entity, #[lua(output(proxy))] - default_axis_settings: bevy::input::gamepad::AxisSettings, + axis: bevy::input::gamepad::GamepadAxis, + value: f32, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::input::gamepad::RawGamepadButtonChangedEvent", + functions[r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::gamepad::RawGamepadButtonChangedEvent; + +"#, + r#" +/// Creates a [`RawGamepadButtonChangedEvent`]. + + #[lua(kind = "Function", output(proxy))] + fn new( + #[proxy] + gamepad: bevy::ecs::entity::Entity, + #[proxy] + button_type: bevy::input::gamepad::GamepadButton, + value: f32, + ) -> bevy::input::gamepad::RawGamepadButtonChangedEvent; + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &gamepad::RawGamepadButtonChangedEvent) -> bool; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct RawGamepadButtonChangedEvent { #[lua(output(proxy))] - default_button_axis_settings: bevy::input::gamepad::ButtonAxisSettings, - button_settings: ReflectedValue, - axis_settings: ReflectedValue, - button_axis_settings: ReflectedValue, + gamepad: bevy::ecs::entity::Entity, + #[lua(output(proxy))] + button: bevy::input::gamepad::GamepadButton, + value: f32, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::input::gamepad::RawGamepadEvent", + functions[r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::gamepad::RawGamepadEvent; + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &gamepad::RawGamepadEvent) -> bool; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) } +"#] +)] +struct RawGamepadEvent {} #[derive(bevy_mod_scripting_lua_derive::LuaProxy)] #[proxy( derive(clone), @@ -824,6 +1078,12 @@ struct PinchGesture(f32); remote = "bevy::input::gestures::RotationGesture", functions[r#" + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::gestures::RotationGesture; + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -832,12 +1092,6 @@ struct PinchGesture(f32); )] fn eq(&self, #[proxy] other: &gestures::RotationGesture) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::gestures::RotationGesture; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -853,6 +1107,12 @@ struct RotationGesture(f32); remote = "bevy::input::gestures::DoubleTapGesture", functions[r#" + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::gestures::DoubleTapGesture; + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -861,12 +1121,6 @@ struct RotationGesture(f32); )] fn eq(&self, #[proxy] other: &gestures::DoubleTapGesture) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::gestures::DoubleTapGesture; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -882,12 +1136,6 @@ struct DoubleTapGesture {} remote = "bevy::input::gestures::PanGesture", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::gestures::PanGesture; - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -896,6 +1144,12 @@ struct DoubleTapGesture {} )] fn eq(&self, #[proxy] other: &gestures::PanGesture) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::gestures::PanGesture; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -911,25 +1165,14 @@ struct PanGesture(#[lua(output(proxy))] bevy::math::Vec2); remote = "bevy::input::ButtonState", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::ButtonState; - -"#, - r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] fn assert_receiver_is_total_eq(&self) -> (); "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &ButtonState) -> bool; + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::ButtonState; "#, r#" @@ -938,24 +1181,6 @@ struct PanGesture(#[lua(output(proxy))] bevy::math::Vec2); #[lua(kind = "Method")] fn is_pressed(&self) -> bool; -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct ButtonState {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::input::gamepad::GamepadInfo", - functions[r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - "#, r#" @@ -965,13 +1190,7 @@ struct ButtonState {} composite = "eq", metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &gamepad::GamepadInfo) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::gamepad::GamepadInfo; + fn eq(&self, #[proxy] other: &ButtonState) -> bool; "#, r#" @@ -981,14 +1200,18 @@ fn index(&self) -> String { } "#] )] -struct GamepadInfo { - name: std::string::String, -} +struct ButtonState {} #[derive(bevy_mod_scripting_lua_derive::LuaProxy)] #[proxy( derive(clone), remote = "bevy::input::gamepad::ButtonSettings", functions[r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::gamepad::ButtonSettings; + +"#, + r#" /// Returns `true` if the button is pressed. /// A button is considered pressed if the `value` passed is greater than or equal to the press threshold. @@ -1038,8 +1261,13 @@ struct GamepadInfo { "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::gamepad::ButtonSettings; + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &gamepad::ButtonSettings) -> bool; "#, r#" @@ -1064,12 +1292,6 @@ struct ButtonSettings {} )] fn eq(&self, #[proxy] other: &gamepad::AxisSettings) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::gamepad::AxisSettings; - "#, r#" /// Get the value above which inputs will be rounded up to 1.0. @@ -1174,6 +1396,12 @@ struct ButtonSettings {} old_value: std::option::Option, ) -> std::option::Option; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::gamepad::AxisSettings; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -1188,6 +1416,12 @@ struct AxisSettings {} derive(clone), remote = "bevy::input::gamepad::ButtonAxisSettings", functions[r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::gamepad::ButtonAxisSettings; + +"#, + r#" /// Filters the `new_value` based on the `old_value`, according to the [`ButtonAxisSettings`]. /// Returns the clamped `new_value`, according to the [`ButtonAxisSettings`], if the change /// exceeds the settings threshold, and `None` otherwise. @@ -1199,12 +1433,6 @@ struct AxisSettings {} old_value: std::option::Option, ) -> std::option::Option; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::gamepad::ButtonAxisSettings; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -1221,11 +1449,21 @@ struct ButtonAxisSettings { #[derive(bevy_mod_scripting_lua_derive::LuaProxy)] #[proxy( derive(clone), - remote = "bevy::input::gamepad::GamepadConnection", + remote = "bevy::input::gamepad::GamepadRumbleIntensity", functions[r#" +/// Creates a new rumble intensity with weak motor intensity set to the given value. +/// Clamped within the `0.0` to `1.0` range. - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::gamepad::GamepadConnection; + #[lua(kind = "Function", output(proxy))] + fn weak_motor(intensity: f32) -> bevy::input::gamepad::GamepadRumbleIntensity; + +"#, + r#" +/// Creates a new rumble intensity with strong motor intensity set to the given value. +/// Clamped within the `0.0` to `1.0` range. + + #[lua(kind = "Function", output(proxy))] + fn strong_motor(intensity: f32) -> bevy::input::gamepad::GamepadRumbleIntensity; "#, r#" @@ -1236,7 +1474,13 @@ struct ButtonAxisSettings { composite = "eq", metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &gamepad::GamepadConnection) -> bool; + fn eq(&self, #[proxy] other: &gamepad::GamepadRumbleIntensity) -> bool; + +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::gamepad::GamepadRumbleIntensity; "#, r#" @@ -1246,13 +1490,22 @@ fn index(&self) -> String { } "#] )] -struct GamepadConnection {} +struct GamepadRumbleIntensity { + strong_motor: f32, + weak_motor: f32, +} #[derive(bevy_mod_scripting_lua_derive::LuaProxy)] #[proxy( derive(clone), remote = "bevy::input::keyboard::Key", functions[r#" + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::keyboard::Key; + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -1267,12 +1520,6 @@ struct GamepadConnection {} #[lua(as_trait = "std::cmp::Eq", kind = "Method")] fn assert_receiver_is_total_eq(&self) -> (); -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::keyboard::Key; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -1288,6 +1535,12 @@ struct Key {} remote = "bevy::input::keyboard::NativeKeyCode", functions[r#" + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); + +"#, + r#" + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] fn clone(&self) -> bevy::input::keyboard::NativeKeyCode; @@ -1302,12 +1555,6 @@ struct Key {} )] fn eq(&self, #[proxy] other: &keyboard::NativeKeyCode) -> bool; -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -1323,8 +1570,8 @@ struct NativeKeyCode {} remote = "bevy::input::keyboard::NativeKey", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::keyboard::NativeKey; + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); "#, r#" @@ -1340,8 +1587,8 @@ struct NativeKeyCode {} "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::keyboard::NativeKey; "#, r#" @@ -1396,6 +1643,12 @@ struct MouseScrollUnit {} #[lua(as_trait = "std::cmp::Eq", kind = "Method")] fn assert_receiver_is_total_eq(&self) -> (); +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::touch::TouchPhase; + "#, r#" @@ -1407,12 +1660,6 @@ struct MouseScrollUnit {} )] fn eq(&self, #[proxy] other: &touch::TouchPhase) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::touch::TouchPhase; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -1428,6 +1675,12 @@ struct TouchPhase {} remote = "bevy::input::touch::ForceTouch", functions[r#" + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::touch::ForceTouch; + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -1436,12 +1689,6 @@ struct TouchPhase {} )] fn eq(&self, #[proxy] other: &touch::ForceTouch) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::touch::ForceTouch; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -1460,40 +1707,51 @@ impl bevy_mod_scripting_lua::tealr::mlu::ExportInstances for Globals { >(self, instances: &mut T) -> bevy_mod_scripting_lua::tealr::mlu::mlua::Result<()> { instances .add_instance( - "Gamepad", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + "GamepadAxisChangedEvent", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::< + LuaGamepadAxisChangedEvent, + >::new, )?; instances .add_instance( - "GamepadAxis", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + "GamepadButtonChangedEvent", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::< + LuaGamepadButtonChangedEvent, + >::new, )?; instances .add_instance( - "GamepadButton", + "GamepadButtonStateChangedEvent", bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::< - LuaGamepadButton, + LuaGamepadButtonStateChangedEvent, >::new, )?; instances .add_instance( - "GamepadAxisChangedEvent", + "GamepadConnectionEvent", bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::< - LuaGamepadAxisChangedEvent, + LuaGamepadConnectionEvent, >::new, )?; instances .add_instance( - "GamepadButtonChangedEvent", + "RawGamepadAxisChangedEvent", bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::< - LuaGamepadButtonChangedEvent, + LuaRawGamepadAxisChangedEvent, >::new, )?; instances .add_instance( - "GamepadConnectionEvent", + "RawGamepadButtonChangedEvent", bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::< - LuaGamepadConnectionEvent, + LuaRawGamepadButtonChangedEvent, + >::new, + )?; + instances + .add_instance( + "GamepadRumbleIntensity", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::< + LuaGamepadRumbleIntensity, >::new, )?; Ok(()) @@ -1522,28 +1780,16 @@ impl bevy_mod_scripting_core::hosts::APIProvider for BevyInputAPIProvider { tw.document_global_instance::() .expect("Something went wrong documenting globals") .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaGamepadAxis, - >, - >() - .process_type::() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaGamepadButton, - >, - >() - .process_type::() + .process_type::() .process_type::() .process_type::() .process_type::() .process_type::() .process_type::() + .process_type::() + .process_type::() .process_type::() .process_type::() .process_type::() @@ -1559,7 +1805,13 @@ impl bevy_mod_scripting_core::hosts::APIProvider for BevyInputAPIProvider { LuaGamepadButtonChangedEvent, >, >() - .process_type::() + .process_type::() + .process_type::< + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< + LuaGamepadButtonStateChangedEvent, + >, + >() + .process_type::() .process_type::() .process_type::< bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< @@ -1567,17 +1819,36 @@ impl bevy_mod_scripting_core::hosts::APIProvider for BevyInputAPIProvider { >, >() .process_type::() - .process_type::() + // .process_type::() + .process_type::() + .process_type::() + .process_type::() + .process_type::< + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< + LuaRawGamepadAxisChangedEvent, + >, + >() + .process_type::() + .process_type::< + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< + LuaRawGamepadButtonChangedEvent, + >, + >() + .process_type::() .process_type::() .process_type::() .process_type::() .process_type::() .process_type::() - .process_type::() .process_type::() .process_type::() .process_type::() - .process_type::() + .process_type::() + .process_type::< + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< + LuaGamepadRumbleIntensity, + >, + >() .process_type::() .process_type::() .process_type::() @@ -1606,14 +1877,15 @@ impl bevy_mod_scripting_core::hosts::APIProvider for BevyInputAPIProvider { fn register_with_app(&self, app: &mut bevy::app::App) { app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); - app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); - app.register_foreign_lua_type::(); + app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); + app.register_foreign_lua_type::(); + app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); @@ -1621,20 +1893,31 @@ impl bevy_mod_scripting_core::hosts::APIProvider for BevyInputAPIProvider { app.register_foreign_lua_type::< bevy::input::gamepad::GamepadButtonChangedEvent, >(); - app.register_foreign_lua_type::(); + app.register_foreign_lua_type::< + bevy::input::gamepad::GamepadButtonStateChangedEvent, + >(); + app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); - app.register_foreign_lua_type::(); + // app.register_foreign_lua_type::(); + app.register_foreign_lua_type::(); + app.register_foreign_lua_type::(); + app.register_foreign_lua_type::< + bevy::input::gamepad::RawGamepadAxisChangedEvent, + >(); + app.register_foreign_lua_type::< + bevy::input::gamepad::RawGamepadButtonChangedEvent, + >(); + app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); - app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); - app.register_foreign_lua_type::(); + app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); diff --git a/crates/bevy_script_api/src/providers/bevy_math.rs b/crates/bevy_script_api/src/providers/bevy_math.rs index 461fb0b5a7..62142da498 100644 --- a/crates/bevy_script_api/src/providers/bevy_math.rs +++ b/crates/bevy_script_api/src/providers/bevy_math.rs @@ -8,6 +8,70 @@ use bevy_script_api::{ lua::RegisterForeignLuaType, ReflectedValue, common::bevy::GetWorld, }; #[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::math::AspectRatio", + functions[r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::AspectRatio; + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &aspect_ratio::AspectRatio) -> bool; + +"#, + r#" +/// Returns the aspect ratio as a f32 value. + + #[lua(kind = "Method")] + fn ratio(&self) -> f32; + +"#, + r#" +/// Returns the inverse of this aspect ratio (height/width). + + #[lua(kind = "Method", output(proxy))] + fn inverse(&self) -> bevy::math::AspectRatio; + +"#, + r#" +/// Returns true if the aspect ratio represents a landscape orientation. + + #[lua(kind = "Method")] + fn is_landscape(&self) -> bool; + +"#, + r#" +/// Returns true if the aspect ratio represents a portrait orientation. + + #[lua(kind = "Method")] + fn is_portrait(&self) -> bool; + +"#, + r#" +/// Returns true if the aspect ratio is exactly square. + + #[lua(kind = "Method")] + fn is_square(&self) -> bool; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct AspectRatio(); +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] #[proxy( derive(clone), remote = "bevy::math::CompassOctant", @@ -80,25 +144,116 @@ struct CompassQuadrant {} #[derive(bevy_mod_scripting_lua_derive::LuaProxy)] #[proxy( derive(clone), - remote = "bevy::math::AspectRatio", + remote = "bevy::math::Isometry2d", functions[r#" -/// Create a new `AspectRatio` from a given `width` and `height`. + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: bevy::math::prelude::Vec2) -> bevy::math::prelude::Vec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: bevy::math::Isometry2d) -> bevy::math::Isometry2d; + +"#, + r#" +/// Create a two-dimensional isometry from a rotation and a translation. #[lua(kind = "Function", output(proxy))] - fn new(width: f32, height: f32) -> bevy::math::AspectRatio; + fn new( + #[proxy] + translation: bevy::math::prelude::Vec2, + #[proxy] + rotation: bevy::math::Rot2, + ) -> bevy::math::Isometry2d; "#, r#" -/// Create a new `AspectRatio` from a given amount of `x` pixels and `y` pixels. +/// Create a two-dimensional isometry from a rotation. #[lua(kind = "Function", output(proxy))] - fn from_pixels(x: u32, y: u32) -> bevy::math::AspectRatio; + fn from_rotation(#[proxy] rotation: bevy::math::Rot2) -> bevy::math::Isometry2d; + +"#, + r#" +/// Create a two-dimensional isometry from a translation. + + #[lua(kind = "Function", output(proxy))] + fn from_translation( + #[proxy] + translation: bevy::math::prelude::Vec2, + ) -> bevy::math::Isometry2d; + +"#, + r#" +/// Create a two-dimensional isometry from a translation with the given `x` and `y` components. + + #[lua(kind = "Function", output(proxy))] + fn from_xy(x: f32, y: f32) -> bevy::math::Isometry2d; + +"#, + r#" +/// The inverse isometry that undoes this one. + + #[lua(kind = "Method", output(proxy))] + fn inverse(&self) -> bevy::math::Isometry2d; + +"#, + r#" +/// Compute `iso1.inverse() * iso2` in a more efficient way for one-shot cases. +/// If the same isometry is used multiple times, it is more efficient to instead compute +/// the inverse once and use that for each transformation. + + #[lua(kind = "Method", output(proxy))] + fn inverse_mul( + &self, + #[proxy] + rhs: bevy::math::Isometry2d, + ) -> bevy::math::Isometry2d; + +"#, + r#" +/// Transform a point by rotating and translating it using this isometry. + + #[lua(kind = "Method", output(proxy))] + fn transform_point( + &self, + #[proxy] + point: bevy::math::prelude::Vec2, + ) -> bevy::math::prelude::Vec2; + +"#, + r#" +/// Transform a point by rotating and translating it using the inverse of this isometry. +/// This is more efficient than `iso.inverse().transform_point(point)` for one-shot cases. +/// If the same isometry is used multiple times, it is more efficient to instead compute +/// the inverse once and use that for each transformation. + + #[lua(kind = "Method", output(proxy))] + fn inverse_transform_point( + &self, + #[proxy] + point: bevy::math::prelude::Vec2, + ) -> bevy::math::prelude::Vec2; "#, r#" #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::AspectRatio; + fn clone(&self) -> bevy::math::Isometry2d; "#, r#" @@ -109,7 +264,19 @@ struct CompassQuadrant {} composite = "eq", metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &aspect_ratio::AspectRatio) -> bool; + fn eq(&self, #[proxy] other: &isometry::Isometry2d) -> bool; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: bevy::math::prelude::Dir2) -> bevy::math::prelude::Dir2; "#, r#" @@ -119,46 +286,136 @@ fn index(&self) -> String { } "#] )] -struct AspectRatio(); +struct Isometry2d { + #[lua(output(proxy))] + rotation: bevy::math::Rot2, + #[lua(output(proxy))] + translation: bevy::math::prelude::Vec2, +} #[derive(bevy_mod_scripting_lua_derive::LuaProxy)] #[proxy( derive(clone), - remote = "bevy::math::Ray2d", + remote = "bevy::math::Isometry3d", functions[r#" -/// Create a new `Ray2d` from a given origin and direction -/// # Panics -/// Panics if the given `direction` is zero (or very close to zero), or non-finite. + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: bevy::math::prelude::Dir3) -> bevy::math::prelude::Dir3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: bevy::math::prelude::Vec3) -> bevy::math::prelude::Vec3; + +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::Isometry3d; + +"#, + r#" +/// Create a three-dimensional isometry from a rotation. #[lua(kind = "Function", output(proxy))] - fn new( - #[proxy] - origin: bevy::math::prelude::Vec2, + fn from_rotation( #[proxy] - direction: bevy::math::prelude::Vec2, - ) -> bevy::math::Ray2d; + rotation: bevy::math::prelude::Quat, + ) -> bevy::math::Isometry3d; "#, r#" -/// Get a point at a given distance along the ray +/// Create a three-dimensional isometry from a translation with the given `x`, `y`, and `z` components. + + #[lua(kind = "Function", output(proxy))] + fn from_xyz(x: f32, y: f32, z: f32) -> bevy::math::Isometry3d; + +"#, + r#" +/// The inverse isometry that undoes this one. #[lua(kind = "Method", output(proxy))] - fn get_point(&self, distance: f32) -> bevy::math::prelude::Vec2; + fn inverse(&self) -> bevy::math::Isometry3d; "#, r#" -/// Get the distance to a plane if the ray intersects it +/// Compute `iso1.inverse() * iso2` in a more efficient way for one-shot cases. +/// If the same isometry is used multiple times, it is more efficient to instead compute +/// the inverse once and use that for each transformation. - #[lua(kind = "Method")] - fn intersect_plane( + #[lua(kind = "Method", output(proxy))] + fn inverse_mul( &self, #[proxy] - plane_origin: bevy::math::prelude::Vec2, - #[proxy] - plane: bevy::math::primitives::Plane2d, - ) -> std::option::Option; + rhs: bevy::math::Isometry3d, + ) -> bevy::math::Isometry3d; + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &isometry::Isometry3d) -> bool; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: bevy::math::Isometry3d) -> bevy::math::Isometry3d; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; "#, r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct Isometry3d { + #[lua(output(proxy))] + rotation: bevy::math::prelude::Quat, + #[lua(output(proxy))] + translation: bevy::math::Vec3A, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::math::Ray2d", + functions[r#" #[lua( as_trait = "std::cmp::PartialEq", @@ -174,6 +431,38 @@ struct AspectRatio(); #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] fn clone(&self) -> bevy::math::Ray2d; +"#, + r#" +/// Create a new `Ray2d` from a given origin and direction + + #[lua(kind = "Function", output(proxy))] + fn new( + #[proxy] + origin: bevy::math::prelude::Vec2, + #[proxy] + direction: bevy::math::prelude::Dir2, + ) -> bevy::math::Ray2d; + +"#, + r#" +/// Get a point at a given distance along the ray + + #[lua(kind = "Method", output(proxy))] + fn get_point(&self, distance: f32) -> bevy::math::prelude::Vec2; + +"#, + r#" +/// Get the distance to a plane if the ray intersects it + + #[lua(kind = "Method")] + fn intersect_plane( + &self, + #[proxy] + plane_origin: bevy::math::prelude::Vec2, + #[proxy] + plane: bevy::math::primitives::Plane2d, + ) -> std::option::Option; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -197,29 +486,16 @@ struct Ray2d { #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] fn clone(&self) -> bevy::math::Ray3d; -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &ray::Ray3d) -> bool; - "#, r#" /// Create a new `Ray3d` from a given origin and direction -/// # Panics -/// Panics if the given `direction` is zero (or very close to zero), or non-finite. #[lua(kind = "Function", output(proxy))] fn new( #[proxy] origin: bevy::math::prelude::Vec3, #[proxy] - direction: bevy::math::prelude::Vec3, + direction: bevy::math::prelude::Dir3, ) -> bevy::math::Ray3d; "#, @@ -242,6 +518,17 @@ struct Ray2d { plane: bevy::math::primitives::InfinitePlane3d, ) -> std::option::Option; +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &ray::Ray3d) -> bool; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -261,20 +548,17 @@ struct Ray3d { derive(clone), remote = "bevy::math::Rot2", functions[r#" -/// Rotates a [`Vec2`] by a [`Rot2`]. #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::cmp::PartialEq", kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "eq", + metamethod = "Eq", )] - fn mul(self, #[proxy] rhs: bevy::math::prelude::Vec2) -> bevy::math::prelude::Vec2; + fn eq(&self, #[proxy] other: &rotation2d::Rot2) -> bool; "#, r#" -/// Rotates the [`Dir2`] using a [`Rot2`]. #[lua( as_trait = "std::ops::Mul", @@ -283,21 +567,24 @@ struct Ray3d { composite = "mul", metamethod = "Mul", )] - fn mul( - self, - #[proxy] - direction: bevy::math::prelude::Dir2, - ) -> bevy::math::prelude::Dir2; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::Rot2; + fn mul(self, #[proxy] rhs: bevy::math::Rot2) -> bevy::math::Rot2; "#, r#" /// Creates a [`Rot2`] from a counterclockwise angle in radians. +/// # Note +/// The input rotation will always be clamped to the range `(-Ï€, Ï€]` by design. +/// # Example +/// ``` +/// # use bevy_math::Rot2; +/// # use approx::assert_relative_eq; +/// # use std::f32::consts::{FRAC_PI_2, PI}; +/// let rot1 = Rot2::radians(3.0 * FRAC_PI_2); +/// let rot2 = Rot2::radians(-FRAC_PI_2); +/// assert_relative_eq!(rot1, rot2); +/// let rot3 = Rot2::radians(PI); +/// assert_relative_eq!(rot1 * rot1, rot3); +/// ``` #[lua(kind = "Function", output(proxy))] fn radians(radians: f32) -> bevy::math::Rot2; @@ -305,10 +592,41 @@ struct Ray3d { "#, r#" /// Creates a [`Rot2`] from a counterclockwise angle in degrees. +/// # Note +/// The input rotation will always be clamped to the range `(-180°, 180°]` by design. +/// # Example +/// ``` +/// # use bevy_math::Rot2; +/// # use approx::assert_relative_eq; +/// let rot1 = Rot2::degrees(270.0); +/// let rot2 = Rot2::degrees(-90.0); +/// assert_relative_eq!(rot1, rot2); +/// let rot3 = Rot2::degrees(180.0); +/// assert_relative_eq!(rot1 * rot1, rot3); +/// ``` #[lua(kind = "Function", output(proxy))] fn degrees(degrees: f32) -> bevy::math::Rot2; +"#, + r#" +/// Creates a [`Rot2`] from a counterclockwise fraction of a full turn of 360 degrees. +/// # Note +/// The input rotation will always be clamped to the range `(-50%, 50%]` by design. +/// # Example +/// ``` +/// # use bevy_math::Rot2; +/// # use approx::assert_relative_eq; +/// let rot1 = Rot2::turn_fraction(0.75); +/// let rot2 = Rot2::turn_fraction(-0.25); +/// assert_relative_eq!(rot1, rot2); +/// let rot3 = Rot2::turn_fraction(0.5); +/// assert_relative_eq!(rot1 * rot1, rot3); +/// ``` + + #[lua(kind = "Function", output(proxy))] + fn turn_fraction(fraction: f32) -> bevy::math::Rot2; + "#, r#" /// Creates a [`Rot2`] from the sine and cosine of an angle in radians. @@ -333,6 +651,13 @@ struct Ray3d { #[lua(kind = "Method")] fn as_degrees(self) -> f32; +"#, + r#" +/// Returns the rotation as a fraction of a full 360 degree turn. + + #[lua(kind = "Method")] + fn as_turn_fraction(self) -> f32; + "#, r#" /// Returns the sine and cosine of the rotation angle in radians. @@ -383,6 +708,15 @@ struct Ray3d { #[lua(kind = "Method", output(proxy))] fn normalize(self) -> bevy::math::Rot2; +"#, + r#" +/// Returns `self` after an approximate normalization, assuming the value is already nearly normalized. +/// Useful for preventing numerical error accumulation. +/// See [`Dir3::fast_renormalize`](crate::Dir3::fast_renormalize) for an example of when such error accumulation might occur. + + #[lua(kind = "Method", output(proxy))] + fn fast_renormalize(self) -> bevy::math::Rot2; + "#, r#" /// Returns `true` if the rotation is neither infinite nor NaN. @@ -487,6 +821,13 @@ struct Ray3d { "#, r#" + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::Rot2; + +"#, + r#" +/// Rotates a [`Vec2`] by a [`Rot2`]. + #[lua( as_trait = "std::ops::Mul", kind = "MetaFunction", @@ -494,18 +835,24 @@ struct Ray3d { composite = "mul", metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: bevy::math::Rot2) -> bevy::math::Rot2; + fn mul(self, #[proxy] rhs: bevy::math::prelude::Vec2) -> bevy::math::prelude::Vec2; "#, r#" +/// Rotates the [`Dir2`] using a [`Rot2`]. #[lua( - as_trait = "std::cmp::PartialEq", + as_trait = "std::ops::Mul", kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", + output(proxy), + composite = "mul", + metamethod = "Mul", )] - fn eq(&self, #[proxy] other: &rotation2d::Rot2) -> bool; + fn mul( + self, + #[proxy] + direction: bevy::math::prelude::Dir2, + ) -> bevy::math::prelude::Dir2; "#, r#" @@ -524,6 +871,35 @@ struct Rot2 { derive(clone), remote = "bevy::math::prelude::Dir2", functions[r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::prelude::Dir2; + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &direction::Dir2) -> bool; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Neg", + kind = "MetaFunction", + output(proxy), + composite = "neg", + metamethod = "Unm", + )] + fn neg(self) -> bevy::math::prelude::Dir2; + +"#, + r#" /// Create a [`Dir2`] from a [`Vec2`] that is already normalized. /// # Warning /// `value` must be normalized, i.e its length must be `1.0`. @@ -534,6 +910,15 @@ struct Rot2 { value: bevy::math::prelude::Vec2, ) -> bevy::math::prelude::Dir2; +"#, + r#" +/// Create a direction from its `x` and `y` components, assuming the resulting vector is normalized. +/// # Warning +/// The vector produced from `x` and `y` must be normalized, i.e its length must be `1.0`. + + #[lua(kind = "Function", output(proxy))] + fn from_xy_unchecked(x: f32, y: f32) -> bevy::math::prelude::Dir2; + "#, r#" /// Returns the inner [`Vec2`] @@ -617,9 +1002,12 @@ struct Rot2 { "#, r#" +/// Returns `self` after an approximate normalization, assuming the value is already nearly normalized. +/// Useful for preventing numerical error accumulation. +/// See [`Dir3::fast_renormalize`] for an example of when such error accumulation might occur. - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::prelude::Dir2; + #[lua(kind = "Method", output(proxy))] + fn fast_renormalize(self) -> bevy::math::prelude::Dir2; "#, r#" @@ -633,29 +1021,6 @@ struct Rot2 { )] fn mul(self, rhs: f32) -> bevy::math::prelude::Vec2; -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &direction::Dir2) -> bool; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Neg", - kind = "MetaFunction", - output(proxy), - composite = "neg", - metamethod = "Unm", - )] - fn neg(self) -> bevy::math::prelude::Dir2; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -680,6 +1045,12 @@ struct Dir2(); )] fn neg(self) -> bevy::math::prelude::Dir3; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::prelude::Dir3; + "#, r#" /// Create a [`Dir3`] from a [`Vec3`] that is already normalized. @@ -692,6 +1063,15 @@ struct Dir2(); value: bevy::math::prelude::Vec3, ) -> bevy::math::prelude::Dir3; +"#, + r#" +/// Create a direction from its `x`, `y`, and `z` components, assuming the resulting vector is normalized. +/// # Warning +/// The vector produced from `x`, `y`, and `z` must be normalized, i.e its length must be `1.0`. + + #[lua(kind = "Function", output(proxy))] + fn from_xyz_unchecked(x: f32, y: f32, z: f32) -> bevy::math::prelude::Dir3; + "#, r#" /// Returns the inner [`Vec3`] @@ -733,32 +1113,57 @@ struct Dir2(); "#, r#" +/// Returns `self` after an approximate normalization, assuming the value is already nearly normalized. +/// Useful for preventing numerical error accumulation. +/// # Example +/// The following seemingly benign code would start accumulating errors over time, +/// leading to `dir` eventually not being normalized anymore. +/// ``` +/// # use bevy_math::prelude::*; +/// # let N: usize = 200; +/// let mut dir = Dir3::X; +/// let quaternion = Quat::from_euler(EulerRot::XYZ, 1.0, 2.0, 3.0); +/// for i in 0..N { +/// dir = quaternion * dir; +/// } +/// ``` +/// Instead, do the following. +/// ``` +/// # use bevy_math::prelude::*; +/// # let N: usize = 200; +/// let mut dir = Dir3::X; +/// let quaternion = Quat::from_euler(EulerRot::XYZ, 1.0, 2.0, 3.0); +/// for i in 0..N { +/// dir = quaternion * dir; +/// dir = dir.fast_renormalize(); +/// } +/// ``` - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::prelude::Dir3; + #[lua(kind = "Method", output(proxy))] + fn fast_renormalize(self) -> bevy::math::prelude::Dir3; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", + as_trait = "std::ops::Mul", kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", + output(proxy), + composite = "mul", + metamethod = "Mul", )] - fn eq(&self, #[proxy] other: &direction::Dir3) -> bool; + fn mul(self, rhs: f32) -> bevy::math::prelude::Vec3; "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::cmp::PartialEq", kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "eq", + metamethod = "Eq", )] - fn mul(self, rhs: f32) -> bevy::math::prelude::Vec3; + fn eq(&self, #[proxy] other: &direction::Dir3) -> bool; "#, r#" @@ -787,19 +1192,20 @@ struct Dir3(); "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::prelude::Dir3A; + #[lua( + as_trait = "std::ops::Neg", + kind = "MetaFunction", + output(proxy), + composite = "neg", + metamethod = "Unm", + )] + fn neg(self) -> bevy::math::prelude::Dir3A; "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &direction::Dir3A) -> bool; + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::prelude::Dir3A; "#, r#" @@ -810,6 +1216,15 @@ struct Dir3(); #[lua(kind = "Function", output(proxy))] fn new_unchecked(#[proxy] value: bevy::math::Vec3A) -> bevy::math::prelude::Dir3A; +"#, + r#" +/// Create a direction from its `x`, `y`, and `z` components, assuming the resulting vector is normalized. +/// # Warning +/// The vector produced from `x`, `y`, and `z` must be normalized, i.e its length must be `1.0`. + + #[lua(kind = "Function", output(proxy))] + fn from_xyz_unchecked(x: f32, y: f32, z: f32) -> bevy::math::prelude::Dir3A; + "#, r#" /// Returns the inner [`Vec3A`] @@ -849,17 +1264,25 @@ struct Dir3(); s: f32, ) -> bevy::math::prelude::Dir3A; +"#, + r#" +/// Returns `self` after an approximate normalization, assuming the value is already nearly normalized. +/// Useful for preventing numerical error accumulation. +/// See [`Dir3::fast_renormalize`] for an example of when such error accumulation might occur. + + #[lua(kind = "Method", output(proxy))] + fn fast_renormalize(self) -> bevy::math::prelude::Dir3A; + "#, r#" #[lua( - as_trait = "std::ops::Neg", + as_trait = "std::cmp::PartialEq", kind = "MetaFunction", - output(proxy), - composite = "neg", - metamethod = "Unm", + composite = "eq", + metamethod = "Eq", )] - fn neg(self) -> bevy::math::prelude::Dir3A; + fn eq(&self, #[proxy] other: &direction::Dir3A) -> bool; "#, r#" @@ -875,6 +1298,12 @@ struct Dir3A(); derive(clone), remote = "bevy::math::prelude::IRect", functions[r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::prelude::IRect; + +"#, + r#" /// Create a new rectangle from two corner points. /// The two points do not need to be the minimum and/or maximum corners. /// They only need to be two opposite corners. @@ -913,7 +1342,7 @@ struct Dir3A(); "#, r#" /// Create a new rectangle from its center and size. -/// # Rounding Behaviour +/// # Rounding Behavior /// If the size contains odd numbers they will be rounded down to the nearest whole number. /// # Panics /// This method panics if any of the components of the size is negative. @@ -1009,7 +1438,7 @@ struct Dir3A(); "#, r#" /// Rectangle half-size. -/// # Rounding Behaviour +/// # Rounding Behavior /// If the full size contains odd numbers they will be rounded down to the nearest whole number when calculating the half size. /// # Examples /// ``` @@ -1024,7 +1453,7 @@ struct Dir3A(); "#, r#" /// The center point of the rectangle. -/// # Rounding Behaviour +/// # Rounding Behavior /// If the (min + max) contains odd numbers they will be rounded down to the nearest whole number when calculating the center. /// # Examples /// ``` @@ -1158,12 +1587,6 @@ struct Dir3A(); #[lua(as_trait = "std::cmp::Eq", kind = "Method")] fn assert_receiver_is_total_eq(&self) -> (); -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::prelude::IRect; - "#, r#" @@ -1194,6 +1617,23 @@ struct IRect { derive(clone), remote = "bevy::math::prelude::Rect", functions[r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &rects::rect::Rect) -> bool; + +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::prelude::Rect; + +"#, + r#" /// Create a new rectangle from two corner points. /// The two points do not need to be the minimum and/or maximum corners. /// They only need to be two opposite corners. @@ -1488,23 +1928,6 @@ struct IRect { #[lua(kind = "Method", output(proxy))] fn as_urect(&self) -> bevy::math::prelude::URect; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::prelude::Rect; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &rects::rect::Rect) -> bool; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -1562,7 +1985,7 @@ struct Rect { "#, r#" /// Create a new rectangle from its center and size. -/// # Rounding Behaviour +/// # Rounding Behavior /// If the size contains odd numbers they will be rounded down to the nearest whole number. /// # Panics /// This method panics if any of the components of the size is negative or if `origin - (size / 2)` results in any negatives. @@ -1658,7 +2081,7 @@ struct Rect { "#, r#" /// Rectangle half-size. -/// # Rounding Behaviour +/// # Rounding Behavior /// If the full size contains odd numbers they will be rounded down to the nearest whole number when calculating the half size. /// # Examples /// ``` @@ -1673,7 +2096,7 @@ struct Rect { "#, r#" /// The center point of the rectangle. -/// # Rounding Behaviour +/// # Rounding Behavior /// If the (min + max) contains odd numbers they will be rounded down to the nearest whole number when calculating the center. /// # Examples /// ``` @@ -1851,6 +2274,12 @@ struct Affine3 { derive(clone), remote = "bevy::math::bounding::Aabb2d", functions[r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::bounding::Aabb2d; + +"#, + r#" /// Constructs an AABB from its center and half-size. #[lua(kind = "Function", output(proxy))] @@ -1881,12 +2310,6 @@ struct Affine3 { point: bevy::math::prelude::Vec2, ) -> bevy::math::prelude::Vec2; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::bounding::Aabb2d; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -2023,22 +2446,80 @@ struct Circle { #[derive(bevy_mod_scripting_lua_derive::LuaProxy)] #[proxy( derive(clone), - remote = "bevy::math::primitives::Arc2d", + remote = "bevy::math::primitives::Annulus", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::Arc2d; - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", composite = "eq", metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &primitives::dim2::Arc2d) -> bool; + fn eq(&self, #[proxy] other: &primitives::dim2::Annulus) -> bool; + +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::primitives::Annulus; + +"#, + r#" +/// Create a new [`Annulus`] from the radii of the inner and outer circle + + #[lua(kind = "Function", output(proxy))] + fn new(inner_radius: f32, outer_radius: f32) -> bevy::math::primitives::Annulus; + +"#, + r#" +/// Get the diameter of the annulus + + #[lua(kind = "Method")] + fn diameter(&self) -> f32; + +"#, + r#" +/// Get the thickness of the annulus + + #[lua(kind = "Method")] + fn thickness(&self) -> f32; + +"#, + r#" +/// Finds the point on the annulus that is closest to the given `point`: +/// - If the point is outside of the annulus completely, the returned point will be on the outer perimeter. +/// - If the point is inside of the inner circle (hole) of the annulus, the returned point will be on the inner perimeter. +/// - Otherwise, the returned point is overlapping the annulus and returned as is. + + #[lua(kind = "Method", output(proxy))] + fn closest_point( + &self, + #[proxy] + point: bevy::math::prelude::Vec2, + ) -> bevy::math::prelude::Vec2; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct Annulus { + #[lua(output(proxy))] + inner_circle: bevy::math::primitives::Circle, + #[lua(output(proxy))] + outer_circle: bevy::math::primitives::Circle, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::math::primitives::Arc2d", + functions[r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::primitives::Arc2d; "#, r#" @@ -2161,6 +2642,17 @@ struct Circle { #[lua(kind = "Method")] fn is_major(&self) -> bool; +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &primitives::dim2::Arc2d) -> bool; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -2178,21 +2670,17 @@ struct Arc2d { derive(clone), remote = "bevy::math::primitives::Capsule2d", functions[r#" +/// Create a new `Capsule2d` from a radius and length - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &primitives::dim2::Capsule2d) -> bool; + #[lua(kind = "Function", output(proxy))] + fn new(radius: f32, length: f32) -> bevy::math::primitives::Capsule2d; "#, r#" -/// Create a new `Capsule2d` from a radius and length +/// Get the part connecting the semicircular ends of the capsule as a [`Rectangle`] - #[lua(kind = "Function", output(proxy))] - fn new(radius: f32, length: f32) -> bevy::math::primitives::Capsule2d; + #[lua(kind = "Method", output(proxy))] + fn to_inner_rectangle(&self) -> bevy::math::primitives::Rectangle; "#, r#" @@ -2200,6 +2688,17 @@ struct Arc2d { #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] fn clone(&self) -> bevy::math::primitives::Capsule2d; +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &primitives::dim2::Capsule2d) -> bool; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -2330,13 +2829,13 @@ struct Capsule2d { fn sagitta(&self) -> f32; "#, - r#" -/// Returns the area of this sector +// r#" +// /// Returns the area of this sector - #[lua(kind = "Method")] - fn area(&self) -> f32; +// #[lua(kind = "Method")] +// fn area(&self) -> f32; -"#, +// "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] fn index(&self) -> String { @@ -2346,30 +2845,13 @@ fn index(&self) -> String { )] struct CircularSector { #[lua(output(proxy))] - arc: bevy::math::primitives::Arc2d, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::math::primitives::CircularSegment", - functions[r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::CircularSegment; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &primitives::dim2::CircularSegment) -> bool; - -"#, - r#" + arc: bevy::math::primitives::Arc2d, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::math::primitives::CircularSegment", + functions[r#" /// Create a new [`CircularSegment`] from a `radius`, and an `angle` #[lua(kind = "Function", output(proxy))] @@ -2464,11 +2946,28 @@ struct CircularSector { fn sagitta(&self) -> f32; "#, +// r#" +// /// Returns the area of this segment + +// #[lua(kind = "Method")] +// fn area(&self) -> f32; + +// "#, r#" -/// Returns the area of this segment - #[lua(kind = "Method")] - fn area(&self) -> f32; + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &primitives::dim2::CircularSegment) -> bool; + +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::primitives::CircularSegment; "#, r#" @@ -2487,17 +2986,6 @@ struct CircularSegment { derive(clone), remote = "bevy::math::primitives::Ellipse", functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &primitives::dim2::Ellipse) -> bool; - -"#, - r#" /// Create a new `Ellipse` from half of its width and height. /// This corresponds to the two perpendicular radii defining the ellipse. @@ -2546,6 +3034,17 @@ struct CircularSegment { #[lua(kind = "Method")] fn semi_minor(&self) -> f32; +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &primitives::dim2::Ellipse) -> bool; + "#, r#" @@ -2601,15 +3100,9 @@ struct Line2d { derive(clone), remote = "bevy::math::primitives::Plane2d", functions[r#" -/// Create a new `Plane2d` from a normal -/// # Panics -/// Panics if the given `normal` is zero (or very close to zero), or non-finite. - #[lua(kind = "Function", output(proxy))] - fn new( - #[proxy] - normal: bevy::math::prelude::Vec2, - ) -> bevy::math::primitives::Plane2d; + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::primitives::Plane2d; "#, r#" @@ -2624,9 +3117,15 @@ struct Line2d { "#, r#" +/// Create a new `Plane2d` from a normal +/// # Panics +/// Panics if the given `normal` is zero (or very close to zero), or non-finite. - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::Plane2d; + #[lua(kind = "Function", output(proxy))] + fn new( + #[proxy] + normal: bevy::math::prelude::Vec2, + ) -> bevy::math::primitives::Plane2d; "#, r#" @@ -2700,6 +3199,12 @@ struct Plane2d { point: bevy::math::prelude::Vec2, ) -> bevy::math::prelude::Vec2; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::primitives::Rectangle; + "#, r#" @@ -2711,12 +3216,6 @@ struct Plane2d { )] fn eq(&self, #[proxy] other: &primitives::dim2::Rectangle) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::Rectangle; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -2734,30 +3233,13 @@ struct Rectangle { derive(clone), remote = "bevy::math::primitives::RegularPolygon", functions[r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::RegularPolygon; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &primitives::dim2::RegularPolygon) -> bool; - -"#, - r#" /// Create a new `RegularPolygon` /// from the radius of the circumcircle and a number of sides /// # Panics /// Panics if `circumradius` is negative #[lua(kind = "Function", output(proxy))] - fn new(circumradius: f32, sides: usize) -> bevy::math::primitives::RegularPolygon; + fn new(circumradius: f32, sides: u32) -> bevy::math::primitives::RegularPolygon; "#, r#" @@ -2819,6 +3301,23 @@ struct Rectangle { #[lua(kind = "Method")] fn external_angle_radians(&self) -> f32; +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &primitives::dim2::RegularPolygon) -> bool; + +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::primitives::RegularPolygon; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -2830,7 +3329,7 @@ fn index(&self) -> String { struct RegularPolygon { #[lua(output(proxy))] circumcircle: bevy::math::primitives::Circle, - sides: usize, + sides: u32, } #[derive(bevy_mod_scripting_lua_derive::LuaProxy)] #[proxy( @@ -2838,12 +3337,6 @@ struct RegularPolygon { remote = "bevy::math::primitives::Rhombus", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::Rhombus; - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -2852,6 +3345,12 @@ struct RegularPolygon { )] fn eq(&self, #[proxy] other: &primitives::dim2::Rhombus) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::primitives::Rhombus; + "#, r#" /// Create a new `Rhombus` from a vertical and horizontal diagonal sizes. @@ -2929,6 +3428,17 @@ struct Rhombus { derive(clone), remote = "bevy::math::primitives::Segment2d", functions[r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &primitives::dim2::Segment2d) -> bool; + +"#, + r#" /// Create a new `Segment2d` from a direction and full length of the segment #[lua(kind = "Function", output(proxy))] @@ -2958,17 +3468,6 @@ struct Rhombus { #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] fn clone(&self) -> bevy::math::primitives::Segment2d; -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &primitives::dim2::Segment2d) -> bool; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -2987,12 +3486,6 @@ struct Segment2d { derive(clone), remote = "bevy::math::primitives::Triangle2d", functions[r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::Triangle2d; - -"#, - r#" /// Create a new `Triangle2d` from points `a`, `b`, and `c` #[lua(kind = "Function", output(proxy))] @@ -3054,6 +3547,12 @@ struct Segment2d { )] fn eq(&self, #[proxy] other: &primitives::dim2::Triangle2d) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::primitives::Triangle2d; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -3100,6 +3599,12 @@ struct Aabb3d { derive(clone), remote = "bevy::math::bounding::BoundingSphere", functions[r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::bounding::BoundingSphere; + +"#, + r#" /// Get the radius of the bounding sphere #[lua(kind = "Method")] @@ -3112,12 +3617,6 @@ struct Aabb3d { #[lua(kind = "Method", output(proxy))] fn aabb_3d(&self) -> bevy::math::bounding::Aabb3d; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::bounding::BoundingSphere; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -3137,6 +3636,12 @@ struct BoundingSphere { derive(clone), remote = "bevy::math::primitives::Sphere", functions[r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::primitives::Sphere; + +"#, + r#" /// Create a new [`Sphere`] from a `radius` #[lua(kind = "Function", output(proxy))] @@ -3173,12 +3678,6 @@ struct BoundingSphere { )] fn eq(&self, #[proxy] other: &primitives::dim3::Sphere) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::Sphere; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -3254,6 +3753,12 @@ struct Sphere { point: bevy::math::prelude::Vec3, ) -> bevy::math::prelude::Vec3; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::primitives::Cuboid; + "#, r#" @@ -3265,12 +3770,6 @@ struct Sphere { )] fn eq(&self, #[proxy] other: &primitives::dim3::Cuboid) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::Cuboid; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -3349,17 +3848,6 @@ struct Cylinder { derive(clone), remote = "bevy::math::primitives::Capsule3d", functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &primitives::dim3::Capsule3d) -> bool; - -"#, - r#" /// Create a new `Capsule3d` from a radius and length #[lua(kind = "Function", output(proxy))] @@ -3379,6 +3867,17 @@ struct Cylinder { #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] fn clone(&self) -> bevy::math::primitives::Capsule3d; +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &primitives::dim3::Capsule3d) -> bool; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -3407,9 +3906,10 @@ struct Capsule3d { "#, r#" +/// Create a new [`Cone`] from a radius and height. - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::Cone; + #[lua(kind = "Function", output(proxy))] + fn new(radius: f32, height: f32) -> bevy::math::primitives::Cone; "#, r#" @@ -3441,6 +3941,12 @@ struct Capsule3d { #[lua(kind = "Method")] fn base_area(&self) -> f32; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::primitives::Cone; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -3459,12 +3965,6 @@ struct Cone { remote = "bevy::math::primitives::ConicalFrustum", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::ConicalFrustum; - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -3473,6 +3973,12 @@ struct Cone { )] fn eq(&self, #[proxy] other: &primitives::dim3::ConicalFrustum) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::primitives::ConicalFrustum; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -3492,12 +3998,6 @@ struct ConicalFrustum { remote = "bevy::math::primitives::InfinitePlane3d", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::InfinitePlane3d; - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -3506,6 +4006,68 @@ struct ConicalFrustum { )] fn eq(&self, #[proxy] other: &primitives::dim3::InfinitePlane3d) -> bool; +"#, + r#" +/// Computes an [`Isometry3d`] which transforms points from the plane in 3D space with the given +/// `origin` to the XY-plane. +/// ## Guarantees +/// * the transformation is a [congruence] meaning it will preserve all distances and angles of +/// the transformed geometry +/// * uses the least rotation possible to transform the geometry +/// * if two geometries are transformed with the same isometry, then the relations between +/// them, like distances, are also preserved +/// * compared to projections, the transformation is lossless (up to floating point errors) +/// reversible +/// ## Non-Guarantees +/// * the rotation used is generally not unique +/// * the orientation of the transformed geometry in the XY plane might be arbitrary, to +/// enforce some kind of alignment the user has to use an extra transformation ontop of this +/// one +/// See [`isometries_xy`] for example usescases. +/// [congruence]: https://en.wikipedia.org/wiki/Congruence_(geometry) +/// [`isometries_xy`]: `InfinitePlane3d::isometries_xy` + + #[lua(kind = "Method", output(proxy))] + fn isometry_into_xy( + &self, + #[proxy] + origin: bevy::math::prelude::Vec3, + ) -> bevy::math::Isometry3d; + +"#, + r#" +/// Computes an [`Isometry3d`] which transforms points from the XY-plane to this plane with the +/// given `origin`. +/// ## Guarantees +/// * the transformation is a [congruence] meaning it will preserve all distances and angles of +/// the transformed geometry +/// * uses the least rotation possible to transform the geometry +/// * if two geometries are transformed with the same isometry, then the relations between +/// them, like distances, are also preserved +/// * compared to projections, the transformation is lossless (up to floating point errors) +/// reversible +/// ## Non-Guarantees +/// * the rotation used is generally not unique +/// * the orientation of the transformed geometry in the XY plane might be arbitrary, to +/// enforce some kind of alignment the user has to use an extra transformation ontop of this +/// one +/// See [`isometries_xy`] for example usescases. +/// [congruence]: https://en.wikipedia.org/wiki/Congruence_(geometry) +/// [`isometries_xy`]: `InfinitePlane3d::isometries_xy` + + #[lua(kind = "Method", output(proxy))] + fn isometry_from_xy( + &self, + #[proxy] + origin: bevy::math::prelude::Vec3, + ) -> bevy::math::Isometry3d; + +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::primitives::InfinitePlane3d; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -3524,12 +4086,6 @@ struct InfinitePlane3d { remote = "bevy::math::primitives::Line3d", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::Line3d; - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -3538,6 +4094,12 @@ struct InfinitePlane3d { )] fn eq(&self, #[proxy] other: &primitives::dim3::Line3d) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::primitives::Line3d; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -3555,6 +4117,12 @@ struct Line3d { derive(clone), remote = "bevy::math::primitives::Segment3d", functions[r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::primitives::Segment3d; + +"#, + r#" /// Create a new `Segment3d` from a direction and full length of the segment #[lua(kind = "Function", output(proxy))] @@ -3578,12 +4146,6 @@ struct Line3d { #[lua(kind = "Method", output(proxy))] fn point2(&self) -> bevy::math::prelude::Vec3; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::Segment3d; - "#, r#" @@ -3613,6 +4175,12 @@ struct Segment3d { derive(clone), remote = "bevy::math::primitives::Torus", functions[r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::primitives::Torus; + +"#, + r#" /// Create a new `Torus` from an inner and outer radius. /// The inner radius is the radius of the hole, and the outer radius /// is the radius of the entire object @@ -3638,12 +4206,6 @@ struct Segment3d { #[lua(kind = "Method")] fn outer_radius(&self) -> f32; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::Torus; - "#, r#" @@ -3770,12 +4332,6 @@ struct Triangle3d { derive(clone), remote = "bevy::math::bounding::RayCast2d", functions[r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::bounding::RayCast2d; - -"#, - r#" /// Construct a [`RayCast2d`] from an origin, [`Dir2`], and max distance. #[lua(kind = "Function", output(proxy))] @@ -3827,6 +4383,12 @@ struct Triangle3d { circle: &bounding::bounded2d::BoundingCircle, ) -> std::option::Option; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::bounding::RayCast2d; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -4125,58 +4687,91 @@ struct BoundingSphereCast { #[derive(bevy_mod_scripting_lua_derive::LuaProxy)] #[proxy( derive(clone), - remote = "bevy::math::FloatOrd", + remote = "bevy::math::curve::interval::Interval", functions[r#" +/// Get the start of this interval. - #[lua(as_trait = "std::cmp::PartialOrd", kind = "Method")] - fn lt(&self, #[proxy] other: &float_ord::FloatOrd) -> bool; + #[lua(kind = "Method")] + fn start(self) -> f32; "#, r#" +/// Get the end of this interval. - #[lua(as_trait = "std::cmp::PartialOrd", kind = "Method")] - fn le(&self, #[proxy] other: &float_ord::FloatOrd) -> bool; + #[lua(kind = "Method")] + fn end(self) -> f32; "#, r#" +/// Get the length of this interval. Note that the result may be infinite (`f32::INFINITY`). - #[lua(as_trait = "std::cmp::PartialOrd", kind = "Method")] - fn gt(&self, #[proxy] other: &float_ord::FloatOrd) -> bool; + #[lua(kind = "Method")] + fn length(self) -> f32; "#, r#" +/// Returns `true` if this interval is bounded — that is, if both its start and end are finite. +/// Equivalently, an interval is bounded if its length is finite. - #[lua(as_trait = "std::cmp::PartialOrd", kind = "Method")] - fn ge(&self, #[proxy] other: &float_ord::FloatOrd) -> bool; + #[lua(kind = "Method")] + fn is_bounded(self) -> bool; "#, r#" +/// Returns `true` if this interval has a finite start. - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &float_ord::FloatOrd) -> bool; + #[lua(kind = "Method")] + fn has_finite_start(self) -> bool; + +"#, + r#" +/// Returns `true` if this interval has a finite end. + + #[lua(kind = "Method")] + fn has_finite_end(self) -> bool; + +"#, + r#" +/// Returns `true` if `item` is contained in this interval. + + #[lua(kind = "Method")] + fn contains(self, item: f32) -> bool; + +"#, + r#" +/// Returns `true` if the other interval is contained in this interval. +/// This is non-strict: each interval will contain itself. + + #[lua(kind = "Method")] + fn contains_interval( + self, + #[proxy] + other: bevy::math::curve::interval::Interval, + ) -> bool; + +"#, + r#" +/// Clamp the given `value` to lie within this interval. + + #[lua(kind = "Method")] + fn clamp(self, value: f32) -> f32; "#, r#" #[lua( - as_trait = "std::ops::Neg", + as_trait = "std::cmp::PartialEq", kind = "MetaFunction", - output(proxy), - composite = "neg", - metamethod = "Unm", + composite = "eq", + metamethod = "Eq", )] - fn neg(self) -> bevy::math::FloatOrd; + fn eq(&self, #[proxy] other: &curve::interval::Interval) -> bool; "#, r#" #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::FloatOrd; + fn clone(&self) -> bevy::math::curve::interval::Interval; "#, r#" @@ -4186,50 +4781,39 @@ fn index(&self) -> String { } "#] )] -struct FloatOrd(f32); +struct Interval {} #[derive(bevy_mod_scripting_lua_derive::LuaProxy)] #[proxy( derive(clone), - remote = "bevy::math::primitives::Annulus", + remote = "bevy::math::FloatOrd", functions[r#" -/// Create a new [`Annulus`] from the radii of the inner and outer circle - #[lua(kind = "Function", output(proxy))] - fn new(inner_radius: f32, outer_radius: f32) -> bevy::math::primitives::Annulus; + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::FloatOrd; "#, r#" -/// Get the diameter of the annulus - #[lua(kind = "Method")] - fn diameter(&self) -> f32; + #[lua(as_trait = "std::cmp::PartialOrd", kind = "Method")] + fn lt(&self, #[proxy] other: &float_ord::FloatOrd) -> bool; "#, r#" -/// Get the thickness of the annulus - #[lua(kind = "Method")] - fn thickness(&self) -> f32; + #[lua(as_trait = "std::cmp::PartialOrd", kind = "Method")] + fn le(&self, #[proxy] other: &float_ord::FloatOrd) -> bool; "#, r#" -/// Finds the point on the annulus that is closest to the given `point`: -/// - If the point is outside of the annulus completely, the returned point will be on the outer perimeter. -/// - If the point is inside of the inner circle (hole) of the annulus, the returned point will be on the inner perimeter. -/// - Otherwise, the returned point is overlapping the annulus and returned as is. - #[lua(kind = "Method", output(proxy))] - fn closest_point( - &self, - #[proxy] - point: bevy::math::prelude::Vec2, - ) -> bevy::math::prelude::Vec2; + #[lua(as_trait = "std::cmp::PartialOrd", kind = "Method")] + fn gt(&self, #[proxy] other: &float_ord::FloatOrd) -> bool; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::Annulus; + #[lua(as_trait = "std::cmp::PartialOrd", kind = "Method")] + fn ge(&self, #[proxy] other: &float_ord::FloatOrd) -> bool; "#, r#" @@ -4240,7 +4824,19 @@ struct FloatOrd(f32); composite = "eq", metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &primitives::dim2::Annulus) -> bool; + fn eq(&self, #[proxy] other: &float_ord::FloatOrd) -> bool; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Neg", + kind = "MetaFunction", + output(proxy), + composite = "neg", + metamethod = "Unm", + )] + fn neg(self) -> bevy::math::FloatOrd; "#, r#" @@ -4250,12 +4846,7 @@ fn index(&self) -> String { } "#] )] -struct Annulus { - #[lua(output(proxy))] - inner_circle: bevy::math::primitives::Circle, - #[lua(output(proxy))] - outer_circle: bevy::math::primitives::Circle, -} +struct FloatOrd(f32); #[derive(bevy_mod_scripting_lua_derive::LuaProxy)] #[proxy( derive(clone), @@ -4309,23 +4900,6 @@ struct Plane3d { derive(clone), remote = "bevy::math::primitives::Tetrahedron", functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &primitives::dim3::Tetrahedron) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::Tetrahedron; - -"#, - r#" /// Create a new [`Tetrahedron`] from points `a`, `b`, `c` and `d`. #[lua(kind = "Function", output(proxy))] @@ -4359,6 +4933,23 @@ struct Plane3d { #[lua(kind = "Method", output(proxy))] fn centroid(&self) -> bevy::math::prelude::Vec3; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::primitives::Tetrahedron; + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &primitives::dim3::Tetrahedron) -> bool; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -4370,6 +4961,35 @@ fn index(&self) -> String { struct Tetrahedron { vertices: ReflectedValue, } +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::math::curve::easing::EaseFunction", + functions[r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &curve::easing::EaseFunction) -> bool; + +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::curve::easing::EaseFunction; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct EaseFunction {} #[derive(Default)] pub(crate) struct Globals; impl bevy_mod_scripting_lua::tealr::mlu::ExportInstances for Globals { @@ -4379,8 +4999,13 @@ impl bevy_mod_scripting_lua::tealr::mlu::ExportInstances for Globals { >(self, instances: &mut T) -> bevy_mod_scripting_lua::tealr::mlu::mlua::Result<()> { instances .add_instance( - "AspectRatio", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + "Isometry2d", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "Isometry3d", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, )?; instances .add_instance( @@ -4444,6 +5069,11 @@ impl bevy_mod_scripting_lua::tealr::mlu::ExportInstances for Globals { "Circle", bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, )?; + instances + .add_instance( + "Annulus", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; instances .add_instance( "Arc2d", @@ -4525,6 +5155,11 @@ impl bevy_mod_scripting_lua::tealr::mlu::ExportInstances for Globals { "Capsule3d", bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, )?; + instances + .add_instance( + "Cone", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; instances .add_instance( "Segment3d", @@ -4574,11 +5209,6 @@ impl bevy_mod_scripting_lua::tealr::mlu::ExportInstances for Globals { LuaBoundingSphereCast, >::new, )?; - instances - .add_instance( - "Annulus", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; instances .add_instance( "Plane3d", @@ -4614,12 +5244,19 @@ impl bevy_mod_scripting_core::hosts::APIProvider for BevyMathAPIProvider { |tw| { tw.document_global_instance::() .expect("Something went wrong documenting globals") + .process_type::() .process_type::() .process_type::() - .process_type::() + .process_type::() + .process_type::< + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< + LuaIsometry2d, + >, + >() + .process_type::() .process_type::< bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaAspectRatio, + LuaIsometry3d, >, >() .process_type::() @@ -4673,6 +5310,10 @@ impl bevy_mod_scripting_core::hosts::APIProvider for BevyMathAPIProvider { .process_type::< bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, >() + .process_type::() + .process_type::< + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, + >() .process_type::() .process_type::< bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, @@ -4755,6 +5396,9 @@ impl bevy_mod_scripting_core::hosts::APIProvider for BevyMathAPIProvider { >, >() .process_type::() + .process_type::< + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, + >() .process_type::() .process_type::() .process_type::() @@ -4810,11 +5454,8 @@ impl bevy_mod_scripting_core::hosts::APIProvider for BevyMathAPIProvider { LuaBoundingSphereCast, >, >() + .process_type::() .process_type::() - .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() .process_type::() .process_type::< bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, @@ -4825,6 +5466,7 @@ impl bevy_mod_scripting_core::hosts::APIProvider for BevyMathAPIProvider { LuaTetrahedron, >, >() + .process_type::() }, ), ) @@ -4845,9 +5487,11 @@ impl bevy_mod_scripting_core::hosts::APIProvider for BevyMathAPIProvider { Ok(()) } fn register_with_app(&self, app: &mut bevy::app::App) { + app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); - app.register_foreign_lua_type::(); + app.register_foreign_lua_type::(); + app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); @@ -4861,6 +5505,7 @@ impl bevy_mod_scripting_core::hosts::APIProvider for BevyMathAPIProvider { app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); + app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); @@ -4892,9 +5537,10 @@ impl bevy_mod_scripting_core::hosts::APIProvider for BevyMathAPIProvider { app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); + app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); - app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); + app.register_foreign_lua_type::(); } } diff --git a/crates/bevy_script_api/src/providers/bevy_reflect.rs b/crates/bevy_script_api/src/providers/bevy_reflect.rs index 357cd40615..6fe8ad6aed 100644 --- a/crates/bevy_script_api/src/providers/bevy_reflect.rs +++ b/crates/bevy_script_api/src/providers/bevy_reflect.rs @@ -8,254 +8,748 @@ use bevy_script_api::{ }; #[derive(bevy_mod_scripting_lua_derive::LuaProxy)] #[proxy( - derive(clone), - remote = "bevy::utils::Duration", + derive(), + remote = "std::sync::atomic::AtomicBool", functions[r#" -/// Creates a new `Duration` from the specified number of whole seconds and -/// additional nanoseconds. -/// If the number of nanoseconds is greater than 1 billion (the number of -/// nanoseconds in a second), then it will carry over into the seconds provided. -/// # Panics -/// This constructor will panic if the carry from the nanoseconds overflows -/// the seconds counter. +/// Creates a new `AtomicBool`. /// # Examples /// ``` -/// use std::time::Duration; -/// let five_seconds = Duration::new(5, 0); +/// use std::sync::atomic::AtomicBool; +/// let atomic_true = AtomicBool::new(true); +/// let atomic_false = AtomicBool::new(false); /// ``` #[lua(kind = "Function", output(proxy))] - fn new(secs: u64, nanos: u32) -> bevy::utils::Duration; + fn new(v: bool) -> std::sync::atomic::AtomicBool; "#, +// r#" +// /// Consumes the atomic and returns the contained value. +// /// This is safe because passing `self` by value guarantees that no other threads are +// /// concurrently accessing the atomic data. +// /// # Examples +// /// ``` +// /// use std::sync::atomic::AtomicBool; +// /// let some_bool = AtomicBool::new(true); +// /// assert_eq!(some_bool.into_inner(), true); +// /// ``` + +// #[lua(kind = "Method")] +// fn into_inner(self) -> bool; + +// "#, r#" -/// Creates a new `Duration` from the specified number of whole seconds. +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct AtomicBool {} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(), + remote = "std::sync::atomic::AtomicI16", + functions[r#" +/// Creates a new atomic integer. /// # Examples /// ``` -/// use std::time::Duration; -/// let duration = Duration::from_secs(5); -/// assert_eq!(5, duration.as_secs()); -/// assert_eq!(0, duration.subsec_nanos()); +///use std::sync::atomic::AtomicI16; +///let atomic_forty_two = AtomicI16::new(42); /// ``` #[lua(kind = "Function", output(proxy))] - fn from_secs(secs: u64) -> bevy::utils::Duration; + fn new(v: i16) -> std::sync::atomic::AtomicI16; "#, +// r#" +// /// Consumes the atomic and returns the contained value. +// /// This is safe because passing `self` by value guarantees that no other threads are +// /// concurrently accessing the atomic data. +// /// # Examples +// /// ``` +// ///use std::sync::atomic::AtomicI16; +// ///let some_var = AtomicI16::new(5); +// /// assert_eq!(some_var.into_inner(), 5); +// /// ``` + +// #[lua(kind = "Method")] +// fn into_inner(self) -> i16; + +// "#, r#" -/// Creates a new `Duration` from the specified number of milliseconds. +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct AtomicI16 {} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(), + remote = "std::sync::atomic::AtomicI32", + functions[r#" +/// Creates a new atomic integer. /// # Examples /// ``` -/// use std::time::Duration; -/// let duration = Duration::from_millis(2569); -/// assert_eq!(2, duration.as_secs()); -/// assert_eq!(569_000_000, duration.subsec_nanos()); +///use std::sync::atomic::AtomicI32; +///let atomic_forty_two = AtomicI32::new(42); /// ``` #[lua(kind = "Function", output(proxy))] - fn from_millis(millis: u64) -> bevy::utils::Duration; + fn new(v: i32) -> std::sync::atomic::AtomicI32; "#, +// r#" +// /// Consumes the atomic and returns the contained value. +// /// This is safe because passing `self` by value guarantees that no other threads are +// /// concurrently accessing the atomic data. +// /// # Examples +// /// ``` +// ///use std::sync::atomic::AtomicI32; +// ///let some_var = AtomicI32::new(5); +// /// assert_eq!(some_var.into_inner(), 5); +// /// ``` + +// #[lua(kind = "Method")] +// fn into_inner(self) -> i32; + +// "#, r#" -/// Creates a new `Duration` from the specified number of microseconds. +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct AtomicI32 {} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(), + remote = "std::sync::atomic::AtomicI64", + functions[r#" +/// Creates a new atomic integer. /// # Examples /// ``` -/// use std::time::Duration; -/// let duration = Duration::from_micros(1_000_002); -/// assert_eq!(1, duration.as_secs()); -/// assert_eq!(2000, duration.subsec_nanos()); +///use std::sync::atomic::AtomicI64; +///let atomic_forty_two = AtomicI64::new(42); /// ``` #[lua(kind = "Function", output(proxy))] - fn from_micros(micros: u64) -> bevy::utils::Duration; + fn new(v: i64) -> std::sync::atomic::AtomicI64; "#, +// r#" +// /// Consumes the atomic and returns the contained value. +// /// This is safe because passing `self` by value guarantees that no other threads are +// /// concurrently accessing the atomic data. +// /// # Examples +// /// ``` +// ///use std::sync::atomic::AtomicI64; +// ///let some_var = AtomicI64::new(5); +// /// assert_eq!(some_var.into_inner(), 5); +// /// ``` + +// #[lua(kind = "Method")] +// fn into_inner(self) -> i64; + +// "#, r#" -/// Creates a new `Duration` from the specified number of nanoseconds. -/// Note: Using this on the return value of `as_nanos()` might cause unexpected behavior: -/// `as_nanos()` returns a u128, and can return values that do not fit in u64, e.g. 585 years. -/// Instead, consider using the pattern `Duration::new(d.as_secs(), d.subsec_nanos())` -/// if you cannot copy/clone the Duration directly. +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct AtomicI64 {} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(), + remote = "std::sync::atomic::AtomicI8", + functions[r#" +/// Creates a new atomic integer. /// # Examples /// ``` -/// use std::time::Duration; -/// let duration = Duration::from_nanos(1_000_000_123); -/// assert_eq!(1, duration.as_secs()); -/// assert_eq!(123, duration.subsec_nanos()); +///use std::sync::atomic::AtomicI8; +///let atomic_forty_two = AtomicI8::new(42); /// ``` #[lua(kind = "Function", output(proxy))] - fn from_nanos(nanos: u64) -> bevy::utils::Duration; + fn new(v: i8) -> std::sync::atomic::AtomicI8; "#, - r#" -/// Returns true if this `Duration` spans no time. -/// # Examples -/// ``` -/// use std::time::Duration; -/// assert!(Duration::ZERO.is_zero()); -/// assert!(Duration::new(0, 0).is_zero()); -/// assert!(Duration::from_nanos(0).is_zero()); -/// assert!(Duration::from_secs(0).is_zero()); -/// assert!(!Duration::new(1, 1).is_zero()); -/// assert!(!Duration::from_nanos(1).is_zero()); -/// assert!(!Duration::from_secs(1).is_zero()); -/// ``` +// r#" +// /// Consumes the atomic and returns the contained value. +// /// This is safe because passing `self` by value guarantees that no other threads are +// /// concurrently accessing the atomic data. +// /// # Examples +// /// ``` +// ///use std::sync::atomic::AtomicI8; +// ///let some_var = AtomicI8::new(5); +// /// assert_eq!(some_var.into_inner(), 5); +// /// ``` - #[lua(kind = "Method")] - fn is_zero(&self) -> bool; +// #[lua(kind = "Method")] +// fn into_inner(self) -> i8; -"#, +// "#, r#" -/// Returns the number of _whole_ seconds contained by this `Duration`. -/// The returned value does not include the fractional (nanosecond) part of the -/// duration, which can be obtained using [`subsec_nanos`]. +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct AtomicI8 {} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(), + remote = "std::sync::atomic::AtomicIsize", + functions[r#" +/// Creates a new atomic integer. /// # Examples /// ``` -/// use std::time::Duration; -/// let duration = Duration::new(5, 730023852); -/// assert_eq!(duration.as_secs(), 5); +///use std::sync::atomic::AtomicIsize; +///let atomic_forty_two = AtomicIsize::new(42); /// ``` -/// To determine the total number of seconds represented by the `Duration` -/// including the fractional part, use [`as_secs_f64`] or [`as_secs_f32`] -/// [`as_secs_f64`]: Duration::as_secs_f64 -/// [`as_secs_f32`]: Duration::as_secs_f32 -/// [`subsec_nanos`]: Duration::subsec_nanos - #[lua(kind = "Method")] - fn as_secs(&self) -> u64; + #[lua(kind = "Function", output(proxy))] + fn new(v: isize) -> std::sync::atomic::AtomicIsize; "#, - r#" -/// Returns the fractional part of this `Duration`, in whole milliseconds. -/// This method does **not** return the length of the duration when -/// represented by milliseconds. The returned number always represents a -/// fractional portion of a second (i.e., it is less than one thousand). -/// # Examples -/// ``` -/// use std::time::Duration; -/// let duration = Duration::from_millis(5432); -/// assert_eq!(duration.as_secs(), 5); -/// assert_eq!(duration.subsec_millis(), 432); -/// ``` +// r#" +// /// Consumes the atomic and returns the contained value. +// /// This is safe because passing `self` by value guarantees that no other threads are +// /// concurrently accessing the atomic data. +// /// # Examples +// /// ``` +// ///use std::sync::atomic::AtomicIsize; +// ///let some_var = AtomicIsize::new(5); +// /// assert_eq!(some_var.into_inner(), 5); +// /// ``` - #[lua(kind = "Method")] - fn subsec_millis(&self) -> u32; +// #[lua(kind = "Method")] +// fn into_inner(self) -> isize; -"#, +// "#, r#" -/// Returns the fractional part of this `Duration`, in whole microseconds. -/// This method does **not** return the length of the duration when -/// represented by microseconds. The returned number always represents a -/// fractional portion of a second (i.e., it is less than one million). +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct AtomicIsize {} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(), + remote = "std::sync::atomic::AtomicU16", + functions[r#" +/// Creates a new atomic integer. /// # Examples /// ``` -/// use std::time::Duration; -/// let duration = Duration::from_micros(1_234_567); -/// assert_eq!(duration.as_secs(), 1); -/// assert_eq!(duration.subsec_micros(), 234_567); +///use std::sync::atomic::AtomicU16; +///let atomic_forty_two = AtomicU16::new(42); /// ``` - #[lua(kind = "Method")] - fn subsec_micros(&self) -> u32; + #[lua(kind = "Function", output(proxy))] + fn new(v: u16) -> std::sync::atomic::AtomicU16; "#, - r#" -/// Returns the fractional part of this `Duration`, in nanoseconds. -/// This method does **not** return the length of the duration when -/// represented by nanoseconds. The returned number always represents a -/// fractional portion of a second (i.e., it is less than one billion). -/// # Examples -/// ``` -/// use std::time::Duration; -/// let duration = Duration::from_millis(5010); -/// assert_eq!(duration.as_secs(), 5); -/// assert_eq!(duration.subsec_nanos(), 10_000_000); -/// ``` +// r#" +// /// Consumes the atomic and returns the contained value. +// /// This is safe because passing `self` by value guarantees that no other threads are +// /// concurrently accessing the atomic data. +// /// # Examples +// /// ``` +// ///use std::sync::atomic::AtomicU16; +// ///let some_var = AtomicU16::new(5); +// /// assert_eq!(some_var.into_inner(), 5); +// /// ``` - #[lua(kind = "Method")] - fn subsec_nanos(&self) -> u32; +// #[lua(kind = "Method")] +// fn into_inner(self) -> u16; -"#, +// "#, r#" -/// Returns the total number of whole milliseconds contained by this `Duration`. +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct AtomicU16 {} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(), + remote = "std::sync::atomic::AtomicU32", + functions[r#" +/// Creates a new atomic integer. /// # Examples /// ``` -/// use std::time::Duration; -/// let duration = Duration::new(5, 730023852); -/// assert_eq!(duration.as_millis(), 5730); +///use std::sync::atomic::AtomicU32; +///let atomic_forty_two = AtomicU32::new(42); /// ``` - #[lua(kind = "Method")] - fn as_millis(&self) -> u128; + #[lua(kind = "Function", output(proxy))] + fn new(v: u32) -> std::sync::atomic::AtomicU32; "#, - r#" -/// Returns the total number of whole microseconds contained by this `Duration`. -/// # Examples -/// ``` -/// use std::time::Duration; -/// let duration = Duration::new(5, 730023852); -/// assert_eq!(duration.as_micros(), 5730023); -/// ``` +// r#" +// /// Consumes the atomic and returns the contained value. +// /// This is safe because passing `self` by value guarantees that no other threads are +// /// concurrently accessing the atomic data. +// /// # Examples +// /// ``` +// ///use std::sync::atomic::AtomicU32; +// ///let some_var = AtomicU32::new(5); +// /// assert_eq!(some_var.into_inner(), 5); +// /// ``` - #[lua(kind = "Method")] - fn as_micros(&self) -> u128; +// #[lua(kind = "Method")] +// fn into_inner(self) -> u32; -"#, +// "#, r#" -/// Returns the total number of nanoseconds contained by this `Duration`. +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct AtomicU32 {} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(), + remote = "std::sync::atomic::AtomicU64", + functions[r#" +/// Creates a new atomic integer. /// # Examples /// ``` -/// use std::time::Duration; -/// let duration = Duration::new(5, 730023852); -/// assert_eq!(duration.as_nanos(), 5730023852); +///use std::sync::atomic::AtomicU64; +///let atomic_forty_two = AtomicU64::new(42); /// ``` - #[lua(kind = "Method")] - fn as_nanos(&self) -> u128; + #[lua(kind = "Function", output(proxy))] + fn new(v: u64) -> std::sync::atomic::AtomicU64; "#, +// r#" +// /// Consumes the atomic and returns the contained value. +// /// This is safe because passing `self` by value guarantees that no other threads are +// /// concurrently accessing the atomic data. +// /// # Examples +// /// ``` +// ///use std::sync::atomic::AtomicU64; +// ///let some_var = AtomicU64::new(5); +// /// assert_eq!(some_var.into_inner(), 5); +// /// ``` + +// #[lua(kind = "Method")] +// fn into_inner(self) -> u64; + +// "#, r#" -/// Saturating `Duration` addition. Computes `self + other`, returning [`Duration::MAX`] -/// if overflow occurred. +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct AtomicU64 {} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(), + remote = "std::sync::atomic::AtomicU8", + functions[r#" +/// Creates a new atomic integer. /// # Examples /// ``` -/// #![feature(duration_constants)] -/// use std::time::Duration; -/// assert_eq!(Duration::new(0, 0).saturating_add(Duration::new(0, 1)), Duration::new(0, 1)); -/// assert_eq!(Duration::new(1, 0).saturating_add(Duration::new(u64::MAX, 0)), Duration::MAX); +///use std::sync::atomic::AtomicU8; +///let atomic_forty_two = AtomicU8::new(42); /// ``` - #[lua(kind = "Method", output(proxy))] - fn saturating_add( - self, - #[proxy] - rhs: bevy::utils::Duration, - ) -> bevy::utils::Duration; + #[lua(kind = "Function", output(proxy))] + fn new(v: u8) -> std::sync::atomic::AtomicU8; "#, +// r#" +// /// Consumes the atomic and returns the contained value. +// /// This is safe because passing `self` by value guarantees that no other threads are +// /// concurrently accessing the atomic data. +// /// # Examples +// /// ``` +// ///use std::sync::atomic::AtomicU8; +// ///let some_var = AtomicU8::new(5); +// /// assert_eq!(some_var.into_inner(), 5); +// /// ``` + +// #[lua(kind = "Method")] +// fn into_inner(self) -> u8; + +// "#, r#" -/// Saturating `Duration` subtraction. Computes `self - other`, returning [`Duration::ZERO`] -/// if the result would be negative or if overflow occurred. +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct AtomicU8 {} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(), + remote = "std::sync::atomic::AtomicUsize", + functions[r#" +/// Creates a new atomic integer. /// # Examples /// ``` -/// use std::time::Duration; -/// assert_eq!(Duration::new(0, 1).saturating_sub(Duration::new(0, 0)), Duration::new(0, 1)); -/// assert_eq!(Duration::new(0, 0).saturating_sub(Duration::new(0, 1)), Duration::ZERO); +///use std::sync::atomic::AtomicUsize; +///let atomic_forty_two = AtomicUsize::new(42); /// ``` - #[lua(kind = "Method", output(proxy))] - fn saturating_sub( - self, - #[proxy] - rhs: bevy::utils::Duration, - ) -> bevy::utils::Duration; + #[lua(kind = "Function", output(proxy))] + fn new(v: usize) -> std::sync::atomic::AtomicUsize; "#, +// r#" +// /// Consumes the atomic and returns the contained value. +// /// This is safe because passing `self` by value guarantees that no other threads are +// /// concurrently accessing the atomic data. +// /// # Examples +// /// ``` +// ///use std::sync::atomic::AtomicUsize; +// ///let some_var = AtomicUsize::new(5); +// /// assert_eq!(some_var.into_inner(), 5); +// /// ``` + +// #[lua(kind = "Method")] +// fn into_inner(self) -> usize; + +// "#, r#" -/// Saturating `Duration` multiplication. Computes `self * other`, returning -/// [`Duration::MAX`] if overflow occurred. +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct AtomicUsize {} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::utils::Duration", + functions[r#" + + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, rhs: u32) -> bevy::utils::Duration; + +"#, + r#" + + #[lua( + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", + output(proxy), + )] + fn clone(&self) -> bevy::utils::Duration; + +"#, + r#" + + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); + +"#, + r#" + + #[lua( + as_trait = "std::ops::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(self, #[proxy] rhs: bevy::utils::Duration) -> bevy::utils::Duration; + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &bevy_utils::Duration) -> bool; + +"#, + r#" +/// Creates a new `Duration` from the specified number of whole seconds and +/// additional nanoseconds. +/// If the number of nanoseconds is greater than 1 billion (the number of +/// nanoseconds in a second), then it will carry over into the seconds provided. +/// # Panics +/// This constructor will panic if the carry from the nanoseconds overflows +/// the seconds counter. +/// # Examples +/// ``` +/// use std::time::Duration; +/// let five_seconds = Duration::new(5, 0); +/// ``` + + #[lua(kind = "Function", output(proxy))] + fn new(secs: u64, nanos: u32) -> bevy::utils::Duration; + +"#, + r#" +/// Creates a new `Duration` from the specified number of whole seconds. +/// # Examples +/// ``` +/// use std::time::Duration; +/// let duration = Duration::from_secs(5); +/// assert_eq!(5, duration.as_secs()); +/// assert_eq!(0, duration.subsec_nanos()); +/// ``` + + #[lua(kind = "Function", output(proxy))] + fn from_secs(secs: u64) -> bevy::utils::Duration; + +"#, + r#" +/// Creates a new `Duration` from the specified number of milliseconds. +/// # Examples +/// ``` +/// use std::time::Duration; +/// let duration = Duration::from_millis(2_569); +/// assert_eq!(2, duration.as_secs()); +/// assert_eq!(569_000_000, duration.subsec_nanos()); +/// ``` + + #[lua(kind = "Function", output(proxy))] + fn from_millis(millis: u64) -> bevy::utils::Duration; + +"#, + r#" +/// Creates a new `Duration` from the specified number of microseconds. +/// # Examples +/// ``` +/// use std::time::Duration; +/// let duration = Duration::from_micros(1_000_002); +/// assert_eq!(1, duration.as_secs()); +/// assert_eq!(2_000, duration.subsec_nanos()); +/// ``` + + #[lua(kind = "Function", output(proxy))] + fn from_micros(micros: u64) -> bevy::utils::Duration; + +"#, + r#" +/// Creates a new `Duration` from the specified number of nanoseconds. +/// Note: Using this on the return value of `as_nanos()` might cause unexpected behavior: +/// `as_nanos()` returns a u128, and can return values that do not fit in u64, e.g. 585 years. +/// Instead, consider using the pattern `Duration::new(d.as_secs(), d.subsec_nanos())` +/// if you cannot copy/clone the Duration directly. +/// # Examples +/// ``` +/// use std::time::Duration; +/// let duration = Duration::from_nanos(1_000_000_123); +/// assert_eq!(1, duration.as_secs()); +/// assert_eq!(123, duration.subsec_nanos()); +/// ``` + + #[lua(kind = "Function", output(proxy))] + fn from_nanos(nanos: u64) -> bevy::utils::Duration; + +"#, + r#" +/// Returns true if this `Duration` spans no time. +/// # Examples +/// ``` +/// use std::time::Duration; +/// assert!(Duration::ZERO.is_zero()); +/// assert!(Duration::new(0, 0).is_zero()); +/// assert!(Duration::from_nanos(0).is_zero()); +/// assert!(Duration::from_secs(0).is_zero()); +/// assert!(!Duration::new(1, 1).is_zero()); +/// assert!(!Duration::from_nanos(1).is_zero()); +/// assert!(!Duration::from_secs(1).is_zero()); +/// ``` + + #[lua(kind = "Method")] + fn is_zero(&self) -> bool; + +"#, + r#" +/// Returns the number of _whole_ seconds contained by this `Duration`. +/// The returned value does not include the fractional (nanosecond) part of the +/// duration, which can be obtained using [`subsec_nanos`]. +/// # Examples +/// ``` +/// use std::time::Duration; +/// let duration = Duration::new(5, 730_023_852); +/// assert_eq!(duration.as_secs(), 5); +/// ``` +/// To determine the total number of seconds represented by the `Duration` +/// including the fractional part, use [`as_secs_f64`] or [`as_secs_f32`] +/// [`as_secs_f64`]: Duration::as_secs_f64 +/// [`as_secs_f32`]: Duration::as_secs_f32 +/// [`subsec_nanos`]: Duration::subsec_nanos + + #[lua(kind = "Method")] + fn as_secs(&self) -> u64; + +"#, + r#" +/// Returns the fractional part of this `Duration`, in whole milliseconds. +/// This method does **not** return the length of the duration when +/// represented by milliseconds. The returned number always represents a +/// fractional portion of a second (i.e., it is less than one thousand). +/// # Examples +/// ``` +/// use std::time::Duration; +/// let duration = Duration::from_millis(5_432); +/// assert_eq!(duration.as_secs(), 5); +/// assert_eq!(duration.subsec_millis(), 432); +/// ``` + + #[lua(kind = "Method")] + fn subsec_millis(&self) -> u32; + +"#, + r#" +/// Returns the fractional part of this `Duration`, in whole microseconds. +/// This method does **not** return the length of the duration when +/// represented by microseconds. The returned number always represents a +/// fractional portion of a second (i.e., it is less than one million). +/// # Examples +/// ``` +/// use std::time::Duration; +/// let duration = Duration::from_micros(1_234_567); +/// assert_eq!(duration.as_secs(), 1); +/// assert_eq!(duration.subsec_micros(), 234_567); +/// ``` + + #[lua(kind = "Method")] + fn subsec_micros(&self) -> u32; + +"#, + r#" +/// Returns the fractional part of this `Duration`, in nanoseconds. +/// This method does **not** return the length of the duration when +/// represented by nanoseconds. The returned number always represents a +/// fractional portion of a second (i.e., it is less than one billion). +/// # Examples +/// ``` +/// use std::time::Duration; +/// let duration = Duration::from_millis(5_010); +/// assert_eq!(duration.as_secs(), 5); +/// assert_eq!(duration.subsec_nanos(), 10_000_000); +/// ``` + + #[lua(kind = "Method")] + fn subsec_nanos(&self) -> u32; + +"#, + r#" +/// Returns the total number of whole milliseconds contained by this `Duration`. +/// # Examples +/// ``` +/// use std::time::Duration; +/// let duration = Duration::new(5, 730_023_852); +/// assert_eq!(duration.as_millis(), 5_730); +/// ``` + + #[lua(kind = "Method")] + fn as_millis(&self) -> u128; + +"#, + r#" +/// Returns the total number of whole microseconds contained by this `Duration`. +/// # Examples +/// ``` +/// use std::time::Duration; +/// let duration = Duration::new(5, 730_023_852); +/// assert_eq!(duration.as_micros(), 5_730_023); +/// ``` + + #[lua(kind = "Method")] + fn as_micros(&self) -> u128; + +"#, + r#" +/// Returns the total number of nanoseconds contained by this `Duration`. +/// # Examples +/// ``` +/// use std::time::Duration; +/// let duration = Duration::new(5, 730_023_852); +/// assert_eq!(duration.as_nanos(), 5_730_023_852); +/// ``` + + #[lua(kind = "Method")] + fn as_nanos(&self) -> u128; + +"#, + r#" +/// Computes the absolute difference between `self` and `other`. +/// # Examples +/// ``` +/// use std::time::Duration; +/// assert_eq!(Duration::new(100, 0).abs_diff(Duration::new(80, 0)), Duration::new(20, 0)); +/// assert_eq!(Duration::new(100, 400_000_000).abs_diff(Duration::new(110, 0)), Duration::new(9, 600_000_000)); +/// ``` + + #[lua(kind = "Method", output(proxy))] + fn abs_diff(self, #[proxy] other: bevy::utils::Duration) -> bevy::utils::Duration; + +"#, + r#" +/// Saturating `Duration` addition. Computes `self + other`, returning [`Duration::MAX`] +/// if overflow occurred. +/// # Examples +/// ``` +/// #![feature(duration_constants)] +/// use std::time::Duration; +/// assert_eq!(Duration::new(0, 0).saturating_add(Duration::new(0, 1)), Duration::new(0, 1)); +/// assert_eq!(Duration::new(1, 0).saturating_add(Duration::new(u64::MAX, 0)), Duration::MAX); +/// ``` + + #[lua(kind = "Method", output(proxy))] + fn saturating_add( + self, + #[proxy] + rhs: bevy::utils::Duration, + ) -> bevy::utils::Duration; + +"#, + r#" +/// Saturating `Duration` subtraction. Computes `self - other`, returning [`Duration::ZERO`] +/// if the result would be negative or if overflow occurred. +/// # Examples +/// ``` +/// use std::time::Duration; +/// assert_eq!(Duration::new(0, 1).saturating_sub(Duration::new(0, 0)), Duration::new(0, 1)); +/// assert_eq!(Duration::new(0, 0).saturating_sub(Duration::new(0, 1)), Duration::ZERO); +/// ``` + + #[lua(kind = "Method", output(proxy))] + fn saturating_sub( + self, + #[proxy] + rhs: bevy::utils::Duration, + ) -> bevy::utils::Duration; + +"#, + r#" +/// Saturating `Duration` multiplication. Computes `self * other`, returning +/// [`Duration::MAX`] if overflow occurred. /// # Examples /// ``` /// #![feature(duration_constants)] @@ -270,7 +764,7 @@ use bevy_script_api::{ "#, r#" /// Returns the number of seconds contained by this `Duration` as `f64`. -/// The returned value does include the fractional (nanosecond) part of the duration. +/// The returned value includes the fractional (nanosecond) part of the duration. /// # Examples /// ``` /// use std::time::Duration; @@ -284,7 +778,7 @@ use bevy_script_api::{ "#, r#" /// Returns the number of seconds contained by this `Duration` as `f32`. -/// The returned value does include the fractional (nanosecond) part of the duration. +/// The returned value includes the fractional (nanosecond) part of the duration. /// # Examples /// ``` /// use std::time::Duration; @@ -381,7 +875,7 @@ use bevy_script_api::{ /// use std::time::Duration; /// let dur = Duration::new(2, 700_000_000); /// assert_eq!(dur.mul_f32(3.14), Duration::new(8, 478_000_641)); -/// assert_eq!(dur.mul_f32(3.14e5), Duration::new(847800, 0)); +/// assert_eq!(dur.mul_f32(3.14e5), Duration::new(847_800, 0)); /// ``` #[lua(kind = "Method", output(proxy))] @@ -389,7 +883,7 @@ use bevy_script_api::{ "#, r#" -/// Divide `Duration` by `f64`. +/// Divides `Duration` by `f64`. /// # Panics /// This method will panic if result is negative, overflows `Duration` or not finite. /// # Examples @@ -405,7 +899,7 @@ use bevy_script_api::{ "#, r#" -/// Divide `Duration` by `f32`. +/// Divides `Duration` by `f32`. /// # Panics /// This method will panic if result is negative, overflows `Duration` or not finite. /// # Examples @@ -423,49 +917,43 @@ use bevy_script_api::{ "#, r#" +/// Divides `Duration` by `Duration` and returns `f64`. +/// # Examples +/// ``` +/// use std::time::Duration; +/// let dur1 = Duration::new(2, 700_000_000); +/// let dur2 = Duration::new(5, 400_000_000); +/// assert_eq!(dur1.div_duration_f64(dur2), 0.5); +/// ``` - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, rhs: u32) -> bevy::utils::Duration; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, #[proxy] rhs: bevy::utils::Duration) -> bevy::utils::Duration; + #[lua(kind = "Method")] + fn div_duration_f64(self, #[proxy] rhs: bevy::utils::Duration) -> f64; "#, r#" +/// Divides `Duration` by `Duration` and returns `f32`. +/// # Examples +/// ``` +/// use std::time::Duration; +/// let dur1 = Duration::new(2, 700_000_000); +/// let dur2 = Duration::new(5, 400_000_000); +/// assert_eq!(dur1.div_duration_f32(dur2), 0.5); +/// ``` - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::utils::Duration; + #[lua(kind = "Method")] + fn div_duration_f32(self, #[proxy] rhs: bevy::utils::Duration) -> f32; "#, r#" #[lua( - as_trait = "std::ops::Sub", + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "sub", - metamethod = "Sub", + composite = "add", + metamethod = "Add", )] - fn sub(self, #[proxy] rhs: bevy::utils::Duration) -> bevy::utils::Duration; + fn add(self, #[proxy] rhs: bevy::utils::Duration) -> bevy::utils::Duration; "#, r#" @@ -481,6 +969,18 @@ use bevy_script_api::{ "#, r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct Duration {} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::utils::Instant", + functions[r#" #[lua(as_trait = "std::cmp::Eq", kind = "Method")] fn assert_receiver_is_total_eq(&self) -> (); @@ -494,22 +994,10 @@ use bevy_script_api::{ composite = "eq", metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &bevy_utils::Duration) -> bool; + fn eq(&self, #[proxy] other: &bevy_utils::Instant) -> bool; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct Duration {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::utils::Instant", - functions[r#" #[lua( as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", @@ -532,24 +1020,22 @@ struct Duration {} "#, r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - -"#, - r#" +/// Returns the amount of time elapsed from another instant to this one, +/// or zero duration if that instant is later than this one. /// # Panics -/// This function may panic if the resulting point in time cannot be represented by the -/// underlying data structure. See [`Instant::checked_add`] for a version without panic. +/// Previous Rust versions panicked when `other` was later than `self`. Currently this +/// method saturates. Future versions may reintroduce the panic in some circumstances. +/// See [Monotonicity]. +/// [Monotonicity]: Instant#monotonicity #[lua( - as_trait = "std::ops::Add", + as_trait = "std::ops::Sub", kind = "MetaFunction", output(proxy), - composite = "add", - metamethod = "Add", + composite = "sub", + metamethod = "Sub", )] - fn add(self, #[proxy] other: bevy::utils::Duration) -> bevy::utils::Instant; + fn sub(self, #[proxy] other: bevy::utils::Instant) -> bevy::utils::Duration; "#, r#" @@ -635,33 +1121,18 @@ struct Duration {} "#, r#" -/// Returns the amount of time elapsed from another instant to this one, -/// or zero duration if that instant is later than this one. /// # Panics -/// Previous Rust versions panicked when `other` was later than `self`. Currently this -/// method saturates. Future versions may reintroduce the panic in some circumstances. -/// See [Monotonicity]. -/// [Monotonicity]: Instant#monotonicity +/// This function may panic if the resulting point in time cannot be represented by the +/// underlying data structure. See [`Instant::checked_add`] for a version without panic. #[lua( - as_trait = "std::ops::Sub", + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, #[proxy] other: bevy::utils::Instant) -> bevy::utils::Duration; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", + composite = "add", + metamethod = "Add", )] - fn eq(&self, #[proxy] other: &bevy_utils::Instant) -> bool; + fn add(self, #[proxy] other: bevy::utils::Duration) -> bevy::utils::Instant; "#, r#" @@ -679,23 +1150,12 @@ struct Instant(); functions[r#" #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> std::path::PathBuf; - -"#, - r#" -/// Clones the contents of `source` into `self`. -/// This method is preferred over simply assigning `source.clone()` to `self`, -/// as it avoids reallocation if possible. - - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "MutatingMethod", + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", )] - fn clone_from(&mut self, #[proxy] source: &std::path::PathBuf) -> (); + fn eq(&self, #[proxy] other: &std::path::PathBuf) -> bool; "#, r#" @@ -794,46 +1254,6 @@ struct Instant(); #[lua(kind = "MutatingMethod")] fn shrink_to(&mut self, min_capacity: usize) -> (); -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &std::path::PathBuf) -> bool; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct PathBuf {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "std::ops::RangeFull", - functions[r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &std::ops::RangeFull) -> bool; - "#, r#" @@ -842,61 +1262,47 @@ struct PathBuf {} kind = "Method", output(proxy), )] - fn clone(&self) -> std::ops::RangeFull; + fn clone(&self) -> std::path::PathBuf; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct RangeFull {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::math::Quat", - functions[r#" +/// Clones the contents of `source` into `self`. +/// This method is preferred over simply assigning `source.clone()` to `self`, +/// as it avoids reallocation if possible. #[lua( - as_trait = "std::ops::Neg", - kind = "MetaFunction", - output(proxy), - composite = "neg", - metamethod = "Unm", + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "MutatingMethod", )] - fn neg(self) -> bevy::math::Quat; + fn clone_from(&mut self, #[proxy] source: &std::path::PathBuf) -> (); "#, r#" -/// Multiplies a quaternion by a scalar value. -/// The product is not guaranteed to be normalized. +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct PathBuf {} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "std::ops::RangeFull", + functions[r#" #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", output(proxy), - composite = "mul", - metamethod = "Mul", )] - fn mul(self, rhs: f32) -> bevy::math::Quat; + fn clone(&self) -> std::ops::RangeFull; "#, r#" -/// Adds two quaternions. -/// The sum is not guaranteed to be normalized. -/// Note that addition is not the same as combining the rotations represented by the -/// two quaternions! That corresponds to multiplication. - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, #[proxy] rhs: bevy::math::Quat) -> bevy::math::Quat; + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); "#, r#" @@ -907,10 +1313,25 @@ struct RangeFull {} composite = "eq", metamethod = "Eq", )] - fn eq(&self, #[proxy] rhs: &glam::Quat) -> bool; + fn eq(&self, #[proxy] other: &std::ops::RangeFull) -> bool; "#, r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct RangeFull {} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::math::Quat", + functions[r#" +/// Multiplies a quaternion and a 3D vector, returning the rotated vector. +/// # Panics +/// Will panic if `self` is not normalized when `glam_assert` is enabled. #[lua( as_trait = "std::ops::Mul", @@ -919,17 +1340,7 @@ struct RangeFull {} composite = "mul", metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; - -"#, - r#" - - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::Quat; + fn mul(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; "#, r#" @@ -1019,6 +1430,10 @@ struct RangeFull {} "#, r#" /// Creates a quaternion from a 3x3 rotation matrix. +/// Note if the input matrix contain scales, shears, or other non-rotation transformations then +/// the resulting quaternion will be ill-defined. +/// # Panics +/// Will panic if any input matrix column is not normalized when `glam_assert` is enabled. #[lua(kind = "Function", output(proxy))] fn from_mat3(#[proxy] mat: &glam::Mat3) -> bevy::math::Quat; @@ -1026,13 +1441,22 @@ struct RangeFull {} "#, r#" /// Creates a quaternion from a 3x3 SIMD aligned rotation matrix. +/// Note if the input matrix contain scales, shears, or other non-rotation transformations then +/// the resulting quaternion will be ill-defined. +/// # Panics +/// Will panic if any input matrix column is not normalized when `glam_assert` is enabled. #[lua(kind = "Function", output(proxy))] fn from_mat3a(#[proxy] mat: &glam::Mat3A) -> bevy::math::Quat; "#, r#" -/// Creates a quaternion from a 3x3 rotation matrix inside a homogeneous 4x4 matrix. +/// Creates a quaternion from the upper 3x3 rotation matrix inside a homogeneous 4x4 matrix. +/// Note if the upper 3x3 matrix contain scales, shears, or other non-rotation transformations +/// then the resulting quaternion will be ill-defined. +/// # Panics +/// Will panic if any column of the upper 3x3 rotation matrix is not normalized when +/// `glam_assert` is enabled. #[lua(kind = "Function", output(proxy))] fn from_mat4(#[proxy] mat: &glam::Mat4) -> bevy::math::Quat; @@ -1106,7 +1530,7 @@ struct RangeFull {} /// Returns the rotation angles for the given euler rotation sequence. #[lua(kind = "Method")] - fn to_euler(self, #[proxy] euler: bevy::math::EulerRot) -> (f32, f32, f32); + fn to_euler(self, #[proxy] order: bevy::math::EulerRot) -> (f32, f32, f32); "#, r#" @@ -1194,6 +1618,7 @@ struct RangeFull {} "#, r#" +/// Returns `true` if any elements are `NAN`. #[lua(kind = "Method")] fn is_nan(self) -> bool; @@ -1223,6 +1648,24 @@ struct RangeFull {} #[lua(kind = "Method")] fn angle_between(self, #[proxy] rhs: bevy::math::Quat) -> f32; +"#, + r#" +/// Rotates towards `rhs` up to `max_angle` (in radians). +/// When `max_angle` is `0.0`, the result will be equal to `self`. When `max_angle` is equal to +/// `self.angle_between(rhs)`, the result will be equal to `rhs`. If `max_angle` is negative, +/// rotates towards the exact opposite of `rhs`. Will not go past the target. +/// Both quaternions must be normalized. +/// # Panics +/// Will panic if `self` or `rhs` are not normalized when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn rotate_towards( + &self, + #[proxy] + rhs: bevy::math::Quat, + max_angle: f32, + ) -> bevy::math::Quat; + "#, r#" /// Returns true if the absolute difference of all elements between `self` and `rhs` @@ -1283,104 +1726,283 @@ struct RangeFull {} "#, r#" /// Creates a quaternion from a 3x3 rotation matrix inside a 3D affine transform. +/// Note if the input affine matrix contain scales, shears, or other non-rotation +/// transformations then the resulting quaternion will be ill-defined. +/// # Panics +/// Will panic if any input affine matrix column is not normalized when `glam_assert` is +/// enabled. #[lua(kind = "Function", output(proxy))] fn from_affine3(#[proxy] a: &glam::Affine3A) -> bevy::math::Quat; "#, r#" -/// Multiplies a quaternion and a 3D vector, returning the rotated vector. +/// Multiplies a quaternion and a 3D vector, returning the rotated vector. + + #[lua(kind = "Method", output(proxy))] + fn mul_vec3a(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; + +"#, + r#" + + #[lua(kind = "Method", output(proxy))] + fn as_dquat(self) -> bevy::math::DQuat; + +"#, + r#" + + #[lua( + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", + output(proxy), + )] + fn clone(&self) -> bevy::math::Quat; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Neg", + kind = "MetaFunction", + output(proxy), + composite = "neg", + metamethod = "Unm", + )] + fn neg(self) -> bevy::math::Quat; + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] rhs: &glam::Quat) -> bool; + +"#, + r#" +/// Adds two quaternions. +/// The sum is not guaranteed to be normalized. +/// Note that addition is not the same as combining the rotations represented by the +/// two quaternions! That corresponds to multiplication. + + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, #[proxy] rhs: bevy::math::Quat) -> bevy::math::Quat; + +"#, + r#" +/// Multiplies two quaternions. If they each represent a rotation, the result will +/// represent the combined rotation. +/// Note that due to floating point rounding the result may not be perfectly +/// normalized. +/// # Panics +/// Will panic if `self` or `rhs` are not normalized when `glam_assert` is enabled. + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: bevy::math::Quat) -> bevy::math::Quat; + +"#, + r#" +/// Divides a quaternion by a scalar value. +/// The quotient is not guaranteed to be normalized. + + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, rhs: f32) -> bevy::math::Quat; + +"#, + r#" +/// Subtracts the `rhs` quaternion from `self`. +/// The difference is not guaranteed to be normalized. + + #[lua( + as_trait = "std::ops::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(self, #[proxy] rhs: bevy::math::Quat) -> bevy::math::Quat; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; + +"#, + r#" +/// Multiplies a quaternion by a scalar value. +/// The product is not guaranteed to be normalized. + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, rhs: f32) -> bevy::math::Quat; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct Quat(); +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::math::Vec3", + functions[r#" + + #[lua( + as_trait = "std::ops::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(self, rhs: f32) -> bevy::math::Vec3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, rhs: f32) -> bevy::math::Vec3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, #[proxy] rhs: &glam::Vec3) -> bevy::math::Vec3; + +"#, + r#" - #[lua(kind = "Method", output(proxy))] - fn mul_vec3a(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; + #[lua( + as_trait = "std::ops::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(self, #[proxy] rhs: &glam::Vec3) -> bevy::math::Vec3; "#, r#" - #[lua(kind = "Method", output(proxy))] - fn as_dquat(self) -> bevy::math::DQuat; + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; "#, r#" - #[lua(kind = "Method", output(proxy))] - fn as_f64(self) -> bevy::math::DQuat; + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: &glam::Vec3) -> bevy::math::Vec3; "#, r#" -/// Divides a quaternion by a scalar value. -/// The quotient is not guaranteed to be normalized. #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "add", + metamethod = "Add", )] - fn div(self, rhs: f32) -> bevy::math::Quat; + fn add(self, #[proxy] rhs: &glam::Vec3) -> bevy::math::Vec3; "#, r#" -/// Subtracts the `rhs` quaternion from `self`. -/// The difference is not guaranteed to be normalized. #[lua( - as_trait = "std::ops::Sub", + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "sub", - metamethod = "Sub", + composite = "add", + metamethod = "Add", )] - fn sub(self, #[proxy] rhs: bevy::math::Quat) -> bevy::math::Quat; + fn add(self, rhs: f32) -> bevy::math::Vec3; "#, r#" -/// Multiplies two quaternions. If they each represent a rotation, the result will -/// represent the combined rotation. -/// Note that due to floating point rounding the result may not be perfectly -/// normalized. -/// # Panics -/// Will panic if `self` or `rhs` are not normalized when `glam_assert` is enabled. #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Div", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "div", + metamethod = "Div", )] - fn mul(self, #[proxy] rhs: bevy::math::Quat) -> bevy::math::Quat; + fn div(self, #[proxy] rhs: &glam::Vec3) -> bevy::math::Vec3; "#, r#" -/// Multiplies a quaternion and a 3D vector, returning the rotated vector. -/// # Panics -/// Will panic if `self` is not normalized when `glam_assert` is enabled. #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Sub", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "sub", + metamethod = "Sub", )] - fn mul(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; + fn sub(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{}", _self) -} -"#] -)] -struct Quat(); -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::math::Vec3", - functions[r#" /// Creates a new vector. #[lua(kind = "Function", output(proxy))] @@ -1646,6 +2268,14 @@ struct Quat(); #[lua(kind = "Method")] fn is_finite(self) -> bool; +"#, + r#" +/// Performs `is_finite` on each element of self, returning a vector mask of the results. +/// In other words, this computes `[x.is_finite(), y.is_finite(), ...]`. + + #[lua(kind = "Method", output(proxy))] + fn is_finite_mask(self) -> bevy::math::BVec3; + "#, r#" /// Returns `true` if any elements are `NaN`. @@ -1656,7 +2286,7 @@ struct Quat(); "#, r#" /// Performs `is_nan` on each element of self, returning a vector mask of the results. -/// In other words, this computes `[x.is_nan(), y.is_nan(), z.is_nan(), w.is_nan()]`. +/// In other words, this computes `[x.is_nan(), y.is_nan(), ...]`. #[lua(kind = "Method", output(proxy))] fn is_nan_mask(self) -> bevy::math::BVec3; @@ -1716,10 +2346,10 @@ struct Quat(); "#, r#" /// Returns `self` normalized to length 1.0. -/// For valid results, `self` must _not_ be of length zero, nor very close to zero. +/// For valid results, `self` must be finite and _not_ of length zero, nor very close to zero. /// See also [`Self::try_normalize()`] and [`Self::normalize_or_zero()`]. /// Panics -/// Will panic if `self` is zero length when `glam_assert` is enabled. +/// Will panic if the resulting normalized vector is not finite when `glam_assert` is enabled. #[lua(kind = "Method", output(proxy))] fn normalize(self) -> bevy::math::Vec3; @@ -1915,23 +2545,27 @@ struct Quat(); "#, r#" -/// Returns a vector with a length no less than `min` and no more than `max` +/// Returns a vector with a length no less than `min` and no more than `max`. /// # Panics -/// Will panic if `min` is greater than `max` when `glam_assert` is enabled. +/// Will panic if `min` is greater than `max`, or if either `min` or `max` is negative, when `glam_assert` is enabled. #[lua(kind = "Method", output(proxy))] fn clamp_length(self, min: f32, max: f32) -> bevy::math::Vec3; "#, r#" -/// Returns a vector with a length no more than `max` +/// Returns a vector with a length no more than `max`. +/// # Panics +/// Will panic if `max` is negative when `glam_assert` is enabled. #[lua(kind = "Method", output(proxy))] fn clamp_length_max(self, max: f32) -> bevy::math::Vec3; "#, r#" -/// Returns a vector with a length no less than `min` +/// Returns a vector with a length no less than `min`. +/// # Panics +/// Will panic if `min` is negative when `glam_assert` is enabled. #[lua(kind = "Method", output(proxy))] fn clamp_length_min(self, min: f32) -> bevy::math::Vec3; @@ -1956,7 +2590,30 @@ struct Quat(); "#, r#" -/// Returns the angle (in radians) between two vectors. +/// Returns the reflection vector for a given incident vector `self` and surface normal +/// `normal`. +/// `normal` must be normalized. +/// # Panics +/// Will panic if `normal` is not normalized when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn reflect(self, #[proxy] normal: bevy::math::Vec3) -> bevy::math::Vec3; + +"#, + r#" +/// Returns the refraction direction for a given incident vector `self`, surface normal +/// `normal` and ratio of indices of refraction, `eta`. When total internal reflection occurs, +/// a zero vector will be returned. +/// `self` and `normal` must be normalized. +/// # Panics +/// Will panic if `self` or `normal` is not normalized when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn refract(self, #[proxy] normal: bevy::math::Vec3, eta: f32) -> bevy::math::Vec3; + +"#, + r#" +/// Returns the angle (in radians) between two vectors in the range `[0, +Ï€]`. /// The inputs do not need to be unit vectors however they must be non-zero. #[lua(kind = "Method")] @@ -2021,48 +2678,35 @@ struct Quat(); r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", + composite = "add", + metamethod = "Add", )] - fn eq(&self, #[proxy] other: &glam::Vec3) -> bool; + fn add(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; "#, r#" #[lua( - as_trait = "std::ops::Sub", + as_trait = "std::ops::Neg", kind = "MetaFunction", output(proxy), - composite = "sub", - metamethod = "Sub", + composite = "neg", + metamethod = "Unm", )] - fn sub(self, rhs: f32) -> bevy::math::Vec3; + fn neg(self) -> bevy::math::Vec3; "#, r#" #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", output(proxy), - composite = "div", - metamethod = "Div", )] - fn div(self, rhs: f32) -> bevy::math::Vec3; + fn clone(&self) -> bevy::math::Vec3; "#, r#" @@ -2076,18 +2720,6 @@ struct Quat(); )] fn mul(self, rhs: f32) -> bevy::math::Vec3; -"#, - r#" - - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; - "#, r#" @@ -2104,25 +2736,12 @@ struct Quat(); r#" #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add", + as_trait = "std::cmp::PartialEq", kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", + composite = "eq", + metamethod = "Eq", )] - fn add(self, rhs: f32) -> bevy::math::Vec3; + fn eq(&self, #[proxy] other: &glam::Vec3) -> bool; "#, r#" @@ -2134,47 +2753,25 @@ struct Quat(); composite = "rem", metamethod = "Mod", )] - fn rem(self, rhs: f32) -> bevy::math::Vec3; - -"#, - r#" - - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::Vec3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Neg", - kind = "MetaFunction", - output(proxy), - composite = "neg", - metamethod = "Unm", - )] - fn neg(self) -> bevy::math::Vec3; + fn rem(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; "#, r#" #[lua( - as_trait = "std::ops::Add", + as_trait = "std::ops::Div", kind = "MetaFunction", output(proxy), - composite = "add", - metamethod = "Add", + composite = "div", + metamethod = "Div", )] - fn add(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; + fn div(self, rhs: f32) -> bevy::math::Vec3; "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] fn index(&self) -> String { - format!("{}", _self) + format!("{:?}", _self) } "#, r#" @@ -2190,52 +2787,16 @@ fn index(&mut self, lua: &Lua, idx: crate::lua::util::LuaIndex, val: f32) -> Res } "#] )] -struct Vec3 { - x: f32, - y: f32, - z: f32, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::math::IVec2", - functions[r#" - - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, #[proxy] rhs: bevy::math::IVec2) -> bevy::math::IVec2; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: bevy::math::IVec2) -> bevy::math::IVec2; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, rhs: i32) -> bevy::math::IVec2; - -"#, - r#" +struct Vec3 { + x: f32, + y: f32, + z: f32, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::math::IVec2", + functions[r#" /// Creates a new vector. #[lua(kind = "Function", output(proxy))] @@ -2663,13 +3224,13 @@ struct Vec3 { r#" #[lua( - as_trait = "std::ops::Sub", + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "sub", - metamethod = "Sub", + composite = "add", + metamethod = "Add", )] - fn sub(self, rhs: i32) -> bevy::math::IVec2; + fn add(self, rhs: i32) -> bevy::math::IVec2; "#, r#" @@ -2681,7 +3242,73 @@ struct Vec3 { composite = "div", metamethod = "Div", )] - fn div(self, #[proxy] rhs: bevy::math::IVec2) -> bevy::math::IVec2; + fn div(self, rhs: i32) -> bevy::math::IVec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, #[proxy] rhs: &glam::IVec2) -> bevy::math::IVec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, #[proxy] rhs: &glam::IVec2) -> bevy::math::IVec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, #[proxy] rhs: bevy::math::IVec2) -> bevy::math::IVec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Neg", + kind = "MetaFunction", + output(proxy), + composite = "neg", + metamethod = "Unm", + )] + fn neg(self) -> bevy::math::IVec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(self, #[proxy] rhs: &glam::IVec2) -> bevy::math::IVec2; + +"#, + r#" + + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); "#, r#" @@ -2695,6 +3322,18 @@ struct Vec3 { )] fn rem(self, rhs: i32) -> bevy::math::IVec2; +"#, + r#" + + #[lua( + as_trait = "std::ops::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, #[proxy] rhs: bevy::math::IVec2) -> bevy::math::IVec2; + "#, r#" @@ -2707,6 +3346,89 @@ struct Vec3 { )] fn sub(self, #[proxy] rhs: bevy::math::IVec2) -> bevy::math::IVec2; +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: &glam::IVec2) -> bevy::math::IVec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(self, rhs: i32) -> bevy::math::IVec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: bevy::math::IVec2) -> bevy::math::IVec2; + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &glam::IVec2) -> bool; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, #[proxy] rhs: bevy::math::IVec2) -> bevy::math::IVec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, rhs: i32) -> bevy::math::IVec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, #[proxy] rhs: &glam::IVec2) -> bevy::math::IVec2; + "#, r#" @@ -2717,6 +3439,56 @@ struct Vec3 { )] fn clone(&self) -> bevy::math::IVec2; +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#, + r#" +#[lua(kind="MetaMethod", raw , metamethod="Index")] +fn index(&self, lua: &Lua, idx: crate::lua::util::LuaIndex) -> Result { + Ok(self.inner()?[*idx]) +} +"#, + r#" +#[lua(kind="MutatingMetaMethod", raw, metamethod="NewIndex")] +fn index(&mut self, lua: &Lua, idx: crate::lua::util::LuaIndex, val: i32) -> Result<(),_> { + self.val_mut(|s| Ok(s[*idx] = val))? +} +"#] +)] +struct IVec2 { + x: i32, + y: i32, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::math::IVec3", + functions[r#" + + #[lua( + as_trait = "std::ops::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(self, #[proxy] rhs: &glam::IVec3) -> bevy::math::IVec3; + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &glam::IVec3) -> bool; + "#, r#" @@ -2727,42 +3499,65 @@ struct Vec3 { composite = "div", metamethod = "Div", )] - fn div(self, rhs: i32) -> bevy::math::IVec2; + fn div(self, rhs: i32) -> bevy::math::IVec3; "#, r#" #[lua( - as_trait = "std::ops::Neg", + as_trait = "std::ops::Div", kind = "MetaFunction", output(proxy), - composite = "neg", - metamethod = "Unm", + composite = "div", + metamethod = "Div", )] - fn neg(self) -> bevy::math::IVec2; + fn div(self, #[proxy] rhs: &glam::IVec3) -> bevy::math::IVec3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, #[proxy] rhs: &glam::IVec3) -> bevy::math::IVec3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: &glam::IVec3) -> bevy::math::IVec3; "#, r#" #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", output(proxy), - composite = "add", - metamethod = "Add", )] - fn add(self, #[proxy] rhs: bevy::math::IVec2) -> bevy::math::IVec2; + fn clone(&self) -> bevy::math::IVec3; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", + as_trait = "std::ops::Neg", kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", + output(proxy), + composite = "neg", + metamethod = "Unm", )] - fn eq(&self, #[proxy] other: &glam::IVec2) -> bool; + fn neg(self) -> bevy::math::IVec3; "#, r#" @@ -2774,74 +3569,37 @@ struct Vec3 { composite = "mul", metamethod = "Mul", )] - fn mul(self, rhs: i32) -> bevy::math::IVec2; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + fn mul(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::IVec3; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{}", _self) -} -"#, - r#" -#[lua(kind="MetaMethod", raw , metamethod="Index")] -fn index(&self, lua: &Lua, idx: crate::lua::util::LuaIndex) -> Result { - Ok(self.inner()?[*idx]) -} -"#, - r#" -#[lua(kind="MutatingMetaMethod", raw, metamethod="NewIndex")] -fn index(&mut self, lua: &Lua, idx: crate::lua::util::LuaIndex, val: i32) -> Result<(),_> { - self.val_mut(|s| Ok(s[*idx] = val))? -} -"#] -)] -struct IVec2 { - x: i32, - y: i32, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::math::IVec3", - functions[r#" #[lua( - as_trait = "std::ops::Neg", + as_trait = "std::ops::Sub", kind = "MetaFunction", output(proxy), - composite = "neg", - metamethod = "Unm", + composite = "sub", + metamethod = "Sub", )] - fn neg(self) -> bevy::math::IVec3; + fn sub(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::IVec3; "#, r#" - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::IVec3; + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); "#, r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Sub", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "sub", + metamethod = "Sub", )] - fn div(self, rhs: i32) -> bevy::math::IVec3; + fn sub(self, rhs: i32) -> bevy::math::IVec3; "#, r#" @@ -3283,31 +4041,19 @@ struct IVec2 { composite = "add", metamethod = "Add", )] - fn add(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::IVec3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::IVec3; + fn add(self, rhs: i32) -> bevy::math::IVec3; "#, r#" #[lua( - as_trait = "std::ops::Add", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "add", - metamethod = "Add", + composite = "mul", + metamethod = "Mul", )] - fn add(self, rhs: i32) -> bevy::math::IVec3; + fn mul(self, rhs: i32) -> bevy::math::IVec3; "#, r#" @@ -3325,48 +4071,37 @@ struct IVec2 { r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Rem", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "rem", + metamethod = "Mod", )] - fn mul(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::IVec3; + fn rem(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::IVec3; "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "add", + metamethod = "Add", )] - fn mul(self, rhs: i32) -> bevy::math::IVec3; + fn add(self, #[proxy] rhs: &glam::IVec3) -> bevy::math::IVec3; "#, r#" #[lua( - as_trait = "std::ops::Sub", + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::IVec3; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", + composite = "add", + metamethod = "Add", )] - fn eq(&self, #[proxy] other: &glam::IVec3) -> bool; + fn add(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::IVec3; "#, r#" @@ -3380,29 +4115,11 @@ struct IVec2 { )] fn div(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::IVec3; -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, rhs: i32) -> bevy::math::IVec3; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] fn index(&self) -> String { - format!("{}", _self) + format!("{:?}", _self) } "#, r#" @@ -3429,30 +4146,6 @@ struct IVec3 { remote = "bevy::math::IVec4", functions[r#" - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, rhs: i32) -> bevy::math::IVec4; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Neg", - kind = "MetaFunction", - output(proxy), - composite = "neg", - metamethod = "Unm", - )] - fn neg(self) -> bevy::math::IVec4; - -"#, - r#" - #[lua( as_trait = "std::ops::Rem", kind = "MetaFunction", @@ -3466,36 +4159,11 @@ struct IVec3 { r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &glam::IVec4) -> bool; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, rhs: i32) -> bevy::math::IVec4; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", output(proxy), - composite = "div", - metamethod = "Div", )] - fn div(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::IVec4; + fn clone(&self) -> bevy::math::IVec4; "#, r#" @@ -3507,31 +4175,31 @@ struct IVec3 { composite = "add", metamethod = "Add", )] - fn add(self, rhs: i32) -> bevy::math::IVec4; + fn add(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::IVec4; "#, r#" #[lua( - as_trait = "std::ops::Add", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "add", - metamethod = "Add", + composite = "mul", + metamethod = "Mul", )] - fn add(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::IVec4; + fn mul(self, #[proxy] rhs: &glam::IVec4) -> bevy::math::IVec4; "#, r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "mul", + metamethod = "Mul", )] - fn div(self, rhs: i32) -> bevy::math::IVec4; + fn mul(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::IVec4; "#, r#" @@ -3953,41 +4621,85 @@ struct IVec3 { r#" #[lua( - as_trait = "std::ops::Sub", + as_trait = "std::ops::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, #[proxy] rhs: &glam::IVec4) -> bevy::math::IVec4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(self, #[proxy] rhs: &glam::IVec4) -> bevy::math::IVec4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, rhs: i32) -> bevy::math::IVec4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Div", kind = "MetaFunction", output(proxy), - composite = "sub", - metamethod = "Sub", + composite = "div", + metamethod = "Div", )] - fn sub(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::IVec4; + fn div(self, #[proxy] rhs: &glam::IVec4) -> bevy::math::IVec4; "#, r#" #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", + as_trait = "std::ops::Add", + kind = "MetaFunction", output(proxy), + composite = "add", + metamethod = "Add", )] - fn clone(&self) -> bevy::math::IVec4; + fn add(self, rhs: i32) -> bevy::math::IVec4; "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::IVec4; "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Div", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "div", + metamethod = "Div", )] - fn mul(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::IVec4; + fn div(self, rhs: i32) -> bevy::math::IVec4; "#, r#" @@ -4003,54 +4715,27 @@ struct IVec3 { "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{}", _self) -} -"#, - r#" -#[lua(kind="MetaMethod", raw , metamethod="Index")] -fn index(&self, lua: &Lua, idx: crate::lua::util::LuaIndex) -> Result { - Ok(self.inner()?[*idx]) -} -"#, - r#" -#[lua(kind="MutatingMetaMethod", raw, metamethod="NewIndex")] -fn index(&mut self, lua: &Lua, idx: crate::lua::util::LuaIndex, val: i32) -> Result<(),_> { - self.val_mut(|s| Ok(s[*idx] = val))? -} -"#] -)] -struct IVec4 { - x: i32, - y: i32, - z: i32, - w: i32, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::math::I64Vec2", - functions[r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Neg", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "neg", + metamethod = "Unm", )] - fn div(self, #[proxy] rhs: bevy::math::I64Vec2) -> bevy::math::I64Vec2; + fn neg(self) -> bevy::math::IVec4; "#, r#" #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", + as_trait = "std::ops::Add", + kind = "MetaFunction", output(proxy), + composite = "add", + metamethod = "Add", )] - fn clone(&self) -> bevy::math::I64Vec2; + fn add(self, #[proxy] rhs: &glam::IVec4) -> bevy::math::IVec4; "#, r#" @@ -4062,45 +4747,68 @@ struct IVec4 { composite = "sub", metamethod = "Sub", )] - fn sub(self, rhs: i64) -> bevy::math::I64Vec2; + fn sub(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::IVec4; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", + as_trait = "std::ops::Sub", kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", + output(proxy), + composite = "sub", + metamethod = "Sub", )] - fn eq(&self, #[proxy] other: &glam::I64Vec2) -> bool; + fn sub(self, rhs: i32) -> bevy::math::IVec4; "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::cmp::PartialEq", kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "eq", + metamethod = "Eq", )] - fn mul(self, #[proxy] rhs: bevy::math::I64Vec2) -> bevy::math::I64Vec2; + fn eq(&self, #[proxy] other: &glam::IVec4) -> bool; "#, r#" - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, rhs: i64) -> bevy::math::I64Vec2; + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); "#, r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#, + r#" +#[lua(kind="MetaMethod", raw , metamethod="Index")] +fn index(&self, lua: &Lua, idx: crate::lua::util::LuaIndex) -> Result { + Ok(self.inner()?[*idx]) +} +"#, + r#" +#[lua(kind="MutatingMetaMethod", raw, metamethod="NewIndex")] +fn index(&mut self, lua: &Lua, idx: crate::lua::util::LuaIndex, val: i32) -> Result<(),_> { + self.val_mut(|s| Ok(s[*idx] = val))? +} +"#] +)] +struct IVec4 { + x: i32, + y: i32, + z: i32, + w: i32, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::math::I64Vec2", + functions[r#" /// Creates a new vector. #[lua(kind = "Function", output(proxy))] @@ -4542,7 +5250,100 @@ struct IVec4 { composite = "add", metamethod = "Add", )] - fn add(self, #[proxy] rhs: bevy::math::I64Vec2) -> bevy::math::I64Vec2; + fn add(self, rhs: i64) -> bevy::math::I64Vec2; + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &glam::I64Vec2) -> bool; + +"#, + r#" + + #[lua( + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", + output(proxy), + )] + fn clone(&self) -> bevy::math::I64Vec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(self, #[proxy] rhs: &glam::I64Vec2) -> bevy::math::I64Vec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Neg", + kind = "MetaFunction", + output(proxy), + composite = "neg", + metamethod = "Unm", + )] + fn neg(self) -> bevy::math::I64Vec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, rhs: i64) -> bevy::math::I64Vec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: &glam::I64Vec2) -> bevy::math::I64Vec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, #[proxy] rhs: &glam::I64Vec2) -> bevy::math::I64Vec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(self, #[proxy] rhs: bevy::math::I64Vec2) -> bevy::math::I64Vec2; "#, r#" @@ -4554,79 +5355,115 @@ struct IVec4 { composite = "add", metamethod = "Add", )] - fn add(self, rhs: i64) -> bevy::math::I64Vec2; + fn add(self, #[proxy] rhs: &glam::I64Vec2) -> bevy::math::I64Vec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, #[proxy] rhs: bevy::math::I64Vec2) -> bevy::math::I64Vec2; + +"#, + r#" + + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); + +"#, + r#" + + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, #[proxy] rhs: &glam::I64Vec2) -> bevy::math::I64Vec2; "#, r#" #[lua( - as_trait = "std::ops::Sub", + as_trait = "std::ops::Rem", kind = "MetaFunction", output(proxy), - composite = "sub", - metamethod = "Sub", + composite = "rem", + metamethod = "Mod", )] - fn sub(self, #[proxy] rhs: bevy::math::I64Vec2) -> bevy::math::I64Vec2; + fn rem(self, #[proxy] rhs: bevy::math::I64Vec2) -> bevy::math::I64Vec2; "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Rem", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "rem", + metamethod = "Mod", )] - fn mul(self, rhs: i64) -> bevy::math::I64Vec2; + fn rem(self, rhs: i64) -> bevy::math::I64Vec2; "#, r#" #[lua( - as_trait = "std::ops::Rem", + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "rem", - metamethod = "Mod", + composite = "add", + metamethod = "Add", )] - fn rem(self, rhs: i64) -> bevy::math::I64Vec2; + fn add(self, #[proxy] rhs: bevy::math::I64Vec2) -> bevy::math::I64Vec2; "#, r#" #[lua( - as_trait = "std::ops::Neg", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "neg", - metamethod = "Unm", + composite = "mul", + metamethod = "Mul", )] - fn neg(self) -> bevy::math::I64Vec2; + fn mul(self, #[proxy] rhs: bevy::math::I64Vec2) -> bevy::math::I64Vec2; "#, r#" #[lua( - as_trait = "std::ops::Rem", + as_trait = "std::ops::Div", kind = "MetaFunction", output(proxy), - composite = "rem", - metamethod = "Mod", + composite = "div", + metamethod = "Div", )] - fn rem(self, #[proxy] rhs: bevy::math::I64Vec2) -> bevy::math::I64Vec2; + fn div(self, rhs: i64) -> bevy::math::I64Vec2; "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua( + as_trait = "std::ops::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(self, rhs: i64) -> bevy::math::I64Vec2; "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] fn index(&self) -> String { - format!("{}", _self) + format!("{:?}", _self) } "#] )] @@ -4641,11 +5478,13 @@ struct I64Vec2 { functions[r#" #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", + as_trait = "std::ops::Sub", + kind = "MetaFunction", output(proxy), + composite = "sub", + metamethod = "Sub", )] - fn clone(&self) -> bevy::math::I64Vec3; + fn sub(self, #[proxy] rhs: &glam::I64Vec3) -> bevy::math::I64Vec3; "#, r#" @@ -4657,7 +5496,7 @@ struct I64Vec2 { composite = "div", metamethod = "Div", )] - fn div(self, #[proxy] rhs: bevy::math::I64Vec3) -> bevy::math::I64Vec3; + fn div(self, rhs: i64) -> bevy::math::I64Vec3; "#, r#" @@ -4669,19 +5508,7 @@ struct I64Vec2 { composite = "rem", metamethod = "Mod", )] - fn rem(self, rhs: i64) -> bevy::math::I64Vec3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, #[proxy] rhs: bevy::math::I64Vec3) -> bevy::math::I64Vec3; + fn rem(self, #[proxy] rhs: &glam::I64Vec3) -> bevy::math::I64Vec3; "#, r#" @@ -4693,49 +5520,37 @@ struct I64Vec2 { composite = "div", metamethod = "Div", )] - fn div(self, rhs: i64) -> bevy::math::I64Vec3; + fn div(self, #[proxy] rhs: bevy::math::I64Vec3) -> bevy::math::I64Vec3; "#, r#" - #[lua( - as_trait = "std::ops::Neg", - kind = "MetaFunction", - output(proxy), - composite = "neg", - metamethod = "Unm", - )] - fn neg(self) -> bevy::math::I64Vec3; + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "add", + metamethod = "Add", )] - fn mul(self, rhs: i64) -> bevy::math::I64Vec3; + fn add(self, rhs: i64) -> bevy::math::I64Vec3; "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Sub", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "sub", + metamethod = "Sub", )] - fn mul(self, #[proxy] rhs: bevy::math::I64Vec3) -> bevy::math::I64Vec3; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + fn sub(self, #[proxy] rhs: bevy::math::I64Vec3) -> bevy::math::I64Vec3; "#, r#" @@ -4752,13 +5567,25 @@ struct I64Vec2 { r#" #[lua( - as_trait = "std::ops::Sub", + as_trait = "std::ops::Neg", kind = "MetaFunction", output(proxy), - composite = "sub", - metamethod = "Sub", + composite = "neg", + metamethod = "Unm", )] - fn sub(self, rhs: i64) -> bevy::math::I64Vec3; + fn neg(self) -> bevy::math::I64Vec3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, rhs: i64) -> bevy::math::I64Vec3; "#, r#" @@ -5198,6 +6025,18 @@ struct I64Vec2 { rhs: bevy::math::U64Vec3, ) -> bevy::math::I64Vec3; +"#, + r#" + + #[lua( + as_trait = "std::ops::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, rhs: i64) -> bevy::math::I64Vec3; + "#, r#" @@ -5208,7 +6047,19 @@ struct I64Vec2 { composite = "add", metamethod = "Add", )] - fn add(self, rhs: i64) -> bevy::math::I64Vec3; + fn add(self, #[proxy] rhs: bevy::math::I64Vec3) -> bevy::math::I64Vec3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(self, rhs: i64) -> bevy::math::I64Vec3; "#, r#" @@ -5220,46 +6071,133 @@ struct I64Vec2 { composite = "add", metamethod = "Add", )] - fn add(self, #[proxy] rhs: bevy::math::I64Vec3) -> bevy::math::I64Vec3; + fn add(self, #[proxy] rhs: &glam::I64Vec3) -> bevy::math::I64Vec3; + +"#, + r#" + + #[lua( + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", + output(proxy), + )] + fn clone(&self) -> bevy::math::I64Vec3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, #[proxy] rhs: bevy::math::I64Vec3) -> bevy::math::I64Vec3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: bevy::math::I64Vec3) -> bevy::math::I64Vec3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: &glam::I64Vec3) -> bevy::math::I64Vec3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, #[proxy] rhs: &glam::I64Vec3) -> bevy::math::I64Vec3; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct I64Vec3 { + x: i64, + y: i64, + z: i64, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::math::I64Vec4", + functions[r#" + + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); + +"#, + r#" + + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, rhs: i64) -> bevy::math::I64Vec4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, #[proxy] rhs: &glam::I64Vec4) -> bevy::math::I64Vec4; "#, r#" #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", output(proxy), - composite = "rem", - metamethod = "Mod", )] - fn rem(self, #[proxy] rhs: bevy::math::I64Vec3) -> bevy::math::I64Vec3; + fn clone(&self) -> bevy::math::I64Vec4; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{}", _self) -} -"#] -)] -struct I64Vec3 { - x: i64, - y: i64, - z: i64, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::math::I64Vec4", - functions[r#" #[lua( - as_trait = "std::cmp::PartialEq", + as_trait = "std::ops::Neg", kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", + output(proxy), + composite = "neg", + metamethod = "Unm", )] - fn eq(&self, #[proxy] other: &glam::I64Vec4) -> bool; + fn neg(self) -> bevy::math::I64Vec4; "#, r#" @@ -5685,18 +6623,6 @@ struct I64Vec3 { rhs: bevy::math::U64Vec4, ) -> bevy::math::I64Vec4; -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, #[proxy] rhs: bevy::math::I64Vec4) -> bevy::math::I64Vec4; - "#, r#" @@ -5707,7 +6633,7 @@ struct I64Vec3 { composite = "add", metamethod = "Add", )] - fn add(self, rhs: i64) -> bevy::math::I64Vec4; + fn add(self, #[proxy] rhs: &glam::I64Vec4) -> bevy::math::I64Vec4; "#, r#" @@ -5721,12 +6647,6 @@ struct I64Vec3 { )] fn rem(self, #[proxy] rhs: bevy::math::I64Vec4) -> bevy::math::I64Vec4; -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - "#, r#" @@ -5749,31 +6669,31 @@ struct I64Vec3 { composite = "rem", metamethod = "Mod", )] - fn rem(self, rhs: i64) -> bevy::math::I64Vec4; + fn rem(self, #[proxy] rhs: &glam::I64Vec4) -> bevy::math::I64Vec4; "#, r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Sub", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "sub", + metamethod = "Sub", )] - fn div(self, #[proxy] rhs: bevy::math::I64Vec4) -> bevy::math::I64Vec4; + fn sub(self, #[proxy] rhs: &glam::I64Vec4) -> bevy::math::I64Vec4; "#, r#" #[lua( - as_trait = "std::ops::Neg", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "neg", - metamethod = "Unm", + composite = "mul", + metamethod = "Mul", )] - fn neg(self) -> bevy::math::I64Vec4; + fn mul(self, #[proxy] rhs: bevy::math::I64Vec4) -> bevy::math::I64Vec4; "#, r#" @@ -5803,13 +6723,36 @@ struct I64Vec3 { r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &glam::I64Vec4) -> bool; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Rem", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "rem", + metamethod = "Mod", )] - fn mul(self, #[proxy] rhs: bevy::math::I64Vec4) -> bevy::math::I64Vec4; + fn rem(self, rhs: i64) -> bevy::math::I64Vec4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, #[proxy] rhs: bevy::math::I64Vec4) -> bevy::math::I64Vec4; "#, r#" @@ -5827,17 +6770,31 @@ struct I64Vec3 { r#" #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", + as_trait = "std::ops::Sub", + kind = "MetaFunction", output(proxy), + composite = "sub", + metamethod = "Sub", )] - fn clone(&self) -> bevy::math::I64Vec4; + fn sub(self, #[proxy] rhs: bevy::math::I64Vec4) -> bevy::math::I64Vec4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: &glam::I64Vec4) -> bevy::math::I64Vec4; "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] fn index(&self) -> String { - format!("{}", _self) + format!("{:?}", _self) } "#] )] @@ -5854,37 +6811,36 @@ struct I64Vec4 { functions[r#" #[lua( - as_trait = "std::ops::Sub", + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "sub", - metamethod = "Sub", + composite = "add", + metamethod = "Add", )] - fn sub(self, #[proxy] rhs: bevy::math::UVec2) -> bevy::math::UVec2; + fn add(self, #[proxy] rhs: bevy::math::UVec2) -> bevy::math::UVec2; "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Sub", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "sub", + metamethod = "Sub", )] - fn mul(self, rhs: u32) -> bevy::math::UVec2; + fn sub(self, #[proxy] rhs: &glam::UVec2) -> bevy::math::UVec2; "#, r#" #[lua( - as_trait = "std::ops::Rem", + as_trait = "std::cmp::PartialEq", kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", + composite = "eq", + metamethod = "Eq", )] - fn rem(self, rhs: u32) -> bevy::math::UVec2; + fn eq(&self, #[proxy] other: &glam::UVec2) -> bool; "#, r#" @@ -5898,6 +6854,28 @@ struct I64Vec4 { )] fn sub(self, rhs: u32) -> bevy::math::UVec2; +"#, + r#" + + #[lua( + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", + output(proxy), + )] + fn clone(&self) -> bevy::math::UVec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, #[proxy] rhs: bevy::math::UVec2) -> bevy::math::UVec2; + "#, r#" @@ -5910,6 +6888,18 @@ struct I64Vec4 { )] fn add(self, rhs: u32) -> bevy::math::UVec2; +"#, + r#" + + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, #[proxy] rhs: &glam::UVec2) -> bevy::math::UVec2; + "#, r#" @@ -5920,18 +6910,31 @@ struct I64Vec4 { composite = "div", metamethod = "Div", )] - fn div(self, rhs: u32) -> bevy::math::UVec2; + fn div(self, #[proxy] rhs: &glam::UVec2) -> bevy::math::UVec2; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", + as_trait = "std::ops::Mul", kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", + output(proxy), + composite = "mul", + metamethod = "Mul", )] - fn eq(&self, #[proxy] other: &glam::UVec2) -> bool; + fn mul(self, rhs: u32) -> bevy::math::UVec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, rhs: u32) -> bevy::math::UVec2; "#, r#" @@ -5939,6 +6942,42 @@ struct I64Vec4 { #[lua(as_trait = "std::cmp::Eq", kind = "Method")] fn assert_receiver_is_total_eq(&self) -> (); +"#, + r#" + + #[lua( + as_trait = "std::ops::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(self, #[proxy] rhs: bevy::math::UVec2) -> bevy::math::UVec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, rhs: u32) -> bevy::math::UVec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, #[proxy] rhs: &glam::UVec2) -> bevy::math::UVec2; + "#, r#" /// Creates a new vector. @@ -6265,18 +7304,6 @@ struct I64Vec4 { #[lua(kind = "Method", output(proxy))] fn saturating_add_signed(self, #[proxy] rhs: bevy::math::IVec2) -> bevy::math::UVec2; -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: bevy::math::UVec2) -> bevy::math::UVec2; - "#, r#" @@ -6293,41 +7320,31 @@ struct I64Vec4 { r#" #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, #[proxy] rhs: bevy::math::UVec2) -> bevy::math::UVec2; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "mul", + metamethod = "Mul", )] - fn div(self, #[proxy] rhs: bevy::math::UVec2) -> bevy::math::UVec2; + fn mul(self, #[proxy] rhs: &glam::UVec2) -> bevy::math::UVec2; "#, r#" #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", + as_trait = "std::ops::Mul", + kind = "MetaFunction", output(proxy), + composite = "mul", + metamethod = "Mul", )] - fn clone(&self) -> bevy::math::UVec2; + fn mul(self, #[proxy] rhs: bevy::math::UVec2) -> bevy::math::UVec2; "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] fn index(&self) -> String { - format!("{}", _self) + format!("{:?}", _self) } "#, r#" @@ -6353,18 +7370,6 @@ struct UVec2 { remote = "bevy::math::UVec3", functions[r#" - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, rhs: u32) -> bevy::math::UVec3; - -"#, - r#" - #[lua( as_trait = "std::ops::Div", kind = "MetaFunction", @@ -6372,89 +7377,7 @@ struct UVec2 { composite = "div", metamethod = "Div", )] - fn div(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::UVec3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, rhs: u32) -> bevy::math::UVec3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, rhs: u32) -> bevy::math::UVec3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::UVec3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, rhs: u32) -> bevy::math::UVec3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::UVec3; - -"#, - r#" - - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::UVec3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::UVec3; + fn div(self, rhs: u32) -> bevy::math::UVec3; "#, r#" @@ -6468,23 +7391,17 @@ struct UVec2 { )] fn mul(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::UVec3; -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - "#, r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Sub", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "sub", + metamethod = "Sub", )] - fn div(self, rhs: u32) -> bevy::math::UVec3; + fn sub(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::UVec3; "#, r#" @@ -6779,84 +7696,244 @@ struct UVec2 { "#, r#" -/// Returns a vector containing the wrapping multiplication of `self` and `rhs`. -/// In other words this computes `[self.x.wrapping_mul(rhs.x), self.y.wrapping_mul(rhs.y), ..]`. +/// Returns a vector containing the wrapping multiplication of `self` and `rhs`. +/// In other words this computes `[self.x.wrapping_mul(rhs.x), self.y.wrapping_mul(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn wrapping_mul(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::UVec3; + +"#, + r#" +/// Returns a vector containing the wrapping division of `self` and `rhs`. +/// In other words this computes `[self.x.wrapping_div(rhs.x), self.y.wrapping_div(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn wrapping_div(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::UVec3; + +"#, + r#" +/// Returns a vector containing the saturating addition of `self` and `rhs`. +/// In other words this computes `[self.x.saturating_add(rhs.x), self.y.saturating_add(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn saturating_add(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::UVec3; + +"#, + r#" +/// Returns a vector containing the saturating subtraction of `self` and `rhs`. +/// In other words this computes `[self.x.saturating_sub(rhs.x), self.y.saturating_sub(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn saturating_sub(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::UVec3; + +"#, + r#" +/// Returns a vector containing the saturating multiplication of `self` and `rhs`. +/// In other words this computes `[self.x.saturating_mul(rhs.x), self.y.saturating_mul(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn saturating_mul(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::UVec3; + +"#, + r#" +/// Returns a vector containing the saturating division of `self` and `rhs`. +/// In other words this computes `[self.x.saturating_div(rhs.x), self.y.saturating_div(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn saturating_div(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::UVec3; + +"#, + r#" +/// Returns a vector containing the wrapping addition of `self` and signed vector `rhs`. +/// In other words this computes `[self.x.wrapping_add_signed(rhs.x), self.y.wrapping_add_signed(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn wrapping_add_signed(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::UVec3; + +"#, + r#" +/// Returns a vector containing the saturating addition of `self` and signed vector `rhs`. +/// In other words this computes `[self.x.saturating_add_signed(rhs.x), self.y.saturating_add_signed(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn saturating_add_signed(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::UVec3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, rhs: u32) -> bevy::math::UVec3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, rhs: u32) -> bevy::math::UVec3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(self, #[proxy] rhs: &glam::UVec3) -> bevy::math::UVec3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, #[proxy] rhs: &glam::UVec3) -> bevy::math::UVec3; + +"#, + r#" + + #[lua( + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", + output(proxy), + )] + fn clone(&self) -> bevy::math::UVec3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::UVec3; + +"#, + r#" - #[lua(kind = "Method", output(proxy))] - fn wrapping_mul(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::UVec3; + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::UVec3; "#, r#" -/// Returns a vector containing the wrapping division of `self` and `rhs`. -/// In other words this computes `[self.x.wrapping_div(rhs.x), self.y.wrapping_div(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] - fn wrapping_div(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::UVec3; + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &glam::UVec3) -> bool; "#, r#" -/// Returns a vector containing the saturating addition of `self` and `rhs`. -/// In other words this computes `[self.x.saturating_add(rhs.x), self.y.saturating_add(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] - fn saturating_add(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::UVec3; + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); "#, r#" -/// Returns a vector containing the saturating subtraction of `self` and `rhs`. -/// In other words this computes `[self.x.saturating_sub(rhs.x), self.y.saturating_sub(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] - fn saturating_sub(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::UVec3; + #[lua( + as_trait = "std::ops::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::UVec3; "#, r#" -/// Returns a vector containing the saturating multiplication of `self` and `rhs`. -/// In other words this computes `[self.x.saturating_mul(rhs.x), self.y.saturating_mul(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] - fn saturating_mul(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::UVec3; + #[lua( + as_trait = "std::ops::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(self, rhs: u32) -> bevy::math::UVec3; "#, r#" -/// Returns a vector containing the saturating division of `self` and `rhs`. -/// In other words this computes `[self.x.saturating_div(rhs.x), self.y.saturating_div(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] - fn saturating_div(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::UVec3; + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: &glam::UVec3) -> bevy::math::UVec3; "#, r#" -/// Returns a vector containing the wrapping addition of `self` and signed vector `rhs`. -/// In other words this computes `[self.x.wrapping_add_signed(rhs.x), self.y.wrapping_add_signed(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] - fn wrapping_add_signed(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::UVec3; + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, #[proxy] rhs: &glam::UVec3) -> bevy::math::UVec3; "#, r#" -/// Returns a vector containing the saturating addition of `self` and signed vector `rhs`. -/// In other words this computes `[self.x.saturating_add_signed(rhs.x), self.y.saturating_add_signed(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] - fn saturating_add_signed(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::UVec3; + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, rhs: u32) -> bevy::math::UVec3; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", + as_trait = "std::ops::Rem", kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", + output(proxy), + composite = "rem", + metamethod = "Mod", )] - fn eq(&self, #[proxy] other: &glam::UVec3) -> bool; + fn rem(self, #[proxy] rhs: &glam::UVec3) -> bevy::math::UVec3; "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] fn index(&self) -> String { - format!("{}", _self) + format!("{:?}", _self) } "#, r#" @@ -6884,48 +7961,37 @@ struct UVec3 { functions[r#" #[lua( - as_trait = "std::ops::Rem", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, rhs: u32) -> bevy::math::UVec4; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", + composite = "mul", + metamethod = "Mul", )] - fn eq(&self, #[proxy] other: &glam::UVec4) -> bool; + fn mul(self, #[proxy] rhs: bevy::math::UVec4) -> bevy::math::UVec4; "#, r#" #[lua( - as_trait = "std::ops::Add", + as_trait = "std::ops::Sub", kind = "MetaFunction", output(proxy), - composite = "add", - metamethod = "Add", + composite = "sub", + metamethod = "Sub", )] - fn add(self, rhs: u32) -> bevy::math::UVec4; + fn sub(self, #[proxy] rhs: &glam::UVec4) -> bevy::math::UVec4; "#, r#" #[lua( - as_trait = "std::ops::Add", + as_trait = "std::ops::Rem", kind = "MetaFunction", output(proxy), - composite = "add", - metamethod = "Add", + composite = "rem", + metamethod = "Mod", )] - fn add(self, #[proxy] rhs: bevy::math::UVec4) -> bevy::math::UVec4; + fn rem(self, #[proxy] rhs: bevy::math::UVec4) -> bevy::math::UVec4; "#, r#" @@ -6943,53 +8009,25 @@ struct UVec3 { r#" #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::UVec4; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, #[proxy] rhs: bevy::math::UVec4) -> bevy::math::UVec4; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Rem", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "rem", + metamethod = "Mod", )] - fn div(self, rhs: u32) -> bevy::math::UVec4; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + fn rem(self, rhs: u32) -> bevy::math::UVec4; "#, r#" #[lua( - as_trait = "std::ops::Rem", + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "rem", - metamethod = "Mod", + composite = "add", + metamethod = "Add", )] - fn rem(self, #[proxy] rhs: bevy::math::UVec4) -> bevy::math::UVec4; + fn add(self, rhs: u32) -> bevy::math::UVec4; "#, r#" @@ -7321,28 +8359,121 @@ struct UVec3 { /// Returns a vector containing the wrapping addition of `self` and signed vector `rhs`. /// In other words this computes `[self.x.wrapping_add_signed(rhs.x), self.y.wrapping_add_signed(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] - fn wrapping_add_signed(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::UVec4; + #[lua(kind = "Method", output(proxy))] + fn wrapping_add_signed(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::UVec4; + +"#, + r#" +/// Returns a vector containing the saturating addition of `self` and signed vector `rhs`. +/// In other words this computes `[self.x.saturating_add_signed(rhs.x), self.y.saturating_add_signed(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn saturating_add_signed(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::UVec4; + +"#, + r#" + + #[lua( + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", + output(proxy), + )] + fn clone(&self) -> bevy::math::UVec4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, #[proxy] rhs: &glam::UVec4) -> bevy::math::UVec4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, #[proxy] rhs: bevy::math::UVec4) -> bevy::math::UVec4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(self, #[proxy] rhs: bevy::math::UVec4) -> bevy::math::UVec4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, #[proxy] rhs: &glam::UVec4) -> bevy::math::UVec4; + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &glam::UVec4) -> bool; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, rhs: u32) -> bevy::math::UVec4; "#, r#" -/// Returns a vector containing the saturating addition of `self` and signed vector `rhs`. -/// In other words this computes `[self.x.saturating_add_signed(rhs.x), self.y.saturating_add_signed(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] - fn saturating_add_signed(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::UVec4; + #[lua( + as_trait = "std::ops::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, #[proxy] rhs: &glam::UVec4) -> bevy::math::UVec4; "#, r#" #[lua( - as_trait = "std::ops::Sub", + as_trait = "std::ops::Div", kind = "MetaFunction", output(proxy), - composite = "sub", - metamethod = "Sub", + composite = "div", + metamethod = "Div", )] - fn sub(self, #[proxy] rhs: bevy::math::UVec4) -> bevy::math::UVec4; + fn div(self, rhs: u32) -> bevy::math::UVec4; "#, r#" @@ -7354,25 +8485,31 @@ struct UVec3 { composite = "mul", metamethod = "Mul", )] - fn mul(self, rhs: u32) -> bevy::math::UVec4; + fn mul(self, #[proxy] rhs: &glam::UVec4) -> bevy::math::UVec4; + +"#, + r#" + + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Div", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "div", + metamethod = "Div", )] - fn mul(self, #[proxy] rhs: bevy::math::UVec4) -> bevy::math::UVec4; + fn div(self, #[proxy] rhs: bevy::math::UVec4) -> bevy::math::UVec4; "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] fn index(&self) -> String { - format!("{}", _self) + format!("{:?}", _self) } "#, r#" @@ -7401,22 +8538,37 @@ struct UVec4 { functions[r#" #[lua( - as_trait = "std::cmp::PartialEq", + as_trait = "std::ops::Sub", kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", + output(proxy), + composite = "sub", + metamethod = "Sub", )] - fn eq(&self, #[proxy] other: &glam::U64Vec2) -> bool; + fn sub(self, #[proxy] rhs: &glam::U64Vec2) -> bevy::math::U64Vec2; "#, r#" #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", + as_trait = "std::ops::Add", + kind = "MetaFunction", output(proxy), + composite = "add", + metamethod = "Add", )] - fn clone(&self) -> bevy::math::U64Vec2; + fn add(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::U64Vec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(self, rhs: u64) -> bevy::math::U64Vec2; "#, r#" @@ -7428,7 +8580,19 @@ struct UVec4 { composite = "mul", metamethod = "Mul", )] - fn mul(self, rhs: u64) -> bevy::math::U64Vec2; + fn mul(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::U64Vec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: &glam::U64Vec2) -> bevy::math::U64Vec2; "#, r#" @@ -7436,6 +8600,42 @@ struct UVec4 { #[lua(as_trait = "std::cmp::Eq", kind = "Method")] fn assert_receiver_is_total_eq(&self) -> (); +"#, + r#" + + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, #[proxy] rhs: &glam::U64Vec2) -> bevy::math::U64Vec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, #[proxy] rhs: &glam::U64Vec2) -> bevy::math::U64Vec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, rhs: u64) -> bevy::math::U64Vec2; + "#, r#" /// Creates a new vector. @@ -7770,6 +8970,150 @@ struct UVec4 { rhs: bevy::math::I64Vec2, ) -> bevy::math::U64Vec2; +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &glam::U64Vec2) -> bool; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, rhs: u64) -> bevy::math::U64Vec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, rhs: u64) -> bevy::math::U64Vec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, rhs: u64) -> bevy::math::U64Vec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, #[proxy] rhs: &glam::U64Vec2) -> bevy::math::U64Vec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::U64Vec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::U64Vec2; + +"#, + r#" + + #[lua( + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", + output(proxy), + )] + fn clone(&self) -> bevy::math::U64Vec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::U64Vec2; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct U64Vec2 { + x: u64, + y: u64, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::math::U64Vec3", + functions[r#" + + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, #[proxy] rhs: bevy::math::U64Vec3) -> bevy::math::U64Vec3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(self, #[proxy] rhs: &glam::U64Vec3) -> bevy::math::U64Vec3; + "#, r#" @@ -7780,31 +9124,31 @@ struct UVec4 { composite = "add", metamethod = "Add", )] - fn add(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::U64Vec2; + fn add(self, rhs: u64) -> bevy::math::U64Vec3; "#, r#" #[lua( - as_trait = "std::ops::Rem", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "rem", - metamethod = "Mod", + composite = "mul", + metamethod = "Mul", )] - fn rem(self, rhs: u64) -> bevy::math::U64Vec2; + fn mul(self, #[proxy] rhs: &glam::U64Vec3) -> bevy::math::U64Vec3; "#, r#" #[lua( - as_trait = "std::ops::Rem", + as_trait = "std::ops::Div", kind = "MetaFunction", output(proxy), - composite = "rem", - metamethod = "Mod", + composite = "div", + metamethod = "Div", )] - fn rem(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::U64Vec2; + fn div(self, #[proxy] rhs: &glam::U64Vec3) -> bevy::math::U64Vec3; "#, r#" @@ -7816,19 +9160,19 @@ struct UVec4 { composite = "div", metamethod = "Div", )] - fn div(self, rhs: u64) -> bevy::math::U64Vec2; + fn div(self, rhs: u64) -> bevy::math::U64Vec3; "#, r#" #[lua( - as_trait = "std::ops::Sub", + as_trait = "std::ops::Rem", kind = "MetaFunction", output(proxy), - composite = "sub", - metamethod = "Sub", + composite = "rem", + metamethod = "Mod", )] - fn sub(self, rhs: u64) -> bevy::math::U64Vec2; + fn rem(self, #[proxy] rhs: bevy::math::U64Vec3) -> bevy::math::U64Vec3; "#, r#" @@ -7840,19 +9184,13 @@ struct UVec4 { composite = "sub", metamethod = "Sub", )] - fn sub(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::U64Vec2; + fn sub(self, #[proxy] rhs: bevy::math::U64Vec3) -> bevy::math::U64Vec3; "#, r#" - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::U64Vec2; + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); "#, r#" @@ -7864,56 +9202,19 @@ struct UVec4 { composite = "div", metamethod = "Div", )] - fn div(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::U64Vec2; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, rhs: u64) -> bevy::math::U64Vec2; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{}", _self) -} -"#] -)] -struct U64Vec2 { - x: u64, - y: u64, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::math::U64Vec3", - functions[r#" - - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::U64Vec3; + fn div(self, #[proxy] rhs: bevy::math::U64Vec3) -> bevy::math::U64Vec3; "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Rem", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "rem", + metamethod = "Mod", )] - fn mul(self, #[proxy] rhs: bevy::math::U64Vec3) -> bevy::math::U64Vec3; + fn rem(self, rhs: u64) -> bevy::math::U64Vec3; "#, r#" @@ -7925,79 +9226,76 @@ struct U64Vec2 { composite = "rem", metamethod = "Mod", )] - fn rem(self, rhs: u64) -> bevy::math::U64Vec3; + fn rem(self, #[proxy] rhs: &glam::U64Vec3) -> bevy::math::U64Vec3; "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::cmp::PartialEq", kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "eq", + metamethod = "Eq", )] - fn mul(self, rhs: u64) -> bevy::math::U64Vec3; + fn eq(&self, #[proxy] other: &glam::U64Vec3) -> bool; "#, r#" #[lua( - as_trait = "std::ops::Rem", + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "rem", - metamethod = "Mod", + composite = "add", + metamethod = "Add", )] - fn rem(self, #[proxy] rhs: bevy::math::U64Vec3) -> bevy::math::U64Vec3; + fn add(self, #[proxy] rhs: &glam::U64Vec3) -> bevy::math::U64Vec3; "#, r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Sub", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "sub", + metamethod = "Sub", )] - fn div(self, rhs: u64) -> bevy::math::U64Vec3; + fn sub(self, rhs: u64) -> bevy::math::U64Vec3; "#, r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "mul", + metamethod = "Mul", )] - fn div(self, #[proxy] rhs: bevy::math::U64Vec3) -> bevy::math::U64Vec3; + fn mul(self, #[proxy] rhs: bevy::math::U64Vec3) -> bevy::math::U64Vec3; "#, r#" #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", output(proxy), - composite = "add", - metamethod = "Add", )] - fn add(self, #[proxy] rhs: bevy::math::U64Vec3) -> bevy::math::U64Vec3; + fn clone(&self) -> bevy::math::U64Vec3; "#, r#" #[lua( - as_trait = "std::ops::Sub", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "sub", - metamethod = "Sub", + composite = "mul", + metamethod = "Mul", )] - fn sub(self, rhs: u64) -> bevy::math::U64Vec3; + fn mul(self, rhs: u64) -> bevy::math::U64Vec3; "#, r#" @@ -8362,52 +9660,11 @@ struct U64Vec2 { rhs: bevy::math::I64Vec3, ) -> bevy::math::U64Vec3; -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &glam::U64Vec3) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, rhs: u64) -> bevy::math::U64Vec3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, #[proxy] rhs: bevy::math::U64Vec3) -> bevy::math::U64Vec3; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] fn index(&self) -> String { - format!("{}", _self) + format!("{:?}", _self) } "#] )] @@ -8423,25 +9680,25 @@ struct U64Vec3 { functions[r#" #[lua( - as_trait = "std::ops::Rem", + as_trait = "std::ops::Div", kind = "MetaFunction", output(proxy), - composite = "rem", - metamethod = "Mod", + composite = "div", + metamethod = "Div", )] - fn rem(self, #[proxy] rhs: bevy::math::U64Vec4) -> bevy::math::U64Vec4; + fn div(self, #[proxy] rhs: &glam::U64Vec4) -> bevy::math::U64Vec4; "#, r#" #[lua( - as_trait = "std::ops::Sub", + as_trait = "std::ops::Div", kind = "MetaFunction", output(proxy), - composite = "sub", - metamethod = "Sub", + composite = "div", + metamethod = "Div", )] - fn sub(self, rhs: u64) -> bevy::math::U64Vec4; + fn div(self, rhs: u64) -> bevy::math::U64Vec4; "#, r#" @@ -8455,17 +9712,35 @@ struct U64Vec3 { )] fn sub(self, #[proxy] rhs: bevy::math::U64Vec4) -> bevy::math::U64Vec4; +"#, + r#" + + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); + "#, r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Rem", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "rem", + metamethod = "Mod", )] - fn div(self, #[proxy] rhs: bevy::math::U64Vec4) -> bevy::math::U64Vec4; + fn rem(self, #[proxy] rhs: &glam::U64Vec4) -> bevy::math::U64Vec4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, rhs: u64) -> bevy::math::U64Vec4; "#, r#" @@ -8477,6 +9752,18 @@ struct U64Vec3 { )] fn clone(&self) -> bevy::math::U64Vec4; +"#, + r#" + + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, rhs: u64) -> bevy::math::U64Vec4; + "#, r#" /// Creates a new vector. @@ -8816,26 +10103,51 @@ struct U64Vec3 { "#, r#" -/// Returns a vector containing the saturating addition of `self` and signed vector `rhs`. -/// In other words this computes `[self.x.saturating_add_signed(rhs.x), self.y.saturating_add_signed(rhs.y), ..]`. +/// Returns a vector containing the saturating addition of `self` and signed vector `rhs`. +/// In other words this computes `[self.x.saturating_add_signed(rhs.x), self.y.saturating_add_signed(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn saturating_add_signed( + self, + #[proxy] + rhs: bevy::math::I64Vec4, + ) -> bevy::math::U64Vec4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, #[proxy] rhs: bevy::math::U64Vec4) -> bevy::math::U64Vec4; + +"#, + r#" - #[lua(kind = "Method", output(proxy))] - fn saturating_add_signed( - self, - #[proxy] - rhs: bevy::math::I64Vec4, - ) -> bevy::math::U64Vec4; + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: bevy::math::U64Vec4) -> bevy::math::U64Vec4; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", + as_trait = "std::ops::Add", kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", + output(proxy), + composite = "add", + metamethod = "Add", )] - fn eq(&self, #[proxy] other: &glam::U64Vec4) -> bool; + fn add(self, #[proxy] rhs: bevy::math::U64Vec4) -> bevy::math::U64Vec4; "#, r#" @@ -8847,31 +10159,30 @@ struct U64Vec3 { composite = "add", metamethod = "Add", )] - fn add(self, rhs: u64) -> bevy::math::U64Vec4; + fn add(self, #[proxy] rhs: &glam::U64Vec4) -> bevy::math::U64Vec4; "#, r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Sub", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "sub", + metamethod = "Sub", )] - fn div(self, rhs: u64) -> bevy::math::U64Vec4; + fn sub(self, rhs: u64) -> bevy::math::U64Vec4; "#, r#" #[lua( - as_trait = "std::ops::Add", + as_trait = "std::cmp::PartialEq", kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", + composite = "eq", + metamethod = "Eq", )] - fn add(self, #[proxy] rhs: bevy::math::U64Vec4) -> bevy::math::U64Vec4; + fn eq(&self, #[proxy] other: &glam::U64Vec4) -> bool; "#, r#" @@ -8888,8 +10199,14 @@ struct U64Vec3 { "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua( + as_trait = "std::ops::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, #[proxy] rhs: bevy::math::U64Vec4) -> bevy::math::U64Vec4; "#, r#" @@ -8901,25 +10218,25 @@ struct U64Vec3 { composite = "mul", metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: bevy::math::U64Vec4) -> bevy::math::U64Vec4; + fn mul(self, #[proxy] rhs: &glam::U64Vec4) -> bevy::math::U64Vec4; "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Sub", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "sub", + metamethod = "Sub", )] - fn mul(self, rhs: u64) -> bevy::math::U64Vec4; + fn sub(self, #[proxy] rhs: &glam::U64Vec4) -> bevy::math::U64Vec4; "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] fn index(&self) -> String { - format!("{}", _self) + format!("{:?}", _self) } "#] )] @@ -8936,37 +10253,49 @@ struct U64Vec4 { functions[r#" #[lua( - as_trait = "std::ops::Add", + as_trait = "std::ops::Rem", kind = "MetaFunction", output(proxy), - composite = "add", - metamethod = "Add", + composite = "rem", + metamethod = "Mod", )] - fn add(self, rhs: f32) -> bevy::math::Vec2; + fn rem(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; "#, r#" #[lua( - as_trait = "std::ops::Add", + as_trait = "std::ops::Sub", kind = "MetaFunction", output(proxy), - composite = "add", - metamethod = "Add", + composite = "sub", + metamethod = "Sub", )] - fn add(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; + fn sub(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Div", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "div", + metamethod = "Div", )] - fn mul(self, rhs: f32) -> bevy::math::Vec2; + fn div(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Neg", + kind = "MetaFunction", + output(proxy), + composite = "neg", + metamethod = "Unm", + )] + fn neg(self) -> bevy::math::Vec2; "#, r#" @@ -8978,7 +10307,55 @@ struct U64Vec4 { composite = "div", metamethod = "Div", )] - fn div(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; + fn div(self, rhs: f32) -> bevy::math::Vec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(self, rhs: f32) -> bevy::math::Vec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: &glam::Vec2) -> bevy::math::Vec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, #[proxy] rhs: &glam::Vec2) -> bevy::math::Vec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(self, #[proxy] rhs: &glam::Vec2) -> bevy::math::Vec2; "#, r#" @@ -8990,6 +10367,53 @@ struct U64Vec4 { )] fn clone(&self) -> bevy::math::Vec2; +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &glam::Vec2) -> bool; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, #[proxy] rhs: &glam::Vec2) -> bevy::math::Vec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, rhs: f32) -> bevy::math::Vec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; + "#, r#" /// Creates a new vector. @@ -9235,6 +10659,14 @@ struct U64Vec4 { #[lua(kind = "Method")] fn is_finite(self) -> bool; +"#, + r#" +/// Performs `is_finite` on each element of self, returning a vector mask of the results. +/// In other words, this computes `[x.is_finite(), y.is_finite(), ...]`. + + #[lua(kind = "Method", output(proxy))] + fn is_finite_mask(self) -> bevy::math::BVec2; + "#, r#" /// Returns `true` if any elements are `NaN`. @@ -9245,7 +10677,7 @@ struct U64Vec4 { "#, r#" /// Performs `is_nan` on each element of self, returning a vector mask of the results. -/// In other words, this computes `[x.is_nan(), y.is_nan(), z.is_nan(), w.is_nan()]`. +/// In other words, this computes `[x.is_nan(), y.is_nan(), ...]`. #[lua(kind = "Method", output(proxy))] fn is_nan_mask(self) -> bevy::math::BVec2; @@ -9305,10 +10737,10 @@ struct U64Vec4 { "#, r#" /// Returns `self` normalized to length 1.0. -/// For valid results, `self` must _not_ be of length zero, nor very close to zero. +/// For valid results, `self` must be finite and _not_ of length zero, nor very close to zero. /// See also [`Self::try_normalize()`] and [`Self::normalize_or_zero()`]. /// Panics -/// Will panic if `self` is zero length when `glam_assert` is enabled. +/// Will panic if the resulting normalized vector is not finite when `glam_assert` is enabled. #[lua(kind = "Method", output(proxy))] fn normalize(self) -> bevy::math::Vec2; @@ -9504,23 +10936,27 @@ struct U64Vec4 { "#, r#" -/// Returns a vector with a length no less than `min` and no more than `max` +/// Returns a vector with a length no less than `min` and no more than `max`. /// # Panics -/// Will panic if `min` is greater than `max` when `glam_assert` is enabled. +/// Will panic if `min` is greater than `max`, or if either `min` or `max` is negative, when `glam_assert` is enabled. #[lua(kind = "Method", output(proxy))] fn clamp_length(self, min: f32, max: f32) -> bevy::math::Vec2; "#, r#" -/// Returns a vector with a length no more than `max` +/// Returns a vector with a length no more than `max`. +/// # Panics +/// Will panic if `max` is negative when `glam_assert` is enabled. #[lua(kind = "Method", output(proxy))] fn clamp_length_max(self, max: f32) -> bevy::math::Vec2; "#, r#" -/// Returns a vector with a length no less than `min` +/// Returns a vector with a length no less than `min`. +/// # Panics +/// Will panic if `min` is negative when `glam_assert` is enabled. #[lua(kind = "Method", output(proxy))] fn clamp_length_min(self, min: f32) -> bevy::math::Vec2; @@ -9543,6 +10979,29 @@ struct U64Vec4 { b: bevy::math::Vec2, ) -> bevy::math::Vec2; +"#, + r#" +/// Returns the reflection vector for a given incident vector `self` and surface normal +/// `normal`. +/// `normal` must be normalized. +/// # Panics +/// Will panic if `normal` is not normalized when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn reflect(self, #[proxy] normal: bevy::math::Vec2) -> bevy::math::Vec2; + +"#, + r#" +/// Returns the refraction direction for a given incident vector `self`, surface normal +/// `normal` and ratio of indices of refraction, `eta`. When total internal reflection occurs, +/// a zero vector will be returned. +/// `self` and `normal` must be normalized. +/// # Panics +/// Will panic if `self` or `normal` is not normalized when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn refract(self, #[proxy] normal: bevy::math::Vec2, eta: f32) -> bevy::math::Vec2; + "#, r#" /// Creates a 2D vector containing `[angle.cos(), angle.sin()]`. This can be used in @@ -9563,12 +11022,18 @@ struct U64Vec4 { "#, r#" -/// Returns the angle (in radians) between `self` and `rhs` in the range `[-Ï€, +Ï€]`. -/// The inputs do not need to be unit vectors however they must be non-zero. #[lua(kind = "Method")] fn angle_between(self, #[proxy] rhs: bevy::math::Vec2) -> f32; +"#, + r#" +/// Returns the angle of rotation (in radians) from `self` to `rhs` in the range `[-Ï€, +Ï€]`. +/// The inputs do not need to be unit vectors however they must be non-zero. + + #[lua(kind = "Method")] + fn angle_to(self, #[proxy] rhs: bevy::math::Vec2) -> f32; + "#, r#" /// Returns a vector that is equal to `self` rotated by 90 degrees. @@ -9595,109 +11060,89 @@ struct U64Vec4 { "#, r#" -/// Casts all elements of `self` to `f64`. - - #[lua(kind = "Method", output(proxy))] - fn as_dvec2(&self) -> bevy::math::DVec2; - -"#, - r#" -/// Casts all elements of `self` to `i32`. +/// Rotates towards `rhs` up to `max_angle` (in radians). +/// When `max_angle` is `0.0`, the result will be equal to `self`. When `max_angle` is equal to +/// `self.angle_between(rhs)`, the result will be equal to `rhs`. If `max_angle` is negative, +/// rotates towards the exact opposite of `rhs`. Will not go past the target. #[lua(kind = "Method", output(proxy))] - fn as_ivec2(&self) -> bevy::math::IVec2; + fn rotate_towards( + &self, + #[proxy] + rhs: bevy::math::Vec2, + max_angle: f32, + ) -> bevy::math::Vec2; "#, r#" -/// Casts all elements of `self` to `u32`. +/// Casts all elements of `self` to `f64`. #[lua(kind = "Method", output(proxy))] - fn as_uvec2(&self) -> bevy::math::UVec2; + fn as_dvec2(&self) -> bevy::math::DVec2; "#, r#" -/// Casts all elements of `self` to `i64`. +/// Casts all elements of `self` to `i32`. #[lua(kind = "Method", output(proxy))] - fn as_i64vec2(&self) -> bevy::math::I64Vec2; + fn as_ivec2(&self) -> bevy::math::IVec2; "#, r#" -/// Casts all elements of `self` to `u64`. +/// Casts all elements of `self` to `u32`. #[lua(kind = "Method", output(proxy))] - fn as_u64vec2(&self) -> bevy::math::U64Vec2; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, rhs: f32) -> bevy::math::Vec2; + fn as_uvec2(&self) -> bevy::math::UVec2; "#, r#" +/// Casts all elements of `self` to `i64`. - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; + #[lua(kind = "Method", output(proxy))] + fn as_i64vec2(&self) -> bevy::math::I64Vec2; "#, r#" +/// Casts all elements of `self` to `u64`. - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; + #[lua(kind = "Method", output(proxy))] + fn as_u64vec2(&self) -> bevy::math::U64Vec2; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", + as_trait = "std::ops::Add", kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", + output(proxy), + composite = "add", + metamethod = "Add", )] - fn eq(&self, #[proxy] other: &glam::Vec2) -> bool; + fn add(self, #[proxy] rhs: &glam::Vec2) -> bevy::math::Vec2; "#, r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "mul", + metamethod = "Mul", )] - fn div(self, rhs: f32) -> bevy::math::Vec2; + fn mul(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; "#, r#" #[lua( - as_trait = "std::ops::Neg", + as_trait = "std::ops::Rem", kind = "MetaFunction", output(proxy), - composite = "neg", - metamethod = "Unm", + composite = "rem", + metamethod = "Mod", )] - fn neg(self) -> bevy::math::Vec2; + fn rem(self, rhs: f32) -> bevy::math::Vec2; "#, r#" @@ -9709,25 +11154,13 @@ struct U64Vec4 { composite = "mul", metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, rhs: f32) -> bevy::math::Vec2; + fn mul(self, rhs: f32) -> bevy::math::Vec2; "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] fn index(&self) -> String { - format!("{}", _self) + format!("{:?}", _self) } "#, r#" @@ -9753,30 +11186,6 @@ struct Vec2 { remote = "bevy::math::Vec3A", functions[r#" - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, rhs: f32) -> bevy::math::Vec3A; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, rhs: f32) -> bevy::math::Vec3A; - -"#, - r#" - #[lua( as_trait = "std::ops::Sub", kind = "MetaFunction", @@ -9784,67 +11193,18 @@ struct Vec2 { composite = "sub", metamethod = "Sub", )] - fn sub(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Neg", - kind = "MetaFunction", - output(proxy), - composite = "neg", - metamethod = "Unm", - )] - fn neg(self) -> bevy::math::Vec3A; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, rhs: f32) -> bevy::math::Vec3A; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, rhs: f32) -> bevy::math::Vec3A; + fn sub(self, #[proxy] rhs: &glam::Vec3A) -> bevy::math::Vec3A; "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::cmp::PartialEq", kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "eq", + metamethod = "Eq", )] - fn mul(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; + fn eq(&self, #[proxy] rhs: &glam::Vec3A) -> bool; "#, r#" @@ -9891,6 +11251,14 @@ struct Vec2 { #[lua(kind = "Method")] fn to_array(&self) -> [f32; 3]; +"#, + r#" +/// Creates a [`Vec3A`] from the `x`, `y` and `z` elements of `self` discarding `w`. +/// On architectures where SIMD is supported such as SSE2 on `x86_64` this conversion is a noop. + + #[lua(kind = "Function", output(proxy))] + fn from_vec4(#[proxy] v: bevy::math::Vec4) -> bevy::math::Vec3A; + "#, r#" /// Creates a 4D vector from `self` and the given `w` value. @@ -10113,6 +11481,14 @@ struct Vec2 { #[lua(kind = "Method")] fn is_finite(self) -> bool; +"#, + r#" +/// Performs `is_finite` on each element of self, returning a vector mask of the results. +/// In other words, this computes `[x.is_finite(), y.is_finite(), ...]`. + + #[lua(kind = "Method", output(proxy))] + fn is_finite_mask(self) -> bevy::math::BVec3A; + "#, r#" /// Returns `true` if any elements are `NaN`. @@ -10123,7 +11499,7 @@ struct Vec2 { "#, r#" /// Performs `is_nan` on each element of self, returning a vector mask of the results. -/// In other words, this computes `[x.is_nan(), y.is_nan(), z.is_nan(), w.is_nan()]`. +/// In other words, this computes `[x.is_nan(), y.is_nan(), ...]`. #[lua(kind = "Method", output(proxy))] fn is_nan_mask(self) -> bevy::math::BVec3A; @@ -10183,10 +11559,10 @@ struct Vec2 { "#, r#" /// Returns `self` normalized to length 1.0. -/// For valid results, `self` must _not_ be of length zero, nor very close to zero. +/// For valid results, `self` must be finite and _not_ of length zero, nor very close to zero. /// See also [`Self::try_normalize()`] and [`Self::normalize_or_zero()`]. /// Panics -/// Will panic if `self` is zero length when `glam_assert` is enabled. +/// Will panic if the resulting normalized vector is not finite when `glam_assert` is enabled. #[lua(kind = "Method", output(proxy))] fn normalize(self) -> bevy::math::Vec3A; @@ -10390,23 +11766,27 @@ struct Vec2 { "#, r#" -/// Returns a vector with a length no less than `min` and no more than `max` +/// Returns a vector with a length no less than `min` and no more than `max`. /// # Panics -/// Will panic if `min` is greater than `max` when `glam_assert` is enabled. +/// Will panic if `min` is greater than `max`, or if either `min` or `max` is negative, when `glam_assert` is enabled. #[lua(kind = "Method", output(proxy))] fn clamp_length(self, min: f32, max: f32) -> bevy::math::Vec3A; "#, r#" -/// Returns a vector with a length no more than `max` +/// Returns a vector with a length no more than `max`. +/// # Panics +/// Will panic if `max` is negative when `glam_assert` is enabled. #[lua(kind = "Method", output(proxy))] fn clamp_length_max(self, max: f32) -> bevy::math::Vec3A; "#, r#" -/// Returns a vector with a length no less than `min` +/// Returns a vector with a length no less than `min`. +/// # Panics +/// Will panic if `min` is negative when `glam_assert` is enabled. #[lua(kind = "Method", output(proxy))] fn clamp_length_min(self, min: f32) -> bevy::math::Vec3A; @@ -10431,87 +11811,233 @@ struct Vec2 { "#, r#" -/// Returns the angle (in radians) between two vectors. -/// The inputs do not need to be unit vectors however they must be non-zero. +/// Returns the reflection vector for a given incident vector `self` and surface normal +/// `normal`. +/// `normal` must be normalized. +/// # Panics +/// Will panic if `normal` is not normalized when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn reflect(self, #[proxy] normal: bevy::math::Vec3A) -> bevy::math::Vec3A; + +"#, + r#" +/// Returns the refraction direction for a given incident vector `self`, surface normal +/// `normal` and ratio of indices of refraction, `eta`. When total internal reflection occurs, +/// a zero vector will be returned. +/// `self` and `normal` must be normalized. +/// # Panics +/// Will panic if `self` or `normal` is not normalized when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn refract(self, #[proxy] normal: bevy::math::Vec3A, eta: f32) -> bevy::math::Vec3A; + +"#, + r#" +/// Returns the angle (in radians) between two vectors in the range `[0, +Ï€]`. +/// The inputs do not need to be unit vectors however they must be non-zero. + + #[lua(kind = "Method")] + fn angle_between(self, #[proxy] rhs: bevy::math::Vec3A) -> f32; + +"#, + r#" +/// Returns some vector that is orthogonal to the given one. +/// The input vector must be finite and non-zero. +/// The output vector is not necessarily unit length. For that use +/// [`Self::any_orthonormal_vector()`] instead. + + #[lua(kind = "Method", output(proxy))] + fn any_orthogonal_vector(&self) -> bevy::math::Vec3A; + +"#, + r#" +/// Returns any unit vector that is orthogonal to the given one. +/// The input vector must be unit length. +/// # Panics +/// Will panic if `self` is not normalized when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn any_orthonormal_vector(&self) -> bevy::math::Vec3A; + +"#, + r#" +/// Casts all elements of `self` to `f64`. + + #[lua(kind = "Method", output(proxy))] + fn as_dvec3(&self) -> bevy::math::DVec3; + +"#, + r#" +/// Casts all elements of `self` to `i32`. + + #[lua(kind = "Method", output(proxy))] + fn as_ivec3(&self) -> bevy::math::IVec3; + +"#, + r#" +/// Casts all elements of `self` to `u32`. + + #[lua(kind = "Method", output(proxy))] + fn as_uvec3(&self) -> bevy::math::UVec3; + +"#, + r#" +/// Casts all elements of `self` to `i64`. + + #[lua(kind = "Method", output(proxy))] + fn as_i64vec3(&self) -> bevy::math::I64Vec3; + +"#, + r#" +/// Casts all elements of `self` to `u64`. + + #[lua(kind = "Method", output(proxy))] + fn as_u64vec3(&self) -> bevy::math::U64Vec3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, rhs: f32) -> bevy::math::Vec3A; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; + +"#, + r#" - #[lua(kind = "Method")] - fn angle_between(self, #[proxy] rhs: bevy::math::Vec3A) -> f32; + #[lua( + as_trait = "std::ops::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, #[proxy] rhs: &glam::Vec3A) -> bevy::math::Vec3A; "#, r#" -/// Returns some vector that is orthogonal to the given one. -/// The input vector must be finite and non-zero. -/// The output vector is not necessarily unit length. For that use -/// [`Self::any_orthonormal_vector()`] instead. - #[lua(kind = "Method", output(proxy))] - fn any_orthogonal_vector(&self) -> bevy::math::Vec3A; + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, rhs: f32) -> bevy::math::Vec3A; "#, r#" -/// Returns any unit vector that is orthogonal to the given one. -/// The input vector must be unit length. -/// # Panics -/// Will panic if `self` is not normalized when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] - fn any_orthonormal_vector(&self) -> bevy::math::Vec3A; + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; "#, r#" -/// Casts all elements of `self` to `f64`. - #[lua(kind = "Method", output(proxy))] - fn as_dvec3(&self) -> bevy::math::DVec3; + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, rhs: f32) -> bevy::math::Vec3A; "#, r#" -/// Casts all elements of `self` to `i32`. - #[lua(kind = "Method", output(proxy))] - fn as_ivec3(&self) -> bevy::math::IVec3; + #[lua( + as_trait = "std::ops::Neg", + kind = "MetaFunction", + output(proxy), + composite = "neg", + metamethod = "Unm", + )] + fn neg(self) -> bevy::math::Vec3A; "#, r#" -/// Casts all elements of `self` to `u32`. - #[lua(kind = "Method", output(proxy))] - fn as_uvec3(&self) -> bevy::math::UVec3; + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, #[proxy] rhs: &glam::Vec3A) -> bevy::math::Vec3A; "#, r#" -/// Casts all elements of `self` to `i64`. - #[lua(kind = "Method", output(proxy))] - fn as_i64vec3(&self) -> bevy::math::I64Vec3; + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; "#, r#" -/// Casts all elements of `self` to `u64`. - #[lua(kind = "Method", output(proxy))] - fn as_u64vec3(&self) -> bevy::math::U64Vec3; + #[lua( + as_trait = "std::ops::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(self, rhs: f32) -> bevy::math::Vec3A; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", + as_trait = "std::ops::Div", kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", + output(proxy), + composite = "div", + metamethod = "Div", )] - fn eq(&self, #[proxy] rhs: &glam::Vec3A) -> bool; + fn div(self, #[proxy] rhs: &glam::Vec3A) -> bevy::math::Vec3A; "#, r#" #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", + as_trait = "std::ops::Add", + kind = "MetaFunction", output(proxy), + composite = "add", + metamethod = "Add", )] - fn clone(&self) -> bevy::math::Vec3A; + fn add(self, rhs: f32) -> bevy::math::Vec3A; "#, r#" @@ -10523,37 +12049,47 @@ struct Vec2 { composite = "rem", metamethod = "Mod", )] - fn rem(self, rhs: f32) -> bevy::math::Vec3A; + fn rem(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; "#, r#" #[lua( - as_trait = "std::ops::Rem", + as_trait = "std::ops::Sub", kind = "MetaFunction", output(proxy), - composite = "rem", - metamethod = "Mod", + composite = "sub", + metamethod = "Sub", )] - fn rem(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; + fn sub(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; "#, r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "mul", + metamethod = "Mul", )] - fn div(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; + fn mul(self, #[proxy] rhs: &glam::Vec3A) -> bevy::math::Vec3A; + +"#, + r#" + + #[lua( + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", + output(proxy), + )] + fn clone(&self) -> bevy::math::Vec3A; "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] fn index(&self) -> String { - format!("{}", _self) + format!("{:?}", _self) } "#, r#" @@ -10834,6 +12370,14 @@ struct Vec3A(); #[lua(kind = "Method")] fn is_finite(self) -> bool; +"#, + r#" +/// Performs `is_finite` on each element of self, returning a vector mask of the results. +/// In other words, this computes `[x.is_finite(), y.is_finite(), ...]`. + + #[lua(kind = "Method", output(proxy))] + fn is_finite_mask(self) -> bevy::math::BVec4A; + "#, r#" /// Returns `true` if any elements are `NaN`. @@ -10844,7 +12388,7 @@ struct Vec3A(); "#, r#" /// Performs `is_nan` on each element of self, returning a vector mask of the results. -/// In other words, this computes `[x.is_nan(), y.is_nan(), z.is_nan(), w.is_nan()]`. +/// In other words, this computes `[x.is_nan(), y.is_nan(), ...]`. #[lua(kind = "Method", output(proxy))] fn is_nan_mask(self) -> bevy::math::BVec4A; @@ -10904,10 +12448,10 @@ struct Vec3A(); "#, r#" /// Returns `self` normalized to length 1.0. -/// For valid results, `self` must _not_ be of length zero, nor very close to zero. +/// For valid results, `self` must be finite and _not_ of length zero, nor very close to zero. /// See also [`Self::try_normalize()`] and [`Self::normalize_or_zero()`]. /// Panics -/// Will panic if `self` is zero length when `glam_assert` is enabled. +/// Will panic if the resulting normalized vector is not finite when `glam_assert` is enabled. #[lua(kind = "Method", output(proxy))] fn normalize(self) -> bevy::math::Vec4; @@ -11103,23 +12647,27 @@ struct Vec3A(); "#, r#" -/// Returns a vector with a length no less than `min` and no more than `max` +/// Returns a vector with a length no less than `min` and no more than `max`. /// # Panics -/// Will panic if `min` is greater than `max` when `glam_assert` is enabled. +/// Will panic if `min` is greater than `max`, or if either `min` or `max` is negative, when `glam_assert` is enabled. #[lua(kind = "Method", output(proxy))] fn clamp_length(self, min: f32, max: f32) -> bevy::math::Vec4; "#, r#" -/// Returns a vector with a length no more than `max` +/// Returns a vector with a length no more than `max`. +/// # Panics +/// Will panic if `max` is negative when `glam_assert` is enabled. #[lua(kind = "Method", output(proxy))] fn clamp_length_max(self, max: f32) -> bevy::math::Vec4; "#, r#" -/// Returns a vector with a length no less than `min` +/// Returns a vector with a length no less than `min`. +/// # Panics +/// Will panic if `min` is negative when `glam_assert` is enabled. #[lua(kind = "Method", output(proxy))] fn clamp_length_min(self, min: f32) -> bevy::math::Vec4; @@ -11142,6 +12690,29 @@ struct Vec3A(); b: bevy::math::Vec4, ) -> bevy::math::Vec4; +"#, + r#" +/// Returns the reflection vector for a given incident vector `self` and surface normal +/// `normal`. +/// `normal` must be normalized. +/// # Panics +/// Will panic if `normal` is not normalized when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn reflect(self, #[proxy] normal: bevy::math::Vec4) -> bevy::math::Vec4; + +"#, + r#" +/// Returns the refraction direction for a given incident vector `self`, surface normal +/// `normal` and ratio of indices of refraction, `eta`. When total internal reflection occurs, +/// a zero vector will be returned. +/// `self` and `normal` must be normalized. +/// # Panics +/// Will panic if `self` or `normal` is not normalized when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn refract(self, #[proxy] normal: bevy::math::Vec4, eta: f32) -> bevy::math::Vec4; + "#, r#" /// Casts all elements of `self` to `f64`. @@ -11181,24 +12752,37 @@ struct Vec3A(); r#" #[lua( - as_trait = "std::cmp::PartialEq", + as_trait = "std::ops::Rem", kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", + output(proxy), + composite = "rem", + metamethod = "Mod", )] - fn eq(&self, #[proxy] rhs: &glam::Vec4) -> bool; + fn rem(self, rhs: f32) -> bevy::math::Vec4; "#, r#" #[lua( - as_trait = "std::ops::Sub", + as_trait = "std::ops::Div", kind = "MetaFunction", output(proxy), - composite = "sub", - metamethod = "Sub", + composite = "div", + metamethod = "Div", )] - fn sub(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::Vec4; + fn div(self, #[proxy] rhs: &glam::Vec4) -> bevy::math::Vec4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, rhs: f32) -> bevy::math::Vec4; "#, r#" @@ -11212,6 +12796,18 @@ struct Vec3A(); )] fn neg(self) -> bevy::math::Vec4; +"#, + r#" + + #[lua( + as_trait = "std::ops::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(self, #[proxy] rhs: &glam::Vec4) -> bevy::math::Vec4; + "#, r#" @@ -11224,6 +12820,30 @@ struct Vec3A(); )] fn add(self, rhs: f32) -> bevy::math::Vec4; +"#, + r#" + + #[lua( + as_trait = "std::ops::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::Vec4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, #[proxy] rhs: &glam::Vec4) -> bevy::math::Vec4; + "#, r#" @@ -11240,13 +12860,13 @@ struct Vec3A(); r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Sub", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "sub", + metamethod = "Sub", )] - fn div(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::Vec4; + fn sub(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::Vec4; "#, r#" @@ -11258,7 +12878,7 @@ struct Vec3A(); composite = "mul", metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::Vec4; + fn mul(self, #[proxy] rhs: &glam::Vec4) -> bevy::math::Vec4; "#, r#" @@ -11274,25 +12894,24 @@ struct Vec3A(); r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::cmp::PartialEq", kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", + composite = "eq", + metamethod = "Eq", )] - fn div(self, rhs: f32) -> bevy::math::Vec4; + fn eq(&self, #[proxy] rhs: &glam::Vec4) -> bool; "#, r#" #[lua( - as_trait = "std::ops::Rem", + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "rem", - metamethod = "Mod", + composite = "add", + metamethod = "Add", )] - fn rem(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::Vec4; + fn add(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::Vec4; "#, r#" @@ -11304,37 +12923,49 @@ struct Vec3A(); composite = "mul", metamethod = "Mul", )] - fn mul(self, rhs: f32) -> bevy::math::Vec4; + fn mul(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::Vec4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, #[proxy] rhs: &glam::Vec4) -> bevy::math::Vec4; "#, r#" #[lua( - as_trait = "std::ops::Rem", + as_trait = "std::ops::Div", kind = "MetaFunction", output(proxy), - composite = "rem", - metamethod = "Mod", + composite = "div", + metamethod = "Div", )] - fn rem(self, rhs: f32) -> bevy::math::Vec4; + fn div(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::Vec4; "#, r#" #[lua( - as_trait = "std::ops::Add", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "add", - metamethod = "Add", + composite = "mul", + metamethod = "Mul", )] - fn add(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::Vec4; + fn mul(self, rhs: f32) -> bevy::math::Vec4; "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] fn index(&self) -> String { - format!("{}", _self) + format!("{:?}", _self) } "#, r#" @@ -11357,27 +12988,6 @@ struct Vec4(); remote = "bevy::math::BVec2", functions[r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &glam::BVec2) -> bool; - -"#, - r#" - - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::BVec2; - -"#, - r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] fn assert_receiver_is_total_eq(&self) -> (); @@ -11441,11 +13051,32 @@ struct Vec4(); #[lua(kind = "MutatingMethod")] fn set(&mut self, index: usize, value: bool) -> (); +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &glam::BVec2) -> bool; + +"#, + r#" + + #[lua( + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", + output(proxy), + )] + fn clone(&self) -> bevy::math::BVec2; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] fn index(&self) -> String { - format!("{}", _self) + format!("{:?}", _self) } "#] )] @@ -11459,17 +13090,6 @@ struct BVec2 { remote = "bevy::math::BVec3", functions[r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &glam::BVec3) -> bool; - -"#, - r#" - #[lua( as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", kind = "Method", @@ -11477,6 +13097,12 @@ struct BVec2 { )] fn clone(&self) -> bevy::math::BVec3; +"#, + r#" + + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); + "#, r#" /// Creates a new vector mask. @@ -11540,14 +13166,19 @@ struct BVec2 { "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &glam::BVec3) -> bool; "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] fn index(&self) -> String { - format!("{}", _self) + format!("{:?}", _self) } "#] )] @@ -11562,16 +13193,6 @@ struct BVec3 { remote = "bevy::math::BVec4", functions[r#" - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::BVec4; - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -11646,11 +13267,21 @@ struct BVec3 { #[lua(as_trait = "std::cmp::Eq", kind = "Method")] fn assert_receiver_is_total_eq(&self) -> (); +"#, + r#" + + #[lua( + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", + output(proxy), + )] + fn clone(&self) -> bevy::math::BVec4; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] fn index(&self) -> String { - format!("{}", _self) + format!("{:?}", _self) } "#] )] @@ -11673,7 +13304,29 @@ struct BVec4 { composite = "mul", metamethod = "Mul", )] - fn mul(self, rhs: f64) -> bevy::math::DVec2; + fn mul(self, #[proxy] rhs: &glam::DVec2) -> bevy::math::DVec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; + +"#, + r#" + + #[lua( + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", + output(proxy), + )] + fn clone(&self) -> bevy::math::DVec2; "#, r#" @@ -11687,6 +13340,42 @@ struct BVec4 { )] fn sub(self, rhs: f64) -> bevy::math::DVec2; +"#, + r#" + + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, #[proxy] rhs: &glam::DVec2) -> bevy::math::DVec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; + "#, r#" @@ -11703,13 +13392,24 @@ struct BVec4 { r#" #[lua( - as_trait = "std::ops::Add", + as_trait = "std::ops::Sub", kind = "MetaFunction", output(proxy), - composite = "add", - metamethod = "Add", + composite = "sub", + metamethod = "Sub", )] - fn add(self, rhs: f64) -> bevy::math::DVec2; + fn sub(self, #[proxy] rhs: &glam::DVec2) -> bevy::math::DVec2; + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &glam::DVec2) -> bool; "#, r#" @@ -11727,23 +13427,25 @@ struct BVec4 { r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "add", + metamethod = "Add", )] - fn div(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; + fn add(self, rhs: f64) -> bevy::math::DVec2; "#, r#" #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", + as_trait = "std::ops::Div", + kind = "MetaFunction", output(proxy), + composite = "div", + metamethod = "Div", )] - fn clone(&self) -> bevy::math::DVec2; + fn div(self, rhs: f64) -> bevy::math::DVec2; "#, r#" @@ -11761,24 +13463,37 @@ struct BVec4 { r#" #[lua( - as_trait = "std::ops::Add", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "add", - metamethod = "Add", + composite = "mul", + metamethod = "Mul", )] - fn add(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; + fn mul(self, rhs: f64) -> bevy::math::DVec2; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", + as_trait = "std::ops::Rem", kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", + output(proxy), + composite = "rem", + metamethod = "Mod", )] - fn eq(&self, #[proxy] other: &glam::DVec2) -> bool; + fn rem(self, #[proxy] rhs: &glam::DVec2) -> bevy::math::DVec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; "#, r#" @@ -12025,6 +13740,14 @@ struct BVec4 { #[lua(kind = "Method")] fn is_finite(self) -> bool; +"#, + r#" +/// Performs `is_finite` on each element of self, returning a vector mask of the results. +/// In other words, this computes `[x.is_finite(), y.is_finite(), ...]`. + + #[lua(kind = "Method", output(proxy))] + fn is_finite_mask(self) -> bevy::math::BVec2; + "#, r#" /// Returns `true` if any elements are `NaN`. @@ -12035,7 +13758,7 @@ struct BVec4 { "#, r#" /// Performs `is_nan` on each element of self, returning a vector mask of the results. -/// In other words, this computes `[x.is_nan(), y.is_nan(), z.is_nan(), w.is_nan()]`. +/// In other words, this computes `[x.is_nan(), y.is_nan(), ...]`. #[lua(kind = "Method", output(proxy))] fn is_nan_mask(self) -> bevy::math::BVec2; @@ -12095,10 +13818,10 @@ struct BVec4 { "#, r#" /// Returns `self` normalized to length 1.0. -/// For valid results, `self` must _not_ be of length zero, nor very close to zero. +/// For valid results, `self` must be finite and _not_ of length zero, nor very close to zero. /// See also [`Self::try_normalize()`] and [`Self::normalize_or_zero()`]. /// Panics -/// Will panic if `self` is zero length when `glam_assert` is enabled. +/// Will panic if the resulting normalized vector is not finite when `glam_assert` is enabled. #[lua(kind = "Method", output(proxy))] fn normalize(self) -> bevy::math::DVec2; @@ -12302,23 +14025,27 @@ struct BVec4 { "#, r#" -/// Returns a vector with a length no less than `min` and no more than `max` +/// Returns a vector with a length no less than `min` and no more than `max`. /// # Panics -/// Will panic if `min` is greater than `max` when `glam_assert` is enabled. +/// Will panic if `min` is greater than `max`, or if either `min` or `max` is negative, when `glam_assert` is enabled. #[lua(kind = "Method", output(proxy))] fn clamp_length(self, min: f64, max: f64) -> bevy::math::DVec2; "#, r#" -/// Returns a vector with a length no more than `max` +/// Returns a vector with a length no more than `max`. +/// # Panics +/// Will panic if `max` is negative when `glam_assert` is enabled. #[lua(kind = "Method", output(proxy))] fn clamp_length_max(self, max: f64) -> bevy::math::DVec2; "#, r#" -/// Returns a vector with a length no less than `min` +/// Returns a vector with a length no less than `min`. +/// # Panics +/// Will panic if `min` is negative when `glam_assert` is enabled. #[lua(kind = "Method", output(proxy))] fn clamp_length_min(self, min: f64) -> bevy::math::DVec2; @@ -12333,13 +14060,36 @@ struct BVec4 { /// mind. #[lua(kind = "Method", output(proxy))] - fn mul_add( - self, - #[proxy] - a: bevy::math::DVec2, - #[proxy] - b: bevy::math::DVec2, - ) -> bevy::math::DVec2; + fn mul_add( + self, + #[proxy] + a: bevy::math::DVec2, + #[proxy] + b: bevy::math::DVec2, + ) -> bevy::math::DVec2; + +"#, + r#" +/// Returns the reflection vector for a given incident vector `self` and surface normal +/// `normal`. +/// `normal` must be normalized. +/// # Panics +/// Will panic if `normal` is not normalized when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn reflect(self, #[proxy] normal: bevy::math::DVec2) -> bevy::math::DVec2; + +"#, + r#" +/// Returns the refraction direction for a given incident vector `self`, surface normal +/// `normal` and ratio of indices of refraction, `eta`. When total internal reflection occurs, +/// a zero vector will be returned. +/// `self` and `normal` must be normalized. +/// # Panics +/// Will panic if `self` or `normal` is not normalized when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn refract(self, #[proxy] normal: bevy::math::DVec2, eta: f64) -> bevy::math::DVec2; "#, r#" @@ -12361,12 +14111,18 @@ struct BVec4 { "#, r#" -/// Returns the angle (in radians) between `self` and `rhs` in the range `[-Ï€, +Ï€]`. -/// The inputs do not need to be unit vectors however they must be non-zero. #[lua(kind = "Method")] fn angle_between(self, #[proxy] rhs: bevy::math::DVec2) -> f64; +"#, + r#" +/// Returns the angle of rotation (in radians) from `self` to `rhs` in the range `[-Ï€, +Ï€]`. +/// The inputs do not need to be unit vectors however they must be non-zero. + + #[lua(kind = "Method")] + fn angle_to(self, #[proxy] rhs: bevy::math::DVec2) -> f64; + "#, r#" /// Returns a vector that is equal to `self` rotated by 90 degrees. @@ -12391,6 +14147,21 @@ struct BVec4 { #[lua(kind = "Method", output(proxy))] fn rotate(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; +"#, + r#" +/// Rotates towards `rhs` up to `max_angle` (in radians). +/// When `max_angle` is `0.0`, the result will be equal to `self`. When `max_angle` is equal to +/// `self.angle_between(rhs)`, the result will be equal to `rhs`. If `max_angle` is negative, +/// rotates towards the exact opposite of `rhs`. Will not go past the target. + + #[lua(kind = "Method", output(proxy))] + fn rotate_towards( + &self, + #[proxy] + rhs: bevy::math::DVec2, + max_angle: f64, + ) -> bevy::math::DVec2; + "#, r#" /// Casts all elements of `self` to `f32`. @@ -12426,18 +14197,6 @@ struct BVec4 { #[lua(kind = "Method", output(proxy))] fn as_u64vec2(&self) -> bevy::math::U64Vec2; -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; - "#, r#" @@ -12448,25 +14207,13 @@ struct BVec4 { composite = "div", metamethod = "Div", )] - fn div(self, rhs: f64) -> bevy::math::DVec2; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; + fn div(self, #[proxy] rhs: &glam::DVec2) -> bevy::math::DVec2; "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] fn index(&self) -> String { - format!("{}", _self) + format!("{:?}", _self) } "#, r#" @@ -12492,64 +14239,6 @@ struct DVec2 { remote = "bevy::math::DVec3", functions[r#" - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, rhs: f64) -> bevy::math::DVec3; - -"#, - r#" - - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::DVec3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, rhs: f64) -> bevy::math::DVec3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; - -"#, - r#" - #[lua( as_trait = "std::ops::Add", kind = "MetaFunction", @@ -12557,30 +14246,7 @@ struct DVec2 { composite = "add", metamethod = "Add", )] - fn add(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, rhs: f64) -> bevy::math::DVec3; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &glam::DVec3) -> bool; + fn add(self, #[proxy] rhs: &glam::DVec3) -> bevy::math::DVec3; "#, r#" @@ -12592,19 +14258,17 @@ struct DVec2 { composite = "div", metamethod = "Div", )] - fn div(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; + fn div(self, #[proxy] rhs: &glam::DVec3) -> bevy::math::DVec3; "#, r#" #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", output(proxy), - composite = "mul", - metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; + fn clone(&self) -> bevy::math::DVec3; "#, r#" @@ -12622,25 +14286,13 @@ struct DVec2 { r#" #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, rhs: f64) -> bevy::math::DVec3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Neg", + as_trait = "std::ops::Rem", kind = "MetaFunction", output(proxy), - composite = "neg", - metamethod = "Unm", + composite = "rem", + metamethod = "Mod", )] - fn neg(self) -> bevy::math::DVec3; + fn rem(self, rhs: f64) -> bevy::math::DVec3; "#, r#" @@ -12909,6 +14561,14 @@ struct DVec2 { #[lua(kind = "Method")] fn is_finite(self) -> bool; +"#, + r#" +/// Performs `is_finite` on each element of self, returning a vector mask of the results. +/// In other words, this computes `[x.is_finite(), y.is_finite(), ...]`. + + #[lua(kind = "Method", output(proxy))] + fn is_finite_mask(self) -> bevy::math::BVec3; + "#, r#" /// Returns `true` if any elements are `NaN`. @@ -12919,7 +14579,7 @@ struct DVec2 { "#, r#" /// Performs `is_nan` on each element of self, returning a vector mask of the results. -/// In other words, this computes `[x.is_nan(), y.is_nan(), z.is_nan(), w.is_nan()]`. +/// In other words, this computes `[x.is_nan(), y.is_nan(), ...]`. #[lua(kind = "Method", output(proxy))] fn is_nan_mask(self) -> bevy::math::BVec3; @@ -12979,10 +14639,10 @@ struct DVec2 { "#, r#" /// Returns `self` normalized to length 1.0. -/// For valid results, `self` must _not_ be of length zero, nor very close to zero. +/// For valid results, `self` must be finite and _not_ of length zero, nor very close to zero. /// See also [`Self::try_normalize()`] and [`Self::normalize_or_zero()`]. /// Panics -/// Will panic if `self` is zero length when `glam_assert` is enabled. +/// Will panic if the resulting normalized vector is not finite when `glam_assert` is enabled. #[lua(kind = "Method", output(proxy))] fn normalize(self) -> bevy::math::DVec3; @@ -13186,23 +14846,27 @@ struct DVec2 { "#, r#" -/// Returns a vector with a length no less than `min` and no more than `max` +/// Returns a vector with a length no less than `min` and no more than `max`. /// # Panics -/// Will panic if `min` is greater than `max` when `glam_assert` is enabled. +/// Will panic if `min` is greater than `max`, or if either `min` or `max` is negative, when `glam_assert` is enabled. #[lua(kind = "Method", output(proxy))] fn clamp_length(self, min: f64, max: f64) -> bevy::math::DVec3; "#, r#" -/// Returns a vector with a length no more than `max` +/// Returns a vector with a length no more than `max`. +/// # Panics +/// Will panic if `max` is negative when `glam_assert` is enabled. #[lua(kind = "Method", output(proxy))] fn clamp_length_max(self, max: f64) -> bevy::math::DVec3; "#, r#" -/// Returns a vector with a length no less than `min` +/// Returns a vector with a length no less than `min`. +/// # Panics +/// Will panic if `min` is negative when `glam_assert` is enabled. #[lua(kind = "Method", output(proxy))] fn clamp_length_min(self, min: f64) -> bevy::math::DVec3; @@ -13227,7 +14891,30 @@ struct DVec2 { "#, r#" -/// Returns the angle (in radians) between two vectors. +/// Returns the reflection vector for a given incident vector `self` and surface normal +/// `normal`. +/// `normal` must be normalized. +/// # Panics +/// Will panic if `normal` is not normalized when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn reflect(self, #[proxy] normal: bevy::math::DVec3) -> bevy::math::DVec3; + +"#, + r#" +/// Returns the refraction direction for a given incident vector `self`, surface normal +/// `normal` and ratio of indices of refraction, `eta`. When total internal reflection occurs, +/// a zero vector will be returned. +/// `self` and `normal` must be normalized. +/// # Panics +/// Will panic if `self` or `normal` is not normalized when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn refract(self, #[proxy] normal: bevy::math::DVec3, eta: f64) -> bevy::math::DVec3; + +"#, + r#" +/// Returns the angle (in radians) between two vectors in the range `[0, +Ï€]`. /// The inputs do not need to be unit vectors however they must be non-zero. #[lua(kind = "Method")] @@ -13297,42 +14984,63 @@ struct DVec2 { "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{}", _self) -} + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; + "#, r#" -#[lua(kind="MetaMethod", raw , metamethod="Index")] -fn index(&self, lua: &Lua, idx: crate::lua::util::LuaIndex) -> Result { - Ok(self.inner()?[*idx]) -} + + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; + "#, r#" -#[lua(kind="MutatingMetaMethod", raw, metamethod="NewIndex")] -fn index(&mut self, lua: &Lua, idx: crate::lua::util::LuaIndex, val: f64) -> Result<(),_> { - self.val_mut(|s| Ok(s[*idx] = val))? -} -"#] -)] -struct DVec3 { - x: f64, - y: f64, - z: f64, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::math::DVec4", - functions[r#" #[lua( - as_trait = "std::cmp::PartialEq", + as_trait = "std::ops::Add", kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, rhs: f64) -> bevy::math::DVec3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, #[proxy] rhs: &glam::DVec3) -> bevy::math::DVec3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Neg", + kind = "MetaFunction", + output(proxy), + composite = "neg", + metamethod = "Unm", )] - fn eq(&self, #[proxy] other: &glam::DVec4) -> bool; + fn neg(self) -> bevy::math::DVec3; "#, r#" @@ -13344,31 +15052,31 @@ struct DVec3 { composite = "sub", metamethod = "Sub", )] - fn sub(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::DVec4; + fn sub(self, #[proxy] rhs: &glam::DVec3) -> bevy::math::DVec3; "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Div", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "div", + metamethod = "Div", )] - fn mul(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::DVec4; + fn div(self, rhs: f64) -> bevy::math::DVec3; "#, r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Sub", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "sub", + metamethod = "Sub", )] - fn div(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::DVec4; + fn sub(self, rhs: f64) -> bevy::math::DVec3; "#, r#" @@ -13380,19 +15088,19 @@ struct DVec3 { composite = "rem", metamethod = "Mod", )] - fn rem(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::DVec4; + fn rem(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; "#, r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Sub", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "sub", + metamethod = "Sub", )] - fn div(self, rhs: f64) -> bevy::math::DVec4; + fn sub(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; "#, r#" @@ -13404,17 +15112,70 @@ struct DVec3 { composite = "add", metamethod = "Add", )] - fn add(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::DVec4; + fn add(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; "#, r#" #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", + as_trait = "std::ops::Mul", + kind = "MetaFunction", output(proxy), + composite = "mul", + metamethod = "Mul", )] - fn clone(&self) -> bevy::math::DVec4; + fn mul(self, #[proxy] rhs: &glam::DVec3) -> bevy::math::DVec3; + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &glam::DVec3) -> bool; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#, + r#" +#[lua(kind="MetaMethod", raw , metamethod="Index")] +fn index(&self, lua: &Lua, idx: crate::lua::util::LuaIndex) -> Result { + Ok(self.inner()?[*idx]) +} +"#, + r#" +#[lua(kind="MutatingMetaMethod", raw, metamethod="NewIndex")] +fn index(&mut self, lua: &Lua, idx: crate::lua::util::LuaIndex, val: f64) -> Result<(),_> { + self.val_mut(|s| Ok(s[*idx] = val))? +} +"#] +)] +struct DVec3 { + x: f64, + y: f64, + z: f64, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::math::DVec4", + functions[r#" + + #[lua( + as_trait = "std::ops::Neg", + kind = "MetaFunction", + output(proxy), + composite = "neg", + metamethod = "Unm", + )] + fn neg(self) -> bevy::math::DVec4; "#, r#" @@ -13426,43 +15187,53 @@ struct DVec3 { composite = "add", metamethod = "Add", )] - fn add(self, rhs: f64) -> bevy::math::DVec4; + fn add(self, #[proxy] rhs: &glam::DVec4) -> bevy::math::DVec4; "#, r#" #[lua( - as_trait = "std::ops::Sub", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "sub", - metamethod = "Sub", + composite = "mul", + metamethod = "Mul", )] - fn sub(self, rhs: f64) -> bevy::math::DVec4; + fn mul(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::DVec4; "#, r#" #[lua( - as_trait = "std::ops::Neg", + as_trait = "std::ops::Rem", kind = "MetaFunction", output(proxy), - composite = "neg", - metamethod = "Unm", + composite = "rem", + metamethod = "Mod", )] - fn neg(self) -> bevy::math::DVec4; + fn rem(self, #[proxy] rhs: &glam::DVec4) -> bevy::math::DVec4; "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Rem", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "rem", + metamethod = "Mod", )] - fn mul(self, rhs: f64) -> bevy::math::DVec4; + fn rem(self, rhs: f64) -> bevy::math::DVec4; + +"#, + r#" + + #[lua( + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", + output(proxy), + )] + fn clone(&self) -> bevy::math::DVec4; "#, r#" @@ -13724,6 +15495,14 @@ struct DVec3 { #[lua(kind = "Method")] fn is_finite(self) -> bool; +"#, + r#" +/// Performs `is_finite` on each element of self, returning a vector mask of the results. +/// In other words, this computes `[x.is_finite(), y.is_finite(), ...]`. + + #[lua(kind = "Method", output(proxy))] + fn is_finite_mask(self) -> bevy::math::BVec4; + "#, r#" /// Returns `true` if any elements are `NaN`. @@ -13734,7 +15513,7 @@ struct DVec3 { "#, r#" /// Performs `is_nan` on each element of self, returning a vector mask of the results. -/// In other words, this computes `[x.is_nan(), y.is_nan(), z.is_nan(), w.is_nan()]`. +/// In other words, this computes `[x.is_nan(), y.is_nan(), ...]`. #[lua(kind = "Method", output(proxy))] fn is_nan_mask(self) -> bevy::math::BVec4; @@ -13794,10 +15573,10 @@ struct DVec3 { "#, r#" /// Returns `self` normalized to length 1.0. -/// For valid results, `self` must _not_ be of length zero, nor very close to zero. +/// For valid results, `self` must be finite and _not_ of length zero, nor very close to zero. /// See also [`Self::try_normalize()`] and [`Self::normalize_or_zero()`]. /// Panics -/// Will panic if `self` is zero length when `glam_assert` is enabled. +/// Will panic if the resulting normalized vector is not finite when `glam_assert` is enabled. #[lua(kind = "Method", output(proxy))] fn normalize(self) -> bevy::math::DVec4; @@ -14001,97 +15780,255 @@ struct DVec3 { "#, r#" -/// Returns a vector with a length no less than `min` and no more than `max` +/// Returns a vector with a length no less than `min` and no more than `max`. /// # Panics -/// Will panic if `min` is greater than `max` when `glam_assert` is enabled. +/// Will panic if `min` is greater than `max`, or if either `min` or `max` is negative, when `glam_assert` is enabled. #[lua(kind = "Method", output(proxy))] fn clamp_length(self, min: f64, max: f64) -> bevy::math::DVec4; "#, r#" -/// Returns a vector with a length no more than `max` +/// Returns a vector with a length no more than `max`. +/// # Panics +/// Will panic if `max` is negative when `glam_assert` is enabled. #[lua(kind = "Method", output(proxy))] fn clamp_length_max(self, max: f64) -> bevy::math::DVec4; "#, r#" -/// Returns a vector with a length no less than `min` +/// Returns a vector with a length no less than `min`. +/// # Panics +/// Will panic if `min` is negative when `glam_assert` is enabled. #[lua(kind = "Method", output(proxy))] fn clamp_length_min(self, min: f64) -> bevy::math::DVec4; "#, r#" -/// Fused multiply-add. Computes `(self * a) + b` element-wise with only one rounding -/// error, yielding a more accurate result than an unfused multiply-add. -/// Using `mul_add` *may* be more performant than an unfused multiply-add if the target -/// architecture has a dedicated fma CPU instruction. However, this is not always true, -/// and will be heavily dependant on designing algorithms with specific target hardware in -/// mind. +/// Fused multiply-add. Computes `(self * a) + b` element-wise with only one rounding +/// error, yielding a more accurate result than an unfused multiply-add. +/// Using `mul_add` *may* be more performant than an unfused multiply-add if the target +/// architecture has a dedicated fma CPU instruction. However, this is not always true, +/// and will be heavily dependant on designing algorithms with specific target hardware in +/// mind. + + #[lua(kind = "Method", output(proxy))] + fn mul_add( + self, + #[proxy] + a: bevy::math::DVec4, + #[proxy] + b: bevy::math::DVec4, + ) -> bevy::math::DVec4; + +"#, + r#" +/// Returns the reflection vector for a given incident vector `self` and surface normal +/// `normal`. +/// `normal` must be normalized. +/// # Panics +/// Will panic if `normal` is not normalized when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn reflect(self, #[proxy] normal: bevy::math::DVec4) -> bevy::math::DVec4; + +"#, + r#" +/// Returns the refraction direction for a given incident vector `self`, surface normal +/// `normal` and ratio of indices of refraction, `eta`. When total internal reflection occurs, +/// a zero vector will be returned. +/// `self` and `normal` must be normalized. +/// # Panics +/// Will panic if `self` or `normal` is not normalized when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn refract(self, #[proxy] normal: bevy::math::DVec4, eta: f64) -> bevy::math::DVec4; + +"#, + r#" +/// Casts all elements of `self` to `f32`. + + #[lua(kind = "Method", output(proxy))] + fn as_vec4(&self) -> bevy::math::Vec4; + +"#, + r#" +/// Casts all elements of `self` to `i32`. + + #[lua(kind = "Method", output(proxy))] + fn as_ivec4(&self) -> bevy::math::IVec4; + +"#, + r#" +/// Casts all elements of `self` to `u32`. + + #[lua(kind = "Method", output(proxy))] + fn as_uvec4(&self) -> bevy::math::UVec4; + +"#, + r#" +/// Casts all elements of `self` to `i64`. + + #[lua(kind = "Method", output(proxy))] + fn as_i64vec4(&self) -> bevy::math::I64Vec4; + +"#, + r#" +/// Casts all elements of `self` to `u64`. + + #[lua(kind = "Method", output(proxy))] + fn as_u64vec4(&self) -> bevy::math::U64Vec4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(self, #[proxy] rhs: &glam::DVec4) -> bevy::math::DVec4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::DVec4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::DVec4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, rhs: f64) -> bevy::math::DVec4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, rhs: f64) -> bevy::math::DVec4; + +"#, + r#" - #[lua(kind = "Method", output(proxy))] - fn mul_add( - self, - #[proxy] - a: bevy::math::DVec4, - #[proxy] - b: bevy::math::DVec4, - ) -> bevy::math::DVec4; + #[lua( + as_trait = "std::ops::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(self, rhs: f64) -> bevy::math::DVec4; "#, r#" -/// Casts all elements of `self` to `f32`. - #[lua(kind = "Method", output(proxy))] - fn as_vec4(&self) -> bevy::math::Vec4; + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &glam::DVec4) -> bool; "#, r#" -/// Casts all elements of `self` to `i32`. - #[lua(kind = "Method", output(proxy))] - fn as_ivec4(&self) -> bevy::math::IVec4; + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::DVec4; "#, r#" -/// Casts all elements of `self` to `u32`. - #[lua(kind = "Method", output(proxy))] - fn as_uvec4(&self) -> bevy::math::UVec4; + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, rhs: f64) -> bevy::math::DVec4; "#, r#" -/// Casts all elements of `self` to `i64`. - #[lua(kind = "Method", output(proxy))] - fn as_i64vec4(&self) -> bevy::math::I64Vec4; + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: &glam::DVec4) -> bevy::math::DVec4; "#, r#" -/// Casts all elements of `self` to `u64`. - #[lua(kind = "Method", output(proxy))] - fn as_u64vec4(&self) -> bevy::math::U64Vec4; + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::DVec4; "#, r#" #[lua( - as_trait = "std::ops::Rem", + as_trait = "std::ops::Div", kind = "MetaFunction", output(proxy), - composite = "rem", - metamethod = "Mod", + composite = "div", + metamethod = "Div", )] - fn rem(self, rhs: f64) -> bevy::math::DVec4; + fn div(self, #[proxy] rhs: &glam::DVec4) -> bevy::math::DVec4; "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] fn index(&self) -> String { - format!("{}", _self) + format!("{:?}", _self) } "#, r#" @@ -14120,35 +16057,37 @@ struct DVec4 { functions[r#" #[lua( - as_trait = "std::ops::Neg", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "neg", - metamethod = "Unm", + composite = "mul", + metamethod = "Mul", )] - fn neg(self) -> bevy::math::Mat2; + fn mul(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; "#, r#" #[lua( - as_trait = "std::ops::Add", + as_trait = "std::ops::Div", kind = "MetaFunction", output(proxy), - composite = "add", - metamethod = "Add", + composite = "div", + metamethod = "Div", )] - fn add(self, #[proxy] rhs: bevy::math::Mat2) -> bevy::math::Mat2; + fn div(self, rhs: f32) -> bevy::math::Mat2; "#, r#" #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", + as_trait = "std::ops::Add", + kind = "MetaFunction", output(proxy), + composite = "add", + metamethod = "Add", )] - fn clone(&self) -> bevy::math::Mat2; + fn add(self, #[proxy] rhs: bevy::math::Mat2) -> bevy::math::Mat2; "#, r#" @@ -14160,18 +16099,17 @@ struct DVec4 { composite = "mul", metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; + fn mul(self, #[proxy] rhs: bevy::math::Mat2) -> bevy::math::Mat2; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", + output(proxy), )] - fn eq(&self, #[proxy] rhs: &glam::Mat2) -> bool; + fn clone(&self) -> bevy::math::Mat2; "#, r#" @@ -14183,43 +16121,31 @@ struct DVec4 { composite = "mul", metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: bevy::math::Mat2) -> bevy::math::Mat2; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, #[proxy] rhs: bevy::math::Mat2) -> bevy::math::Mat2; + fn mul(self, rhs: f32) -> bevy::math::Mat2; "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Neg", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "neg", + metamethod = "Unm", )] - fn mul(self, rhs: f32) -> bevy::math::Mat2; + fn neg(self) -> bevy::math::Mat2; "#, r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Sub", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "sub", + metamethod = "Sub", )] - fn div(self, rhs: f32) -> bevy::math::Mat2; + fn sub(self, #[proxy] rhs: bevy::math::Mat2) -> bevy::math::Mat2; "#, r#" @@ -14282,6 +16208,21 @@ struct DVec4 { #[lua(kind = "Function", output(proxy))] fn from_mat3(#[proxy] m: bevy::math::Mat3) -> bevy::math::Mat2; +"#, + r#" +/// Creates a 2x2 matrix from the minor of the given 3x3 matrix, discarding the `i`th column +/// and `j`th row. +/// # Panics +/// Panics if `i` or `j` is greater than 2. + + #[lua(kind = "Function", output(proxy))] + fn from_mat3_minor( + #[proxy] + m: bevy::math::Mat3, + i: usize, + j: usize, + ) -> bevy::math::Mat2; + "#, r#" /// Creates a 2x2 matrix from a 3x3 matrix, discarding the 2nd row and column. @@ -14289,6 +16230,21 @@ struct DVec4 { #[lua(kind = "Function", output(proxy))] fn from_mat3a(#[proxy] m: bevy::math::Mat3A) -> bevy::math::Mat2; +"#, + r#" +/// Creates a 2x2 matrix from the minor of the given 3x3 matrix, discarding the `i`th column +/// and `j`th row. +/// # Panics +/// Panics if `i` or `j` is greater than 2. + + #[lua(kind = "Function", output(proxy))] + fn from_mat3a_minor( + #[proxy] + m: bevy::math::Mat3A, + i: usize, + j: usize, + ) -> bevy::math::Mat2; + "#, r#" /// Returns the matrix column for the given `index`. @@ -14414,11 +16370,22 @@ struct DVec4 { #[lua(kind = "Method", output(proxy))] fn as_dmat2(&self) -> bevy::math::DMat2; +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] rhs: &glam::Mat2) -> bool; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] fn index(&self) -> String { - format!("{}", _self) + format!("{:?}", _self) } "#, r#" @@ -14452,18 +16419,6 @@ struct Mat2(); derive(clone), remote = "bevy::math::Mat3", functions[r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: bevy::math::Affine2) -> bevy::math::Mat3; - -"#, - r#" /// Creates a 3x3 matrix from three column vectors. #[lua(kind = "Function", output(proxy))] @@ -14506,6 +16461,21 @@ struct Mat2(); #[lua(kind = "Function", output(proxy))] fn from_mat4(#[proxy] m: bevy::math::Mat4) -> bevy::math::Mat3; +"#, + r#" +/// Creates a 3x3 matrix from the minor of the given 4x4 matrix, discarding the `i`th column +/// and `j`th row. +/// # Panics +/// Panics if `i` or `j` is greater than 3. + + #[lua(kind = "Function", output(proxy))] + fn from_mat4_minor( + #[proxy] + m: bevy::math::Mat4, + i: usize, + j: usize, + ) -> bevy::math::Mat3; + "#, r#" /// Creates a 3D rotation matrix from the given quaternion. @@ -14539,6 +16509,17 @@ struct Mat2(); c: f32, ) -> bevy::math::Mat3; +"#, + r#" +/// Extract Euler angles with the given Euler rotation order. +/// Note if the input matrix contains scales, shears, or other non-rotation transformations then +/// the resulting Euler angles will be ill-defined. +/// # Panics +/// Will panic if any input matrix column is not normalized when `glam_assert` is enabled. + + #[lua(kind = "Method")] + fn to_euler(&self, #[proxy] order: bevy::math::EulerRot) -> (f32, f32, f32); + "#, r#" /// Creates a 3D rotation matrix from `angle` (in radians) around the x axis. @@ -14773,13 +16754,25 @@ struct Mat2(); r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Neg", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "neg", + metamethod = "Unm", )] - fn mul(self, #[proxy] rhs: bevy::math::Mat3) -> bevy::math::Mat3; + fn neg(self) -> bevy::math::Mat3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, rhs: f32) -> bevy::math::Mat3; "#, r#" @@ -14791,19 +16784,19 @@ struct Mat2(); composite = "mul", metamethod = "Mul", )] - fn mul(self, rhs: f32) -> bevy::math::Mat3; + fn mul(self, #[proxy] rhs: bevy::math::Mat3) -> bevy::math::Mat3; "#, r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "mul", + metamethod = "Mul", )] - fn div(self, rhs: f32) -> bevy::math::Mat3; + fn mul(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; "#, r#" @@ -14815,7 +16808,7 @@ struct Mat2(); composite = "mul", metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; + fn mul(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; "#, r#" @@ -14831,37 +16824,36 @@ struct Mat2(); r#" #[lua( - as_trait = "std::ops::Sub", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "sub", - metamethod = "Sub", + composite = "mul", + metamethod = "Mul", )] - fn sub(self, #[proxy] rhs: bevy::math::Mat3) -> bevy::math::Mat3; + fn mul(self, #[proxy] rhs: bevy::math::Affine2) -> bevy::math::Mat3; "#, r#" #[lua( - as_trait = "std::ops::Neg", + as_trait = "std::ops::Sub", kind = "MetaFunction", output(proxy), - composite = "neg", - metamethod = "Unm", + composite = "sub", + metamethod = "Sub", )] - fn neg(self) -> bevy::math::Mat3; + fn sub(self, #[proxy] rhs: bevy::math::Mat3) -> bevy::math::Mat3; "#, r#" #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", )] - fn mul(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; + fn eq(&self, #[proxy] rhs: &glam::Mat3) -> bool; "#, r#" @@ -14879,18 +16871,19 @@ struct Mat2(); r#" #[lua( - as_trait = "std::cmp::PartialEq", + as_trait = "std::ops::Mul", kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", + output(proxy), + composite = "mul", + metamethod = "Mul", )] - fn eq(&self, #[proxy] rhs: &glam::Mat3) -> bool; + fn mul(self, rhs: f32) -> bevy::math::Mat3; "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] fn index(&self) -> String { - format!("{}", _self) + format!("{:?}", _self) } "#, r#" @@ -14933,25 +16926,23 @@ struct Mat3 { functions[r#" #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", output(proxy), - composite = "mul", - metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: bevy::math::Mat3A) -> bevy::math::Mat3A; + fn clone(&self) -> bevy::math::Mat3A; "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "add", + metamethod = "Add", )] - fn mul(self, #[proxy] rhs: bevy::math::Affine2) -> bevy::math::Mat3A; + fn add(self, #[proxy] rhs: bevy::math::Mat3A) -> bevy::math::Mat3A; "#, r#" @@ -14997,6 +16988,21 @@ struct Mat3 { #[lua(kind = "Function", output(proxy))] fn from_mat4(#[proxy] m: bevy::math::Mat4) -> bevy::math::Mat3A; +"#, + r#" +/// Creates a 3x3 matrix from the minor of the given 4x4 matrix, discarding the `i`th column +/// and `j`th row. +/// # Panics +/// Panics if `i` or `j` is greater than 3. + + #[lua(kind = "Function", output(proxy))] + fn from_mat4_minor( + #[proxy] + m: bevy::math::Mat4, + i: usize, + j: usize, + ) -> bevy::math::Mat3A; + "#, r#" /// Creates a 3D rotation matrix from the given quaternion. @@ -15030,6 +17036,17 @@ struct Mat3 { c: f32, ) -> bevy::math::Mat3A; +"#, + r#" +/// Extract Euler angles with the given Euler rotation order. +/// Note if the input matrix contains scales, shears, or other non-rotation transformations then +/// the resulting Euler angles will be ill-defined. +/// # Panics +/// Will panic if any input matrix column is not normalized when `glam_assert` is enabled. + + #[lua(kind = "Method")] + fn to_euler(&self, #[proxy] order: bevy::math::EulerRot) -> (f32, f32, f32); + "#, r#" /// Creates a 3D rotation matrix from `angle` (in radians) around the x axis. @@ -15264,58 +17281,61 @@ struct Mat3 { r#" #[lua( - as_trait = "std::cmp::PartialEq", + as_trait = "std::ops::Mul", kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", + output(proxy), + composite = "mul", + metamethod = "Mul", )] - fn eq(&self, #[proxy] rhs: &glam::Mat3A) -> bool; + fn mul(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; "#, r#" #[lua( - as_trait = "std::ops::Sub", + as_trait = "std::ops::Div", kind = "MetaFunction", output(proxy), - composite = "sub", - metamethod = "Sub", + composite = "div", + metamethod = "Div", )] - fn sub(self, #[proxy] rhs: bevy::math::Mat3A) -> bevy::math::Mat3A; + fn div(self, rhs: f32) -> bevy::math::Mat3A; "#, r#" #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", + as_trait = "std::ops::Mul", + kind = "MetaFunction", output(proxy), + composite = "mul", + metamethod = "Mul", )] - fn clone(&self) -> bevy::math::Mat3A; + fn mul(self, #[proxy] rhs: bevy::math::Mat3A) -> bevy::math::Mat3A; "#, r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Sub", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "sub", + metamethod = "Sub", )] - fn div(self, rhs: f32) -> bevy::math::Mat3A; + fn sub(self, #[proxy] rhs: bevy::math::Mat3A) -> bevy::math::Mat3A; "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Neg", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "neg", + metamethod = "Unm", )] - fn mul(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; + fn neg(self) -> bevy::math::Mat3A; "#, r#" @@ -15327,49 +17347,48 @@ struct Mat3 { composite = "mul", metamethod = "Mul", )] - fn mul(self, rhs: f32) -> bevy::math::Mat3A; + fn mul(self, #[proxy] rhs: bevy::math::Affine2) -> bevy::math::Mat3A; "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::cmp::PartialEq", kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "eq", + metamethod = "Eq", )] - fn mul(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; + fn eq(&self, #[proxy] rhs: &glam::Mat3A) -> bool; "#, r#" #[lua( - as_trait = "std::ops::Add", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "add", - metamethod = "Add", + composite = "mul", + metamethod = "Mul", )] - fn add(self, #[proxy] rhs: bevy::math::Mat3A) -> bevy::math::Mat3A; + fn mul(self, rhs: f32) -> bevy::math::Mat3A; "#, r#" #[lua( - as_trait = "std::ops::Neg", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "neg", - metamethod = "Unm", + composite = "mul", + metamethod = "Mul", )] - fn neg(self) -> bevy::math::Mat3A; + fn mul(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] fn index(&self) -> String { - format!("{}", _self) + format!("{:?}", _self) } "#, r#" @@ -15412,13 +17431,13 @@ struct Mat3A { functions[r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Neg", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "neg", + metamethod = "Unm", )] - fn div(self, rhs: f32) -> bevy::math::Mat4; + fn neg(self) -> bevy::math::Mat4; "#, r#" @@ -15442,28 +17461,7 @@ struct Mat3A { composite = "mul", metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::Vec4; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] rhs: &glam::Mat4) -> bool; - -"#, - r#" - - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::Mat4; + fn mul(self, #[proxy] rhs: bevy::math::Affine3A) -> bevy::math::Mat4; "#, r#" @@ -15475,31 +17473,17 @@ struct Mat3A { composite = "mul", metamethod = "Mul", )] - fn mul(self, rhs: f32) -> bevy::math::Mat4; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, #[proxy] rhs: bevy::math::Mat4) -> bevy::math::Mat4; + fn mul(self, #[proxy] rhs: bevy::math::Mat4) -> bevy::math::Mat4; "#, r#" #[lua( - as_trait = "std::ops::Neg", - kind = "MetaFunction", + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", output(proxy), - composite = "neg", - metamethod = "Unm", )] - fn neg(self) -> bevy::math::Mat4; + fn clone(&self) -> bevy::math::Mat4; "#, r#" @@ -15511,19 +17495,18 @@ struct Mat3A { composite = "mul", metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: bevy::math::Affine3A) -> bevy::math::Mat4; + fn mul(self, rhs: f32) -> bevy::math::Mat4; "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::cmp::PartialEq", kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "eq", + metamethod = "Eq", )] - fn mul(self, #[proxy] rhs: bevy::math::Mat4) -> bevy::math::Mat4; + fn eq(&self, #[proxy] rhs: &glam::Mat4) -> bool; "#, r#" @@ -15667,6 +17650,18 @@ struct Mat3A { c: f32, ) -> bevy::math::Mat4; +"#, + r#" +/// Extract Euler angles with the given Euler rotation order. +/// Note if the upper 3x3 matrix contain scales, shears, or other non-rotation transformations +/// then the resulting Euler angles will be ill-defined. +/// # Panics +/// Will panic if any column of the upper 3x3 rotation matrix is not normalized when +/// `glam_assert` is enabled. + + #[lua(kind = "Method")] + fn to_euler(&self, #[proxy] order: bevy::math::EulerRot) -> (f32, f32, f32); + "#, r#" /// Creates an affine transformation matrix containing a 3D rotation around the x axis of @@ -15835,7 +17830,8 @@ struct Mat3A { "#, r#" -/// Creates a right-handed perspective projection matrix with [-1,1] depth range. +/// Creates a right-handed perspective projection matrix with `[-1,1]` depth range. +/// Useful to map the standard right-handed coordinate system into what OpenGL expects. /// This is the same as the OpenGL `gluPerspective` function. /// See @@ -15850,6 +17846,7 @@ struct Mat3A { "#, r#" /// Creates a left-handed perspective projection matrix with `[0,1]` depth range. +/// Useful to map the standard left-handed coordinate system into what WebGPU/Metal/Direct3D expect. /// # Panics /// Will panic if `z_near` or `z_far` are less than or equal to zero when `glam_assert` is /// enabled. @@ -15865,6 +17862,7 @@ struct Mat3A { "#, r#" /// Creates a right-handed perspective projection matrix with `[0,1]` depth range. +/// Useful to map the standard right-handed coordinate system into what WebGPU/Metal/Direct3D expect. /// # Panics /// Will panic if `z_near` or `z_far` are less than or equal to zero when `glam_assert` is /// enabled. @@ -15880,8 +17878,11 @@ struct Mat3A { "#, r#" /// Creates an infinite left-handed perspective projection matrix with `[0,1]` depth range. +/// Like `perspective_lh`, but with an infinite value for `z_far`. +/// The result is that points near `z_near` are mapped to depth `0`, and as they move towards infinity the depth approaches `1`. /// # Panics -/// Will panic if `z_near` is less than or equal to zero when `glam_assert` is enabled. +/// Will panic if `z_near` or `z_far` are less than or equal to zero when `glam_assert` is +/// enabled. #[lua(kind = "Function", output(proxy))] fn perspective_infinite_lh( @@ -15892,7 +17893,8 @@ struct Mat3A { "#, r#" -/// Creates an infinite left-handed perspective projection matrix with `[0,1]` depth range. +/// Creates an infinite reverse left-handed perspective projection matrix with `[0,1]` depth range. +/// Similar to `perspective_infinite_lh`, but maps `Z = z_near` to a depth of `1` and `Z = infinity` to a depth of `0`. /// # Panics /// Will panic if `z_near` is less than or equal to zero when `glam_assert` is enabled. @@ -15905,8 +17907,12 @@ struct Mat3A { "#, r#" -/// Creates an infinite right-handed perspective projection matrix with -/// `[0,1]` depth range. +/// Creates an infinite right-handed perspective projection matrix with `[0,1]` depth range. +/// Like `perspective_rh`, but with an infinite value for `z_far`. +/// The result is that points near `z_near` are mapped to depth `0`, and as they move towards infinity the depth approaches `1`. +/// # Panics +/// Will panic if `z_near` or `z_far` are less than or equal to zero when `glam_assert` is +/// enabled. #[lua(kind = "Function", output(proxy))] fn perspective_infinite_rh( @@ -15917,8 +17923,10 @@ struct Mat3A { "#, r#" -/// Creates an infinite reverse right-handed perspective projection matrix -/// with `[0,1]` depth range. +/// Creates an infinite reverse right-handed perspective projection matrix with `[0,1]` depth range. +/// Similar to `perspective_infinite_rh`, but maps `Z = z_near` to a depth of `1` and `Z = infinity` to a depth of `0`. +/// # Panics +/// Will panic if `z_near` is less than or equal to zero when `glam_assert` is enabled. #[lua(kind = "Function", output(proxy))] fn perspective_infinite_reverse_rh( @@ -15933,6 +17941,7 @@ struct Mat3A { /// range. This is the same as the OpenGL `glOrtho` function in OpenGL. /// See /// +/// Useful to map a right-handed coordinate system to the normalized device coordinates that OpenGL expects. #[lua(kind = "Function", output(proxy))] fn orthographic_rh_gl( @@ -15947,6 +17956,7 @@ struct Mat3A { "#, r#" /// Creates a left-handed orthographic projection matrix with `[0,1]` depth range. +/// Useful to map a left-handed coordinate system to the normalized device coordinates that WebGPU/Direct3D/Metal expect. #[lua(kind = "Function", output(proxy))] fn orthographic_lh( @@ -15961,6 +17971,7 @@ struct Mat3A { "#, r#" /// Creates a right-handed orthographic projection matrix with `[0,1]` depth range. +/// Useful to map a right-handed coordinate system to the normalized device coordinates that WebGPU/Direct3D/Metal expect. #[lua(kind = "Function", output(proxy))] fn orthographic_rh( @@ -16008,6 +18019,16 @@ struct Mat3A { #[lua(kind = "Method", output(proxy))] fn transform_vector3(&self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; +"#, + r#" +/// Transforms the given [`Vec3A`] as a 3D point, applying perspective correction. +/// This is the equivalent of multiplying the [`Vec3A`] as a 4D vector where `w` is `1.0`. +/// The perspective divide is performed meaning the resulting 3D vector is divided by `w`. +/// This method assumes that `self` contains a projective transform. + + #[lua(kind = "Method", output(proxy))] + fn project_point3a(&self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; + "#, r#" /// Transforms the given [`Vec3A`] as 3D point. @@ -16092,11 +18113,47 @@ struct Mat3A { #[lua(kind = "Method", output(proxy))] fn as_dmat4(&self) -> bevy::math::DMat4; +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::Vec4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, rhs: f32) -> bevy::math::Mat4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, #[proxy] rhs: bevy::math::Mat4) -> bevy::math::Mat4; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] fn index(&self) -> String { - format!("{}", _self) + format!("{:?}", _self) } "#, r#" @@ -16132,33 +18189,22 @@ struct Mat4 { #[lua(output(proxy))] z_axis: bevy::math::Vec4, #[lua(output(proxy))] - w_axis: bevy::math::Vec4, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::math::DMat2", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] rhs: &glam::DMat2) -> bool; - -"#, - r#" + w_axis: bevy::math::Vec4, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::math::DMat2", + functions[r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Sub", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "sub", + metamethod = "Sub", )] - fn div(self, rhs: f64) -> bevy::math::DMat2; + fn sub(self, #[proxy] rhs: bevy::math::DMat2) -> bevy::math::DMat2; "#, r#" @@ -16172,18 +18218,6 @@ struct Mat4 { )] fn neg(self) -> bevy::math::DMat2; -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: bevy::math::DMat2) -> bevy::math::DMat2; - "#, r#" @@ -16200,37 +18234,24 @@ struct Mat4 { r#" #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, #[proxy] rhs: bevy::math::DMat2) -> bevy::math::DMat2; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub", + as_trait = "std::ops::Div", kind = "MetaFunction", output(proxy), - composite = "sub", - metamethod = "Sub", + composite = "div", + metamethod = "Div", )] - fn sub(self, #[proxy] rhs: bevy::math::DMat2) -> bevy::math::DMat2; + fn div(self, rhs: f64) -> bevy::math::DMat2; "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::cmp::PartialEq", kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "eq", + metamethod = "Eq", )] - fn mul(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; + fn eq(&self, #[proxy] rhs: &glam::DMat2) -> bool; "#, r#" @@ -16303,6 +18324,21 @@ struct Mat4 { #[lua(kind = "Function", output(proxy))] fn from_mat3(#[proxy] m: bevy::math::DMat3) -> bevy::math::DMat2; +"#, + r#" +/// Creates a 2x2 matrix from the minor of the given 3x3 matrix, discarding the `i`th column +/// and `j`th row. +/// # Panics +/// Panics if `i` or `j` is greater than 2. + + #[lua(kind = "Function", output(proxy))] + fn from_mat3_minor( + #[proxy] + m: bevy::math::DMat3, + i: usize, + j: usize, + ) -> bevy::math::DMat2; + "#, r#" /// Returns the matrix column for the given `index`. @@ -16428,11 +18464,47 @@ struct Mat4 { #[lua(kind = "Method", output(proxy))] fn as_mat2(&self) -> bevy::math::Mat2; +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: bevy::math::DMat2) -> bevy::math::DMat2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, #[proxy] rhs: bevy::math::DMat2) -> bevy::math::DMat2; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] fn index(&self) -> String { - format!("{}", _self) + format!("{:?}", _self) } "#, r#" @@ -16473,71 +18545,106 @@ struct DMat2 { functions[r#" #[lua( - as_trait = "std::ops::Sub", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "sub", - metamethod = "Sub", + composite = "mul", + metamethod = "Mul", )] - fn sub(self, #[proxy] rhs: bevy::math::DMat3) -> bevy::math::DMat3; + fn mul(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; "#, r#" #[lua( - as_trait = "std::ops::Neg", + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", + output(proxy), + )] + fn clone(&self) -> bevy::math::DMat3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "neg", - metamethod = "Unm", + composite = "mul", + metamethod = "Mul", )] - fn neg(self) -> bevy::math::DMat3; + fn mul(self, rhs: f64) -> bevy::math::DMat3; "#, r#" #[lua( - as_trait = "std::ops::Add", + as_trait = "std::ops::Div", kind = "MetaFunction", output(proxy), - composite = "add", - metamethod = "Add", + composite = "div", + metamethod = "Div", )] - fn add(self, #[proxy] rhs: bevy::math::DMat3) -> bevy::math::DMat3; + fn div(self, rhs: f64) -> bevy::math::DMat3; "#, r#" #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", + as_trait = "std::ops::Mul", + kind = "MetaFunction", output(proxy), + composite = "mul", + metamethod = "Mul", )] - fn clone(&self) -> bevy::math::DMat3; + fn mul(self, #[proxy] rhs: bevy::math::DMat3) -> bevy::math::DMat3; "#, r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] rhs: &glam::DMat3) -> bool; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "add", + metamethod = "Add", )] - fn div(self, rhs: f64) -> bevy::math::DMat3; + fn add(self, #[proxy] rhs: bevy::math::DMat3) -> bevy::math::DMat3; "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Sub", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "sub", + metamethod = "Sub", )] - fn mul(self, #[proxy] rhs: bevy::math::DAffine2) -> bevy::math::DMat3; + fn sub(self, #[proxy] rhs: bevy::math::DMat3) -> bevy::math::DMat3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Neg", + kind = "MetaFunction", + output(proxy), + composite = "neg", + metamethod = "Unm", + )] + fn neg(self) -> bevy::math::DMat3; "#, r#" @@ -16583,6 +18690,21 @@ struct DMat2 { #[lua(kind = "Function", output(proxy))] fn from_mat4(#[proxy] m: bevy::math::DMat4) -> bevy::math::DMat3; +"#, + r#" +/// Creates a 3x3 matrix from the minor of the given 4x4 matrix, discarding the `i`th column +/// and `j`th row. +/// # Panics +/// Panics if `i` or `j` is greater than 3. + + #[lua(kind = "Function", output(proxy))] + fn from_mat4_minor( + #[proxy] + m: bevy::math::DMat4, + i: usize, + j: usize, + ) -> bevy::math::DMat3; + "#, r#" /// Creates a 3D rotation matrix from the given quaternion. @@ -16620,6 +18742,17 @@ struct DMat2 { c: f64, ) -> bevy::math::DMat3; +"#, + r#" +/// Extract Euler angles with the given Euler rotation order. +/// Note if the input matrix contains scales, shears, or other non-rotation transformations then +/// the resulting Euler angles will be ill-defined. +/// # Panics +/// Will panic if any input matrix column is not normalized when `glam_assert` is enabled. + + #[lua(kind = "Method")] + fn to_euler(&self, #[proxy] order: bevy::math::EulerRot) -> (f64, f64, f64); + "#, r#" /// Creates a 3D rotation matrix from `angle` (in radians) around the x axis. @@ -16853,48 +18986,13 @@ struct DMat2 { composite = "mul", metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: bevy::math::DMat3) -> bevy::math::DMat3; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] rhs: &glam::DMat3) -> bool; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, rhs: f64) -> bevy::math::DMat3; + fn mul(self, #[proxy] rhs: bevy::math::DAffine2) -> bevy::math::DMat3; "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] fn index(&self) -> String { - format!("{}", _self) + format!("{:?}", _self) } "#, r#" @@ -16936,71 +19034,49 @@ struct DMat3 { remote = "bevy::math::DMat4", functions[r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] rhs: &glam::DMat4) -> bool; - -"#, - r#" - #[lua( as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), composite = "mul", - metamethod = "Mul", - )] - fn mul(self, rhs: f64) -> bevy::math::DMat4; - -"#, - r#" - - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), + metamethod = "Mul", )] - fn clone(&self) -> bevy::math::DMat4; + fn mul(self, #[proxy] rhs: bevy::math::DMat4) -> bevy::math::DMat4; "#, r#" #[lua( - as_trait = "std::ops::Sub", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "sub", - metamethod = "Sub", + composite = "mul", + metamethod = "Mul", )] - fn sub(self, #[proxy] rhs: bevy::math::DMat4) -> bevy::math::DMat4; + fn mul(self, rhs: f64) -> bevy::math::DMat4; "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::cmp::PartialEq", kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "eq", + metamethod = "Eq", )] - fn mul(self, #[proxy] rhs: bevy::math::DMat4) -> bevy::math::DMat4; + fn eq(&self, #[proxy] rhs: &glam::DMat4) -> bool; "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Neg", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "neg", + metamethod = "Unm", )] - fn mul(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::DVec4; + fn neg(self) -> bevy::math::DMat4; "#, r#" @@ -17024,7 +19100,7 @@ struct DMat3 { composite = "mul", metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: bevy::math::DAffine3) -> bevy::math::DMat4; + fn mul(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::DVec4; "#, r#" @@ -17162,6 +19238,18 @@ struct DMat3 { c: f64, ) -> bevy::math::DMat4; +"#, + r#" +/// Extract Euler angles with the given Euler rotation order. +/// Note if the upper 3x3 matrix contain scales, shears, or other non-rotation transformations +/// then the resulting Euler angles will be ill-defined. +/// # Panics +/// Will panic if any column of the upper 3x3 rotation matrix is not normalized when +/// `glam_assert` is enabled. + + #[lua(kind = "Method")] + fn to_euler(&self, #[proxy] order: bevy::math::EulerRot) -> (f64, f64, f64); + "#, r#" /// Creates an affine transformation matrix containing a 3D rotation around the x axis of @@ -17330,7 +19418,8 @@ struct DMat3 { "#, r#" -/// Creates a right-handed perspective projection matrix with [-1,1] depth range. +/// Creates a right-handed perspective projection matrix with `[-1,1]` depth range. +/// Useful to map the standard right-handed coordinate system into what OpenGL expects. /// This is the same as the OpenGL `gluPerspective` function. /// See @@ -17345,6 +19434,7 @@ struct DMat3 { "#, r#" /// Creates a left-handed perspective projection matrix with `[0,1]` depth range. +/// Useful to map the standard left-handed coordinate system into what WebGPU/Metal/Direct3D expect. /// # Panics /// Will panic if `z_near` or `z_far` are less than or equal to zero when `glam_assert` is /// enabled. @@ -17360,6 +19450,7 @@ struct DMat3 { "#, r#" /// Creates a right-handed perspective projection matrix with `[0,1]` depth range. +/// Useful to map the standard right-handed coordinate system into what WebGPU/Metal/Direct3D expect. /// # Panics /// Will panic if `z_near` or `z_far` are less than or equal to zero when `glam_assert` is /// enabled. @@ -17375,8 +19466,11 @@ struct DMat3 { "#, r#" /// Creates an infinite left-handed perspective projection matrix with `[0,1]` depth range. +/// Like `perspective_lh`, but with an infinite value for `z_far`. +/// The result is that points near `z_near` are mapped to depth `0`, and as they move towards infinity the depth approaches `1`. /// # Panics -/// Will panic if `z_near` is less than or equal to zero when `glam_assert` is enabled. +/// Will panic if `z_near` or `z_far` are less than or equal to zero when `glam_assert` is +/// enabled. #[lua(kind = "Function", output(proxy))] fn perspective_infinite_lh( @@ -17387,7 +19481,8 @@ struct DMat3 { "#, r#" -/// Creates an infinite left-handed perspective projection matrix with `[0,1]` depth range. +/// Creates an infinite reverse left-handed perspective projection matrix with `[0,1]` depth range. +/// Similar to `perspective_infinite_lh`, but maps `Z = z_near` to a depth of `1` and `Z = infinity` to a depth of `0`. /// # Panics /// Will panic if `z_near` is less than or equal to zero when `glam_assert` is enabled. @@ -17400,8 +19495,12 @@ struct DMat3 { "#, r#" -/// Creates an infinite right-handed perspective projection matrix with -/// `[0,1]` depth range. +/// Creates an infinite right-handed perspective projection matrix with `[0,1]` depth range. +/// Like `perspective_rh`, but with an infinite value for `z_far`. +/// The result is that points near `z_near` are mapped to depth `0`, and as they move towards infinity the depth approaches `1`. +/// # Panics +/// Will panic if `z_near` or `z_far` are less than or equal to zero when `glam_assert` is +/// enabled. #[lua(kind = "Function", output(proxy))] fn perspective_infinite_rh( @@ -17412,8 +19511,10 @@ struct DMat3 { "#, r#" -/// Creates an infinite reverse right-handed perspective projection matrix -/// with `[0,1]` depth range. +/// Creates an infinite reverse right-handed perspective projection matrix with `[0,1]` depth range. +/// Similar to `perspective_infinite_rh`, but maps `Z = z_near` to a depth of `1` and `Z = infinity` to a depth of `0`. +/// # Panics +/// Will panic if `z_near` is less than or equal to zero when `glam_assert` is enabled. #[lua(kind = "Function", output(proxy))] fn perspective_infinite_reverse_rh( @@ -17428,6 +19529,7 @@ struct DMat3 { /// range. This is the same as the OpenGL `glOrtho` function in OpenGL. /// See /// +/// Useful to map a right-handed coordinate system to the normalized device coordinates that OpenGL expects. #[lua(kind = "Function", output(proxy))] fn orthographic_rh_gl( @@ -17442,6 +19544,7 @@ struct DMat3 { "#, r#" /// Creates a left-handed orthographic projection matrix with `[0,1]` depth range. +/// Useful to map a left-handed coordinate system to the normalized device coordinates that WebGPU/Direct3D/Metal expect. #[lua(kind = "Function", output(proxy))] fn orthographic_lh( @@ -17456,6 +19559,7 @@ struct DMat3 { "#, r#" /// Creates a right-handed orthographic projection matrix with `[0,1]` depth range. +/// Useful to map a right-handed coordinate system to the normalized device coordinates that WebGPU/Direct3D/Metal expect. #[lua(kind = "Function", output(proxy))] fn orthographic_rh( @@ -17575,13 +19679,23 @@ struct DMat3 { r#" #[lua( - as_trait = "std::ops::Neg", + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", + output(proxy), + )] + fn clone(&self) -> bevy::math::DMat4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "neg", - metamethod = "Unm", + composite = "mul", + metamethod = "Mul", )] - fn neg(self) -> bevy::math::DMat4; + fn mul(self, #[proxy] rhs: bevy::math::DAffine3) -> bevy::math::DMat4; "#, r#" @@ -17595,11 +19709,23 @@ struct DMat3 { )] fn div(self, rhs: f64) -> bevy::math::DMat4; +"#, + r#" + + #[lua( + as_trait = "std::ops::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(self, #[proxy] rhs: bevy::math::DMat4) -> bevy::math::DMat4; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] fn index(&self) -> String { - format!("{}", _self) + format!("{:?}", _self) } "#, r#" @@ -17642,29 +19768,6 @@ struct DMat4 { derive(clone), remote = "bevy::math::Affine2", functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] rhs: &glam::Affine2) -> bool; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: bevy::math::Affine2) -> bevy::math::Affine2; - -"#, - r#" /// Creates an affine transform from three column vectors. #[lua(kind = "Function", output(proxy))] @@ -17837,11 +19940,13 @@ struct DMat4 { r#" #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", + as_trait = "std::ops::Mul", + kind = "MetaFunction", output(proxy), + composite = "mul", + metamethod = "Mul", )] - fn clone(&self) -> bevy::math::Affine2; + fn mul(self, #[proxy] rhs: bevy::math::Mat3A) -> bevy::math::Mat3A; "#, r#" @@ -17865,13 +19970,34 @@ struct DMat4 { composite = "mul", metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: bevy::math::Mat3A) -> bevy::math::Mat3A; + fn mul(self, #[proxy] rhs: bevy::math::Affine2) -> bevy::math::Affine2; + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] rhs: &glam::Affine2) -> bool; + +"#, + r#" + + #[lua( + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", + output(proxy), + )] + fn clone(&self) -> bevy::math::Affine2; "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] fn index(&self) -> String { - format!("{}", _self) + format!("{:?}", _self) } "#] )] @@ -17886,6 +20012,51 @@ struct Affine2 { derive(clone), remote = "bevy::math::Affine3A", functions[r#" + + #[lua( + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", + output(proxy), + )] + fn clone(&self) -> bevy::math::Affine3A; + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] rhs: &glam::Affine3A) -> bool; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: bevy::math::Mat4) -> bevy::math::Mat4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: bevy::math::Affine3A) -> bevy::math::Affine3A; + +"#, + r#" /// Creates an affine transform from three column vectors. #[lua(kind = "Function", output(proxy))] @@ -18173,14 +20344,30 @@ struct Affine2 { "#, r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct Affine3A { + #[lua(output(proxy))] + matrix3: bevy::math::Mat3A, + #[lua(output(proxy))] + translation: bevy::math::Vec3A, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::math::DAffine2", + functions[r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", + output(proxy), )] - fn eq(&self, #[proxy] rhs: &glam::Affine3A) -> bool; + fn clone(&self) -> bevy::math::DAffine2; "#, r#" @@ -18192,7 +20379,7 @@ struct Affine2 { composite = "mul", metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: bevy::math::Mat4) -> bevy::math::Mat4; + fn mul(self, #[proxy] rhs: bevy::math::DAffine2) -> bevy::math::DAffine2; "#, r#" @@ -18204,46 +20391,18 @@ struct Affine2 { composite = "mul", metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: bevy::math::Affine3A) -> bevy::math::Affine3A; - -"#, - r#" - - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::Affine3A; + fn mul(self, #[proxy] rhs: bevy::math::DMat3) -> bevy::math::DMat3; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{}", _self) -} -"#] -)] -struct Affine3A { - #[lua(output(proxy))] - matrix3: bevy::math::Mat3A, - #[lua(output(proxy))] - translation: bevy::math::Vec3A, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::math::DAffine2", - functions[r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::cmp::PartialEq", kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "eq", + metamethod = "Eq", )] - fn mul(self, #[proxy] rhs: bevy::math::DMat3) -> bevy::math::DMat3; + fn eq(&self, #[proxy] rhs: &glam::DAffine2) -> bool; "#, r#" @@ -18405,8 +20564,37 @@ struct Affine3A { /// Return the inverse of this transform. /// Note that if the transform is not invertible the result will be invalid. - #[lua(kind = "Method", output(proxy))] - fn inverse(&self) -> bevy::math::DAffine2; + #[lua(kind = "Method", output(proxy))] + fn inverse(&self) -> bevy::math::DAffine2; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct DAffine2 { + #[lua(output(proxy))] + matrix2: bevy::math::DMat2, + #[lua(output(proxy))] + translation: bevy::math::DVec2, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::math::DAffine3", + functions[r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: bevy::math::DAffine3) -> bevy::math::DAffine3; "#, r#" @@ -18417,49 +20605,32 @@ struct Affine3A { composite = "eq", metamethod = "Eq", )] - fn eq(&self, #[proxy] rhs: &glam::DAffine2) -> bool; + fn eq(&self, #[proxy] rhs: &glam::DAffine3) -> bool; "#, r#" #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", + as_trait = "std::ops::Mul", + kind = "MetaFunction", output(proxy), + composite = "mul", + metamethod = "Mul", )] - fn clone(&self) -> bevy::math::DAffine2; + fn mul(self, #[proxy] rhs: bevy::math::DMat4) -> bevy::math::DMat4; "#, r#" #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", output(proxy), - composite = "mul", - metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: bevy::math::DAffine2) -> bevy::math::DAffine2; + fn clone(&self) -> bevy::math::DAffine3; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{}", _self) -} -"#] -)] -struct DAffine2 { - #[lua(output(proxy))] - matrix2: bevy::math::DMat2, - #[lua(output(proxy))] - translation: bevy::math::DVec2, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::math::DAffine3", - functions[r#" /// Creates an affine transform from three column vectors. #[lua(kind = "Function", output(proxy))] @@ -18731,27 +20902,53 @@ struct DAffine2 { "#, r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct DAffine3 { + #[lua(output(proxy))] + matrix3: bevy::math::DMat3, + #[lua(output(proxy))] + translation: bevy::math::DVec3, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::math::DQuat", + functions[r#" +/// Divides a quaternion by a scalar value. +/// The quotient is not guaranteed to be normalized. #[lua( - as_trait = "std::cmp::PartialEq", + as_trait = "std::ops::Div", kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", + output(proxy), + composite = "div", + metamethod = "Div", )] - fn eq(&self, #[proxy] rhs: &glam::DAffine3) -> bool; + fn div(self, rhs: f64) -> bevy::math::DQuat; "#, r#" +/// Subtracts the `rhs` quaternion from `self`. +/// The difference is not guaranteed to be normalized. #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", + as_trait = "std::ops::Sub", + kind = "MetaFunction", output(proxy), + composite = "sub", + metamethod = "Sub", )] - fn clone(&self) -> bevy::math::DAffine3; + fn sub(self, #[proxy] rhs: bevy::math::DQuat) -> bevy::math::DQuat; "#, r#" +/// Multiplies a quaternion by a scalar value. +/// The product is not guaranteed to be normalized. #[lua( as_trait = "std::ops::Mul", @@ -18760,10 +20957,28 @@ struct DAffine2 { composite = "mul", metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: bevy::math::DAffine3) -> bevy::math::DAffine3; + fn mul(self, rhs: f64) -> bevy::math::DQuat; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Neg", + kind = "MetaFunction", + output(proxy), + composite = "neg", + metamethod = "Unm", + )] + fn neg(self) -> bevy::math::DQuat; "#, r#" +/// Multiplies two quaternions. If they each represent a rotation, the result will +/// represent the combined rotation. +/// Note that due to floating point rounding the result may not be perfectly +/// normalized. +/// # Panics +/// Will panic if `self` or `rhs` are not normalized when `glam_assert` is enabled. #[lua( as_trait = "std::ops::Mul", @@ -18772,41 +20987,29 @@ struct DAffine2 { composite = "mul", metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: bevy::math::DMat4) -> bevy::math::DMat4; + fn mul(self, #[proxy] rhs: bevy::math::DQuat) -> bevy::math::DQuat; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{}", _self) -} -"#] -)] -struct DAffine3 { - #[lua(output(proxy))] - matrix3: bevy::math::DMat3, - #[lua(output(proxy))] - translation: bevy::math::DVec3, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::math::DQuat", - functions[r#" +/// Adds two quaternions. +/// The sum is not guaranteed to be normalized. +/// Note that addition is not the same as combining the rotations represented by the +/// two quaternions! That corresponds to multiplication. #[lua( - as_trait = "std::ops::Neg", + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "neg", - metamethod = "Unm", + composite = "add", + metamethod = "Add", )] - fn neg(self) -> bevy::math::DQuat; + fn add(self, #[proxy] rhs: bevy::math::DQuat) -> bevy::math::DQuat; "#, r#" -/// Multiplies a quaternion by a scalar value. -/// The product is not guaranteed to be normalized. +/// Multiplies a quaternion and a 3D vector, returning the rotated vector. +/// # Panics +/// Will panic if `self` is not normalized when `glam_assert` is enabled. #[lua( as_trait = "std::ops::Mul", @@ -18815,32 +21018,28 @@ struct DAffine3 { composite = "mul", metamethod = "Mul", )] - fn mul(self, rhs: f64) -> bevy::math::DQuat; + fn mul(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", + output(proxy), )] - fn eq(&self, #[proxy] rhs: &glam::DQuat) -> bool; + fn clone(&self) -> bevy::math::DQuat; "#, r#" -/// Divides a quaternion by a scalar value. -/// The quotient is not guaranteed to be normalized. #[lua( - as_trait = "std::ops::Div", + as_trait = "std::cmp::PartialEq", kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", + composite = "eq", + metamethod = "Eq", )] - fn div(self, rhs: f64) -> bevy::math::DQuat; + fn eq(&self, #[proxy] rhs: &glam::DQuat) -> bool; "#, r#" @@ -18934,13 +21133,22 @@ struct DAffine3 { "#, r#" /// Creates a quaternion from a 3x3 rotation matrix. +/// Note if the input matrix contain scales, shears, or other non-rotation transformations then +/// the resulting quaternion will be ill-defined. +/// # Panics +/// Will panic if any input matrix column is not normalized when `glam_assert` is enabled. #[lua(kind = "Function", output(proxy))] fn from_mat3(#[proxy] mat: &glam::DMat3) -> bevy::math::DQuat; "#, r#" -/// Creates a quaternion from a 3x3 rotation matrix inside a homogeneous 4x4 matrix. +/// Creates a quaternion from the upper 3x3 rotation matrix inside a homogeneous 4x4 matrix. +/// Note if the upper 3x3 matrix contain scales, shears, or other non-rotation transformations +/// then the resulting quaternion will be ill-defined. +/// # Panics +/// Will panic if any column of the upper 3x3 rotation matrix is not normalized when +/// `glam_assert` is enabled. #[lua(kind = "Function", output(proxy))] fn from_mat4(#[proxy] mat: &glam::DMat4) -> bevy::math::DQuat; @@ -19014,7 +21222,7 @@ struct DAffine3 { /// Returns the rotation angles for the given euler rotation sequence. #[lua(kind = "Method")] - fn to_euler(self, #[proxy] euler: bevy::math::EulerRot) -> (f64, f64, f64); + fn to_euler(self, #[proxy] order: bevy::math::EulerRot) -> (f64, f64, f64); "#, r#" @@ -19102,6 +21310,7 @@ struct DAffine3 { "#, r#" +/// Returns `true` if any elements are `NAN`. #[lua(kind = "Method")] fn is_nan(self) -> bool; @@ -19131,6 +21340,24 @@ struct DAffine3 { #[lua(kind = "Method")] fn angle_between(self, #[proxy] rhs: bevy::math::DQuat) -> f64; +"#, + r#" +/// Rotates towards `rhs` up to `max_angle` (in radians). +/// When `max_angle` is `0.0`, the result will be equal to `self`. When `max_angle` is equal to +/// `self.angle_between(rhs)`, the result will be equal to `rhs`. If `max_angle` is negative, +/// rotates towards the exact opposite of `rhs`. Will not go past the target. +/// Both quaternions must be normalized. +/// # Panics +/// Will panic if `self` or `rhs` are not normalized when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn rotate_towards( + &self, + #[proxy] + rhs: bevy::math::DQuat, + max_angle: f64, + ) -> bevy::math::DQuat; + "#, r#" /// Returns true if the absolute difference of all elements between `self` and `rhs` @@ -19161,81 +21388,12 @@ struct DAffine3 { /// Performs a spherical linear interpolation between `self` and `end` /// based on the value `s`. /// When `s` is `0.0`, the result will be equal to `self`. When `s` -/// is `1.0`, the result will be equal to `end`. -/// # Panics -/// Will panic if `self` or `end` are not normalized when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn slerp(self, #[proxy] end: bevy::math::DQuat, s: f64) -> bevy::math::DQuat; - -"#, - r#" -/// Multiplies a quaternion and a 3D vector, returning the rotated vector. -/// # Panics -/// Will panic if `self` is not normalized when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn mul_vec3(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; - -"#, - r#" -/// Multiplies two quaternions. If they each represent a rotation, the result will -/// represent the combined rotation. -/// Note that due to floating point rounding the result may not be perfectly normalized. -/// # Panics -/// Will panic if `self` or `rhs` are not normalized when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn mul_quat(self, #[proxy] rhs: bevy::math::DQuat) -> bevy::math::DQuat; - -"#, - r#" -/// Creates a quaternion from a 3x3 rotation matrix inside a 3D affine transform. - - #[lua(kind = "Function", output(proxy))] - fn from_affine3(#[proxy] a: &glam::DAffine3) -> bevy::math::DQuat; - -"#, - r#" - - #[lua(kind = "Method", output(proxy))] - fn as_quat(self) -> bevy::math::Quat; - -"#, - r#" - - #[lua(kind = "Method", output(proxy))] - fn as_f32(self) -> bevy::math::Quat; - -"#, - r#" -/// Subtracts the `rhs` quaternion from `self`. -/// The difference is not guaranteed to be normalized. - - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, #[proxy] rhs: bevy::math::DQuat) -> bevy::math::DQuat; - -"#, - r#" -/// Adds two quaternions. -/// The sum is not guaranteed to be normalized. -/// Note that addition is not the same as combining the rotations represented by the -/// two quaternions! That corresponds to multiplication. - - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, #[proxy] rhs: bevy::math::DQuat) -> bevy::math::DQuat; +/// is `1.0`, the result will be equal to `end`. +/// # Panics +/// Will panic if `self` or `end` are not normalized when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn slerp(self, #[proxy] end: bevy::math::DQuat, s: f64) -> bevy::math::DQuat; "#, r#" @@ -19243,48 +21401,43 @@ struct DAffine3 { /// # Panics /// Will panic if `self` is not normalized when `glam_assert` is enabled. - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; + #[lua(kind = "Method", output(proxy))] + fn mul_vec3(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; "#, r#" /// Multiplies two quaternions. If they each represent a rotation, the result will /// represent the combined rotation. -/// Note that due to floating point rounding the result may not be perfectly -/// normalized. +/// Note that due to floating point rounding the result may not be perfectly normalized. /// # Panics /// Will panic if `self` or `rhs` are not normalized when `glam_assert` is enabled. - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: bevy::math::DQuat) -> bevy::math::DQuat; + #[lua(kind = "Method", output(proxy))] + fn mul_quat(self, #[proxy] rhs: bevy::math::DQuat) -> bevy::math::DQuat; + +"#, + r#" +/// Creates a quaternion from a 3x3 rotation matrix inside a 3D affine transform. +/// Note if the input affine matrix contain scales, shears, or other non-rotation +/// transformations then the resulting quaternion will be ill-defined. +/// # Panics +/// Will panic if any input affine matrix column is not normalized when `glam_assert` is +/// enabled. + + #[lua(kind = "Function", output(proxy))] + fn from_affine3(#[proxy] a: &glam::DAffine3) -> bevy::math::DQuat; "#, r#" - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::DQuat; + #[lua(kind = "Method", output(proxy))] + fn as_quat(self) -> bevy::math::Quat; "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] fn index(&self) -> String { - format!("{}", _self) + format!("{:?}", _self) } "#] )] @@ -19338,17 +21491,6 @@ struct EulerRot {} derive(clone), remote = "bevy::math::BVec3A", functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] rhs: &glam::BVec3A) -> bool; - -"#, - r#" /// Creates a new vector mask. #[lua(kind = "Function", output(proxy))] @@ -19407,6 +21549,17 @@ struct EulerRot {} #[lua(kind = "MutatingMethod")] fn set(&mut self, index: usize, value: bool) -> (); +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] rhs: &glam::BVec3A) -> bool; + "#, r#" @@ -19421,7 +21574,7 @@ struct EulerRot {} r#" #[lua(kind="MetaMethod", metamethod="ToString")] fn index(&self) -> String { - format!("{}", _self) + format!("{:?}", _self) } "#] )] @@ -19432,6 +21585,17 @@ struct BVec3A(); remote = "bevy::math::BVec4A", functions[r#" + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] rhs: &glam::BVec4A) -> bool; + +"#, + r#" + #[lua( as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", kind = "Method", @@ -19499,285 +21663,110 @@ struct BVec3A(); #[lua(kind = "MutatingMethod")] fn set(&mut self, index: usize, value: bool) -> (); -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] rhs: &glam::BVec4A) -> bool; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] fn index(&self) -> String { - format!("{}", _self) + format!("{:?}", _self) } "#] )] struct BVec4A(); -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "smol_str::SmolStr", - functions[r#" - - #[lua(kind = "Method")] - fn to_string(&self) -> std::string::String; - -"#, - r#" - - #[lua(kind = "Method")] - fn len(&self) -> usize; - -"#, - r#" - - #[lua(kind = "Method")] - fn is_empty(&self) -> bool; - -"#, - r#" - - #[lua(kind = "Method")] - fn is_heap_allocated(&self) -> bool; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &smol_str::SmolStr) -> bool; - -"#, - r#" - - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> smol_str::SmolStr; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{}", _self) -} -"#] -)] -struct SmolStr(); -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "uuid::Uuid", - functions[r#" -/// Returns the version number of the UUID. -/// This represents the algorithm used to generate the value. -/// This method is the future-proof alternative to [`Uuid::get_version`]. -/// # Examples -/// Basic usage: -/// ``` -/// # use uuid::Uuid; -/// # fn main() -> Result<(), uuid::Error> { -/// let my_uuid = Uuid::parse_str("02f09a3f-1624-3b1d-8409-44eff7708208")?; -/// assert_eq!(3, my_uuid.get_version_num()); -/// # Ok(()) -/// # } -/// ``` -/// # References -/// * [Version Field in RFC 9562](https://www.ietf.org/rfc/rfc9562.html#section-4.2) - - #[lua(kind = "Method")] - fn get_version_num(&self) -> usize; - -"#, - r#" -/// Returns a 128bit value containing the value. -/// The bytes in the UUID will be packed directly into a `u128`. -/// # Examples -/// ``` -/// # use uuid::Uuid; -/// # fn main() -> Result<(), uuid::Error> { -/// let uuid = Uuid::parse_str("a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8")?; -/// assert_eq!( -/// uuid.as_u128(), -/// 0xa1a2a3a4b1b2c1c2d1d2d3d4d5d6d7d8, -/// ); -/// # Ok(()) -/// # } -/// ``` - - #[lua(kind = "Method")] - fn as_u128(&self) -> u128; - -"#, - r#" -/// Returns a 128bit little-endian value containing the value. -/// The bytes in the `u128` will be flipped to convert into big-endian -/// order. This is based on the endianness of the UUID, rather than the -/// target environment so bytes will be flipped on both big and little -/// endian machines. -/// Note that this will produce a different result than -/// [`Uuid::to_fields_le`], because the entire UUID is reversed, rather -/// than reversing the individual fields in-place. -/// # Examples -/// ``` -/// # use uuid::Uuid; -/// # fn main() -> Result<(), uuid::Error> { -/// let uuid = Uuid::parse_str("a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8")?; -/// assert_eq!( -/// uuid.to_u128_le(), -/// 0xd8d7d6d5d4d3d2d1c2c1b2b1a4a3a2a1, -/// ); -/// # Ok(()) -/// # } -/// ``` - - #[lua(kind = "Method")] - fn to_u128_le(&self) -> u128; - -"#, - r#" -/// Returns two 64bit values containing the value. -/// The bytes in the UUID will be split into two `u64`. -/// The first u64 represents the 64 most significant bits, -/// the second one represents the 64 least significant. -/// # Examples -/// ``` -/// # use uuid::Uuid; -/// # fn main() -> Result<(), uuid::Error> { -/// let uuid = Uuid::parse_str("a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8")?; -/// assert_eq!( -/// uuid.as_u64_pair(), -/// (0xa1a2a3a4b1b2c1c2, 0xd1d2d3d4d5d6d7d8), -/// ); -/// # Ok(()) -/// # } -/// ``` - - #[lua(kind = "Method")] - fn as_u64_pair(&self) -> (u64, u64); - -"#, - r#" -/// Consumes self and returns the underlying byte value of the UUID. -/// # Examples -/// ``` -/// # use uuid::Uuid; -/// let bytes = [ -/// 0xa1, 0xa2, 0xa3, 0xa4, -/// 0xb1, 0xb2, -/// 0xc1, 0xc2, -/// 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, -/// ]; -/// let uuid = Uuid::from_bytes(bytes); -/// assert_eq!(bytes, uuid.into_bytes()); -/// ``` +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "smol_str::SmolStr", + functions[r#" - #[lua(kind = "Method")] - fn into_bytes(self) -> [u8; 16]; + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &smol_str::SmolStr) -> bool; "#, r#" -/// Returns the bytes of the UUID in little-endian order. -/// The bytes will be flipped to convert into little-endian order. This is -/// based on the endianness of the UUID, rather than the target environment -/// so bytes will be flipped on both big and little endian machines. -/// # Examples -/// ``` -/// use uuid::Uuid; -/// # fn main() -> Result<(), uuid::Error> { -/// let uuid = Uuid::parse_str("a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8")?; -/// assert_eq!( -/// uuid.to_bytes_le(), -/// ([ -/// 0xa4, 0xa3, 0xa2, 0xa1, 0xb2, 0xb1, 0xc2, 0xc1, 0xd1, 0xd2, -/// 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8 -/// ]) -/// ); -/// # Ok(()) -/// # } -/// ``` - #[lua(kind = "Method")] - fn to_bytes_le(&self) -> [u8; 16]; + #[lua( + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", + output(proxy), + )] + fn clone(&self) -> smol_str::SmolStr; "#, r#" -/// Tests if the UUID is nil (all zeros). #[lua(kind = "Method")] - fn is_nil(&self) -> bool; + fn to_string(&self) -> std::string::String; "#, r#" -/// Tests if the UUID is max (all ones). #[lua(kind = "Method")] - fn is_max(&self) -> bool; + fn len(&self) -> usize; "#, r#" -/// A buffer that can be used for `encode_...` calls, that is -/// guaranteed to be long enough for any of the format adapters. -/// # Examples -/// ``` -/// # use uuid::Uuid; -/// let uuid = Uuid::nil(); -/// assert_eq!( -/// uuid.simple().encode_lower(&mut Uuid::encode_buffer()), -/// "00000000000000000000000000000000" -/// ); -/// assert_eq!( -/// uuid.hyphenated() -/// .encode_lower(&mut Uuid::encode_buffer()), -/// "00000000-0000-0000-0000-000000000000" -/// ); -/// assert_eq!( -/// uuid.urn().encode_lower(&mut Uuid::encode_buffer()), -/// "urn:uuid:00000000-0000-0000-0000-000000000000" -/// ); -/// ``` - #[lua(kind = "Function")] - fn encode_buffer() -> [u8; 45]; + #[lua(kind = "Method")] + fn is_empty(&self) -> bool; "#, r#" -/// If the UUID is the correct version (v1, or v6) this will return the -/// node value as a 6-byte array. For other versions this will return `None`. #[lua(kind = "Method")] - fn get_node_id( - &self, - ) -> bevy::reflect::erased_serde::__private::serde::__private::Option<[u8; 6]>; + fn is_heap_allocated(&self) -> bool; "#, r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct SmolStr(); +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "uuid::Uuid", + functions[r#" +/// Creates a random UUID. +/// This uses the [`getrandom`] crate to utilise the operating system's RNG +/// as the source of random numbers. If you'd like to use a custom +/// generator, don't use this method: generate random bytes using your +/// custom generator and pass them to the +/// [`uuid::Builder::from_random_bytes`][from_random_bytes] function +/// instead. +/// Note that usage of this method requires the `v4` feature of this crate +/// to be enabled. +/// # Examples +/// Basic usage: +/// ``` +/// # use uuid::{Uuid, Version}; +/// let uuid = Uuid::new_v4(); +/// assert_eq!(Some(Version::Random), uuid.get_version()); +/// ``` +/// # References +/// * [UUID Version 4 in RFC 9562](https://www.ietf.org/rfc/rfc9562.html#section-5.4) +/// [`getrandom`]: https://crates.io/crates/getrandom +/// [from_random_bytes]: struct.Builder.html#method.from_random_bytes - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(kind = "Function", output(proxy))] + fn new_v4() -> uuid::Uuid; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", + output(proxy), )] - fn eq(&self, #[proxy] other: &uuid::Uuid) -> bool; + fn clone(&self) -> uuid::Uuid; "#, r#" @@ -19836,57 +21825,197 @@ struct SmolStr(); /// ); /// ``` - #[lua(kind = "Function", output(proxy))] - fn from_u128(v: u128) -> uuid::Uuid; + #[lua(kind = "Function", output(proxy))] + fn from_u128(v: u128) -> uuid::Uuid; + +"#, + r#" +/// Creates a UUID from a 128bit value in little-endian order. +/// The entire value will be flipped to convert into big-endian order. +/// This is based on the endianness of the UUID, rather than the target +/// environment so bytes will be flipped on both big and little endian +/// machines. +/// # Examples +/// Basic usage: +/// ``` +/// # use uuid::Uuid; +/// let v = 0xa1a2a3a4b1b2c1c2d1d2d3d4d5d6d7d8u128; +/// let uuid = Uuid::from_u128_le(v); +/// assert_eq!( +/// "d8d7d6d5-d4d3-d2d1-c2c1-b2b1a4a3a2a1", +/// uuid.hyphenated().to_string(), +/// ); +/// ``` + + #[lua(kind = "Function", output(proxy))] + fn from_u128_le(v: u128) -> uuid::Uuid; + +"#, + r#" +/// Creates a UUID from two 64bit values. +/// # Examples +/// Basic usage: +/// ``` +/// # use uuid::Uuid; +/// let hi = 0xa1a2a3a4b1b2c1c2u64; +/// let lo = 0xd1d2d3d4d5d6d7d8u64; +/// let uuid = Uuid::from_u64_pair(hi, lo); +/// assert_eq!( +/// "a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8", +/// uuid.hyphenated().to_string(), +/// ); +/// ``` + + #[lua(kind = "Function", output(proxy))] + fn from_u64_pair(high_bits: u64, low_bits: u64) -> uuid::Uuid; + +"#, + r#" +/// Creates a UUID using the supplied bytes. +/// # Examples +/// Basic usage: +/// ``` +/// # fn main() -> Result<(), uuid::Error> { +/// # use uuid::Uuid; +/// let bytes = [ +/// 0xa1, 0xa2, 0xa3, 0xa4, +/// 0xb1, 0xb2, +/// 0xc1, 0xc2, +/// 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, +/// ]; +/// let uuid = Uuid::from_bytes(bytes); +/// assert_eq!( +/// uuid.hyphenated().to_string(), +/// "a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8" +/// ); +/// # Ok(()) +/// # } +/// ``` + + #[lua(kind = "Function", output(proxy))] + fn from_bytes(bytes: [u8; 16]) -> uuid::Uuid; + +"#, + r#" +/// Creates a UUID using the supplied bytes in little endian order. +/// The individual fields encoded in the buffer will be flipped. +/// # Examples +/// Basic usage: +/// ``` +/// # fn main() -> Result<(), uuid::Error> { +/// # use uuid::Uuid; +/// let bytes = [ +/// 0xa1, 0xa2, 0xa3, 0xa4, +/// 0xb1, 0xb2, +/// 0xc1, 0xc2, +/// 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, +/// ]; +/// let uuid = Uuid::from_bytes_le(bytes); +/// assert_eq!( +/// "a4a3a2a1-b2b1-c2c1-d1d2-d3d4d5d6d7d8", +/// uuid.hyphenated().to_string(), +/// ); +/// # Ok(()) +/// # } +/// ``` + + #[lua(kind = "Function", output(proxy))] + fn from_bytes_le(b: [u8; 16]) -> uuid::Uuid; + +"#, + r#" +/// Returns the version number of the UUID. +/// This represents the algorithm used to generate the value. +/// This method is the future-proof alternative to [`Uuid::get_version`]. +/// # Examples +/// Basic usage: +/// ``` +/// # use uuid::Uuid; +/// # fn main() -> Result<(), uuid::Error> { +/// let my_uuid = Uuid::parse_str("02f09a3f-1624-3b1d-8409-44eff7708208")?; +/// assert_eq!(3, my_uuid.get_version_num()); +/// # Ok(()) +/// # } +/// ``` +/// # References +/// * [Version Field in RFC 9562](https://www.ietf.org/rfc/rfc9562.html#section-4.2) + + #[lua(kind = "Method")] + fn get_version_num(&self) -> usize; + +"#, + r#" +/// Returns a 128bit value containing the value. +/// The bytes in the UUID will be packed directly into a `u128`. +/// # Examples +/// ``` +/// # use uuid::Uuid; +/// # fn main() -> Result<(), uuid::Error> { +/// let uuid = Uuid::parse_str("a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8")?; +/// assert_eq!( +/// uuid.as_u128(), +/// 0xa1a2a3a4b1b2c1c2d1d2d3d4d5d6d7d8, +/// ); +/// # Ok(()) +/// # } +/// ``` + + #[lua(kind = "Method")] + fn as_u128(&self) -> u128; "#, r#" -/// Creates a UUID from a 128bit value in little-endian order. -/// The entire value will be flipped to convert into big-endian order. -/// This is based on the endianness of the UUID, rather than the target -/// environment so bytes will be flipped on both big and little endian -/// machines. +/// Returns a 128bit little-endian value containing the value. +/// The bytes in the `u128` will be flipped to convert into big-endian +/// order. This is based on the endianness of the UUID, rather than the +/// target environment so bytes will be flipped on both big and little +/// endian machines. +/// Note that this will produce a different result than +/// [`Uuid::to_fields_le`], because the entire UUID is reversed, rather +/// than reversing the individual fields in-place. /// # Examples -/// Basic usage: /// ``` /// # use uuid::Uuid; -/// let v = 0xa1a2a3a4b1b2c1c2d1d2d3d4d5d6d7d8u128; -/// let uuid = Uuid::from_u128_le(v); +/// # fn main() -> Result<(), uuid::Error> { +/// let uuid = Uuid::parse_str("a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8")?; /// assert_eq!( -/// "d8d7d6d5-d4d3-d2d1-c2c1-b2b1a4a3a2a1", -/// uuid.hyphenated().to_string(), +/// uuid.to_u128_le(), +/// 0xd8d7d6d5d4d3d2d1c2c1b2b1a4a3a2a1, /// ); +/// # Ok(()) +/// # } /// ``` - #[lua(kind = "Function", output(proxy))] - fn from_u128_le(v: u128) -> uuid::Uuid; + #[lua(kind = "Method")] + fn to_u128_le(&self) -> u128; "#, r#" -/// Creates a UUID from two 64bit values. +/// Returns two 64bit values containing the value. +/// The bytes in the UUID will be split into two `u64`. +/// The first u64 represents the 64 most significant bits, +/// the second one represents the 64 least significant. /// # Examples -/// Basic usage: /// ``` /// # use uuid::Uuid; -/// let hi = 0xa1a2a3a4b1b2c1c2u64; -/// let lo = 0xd1d2d3d4d5d6d7d8u64; -/// let uuid = Uuid::from_u64_pair(hi, lo); +/// # fn main() -> Result<(), uuid::Error> { +/// let uuid = Uuid::parse_str("a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8")?; /// assert_eq!( -/// "a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8", -/// uuid.hyphenated().to_string(), +/// uuid.as_u64_pair(), +/// (0xa1a2a3a4b1b2c1c2, 0xd1d2d3d4d5d6d7d8), /// ); +/// # Ok(()) +/// # } /// ``` - #[lua(kind = "Function", output(proxy))] - fn from_u64_pair(high_bits: u64, low_bits: u64) -> uuid::Uuid; + #[lua(kind = "Method")] + fn as_u64_pair(&self) -> (u64, u64); "#, r#" -/// Creates a UUID using the supplied bytes. +/// Consumes self and returns the underlying byte value of the UUID. /// # Examples -/// Basic usage: /// ``` -/// # fn main() -> Result<(), uuid::Error> { /// # use uuid::Uuid; /// let bytes = [ /// 0xa1, 0xa2, 0xa3, 0xa4, @@ -19895,85 +22024,109 @@ struct SmolStr(); /// 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, /// ]; /// let uuid = Uuid::from_bytes(bytes); -/// assert_eq!( -/// uuid.hyphenated().to_string(), -/// "a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8" -/// ); -/// # Ok(()) -/// # } +/// assert_eq!(bytes, uuid.into_bytes()); /// ``` - #[lua(kind = "Function", output(proxy))] - fn from_bytes(bytes: [u8; 16]) -> uuid::Uuid; + #[lua(kind = "Method")] + fn into_bytes(self) -> [u8; 16]; "#, r#" -/// Creates a UUID using the supplied bytes in little endian order. -/// The individual fields encoded in the buffer will be flipped. +/// Returns the bytes of the UUID in little-endian order. +/// The bytes will be flipped to convert into little-endian order. This is +/// based on the endianness of the UUID, rather than the target environment +/// so bytes will be flipped on both big and little endian machines. /// # Examples -/// Basic usage: /// ``` +/// use uuid::Uuid; /// # fn main() -> Result<(), uuid::Error> { -/// # use uuid::Uuid; -/// let bytes = [ -/// 0xa1, 0xa2, 0xa3, 0xa4, -/// 0xb1, 0xb2, -/// 0xc1, 0xc2, -/// 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, -/// ]; -/// let uuid = Uuid::from_bytes_le(bytes); +/// let uuid = Uuid::parse_str("a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8")?; /// assert_eq!( -/// "a4a3a2a1-b2b1-c2c1-d1d2-d3d4d5d6d7d8", -/// uuid.hyphenated().to_string(), +/// uuid.to_bytes_le(), +/// ([ +/// 0xa4, 0xa3, 0xa2, 0xa1, 0xb2, 0xb1, 0xc2, 0xc1, 0xd1, 0xd2, +/// 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8 +/// ]) /// ); /// # Ok(()) /// # } /// ``` - #[lua(kind = "Function", output(proxy))] - fn from_bytes_le(b: [u8; 16]) -> uuid::Uuid; + #[lua(kind = "Method")] + fn to_bytes_le(&self) -> [u8; 16]; "#, r#" +/// Tests if the UUID is nil (all zeros). - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> uuid::Uuid; + #[lua(kind = "Method")] + fn is_nil(&self) -> bool; "#, r#" -/// Creates a random UUID. -/// This uses the [`getrandom`] crate to utilise the operating system's RNG -/// as the source of random numbers. If you'd like to use a custom -/// generator, don't use this method: generate random bytes using your -/// custom generator and pass them to the -/// [`uuid::Builder::from_random_bytes`][from_random_bytes] function -/// instead. -/// Note that usage of this method requires the `v4` feature of this crate -/// to be enabled. +/// Tests if the UUID is max (all ones). + + #[lua(kind = "Method")] + fn is_max(&self) -> bool; + +"#, + r#" +/// A buffer that can be used for `encode_...` calls, that is +/// guaranteed to be long enough for any of the format adapters. /// # Examples -/// Basic usage: /// ``` -/// # use uuid::{Uuid, Version}; -/// let uuid = Uuid::new_v4(); -/// assert_eq!(Some(Version::Random), uuid.get_version()); +/// # use uuid::Uuid; +/// let uuid = Uuid::nil(); +/// assert_eq!( +/// uuid.simple().encode_lower(&mut Uuid::encode_buffer()), +/// "00000000000000000000000000000000" +/// ); +/// assert_eq!( +/// uuid.hyphenated() +/// .encode_lower(&mut Uuid::encode_buffer()), +/// "00000000-0000-0000-0000-000000000000" +/// ); +/// assert_eq!( +/// uuid.urn().encode_lower(&mut Uuid::encode_buffer()), +/// "urn:uuid:00000000-0000-0000-0000-000000000000" +/// ); /// ``` -/// # References -/// * [UUID Version 4 in RFC 9562](https://www.ietf.org/rfc/rfc9562.html#section-5.4) -/// [`getrandom`]: https://crates.io/crates/getrandom -/// [from_random_bytes]: struct.Builder.html#method.from_random_bytes - #[lua(kind = "Function", output(proxy))] - fn new_v4() -> uuid::Uuid; + #[lua(kind = "Function")] + fn encode_buffer() -> [u8; 45]; + +"#, + r#" +/// If the UUID is the correct version (v1, or v6) this will return the +/// node value as a 6-byte array. For other versions this will return `None`. + + #[lua(kind = "Method")] + fn get_node_id( + &self, + ) -> bevy::reflect::erased_serde::__private::serde::__private::Option<[u8; 6]>; + +"#, + r#" + + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &uuid::Uuid) -> bool; "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] fn index(&self) -> String { - format!("{}", _self) + format!("{:?}", _self) } "#] )] @@ -19985,6 +22138,61 @@ impl bevy_mod_scripting_lua::tealr::mlu::ExportInstances for Globals { 'lua, T: bevy_mod_scripting_lua::tealr::mlu::InstanceCollector<'lua>, >(self, instances: &mut T) -> bevy_mod_scripting_lua::tealr::mlu::mlua::Result<()> { + instances + .add_instance( + "AtomicBool", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "AtomicI16", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "AtomicI32", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "AtomicI64", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "AtomicI8", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "AtomicIsize", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "AtomicU16", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "AtomicU32", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "AtomicU64", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "AtomicU8", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "AtomicUsize", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; instances .add_instance( "Duration", @@ -20215,6 +22423,72 @@ impl bevy_mod_scripting_core::hosts::APIProvider for BevyReflectAPIProvider { |tw| { tw.document_global_instance::() .expect("Something went wrong documenting globals") + .process_type::() + .process_type::< + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< + LuaAtomicBool, + >, + >() + .process_type::() + .process_type::< + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< + LuaAtomicI16, + >, + >() + .process_type::() + .process_type::< + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< + LuaAtomicI32, + >, + >() + .process_type::() + .process_type::< + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< + LuaAtomicI64, + >, + >() + .process_type::() + .process_type::< + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< + LuaAtomicI8, + >, + >() + .process_type::() + .process_type::< + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< + LuaAtomicIsize, + >, + >() + .process_type::() + .process_type::< + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< + LuaAtomicU16, + >, + >() + .process_type::() + .process_type::< + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< + LuaAtomicU32, + >, + >() + .process_type::() + .process_type::< + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< + LuaAtomicU64, + >, + >() + .process_type::() + .process_type::< + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< + LuaAtomicU8, + >, + >() + .process_type::() + .process_type::< + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< + LuaAtomicUsize, + >, + >() .process_type::() .process_type::< bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< @@ -20410,6 +22684,17 @@ impl bevy_mod_scripting_core::hosts::APIProvider for BevyReflectAPIProvider { Ok(()) } fn register_with_app(&self, app: &mut bevy::app::App) { + app.register_foreign_lua_type::(); + app.register_foreign_lua_type::(); + app.register_foreign_lua_type::(); + app.register_foreign_lua_type::(); + app.register_foreign_lua_type::(); + app.register_foreign_lua_type::(); + app.register_foreign_lua_type::(); + app.register_foreign_lua_type::(); + app.register_foreign_lua_type::(); + app.register_foreign_lua_type::(); + app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); diff --git a/crates/bevy_script_api/src/providers/bevy_time.rs b/crates/bevy_script_api/src/providers/bevy_time.rs index 377313b2c9..5f5629cda5 100644 --- a/crates/bevy_script_api/src/providers/bevy_time.rs +++ b/crates/bevy_script_api/src/providers/bevy_time.rs @@ -149,6 +149,14 @@ struct Real {} #[lua(kind = "Method")] fn elapsed_secs(&self) -> f32; +"#, + r#" +/// Returns the time elapsed on the timer as an `f64`. +/// See also [`Timer::elapsed`](Timer::elapsed). + + #[lua(kind = "Method")] + fn elapsed_secs_f64(&self) -> f64; + "#, r#" /// Sets the elapsed time of the timer without any other considerations. @@ -262,7 +270,7 @@ struct Real {} "#, r#" /// Returns `true` if the timer is paused. -/// See also [`Stopwatch::paused`](Stopwatch::paused). +/// See also [`Stopwatch::is_paused`](Stopwatch::is_paused). /// # Examples /// ``` /// # use bevy_time::*; @@ -380,6 +388,12 @@ struct Real {} #[lua(kind = "Method")] fn times_finished_this_tick(&self) -> u32; +"#, + r#" + + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); + "#, r#" @@ -391,12 +405,6 @@ struct Real {} )] fn eq(&self, #[proxy] other: &timer::Timer) -> bool; -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -412,12 +420,6 @@ struct Timer {} remote = "bevy::time::prelude::TimerMode", functions[r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -426,6 +428,12 @@ struct Timer {} )] fn eq(&self, #[proxy] other: &timer::TimerMode) -> bool; +"#, + r#" + + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); + "#, r#" @@ -465,12 +473,6 @@ struct Virtual {} remote = "bevy::time::Stopwatch", functions[r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -479,6 +481,12 @@ struct Virtual {} )] fn eq(&self, #[proxy] other: &stopwatch::Stopwatch) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::time::Stopwatch; + "#, r#" /// Create a new unpaused `Stopwatch` with no elapsed time. @@ -487,7 +495,7 @@ struct Virtual {} /// # use bevy_time::*; /// let stopwatch = Stopwatch::new(); /// assert_eq!(stopwatch.elapsed_secs(), 0.0); -/// assert_eq!(stopwatch.paused(), false); +/// assert_eq!(stopwatch.is_paused(), false); /// ``` #[lua(kind = "Function", output(proxy))] @@ -568,7 +576,7 @@ struct Virtual {} /// let mut stopwatch = Stopwatch::new(); /// stopwatch.pause(); /// stopwatch.tick(Duration::from_secs_f32(1.5)); -/// assert!(stopwatch.paused()); +/// assert!(stopwatch.is_paused()); /// assert_eq!(stopwatch.elapsed_secs(), 0.0); /// ``` @@ -587,7 +595,7 @@ struct Virtual {} /// stopwatch.tick(Duration::from_secs_f32(1.0)); /// stopwatch.unpause(); /// stopwatch.tick(Duration::from_secs_f32(1.0)); -/// assert!(!stopwatch.paused()); +/// assert!(!stopwatch.is_paused()); /// assert_eq!(stopwatch.elapsed_secs(), 1.0); /// ``` @@ -601,15 +609,15 @@ struct Virtual {} /// ``` /// # use bevy_time::*; /// let mut stopwatch = Stopwatch::new(); -/// assert!(!stopwatch.paused()); +/// assert!(!stopwatch.is_paused()); /// stopwatch.pause(); -/// assert!(stopwatch.paused()); +/// assert!(stopwatch.is_paused()); /// stopwatch.unpause(); -/// assert!(!stopwatch.paused()); +/// assert!(!stopwatch.is_paused()); /// ``` #[lua(kind = "Method")] - fn paused(&self) -> bool; + fn is_paused(&self) -> bool; "#, r#" @@ -630,8 +638,8 @@ struct Virtual {} "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::time::Stopwatch; + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); "#, r#" diff --git a/crates/bevy_script_api/src/providers/bevy_transform.rs b/crates/bevy_script_api/src/providers/bevy_transform.rs index 0a55f0c67d..bb78e6d345 100644 --- a/crates/bevy_script_api/src/providers/bevy_transform.rs +++ b/crates/bevy_script_api/src/providers/bevy_transform.rs @@ -5,8 +5,8 @@ use super::bevy_ecs::*; use super::bevy_reflect::*; use super::bevy_core::*; -use super::bevy_hierarchy::*; use super::bevy_math::*; +use super::bevy_hierarchy::*; extern crate self as bevy_script_api; use bevy_script_api::{ lua::RegisterForeignLuaType, ReflectedValue, common::bevy::GetWorld, @@ -17,19 +17,30 @@ use bevy_script_api::{ remote = "bevy::transform::components::GlobalTransform", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::transform::components::GlobalTransform; + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] value: bevy::math::Vec3) -> bevy::math::Vec3; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", + as_trait = "std::ops::Mul", kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", + output(proxy), + composite = "mul", + metamethod = "Mul", )] - fn eq(&self, #[proxy] other: &components::global_transform::GlobalTransform) -> bool; + fn mul( + self, + #[proxy] + global_transform: bevy::transform::components::GlobalTransform, + ) -> bevy::transform::components::GlobalTransform; "#, r#" @@ -64,6 +75,15 @@ use bevy_script_api::{ scale: bevy::math::Vec3, ) -> bevy::transform::components::GlobalTransform; +"#, + r#" + + #[lua(kind = "Function", output(proxy))] + fn from_isometry( + #[proxy] + iso: bevy::math::Isometry3d, + ) -> bevy::transform::components::GlobalTransform; + "#, r#" /// Returns the 3d affine transformation matrix as a [`Mat4`]. @@ -87,6 +107,17 @@ use bevy_script_api::{ #[lua(kind = "Method", output(proxy))] fn compute_transform(&self) -> bevy::transform::components::Transform; +"#, + r#" +/// Returns the isometric part of the transformation as an [isometry]. Any scaling done by the +/// transformation will be ignored. +/// The transform is expected to be non-degenerate and without shearing, or the output +/// will be invalid. +/// [isometry]: Isometry3d + + #[lua(kind = "Method", output(proxy))] + fn to_isometry(&self) -> bevy::math::Isometry3d; + "#, r#" /// Returns the [`Transform`] `self` would have if it was a child of an entity @@ -192,8 +223,35 @@ use bevy_script_api::{ "#, r#" -/// Transforms the given `point`, applying shear, scale, rotation and translation. -/// This moves `point` into the local space of this [`GlobalTransform`]. +/// Transforms the given point from local space to global space, applying shear, scale, rotation and translation. +/// It can be used like this: +/// ``` +/// # use bevy_transform::prelude::{GlobalTransform}; +/// # use bevy_math::prelude::Vec3; +/// let global_transform = GlobalTransform::from_xyz(1., 2., 3.); +/// let local_point = Vec3::new(1., 2., 3.); +/// let global_point = global_transform.transform_point(local_point); +/// assert_eq!(global_point, Vec3::new(2., 4., 6.)); +/// ``` +/// ``` +/// # use bevy_transform::prelude::{GlobalTransform}; +/// # use bevy_math::Vec3; +/// let global_point = Vec3::new(2., 4., 6.); +/// let global_transform = GlobalTransform::from_xyz(1., 2., 3.); +/// let local_point = global_transform.affine().inverse().transform_point3(global_point); +/// assert_eq!(local_point, Vec3::new(1., 2., 3.)) +/// ``` +/// To apply shear, scale, and rotation *without* applying translation, different functions are available: +/// ``` +/// # use bevy_transform::prelude::{GlobalTransform}; +/// # use bevy_math::prelude::Vec3; +/// let global_transform = GlobalTransform::from_xyz(1., 2., 3.); +/// let local_direction = Vec3::new(1., 2., 3.); +/// let global_direction = global_transform.affine().transform_vector3(local_direction); +/// assert_eq!(global_direction, Vec3::new(1., 2., 3.)); +/// let roundtripped_local_direction = global_transform.affine().inverse().transform_vector3(global_direction); +/// assert_eq!(roundtripped_local_direction, local_direction); +/// ``` #[lua(kind = "Method", output(proxy))] fn transform_point(&self, #[proxy] point: bevy::math::Vec3) -> bevy::math::Vec3; @@ -210,21 +268,22 @@ use bevy_script_api::{ transform: bevy::transform::components::Transform, ) -> bevy::transform::components::GlobalTransform; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::transform::components::GlobalTransform; + "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::cmp::PartialEq", kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "eq", + metamethod = "Eq", )] - fn mul( - self, - #[proxy] - global_transform: bevy::transform::components::GlobalTransform, - ) -> bevy::transform::components::GlobalTransform; + fn eq(&self, #[proxy] other: &components::global_transform::GlobalTransform) -> bool; "#, r#" @@ -242,18 +301,6 @@ use bevy_script_api::{ transform: bevy::transform::components::Transform, ) -> bevy::transform::components::GlobalTransform; -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] value: bevy::math::Vec3) -> bevy::math::Vec3; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -269,6 +316,17 @@ struct GlobalTransform(); remote = "bevy::transform::components::Transform", functions[r#" + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &components::transform::Transform) -> bool; + +"#, + r#" + #[lua( as_trait = "std::ops::Mul", kind = "MetaFunction", @@ -282,12 +340,6 @@ struct GlobalTransform(); global_transform: bevy::transform::components::GlobalTransform, ) -> bevy::transform::components::GlobalTransform; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::transform::components::Transform; - "#, r#" @@ -298,7 +350,11 @@ struct GlobalTransform(); composite = "mul", metamethod = "Mul", )] - fn mul(self, #[proxy] value: bevy::math::Vec3) -> bevy::math::Vec3; + fn mul( + self, + #[proxy] + transform: bevy::transform::components::Transform, + ) -> bevy::transform::components::Transform; "#, r#" @@ -310,11 +366,7 @@ struct GlobalTransform(); composite = "mul", metamethod = "Mul", )] - fn mul( - self, - #[proxy] - transform: bevy::transform::components::Transform, - ) -> bevy::transform::components::Transform; + fn mul(self, #[proxy] value: bevy::math::Vec3) -> bevy::math::Vec3; "#, r#" @@ -369,6 +421,17 @@ struct GlobalTransform(); scale: bevy::math::Vec3, ) -> bevy::transform::components::Transform; +"#, + r#" +/// Creates a new [`Transform`] that is equivalent to the given [isometry]. +/// [isometry]: Isometry3d + + #[lua(kind = "Function", output(proxy))] + fn from_isometry( + #[proxy] + iso: bevy::math::Isometry3d, + ) -> bevy::transform::components::Transform; + "#, r#" /// Returns this [`Transform`] with a new translation. @@ -603,12 +666,13 @@ struct GlobalTransform(); "#, r#" /// Transforms the given `point`, applying scale, rotation and translation. -/// If this [`Transform`] has a parent, this will transform a `point` that is -/// relative to the parent's [`Transform`] into one relative to this [`Transform`]. -/// If this [`Transform`] does not have a parent, this will transform a `point` -/// that is in global space into one relative to this [`Transform`]. -/// If you want to transform a `point` in global space to the local space of this [`Transform`], -/// consider using [`GlobalTransform::transform_point()`] instead. +/// If this [`Transform`] has an ancestor entity with a [`Transform`] component, +/// [`Transform::transform_point`] will transform a point in local space into its +/// parent transform's space. +/// If this [`Transform`] does not have a parent, [`Transform::transform_point`] will +/// transform a point in local space into worldspace coordinates. +/// If you always want to transform a point in local space to worldspace, or if you need +/// the inverse transformations, see [`GlobalTransform::transform_point()`]. #[lua(kind = "Method", output(proxy))] fn transform_point(&self, #[proxy] point: bevy::math::Vec3) -> bevy::math::Vec3; @@ -624,14 +688,17 @@ struct GlobalTransform(); "#, r#" +/// Get the [isometry] defined by this transform's rotation and translation, ignoring scale. +/// [isometry]: Isometry3d - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &components::transform::Transform) -> bool; + #[lua(kind = "Method", output(proxy))] + fn to_isometry(&self) -> bevy::math::Isometry3d; + +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::transform::components::Transform; "#, r#" diff --git a/crates/bevy_script_api/src/providers/bevy_window.rs b/crates/bevy_script_api/src/providers/bevy_window.rs index 2c00201875..3ec16478e8 100644 --- a/crates/bevy_script_api/src/providers/bevy_window.rs +++ b/crates/bevy_script_api/src/providers/bevy_window.rs @@ -2,8 +2,10 @@ #![allow(clippy::all)] #![allow(unused, deprecated, dead_code)] #![cfg_attr(rustfmt, rustfmt_skip)] +use super::bevy_a11y::*; use super::bevy_ecs::*; use super::bevy_reflect::*; +use super::bevy_input::*; use super::bevy_math::*; extern crate self as bevy_script_api; use bevy_script_api::{ @@ -15,17 +17,6 @@ use bevy_script_api::{ remote = "bevy::window::prelude::CursorEntered", functions[r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &event::CursorEntered) -> bool; - -"#, - r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] fn clone(&self) -> bevy::window::prelude::CursorEntered; @@ -35,27 +26,6 @@ use bevy_script_api::{ #[lua(as_trait = "std::cmp::Eq", kind = "Method")] fn assert_receiver_is_total_eq(&self) -> (); -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct CursorEntered { - #[lua(output(proxy))] - window: bevy::ecs::entity::Entity, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::window::prelude::CursorIcon", - functions[r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::prelude::CursorIcon; - "#, r#" @@ -65,13 +35,7 @@ struct CursorEntered { composite = "eq", metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &cursor::CursorIcon) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + fn eq(&self, #[proxy] other: &event::CursorEntered) -> bool; "#, r#" @@ -81,13 +45,22 @@ fn index(&self) -> String { } "#] )] -struct CursorIcon {} +struct CursorEntered { + #[lua(output(proxy))] + window: bevy::ecs::entity::Entity, +} #[derive(bevy_mod_scripting_lua_derive::LuaProxy)] #[proxy( derive(clone), remote = "bevy::window::prelude::CursorLeft", functions[r#" + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -102,12 +75,6 @@ struct CursorIcon {} #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] fn clone(&self) -> bevy::window::prelude::CursorLeft; -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -126,12 +93,6 @@ struct CursorLeft { remote = "bevy::window::prelude::CursorMoved", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::prelude::CursorMoved; - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -140,6 +101,12 @@ struct CursorLeft { )] fn eq(&self, #[proxy] other: &event::CursorMoved) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::window::prelude::CursorMoved; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -196,13 +163,8 @@ struct FileDragAndDrop {} remote = "bevy::window::prelude::Ime", functions[r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &event::Ime) -> bool; + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); "#, r#" @@ -213,8 +175,13 @@ struct FileDragAndDrop {} "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &event::Ime) -> bool; "#, r#" @@ -231,12 +198,6 @@ struct Ime {} remote = "bevy::window::prelude::MonitorSelection", functions[r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -251,35 +212,6 @@ struct Ime {} #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] fn clone(&self) -> bevy::window::prelude::MonitorSelection; -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct MonitorSelection {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::window::prelude::ReceivedCharacter", - functions[r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::prelude::ReceivedCharacter; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &event::ReceivedCharacter) -> bool; - "#, r#" @@ -294,23 +226,12 @@ fn index(&self) -> String { } "#] )] -struct ReceivedCharacter { - #[lua(output(proxy))] - window: bevy::ecs::entity::Entity, - #[lua(output(proxy))] - char: smol_str::SmolStr, -} +struct MonitorSelection {} #[derive(bevy_mod_scripting_lua_derive::LuaProxy)] #[proxy( derive(clone), remote = "bevy::window::prelude::Window", functions[r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::prelude::Window; - -"#, - r#" /// Setting to true will attempt to maximize the window. /// Setting to false will attempt to un-maximize the window. @@ -325,6 +246,24 @@ struct ReceivedCharacter { #[lua(kind = "MutatingMethod")] fn set_minimized(&mut self, minimized: bool) -> (); +"#, + r#" +/// Calling this will attempt to start a drag-move of the window. +/// There is no guarantee that this will work unless the left mouse button was +/// pressed immediately before this function was called. + + #[lua(kind = "MutatingMethod")] + fn start_drag_move(&mut self) -> (); + +"#, + r#" +/// Calling this will attempt to start a drag-resize of the window. +/// There is no guarantee that this will work unless the left mouse button was +/// pressed immediately before this function was called. + + #[lua(kind = "MutatingMethod")] + fn start_drag_resize(&mut self, #[proxy] direction: bevy::math::CompassOctant) -> (); + "#, r#" /// The window's client area width in logical pixels. @@ -381,6 +320,12 @@ struct ReceivedCharacter { #[lua(kind = "Method")] fn scale_factor(&self) -> f32; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::window::prelude::Window; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -391,7 +336,7 @@ fn index(&self) -> String { )] struct Window { #[lua(output(proxy))] - cursor: bevy::window::Cursor, + cursor_options: bevy::window::CursorOptions, #[lua(output(proxy))] present_mode: bevy::window::PresentMode, #[lua(output(proxy))] @@ -430,6 +375,13 @@ struct Window { recognize_rotation_gesture: bool, recognize_doubletap_gesture: bool, recognize_pan_gesture: ReflectedValue, + movable_by_window_background: bool, + fullsize_content_view: bool, + has_shadow: bool, + titlebar_shown: bool, + titlebar_transparent: bool, + titlebar_show_title: bool, + titlebar_show_buttons: bool, } #[derive(bevy_mod_scripting_lua_derive::LuaProxy)] #[proxy( @@ -437,6 +389,12 @@ struct Window { remote = "bevy::window::prelude::WindowMoved", functions[r#" + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::window::prelude::WindowMoved; + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -451,12 +409,6 @@ struct Window { #[lua(as_trait = "std::cmp::Eq", kind = "Method")] fn assert_receiver_is_total_eq(&self) -> (); -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::prelude::WindowMoved; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -502,12 +454,6 @@ struct WindowMoved { monitor: bevy::window::prelude::MonitorSelection, ) -> (); -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::prelude::WindowPosition; - "#, r#" @@ -519,6 +465,12 @@ struct WindowMoved { )] fn eq(&self, #[proxy] other: &window::WindowPosition) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::window::prelude::WindowPosition; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -533,14 +485,11 @@ struct WindowPosition {} derive(clone), remote = "bevy::window::prelude::WindowResizeConstraints", functions[r#" +/// Checks if the constraints are valid. +/// Will output warnings if it isn't. - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &window::WindowResizeConstraints) -> bool; + #[lua(kind = "Method", output(proxy))] + fn check_constraints(&self) -> bevy::window::prelude::WindowResizeConstraints; "#, r#" @@ -550,11 +499,14 @@ struct WindowPosition {} "#, r#" -/// Checks if the constraints are valid. -/// Will output warnings if it isn't. - #[lua(kind = "Method", output(proxy))] - fn check_constraints(&self) -> bevy::window::prelude::WindowResizeConstraints; + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &window::WindowResizeConstraints) -> bool; "#, r#" @@ -573,23 +525,52 @@ struct WindowResizeConstraints { #[derive(bevy_mod_scripting_lua_derive::LuaProxy)] #[proxy( derive(clone), - remote = "bevy::window::WindowResized", + remote = "bevy::window::WindowEvent", functions[r#" + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::window::WindowEvent; + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", composite = "eq", metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &event::WindowResized) -> bool; + fn eq(&self, #[proxy] other: &event::WindowEvent) -> bool; "#, r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct WindowEvent {} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::window::WindowResized", + functions[r#" #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] fn clone(&self) -> bevy::window::WindowResized; +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &event::WindowResized) -> bool; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -648,17 +629,6 @@ struct WindowCreated { remote = "bevy::window::WindowClosing", functions[r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &event::WindowClosing) -> bool; - -"#, - r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] fn clone(&self) -> bevy::window::WindowClosing; @@ -668,6 +638,17 @@ struct WindowCreated { #[lua(as_trait = "std::cmp::Eq", kind = "Method")] fn assert_receiver_is_total_eq(&self) -> (); +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &event::WindowClosing) -> bool; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -689,6 +670,12 @@ struct WindowClosing { #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] fn clone(&self) -> bevy::window::WindowClosed; +"#, + r#" + + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); + "#, r#" @@ -700,12 +687,6 @@ struct WindowClosing { )] fn eq(&self, #[proxy] other: &event::WindowClosed) -> bool; -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -724,8 +705,13 @@ struct WindowClosed { remote = "bevy::window::WindowCloseRequested", functions[r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &event::WindowCloseRequested) -> bool; "#, r#" @@ -736,13 +722,8 @@ struct WindowClosed { "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &event::WindowCloseRequested) -> bool; + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); "#, r#" @@ -762,8 +743,8 @@ struct WindowCloseRequested { remote = "bevy::window::WindowDestroyed", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::WindowDestroyed; + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); "#, r#" @@ -779,8 +760,8 @@ struct WindowCloseRequested { "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::window::WindowDestroyed; "#, r#" @@ -800,14 +781,14 @@ struct WindowDestroyed { remote = "bevy::window::RequestRedraw", functions[r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::window::RequestRedraw; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::RequestRedraw; + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); "#, r#" @@ -874,18 +855,6 @@ struct WindowFocused { remote = "bevy::window::WindowOccluded", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::WindowOccluded; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -894,6 +863,18 @@ struct WindowFocused { )] fn eq(&self, #[proxy] other: &event::WindowOccluded) -> bool; +"#, + r#" + + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); + +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::window::WindowOccluded; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -946,12 +927,6 @@ struct WindowScaleFactorChanged { remote = "bevy::window::WindowBackendScaleFactorChanged", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::WindowBackendScaleFactorChanged; - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -960,6 +935,12 @@ struct WindowScaleFactorChanged { )] fn eq(&self, #[proxy] other: &event::WindowBackendScaleFactorChanged) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::window::WindowBackendScaleFactorChanged; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -990,14 +971,14 @@ struct WindowBackendScaleFactorChanged { "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::window::WindowThemeChanged; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::WindowThemeChanged; + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); "#, r#" @@ -1019,25 +1000,25 @@ struct WindowThemeChanged { remote = "bevy::window::AppLifecycle", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::AppLifecycle; + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &event::AppLifecycle) -> bool; "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::window::AppLifecycle; "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &event::AppLifecycle) -> bool; + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); "#, r#" @@ -1061,6 +1042,18 @@ struct AppLifecycle {} remote = "bevy::window::PrimaryWindow", functions[r#" + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); + +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::window::PrimaryWindow; + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -1069,6 +1062,24 @@ struct AppLifecycle {} )] fn eq(&self, #[proxy] other: &window::PrimaryWindow) -> bool; +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct PrimaryWindow {} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::window::WindowTheme", + functions[r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::window::WindowTheme; + "#, r#" @@ -1078,8 +1089,38 @@ struct AppLifecycle {} "#, r#" + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &window::WindowTheme) -> bool; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct WindowTheme {} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::window::Monitor", + functions[r#" + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::PrimaryWindow; + fn clone(&self) -> bevy::window::Monitor; + +"#, + r#" +/// Returns the physical size of the monitor in pixels + + #[lua(kind = "Method", output(proxy))] + fn physical_size(&self) -> bevy::math::UVec2; "#, r#" @@ -1089,18 +1130,62 @@ fn index(&self) -> String { } "#] )] -struct PrimaryWindow {} +struct Monitor { + name: std::option::Option, + physical_height: u32, + physical_width: u32, + #[lua(output(proxy))] + physical_position: bevy::math::IVec2, + refresh_rate_millihertz: std::option::Option, + scale_factor: f64, + video_modes: ReflectedValue, +} #[derive(bevy_mod_scripting_lua_derive::LuaProxy)] #[proxy( derive(clone), - remote = "bevy::window::WindowTheme", + remote = "bevy::window::VideoMode", functions[r#" #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::WindowTheme; + fn clone(&self) -> bevy::window::VideoMode; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct VideoMode { + #[lua(output(proxy))] + physical_size: bevy::math::UVec2, + bit_depth: u16, + refresh_rate_millihertz: u32, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::window::PrimaryMonitor", + functions[r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::window::PrimaryMonitor; "#, r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct PrimaryMonitor {} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::window::SystemCursorIcon", + functions[r#" #[lua( as_trait = "std::cmp::PartialEq", @@ -1108,7 +1193,13 @@ struct PrimaryWindow {} composite = "eq", metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &window::WindowTheme) -> bool; + fn eq(&self, #[proxy] other: &system_cursor::SystemCursorIcon) -> bool; + +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::window::SystemCursorIcon; "#, r#" @@ -1124,7 +1215,7 @@ fn index(&self) -> String { } "#] )] -struct WindowTheme {} +struct SystemCursorIcon {} #[derive(bevy_mod_scripting_lua_derive::LuaProxy)] #[proxy( derive(clone), @@ -1149,15 +1240,14 @@ struct WindowRef {} remote = "bevy::window::NormalizedWindowRef", functions[r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::window::NormalizedWindowRef; "#, r#" -/// Fetch the entity of this window reference - #[lua(kind = "Method", output(proxy))] - fn entity(&self) -> bevy::ecs::entity::Entity; + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); "#, r#" @@ -1172,9 +1262,10 @@ struct WindowRef {} "#, r#" +/// Fetch the entity of this window reference - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::NormalizedWindowRef; + #[lua(kind = "Method", output(proxy))] + fn entity(&self) -> bevy::ecs::entity::Entity; "#, r#" @@ -1188,11 +1279,11 @@ struct NormalizedWindowRef(); #[derive(bevy_mod_scripting_lua_derive::LuaProxy)] #[proxy( derive(clone), - remote = "bevy::window::Cursor", + remote = "bevy::window::CursorOptions", functions[r#" #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::Cursor; + fn clone(&self) -> bevy::window::CursorOptions; "#, r#" @@ -1202,9 +1293,7 @@ fn index(&self) -> String { } "#] )] -struct Cursor { - #[lua(output(proxy))] - icon: bevy::window::prelude::CursorIcon, +struct CursorOptions { visible: bool, #[lua(output(proxy))] grab_mode: bevy::window::CursorGrabMode, @@ -1216,6 +1305,12 @@ struct Cursor { remote = "bevy::window::PresentMode", functions[r#" + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -1230,12 +1325,6 @@ struct Cursor { #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] fn clone(&self) -> bevy::window::PresentMode; -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -1289,17 +1378,6 @@ struct WindowMode {} #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] fn clone(&self) -> bevy::window::WindowResolution; -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &window::WindowResolution) -> bool; - "#, r#" /// Creates a new [`WindowResolution`]. @@ -1428,6 +1506,17 @@ struct WindowMode {} scale_factor_override: std::option::Option, ) -> (); +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &window::WindowResolution) -> bool; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -1443,12 +1532,6 @@ struct WindowResolution {} remote = "bevy::window::CompositeAlphaMode", functions[r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - -"#, - r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] fn clone(&self) -> bevy::window::CompositeAlphaMode; @@ -1463,6 +1546,12 @@ struct WindowResolution {} )] fn eq(&self, #[proxy] other: &window::CompositeAlphaMode) -> bool; +"#, + r#" + + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -1478,12 +1567,6 @@ struct CompositeAlphaMode {} remote = "bevy::window::EnabledButtons", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::EnabledButtons; - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -1492,6 +1575,12 @@ struct CompositeAlphaMode {} )] fn eq(&self, #[proxy] other: &window::EnabledButtons) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::window::EnabledButtons; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -1511,8 +1600,13 @@ struct EnabledButtons { remote = "bevy::window::WindowLevel", functions[r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &window::WindowLevel) -> bool; "#, r#" @@ -1523,13 +1617,8 @@ struct EnabledButtons { "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &window::WindowLevel) -> bool; + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); "#, r#" @@ -1574,6 +1663,13 @@ struct WindowLevel {} #[lua(kind = "MutatingMethod")] fn take_minimize_request(&mut self) -> std::option::Option; +"#, + r#" +/// Consumes the current move request, if it exists. This should only be called by window backends. + + #[lua(kind = "MutatingMethod")] + fn take_move_request(&mut self) -> bool; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -1592,12 +1688,6 @@ struct InternalWindowState {} #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] fn clone(&self) -> bevy::window::CursorGrabMode; -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - "#, r#" @@ -1609,6 +1699,12 @@ struct InternalWindowState {} )] fn eq(&self, #[proxy] other: &window::CursorGrabMode) -> bool; +"#, + r#" + + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -1665,13 +1761,11 @@ impl bevy_mod_scripting_core::hosts::APIProvider for BevyWindowAPIProvider { tw.document_global_instance::() .expect("Something went wrong documenting globals") .process_type::() - .process_type::() .process_type::() .process_type::() .process_type::() .process_type::() .process_type::() - .process_type::() .process_type::() .process_type::() .process_type::() @@ -1681,6 +1775,7 @@ impl bevy_mod_scripting_core::hosts::APIProvider for BevyWindowAPIProvider { >, >() .process_type::() + .process_type::() .process_type::() .process_type::() .process_type::() @@ -1696,9 +1791,13 @@ impl bevy_mod_scripting_core::hosts::APIProvider for BevyWindowAPIProvider { .process_type::() .process_type::() .process_type::() + .process_type::() + .process_type::() + .process_type::() + .process_type::() .process_type::() .process_type::() - .process_type::() + .process_type::() .process_type::() .process_type::() .process_type::() @@ -1733,19 +1832,18 @@ impl bevy_mod_scripting_core::hosts::APIProvider for BevyWindowAPIProvider { } fn register_with_app(&self, app: &mut bevy::app::App) { app.register_foreign_lua_type::(); - app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); - app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); app.register_foreign_lua_type::< bevy::window::prelude::WindowResizeConstraints, >(); + app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); @@ -1761,9 +1859,13 @@ impl bevy_mod_scripting_core::hosts::APIProvider for BevyWindowAPIProvider { app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); + app.register_foreign_lua_type::(); + app.register_foreign_lua_type::(); + app.register_foreign_lua_type::(); + app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); - app.register_foreign_lua_type::(); + app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); diff --git a/crates/bevy_script_api/src/providers/mod.rs b/crates/bevy_script_api/src/providers/mod.rs index 0f2e29eded..b0ca5e66d0 100644 --- a/crates/bevy_script_api/src/providers/mod.rs +++ b/crates/bevy_script_api/src/providers/mod.rs @@ -2,6 +2,7 @@ #![allow(clippy::all)] #![allow(unused, deprecated, dead_code)] #![cfg_attr(rustfmt, rustfmt_skip)] +pub mod bevy_a11y; pub mod bevy_ecs; pub mod bevy_transform; pub mod bevy_math; @@ -22,6 +23,7 @@ impl bevy_mod_scripting_core::hosts::APIProvider for LuaBevyAPIProvider { &mut self, ctx: &mut Self::APITarget, ) -> Result<(), bevy_mod_scripting_core::error::ScriptError> { + bevy_a11y::BevyA11YAPIProvider.attach_api(ctx)?; bevy_ecs::BevyEcsAPIProvider.attach_api(ctx)?; bevy_transform::BevyTransformAPIProvider.attach_api(ctx)?; bevy_math::BevyMathAPIProvider.attach_api(ctx)?; @@ -35,6 +37,7 @@ impl bevy_mod_scripting_core::hosts::APIProvider for LuaBevyAPIProvider { } fn get_doc_fragment(&self) -> Option { [ + bevy_a11y::BevyA11YAPIProvider.get_doc_fragment(), bevy_ecs::BevyEcsAPIProvider.get_doc_fragment(), bevy_transform::BevyTransformAPIProvider.get_doc_fragment(), bevy_math::BevyMathAPIProvider.get_doc_fragment(), @@ -71,6 +74,7 @@ impl bevy_mod_scripting_core::hosts::APIProvider for LuaBevyAPIProvider { Ok(()) } fn register_with_app(&self, app: &mut bevy::app::App) { + bevy_a11y::BevyA11YAPIProvider.register_with_app(app); bevy_ecs::BevyEcsAPIProvider.register_with_app(app); bevy_transform::BevyTransformAPIProvider.register_with_app(app); bevy_math::BevyMathAPIProvider.register_with_app(app); diff --git a/crates/bevy_script_api/src/rhai/std.rs b/crates/bevy_script_api/src/rhai/std.rs index 0ed09d8c41..88e8dc5db5 100644 --- a/crates/bevy_script_api/src/rhai/std.rs +++ b/crates/bevy_script_api/src/rhai/std.rs @@ -121,6 +121,7 @@ impl< + TypePath + Clone + FromRhaiProxy + + bevy::reflect::Typed + GetTypeRegistration, > RhaiProxyable for Option { @@ -249,11 +250,24 @@ impl ToRhaiProxy for Option { /// Composite trait composing the various traits required for a type `T` to be used as part of a RhaiVec pub trait RhaiVecElem: - FromReflect + GetTypeRegistration + TypePath + RhaiProxyable + FromRhaiProxy + Clone + FromReflect + + GetTypeRegistration + + TypePath + + RhaiProxyable + + FromRhaiProxy + + Clone + + bevy::reflect::Typed { } -impl - RhaiVecElem for T +impl< + T: FromReflect + + GetTypeRegistration + + TypePath + + RhaiProxyable + + FromRhaiProxy + + Clone + + bevy::reflect::Typed, + > RhaiVecElem for T { } diff --git a/crates/bevy_script_api/src/sub_reflect.rs b/crates/bevy_script_api/src/sub_reflect.rs index 9ec2395229..1d9f898692 100644 --- a/crates/bevy_script_api/src/sub_reflect.rs +++ b/crates/bevy_script_api/src/sub_reflect.rs @@ -1,3 +1,4 @@ +use bevy::reflect::PartialReflect; use parking_lot::RwLock; use std::fmt; use std::fmt::{Debug, Display}; @@ -122,47 +123,47 @@ impl ReflectionPathElement { match self { ReflectionPathElement::SubReflection { get, .. } => get(base), ReflectionPathElement::FieldAccess(field) => match base.reflect_ref() { - ReflectRef::Struct(s) => { - s.field(field) - .ok_or_else(|| ReflectionError::InvalidReflectionPath { - path: self.to_string(), - msg: "No such field".to_owned(), - }) - } + ReflectRef::Struct(s) => s + .field(field) + .and_then(PartialReflect::try_as_reflect) + .ok_or_else(|| ReflectionError::InvalidReflectionPath { + path: self.to_string(), + msg: "No such field".to_owned(), + }), _ => Err(ReflectionError::InvalidReflectionPath { path: self.to_string(), msg: "No such field".to_owned(), }), }, ReflectionPathElement::IndexAccess(index) => match base.reflect_ref() { - ReflectRef::TupleStruct(s) => { - s.field(*index) - .ok_or_else(|| ReflectionError::InvalidReflectionPath { - path: self.to_string(), - msg: "No such element".to_owned(), - }) - } - ReflectRef::Tuple(s) => { - s.field(*index) - .ok_or_else(|| ReflectionError::InvalidReflectionPath { - path: self.to_string(), - msg: "No such element".to_owned(), - }) - } - ReflectRef::List(s) => { - s.get(*index) - .ok_or_else(|| ReflectionError::InvalidReflectionPath { - path: self.to_string(), - msg: "No such element".to_owned(), - }) - } - ReflectRef::Array(s) => { - s.get(*index) - .ok_or_else(|| ReflectionError::InvalidReflectionPath { - path: self.to_string(), - msg: "No such element".to_owned(), - }) - } + ReflectRef::TupleStruct(s) => s + .field(*index) + .and_then(PartialReflect::try_as_reflect) + .ok_or_else(|| ReflectionError::InvalidReflectionPath { + path: self.to_string(), + msg: "No such element".to_owned(), + }), + ReflectRef::Tuple(s) => s + .field(*index) + .and_then(PartialReflect::try_as_reflect) + .ok_or_else(|| ReflectionError::InvalidReflectionPath { + path: self.to_string(), + msg: "No such element".to_owned(), + }), + ReflectRef::List(s) => s + .get(*index) + .and_then(PartialReflect::try_as_reflect) + .ok_or_else(|| ReflectionError::InvalidReflectionPath { + path: self.to_string(), + msg: "No such element".to_owned(), + }), + ReflectRef::Array(s) => s + .get(*index) + .and_then(PartialReflect::try_as_reflect) + .ok_or_else(|| ReflectionError::InvalidReflectionPath { + path: self.to_string(), + msg: "No such element".to_owned(), + }), _ => Err(ReflectionError::InvalidReflectionPath { path: self.to_string(), msg: "No such element".to_owned(), @@ -178,47 +179,47 @@ impl ReflectionPathElement { match self { ReflectionPathElement::SubReflection { get_mut, .. } => get_mut(base), ReflectionPathElement::FieldAccess(field) => match base.reflect_mut() { - ReflectMut::Struct(s) => { - s.field_mut(field) - .ok_or_else(|| ReflectionError::InvalidReflectionPath { - path: self.to_string(), - msg: "No such field".to_owned(), - }) - } + ReflectMut::Struct(s) => s + .field_mut(field) + .and_then(PartialReflect::try_as_reflect_mut) + .ok_or_else(|| ReflectionError::InvalidReflectionPath { + path: self.to_string(), + msg: "No such field".to_owned(), + }), _ => Err(ReflectionError::InvalidReflectionPath { path: self.to_string(), msg: "No such field".to_owned(), }), }, ReflectionPathElement::IndexAccess(index) => match base.reflect_mut() { - ReflectMut::TupleStruct(s) => { - s.field_mut(*index) - .ok_or_else(|| ReflectionError::InvalidReflectionPath { - path: self.to_string(), - msg: "No such element".to_owned(), - }) - } - ReflectMut::Tuple(s) => { - s.field_mut(*index) - .ok_or_else(|| ReflectionError::InvalidReflectionPath { - path: self.to_string(), - msg: "No such element".to_owned(), - }) - } - ReflectMut::List(s) => { - s.get_mut(*index) - .ok_or_else(|| ReflectionError::InvalidReflectionPath { - path: self.to_string(), - msg: "No such element".to_owned(), - }) - } - ReflectMut::Array(s) => { - s.get_mut(*index) - .ok_or_else(|| ReflectionError::InvalidReflectionPath { - path: self.to_string(), - msg: "No such element".to_owned(), - }) - } + ReflectMut::TupleStruct(s) => s + .field_mut(*index) + .and_then(PartialReflect::try_as_reflect_mut) + .ok_or_else(|| ReflectionError::InvalidReflectionPath { + path: self.to_string(), + msg: "No such element".to_owned(), + }), + ReflectMut::Tuple(s) => s + .field_mut(*index) + .and_then(PartialReflect::try_as_reflect_mut) + .ok_or_else(|| ReflectionError::InvalidReflectionPath { + path: self.to_string(), + msg: "No such element".to_owned(), + }), + ReflectMut::List(s) => s + .get_mut(*index) + .and_then(PartialReflect::try_as_reflect_mut) + .ok_or_else(|| ReflectionError::InvalidReflectionPath { + path: self.to_string(), + msg: "No such element".to_owned(), + }), + ReflectMut::Array(s) => s + .get_mut(*index) + .and_then(PartialReflect::try_as_reflect_mut) + .ok_or_else(|| ReflectionError::InvalidReflectionPath { + path: self.to_string(), + msg: "No such element".to_owned(), + }), _ => Err(ReflectionError::InvalidReflectionPath { path: self.to_string(), msg: "No such element".to_owned(), @@ -310,9 +311,9 @@ impl ReflectionPath { let entity_ref = g.get_entity(*entity) - .ok_or_else(|| ReflectionError::InvalidBaseReference { + .map_err(|e| ReflectionError::InvalidBaseReference { base: self.base.to_string(), - reason: "This entity does not exist".to_owned(), + reason: format!("This entity could not be retrieved. {e}"), })?; let ref_ = self.walk_path(comp.reflect(entity_ref).ok_or_else(|| { diff --git a/crates/languages/bevy_mod_scripting_lua/Cargo.toml b/crates/languages/bevy_mod_scripting_lua/Cargo.toml index 3ba93e1c33..35cde6047a 100644 --- a/crates/languages/bevy_mod_scripting_lua/Cargo.toml +++ b/crates/languages/bevy_mod_scripting_lua/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bevy_mod_scripting_lua" -version = "0.7.1" +version = "0.8.0-alpha.0" authors = ["Maksymilian Mozolewski "] edition = "2021" license = "MIT OR Apache-2.0" diff --git a/crates/languages/bevy_mod_scripting_lua/src/assets.rs b/crates/languages/bevy_mod_scripting_lua/src/assets.rs index 2b87fcdfcb..7e3e50d74b 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/assets.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/assets.rs @@ -1,5 +1,5 @@ use bevy::{ - asset::{io::Reader, Asset, AssetLoader, AsyncReadExt}, + asset::{io::Reader, Asset, AssetLoader}, reflect::TypePath, utils::BoxedFuture, }; @@ -130,24 +130,20 @@ impl AssetLoader for LuaLoader { type Settings = (); type Error = Error; - fn load<'a>( - &'a self, - reader: &'a mut Reader, //bytes: &'a [u8], - _settings: &'a (), - load_context: &'a mut bevy::asset::LoadContext, - ) -> impl bevy::utils::ConditionalSendFuture< - Output = std::result::Result< - ::Asset, - ::Error, - >, + async fn load( + &self, + reader: &mut dyn Reader, //bytes: &'a [u8], + _settings: &(), + load_context: &mut bevy::asset::LoadContext<'_>, + ) -> std::result::Result< + ::Asset, + ::Error, > { bevy::prelude::info!("lua loader invoked: {:#}", load_context.asset_path()); - Box::pin(async move { - let mut bytes = Vec::new(); - reader.read_to_end(&mut bytes).await?; - let bytes = old_lua_load(bytes.as_slice(), load_context).await?; - Ok(LuaFile { bytes }) //}) - }) + let mut bytes = Vec::new(); + reader.read_to_end(&mut bytes).await?; + let bytes = old_lua_load(bytes.as_slice(), load_context).await?; + Ok(LuaFile { bytes }) } #[cfg(feature = "teal")] diff --git a/crates/languages/bevy_mod_scripting_lua/src/docs.rs b/crates/languages/bevy_mod_scripting_lua/src/docs.rs index 8bdd53be48..9fbb42b0d5 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/docs.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/docs.rs @@ -101,10 +101,10 @@ impl DocFragment for LuaDocFragment { tw.given_types.iter_mut().for_each(|tg| { if let TypeGenerator::Record(rg) = tg { rg.fields - .sort_by(|f1, f2| f1.name.deref().cmp(&f2.name.deref())); + .sort_by(|f1, f2| f1.name.deref().cmp(f2.name.deref())); rg.fields.dedup_by(|a, b| a.name == b.name); rg.static_fields - .sort_by(|f1, f2| f1.name.deref().cmp(&f2.name.deref())); + .sort_by(|f1, f2| f1.name.deref().cmp(f2.name.deref())); rg.static_fields.dedup_by(|a, b| a.name == b.name); for field in rg.fields.iter_mut().chain(rg.static_fields.iter_mut()) { escape_name(&mut field.name); @@ -217,7 +217,7 @@ fn escape_name(raw: &mut NameContainer) { "local", // Declarations "record", // Teal extra ]; - let Ok(name) = str::from_utf8(&raw) else { + let Ok(name) = str::from_utf8(raw) else { return; }; if KEYWORD_FIELDS.contains(&name) { diff --git a/crates/languages/bevy_mod_scripting_lua_derive/Cargo.toml b/crates/languages/bevy_mod_scripting_lua_derive/Cargo.toml index c95fe287ec..9cddc7886e 100644 --- a/crates/languages/bevy_mod_scripting_lua_derive/Cargo.toml +++ b/crates/languages/bevy_mod_scripting_lua_derive/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bevy_mod_scripting_lua_derive" -version = "0.7.1" +version = "0.8.0-alpha.0" authors = ["Maksymilian Mozolewski "] edition = "2021" license = "MIT OR Apache-2.0" @@ -23,7 +23,7 @@ path = "src/lib.rs" proc-macro = true [dependencies] -bevy_mod_scripting_common = { path = "../../bevy_mod_scripting_common", version = "0.7.1" } +bevy_mod_scripting_common = { path = "../../bevy_mod_scripting_common", version = "0.8.0-alpha.0" } paste = "1.0.7" darling = "0.20" syn = { version = "2.0.38", features = ["full", "fold", "extra-traits"] } diff --git a/crates/languages/bevy_mod_scripting_rhai/Cargo.toml b/crates/languages/bevy_mod_scripting_rhai/Cargo.toml index 3f2c87994f..fb5abd3edf 100644 --- a/crates/languages/bevy_mod_scripting_rhai/Cargo.toml +++ b/crates/languages/bevy_mod_scripting_rhai/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bevy_mod_scripting_rhai" -version = "0.7.1" +version = "0.8.0-alpha.0" authors = ["Maksymilian Mozolewski "] edition = "2021" license = "MIT OR Apache-2.0" diff --git a/crates/languages/bevy_mod_scripting_rhai/src/assets.rs b/crates/languages/bevy_mod_scripting_rhai/src/assets.rs index c4d2da90cc..36b9249865 100644 --- a/crates/languages/bevy_mod_scripting_rhai/src/assets.rs +++ b/crates/languages/bevy_mod_scripting_rhai/src/assets.rs @@ -1,5 +1,5 @@ use bevy::{ - asset::{io::Reader, Asset, AssetLoader, AsyncReadExt, LoadContext}, + asset::{io::Reader, Asset, AssetLoader, LoadContext}, reflect::TypePath, }; @@ -25,11 +25,11 @@ impl AssetLoader for RhaiLoader { type Asset = RhaiFile; type Settings = (); type Error = anyhow::Error; - async fn load<'a>( - &'a self, - reader: &'a mut Reader<'_>, - _: &'a Self::Settings, - _: &'a mut LoadContext<'_>, + async fn load( + &self, + reader: &mut dyn Reader, + _: &Self::Settings, + _: &mut LoadContext<'_>, ) -> Result { let mut bytes = Vec::new(); reader.read_to_end(&mut bytes).await?; diff --git a/crates/languages/bevy_mod_scripting_rhai_derive/Cargo.toml b/crates/languages/bevy_mod_scripting_rhai_derive/Cargo.toml index f06a35aa00..2e60540d04 100644 --- a/crates/languages/bevy_mod_scripting_rhai_derive/Cargo.toml +++ b/crates/languages/bevy_mod_scripting_rhai_derive/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bevy_mod_scripting_rhai_derive" -version = "0.7.1" +version = "0.8.0-alpha.0" authors = ["Maksymilian Mozolewski "] edition = "2021" license = "MIT OR Apache-2.0" @@ -17,7 +17,7 @@ path = "src/lib.rs" proc-macro = true [dependencies] -bevy_mod_scripting_common = { path = "../../bevy_mod_scripting_common", version = "0.7.1" } +bevy_mod_scripting_common = { path = "../../bevy_mod_scripting_common", version = "0.8.0-alpha.0" } paste = "1.0.7" syn = { version = "1.0.57", features = ["full", "fold", "extra-traits"] } quote = "1.0.8" diff --git a/crates/languages/bevy_mod_scripting_rune/Cargo.toml b/crates/languages/bevy_mod_scripting_rune/Cargo.toml index e86f4f8ff2..2bfcb90384 100644 --- a/crates/languages/bevy_mod_scripting_rune/Cargo.toml +++ b/crates/languages/bevy_mod_scripting_rune/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bevy_mod_scripting_rune" -version = "0.7.1" +version = "0.8.0-alpha.0" edition = "2021" license = "MIT OR Apache-2.0" description = "Necessary functionality for Rune support with bevy_mod_scripting" diff --git a/crates/languages/bevy_mod_scripting_rune/src/assets.rs b/crates/languages/bevy_mod_scripting_rune/src/assets.rs index e05272272d..e5d0f96ab2 100644 --- a/crates/languages/bevy_mod_scripting_rune/src/assets.rs +++ b/crates/languages/bevy_mod_scripting_rune/src/assets.rs @@ -1,6 +1,6 @@ use anyhow::Error; use bevy::{ - asset::{io::Reader, Asset, AssetLoader, AsyncReadExt}, + asset::{io::Reader, Asset, AssetLoader}, reflect::TypePath, }; use bevy_mod_scripting_core::prelude::*; @@ -27,22 +27,15 @@ impl AssetLoader for RuneLoader { type Settings = (); type Error = Error; - fn load<'a>( - &'a self, - reader: &'a mut Reader, - _settings: &'a (), - _load_context: &'a mut bevy::asset::LoadContext, - ) -> impl bevy::utils::ConditionalSendFuture< - Output = std::result::Result< - ::Asset, - ::Error, - >, - > { - Box::pin(async move { - let mut bytes = Vec::new(); - reader.read_to_end(&mut bytes).await?; - Ok(RuneFile { bytes }) - }) + async fn load( + &self, + reader: &mut dyn Reader, + _settings: &(), + _load_context: &mut bevy::asset::LoadContext<'_>, + ) -> std::result::Result { + let mut bytes = Vec::new(); + reader.read_to_end(&mut bytes).await?; + Ok(RuneFile { bytes }) } fn extensions(&self) -> &[&str] { diff --git a/crates/macro_tests/Cargo.toml b/crates/macro_tests/Cargo.toml index 969de9f57b..9cc1a7bdba 100644 --- a/crates/macro_tests/Cargo.toml +++ b/crates/macro_tests/Cargo.toml @@ -15,7 +15,7 @@ debug = false [dev-dependencies] trybuild = "1.0" -bevy = { version = "0.14", default-features = false } +bevy = { version = "0.15.0-rc.2", default-features = false } bevy_mod_scripting = { path = "../../", features = [ "lua", "lua_script_api", diff --git a/examples/lua/game_of_life.rs b/examples/lua/game_of_life.rs index 11482c2fb7..1048e0b7a2 100644 --- a/examples/lua/game_of_life.rs +++ b/examples/lua/game_of_life.rs @@ -86,18 +86,15 @@ pub fn setup( let script_path = bevy_mod_scripting_lua::lua_path!("game_of_life"); - commands.spawn(Camera2dBundle::default()); + commands.spawn(Camera2d); commands - .spawn(SpriteBundle { - texture: assets.add(image), - sprite: Sprite { - custom_size: Some(Vec2::new( - settings.display_grid_dimensions.0 as f32, - settings.display_grid_dimensions.1 as f32, - )), - color: Color::srgb(1.0, 0.388, 0.278), // TOMATO - ..Default::default() - }, + .spawn(Sprite { + image: assets.add(image), + custom_size: Some(Vec2::new( + settings.display_grid_dimensions.0 as f32, + settings.display_grid_dimensions.1 as f32, + )), + color: Color::srgb(1.0, 0.388, 0.278), // TOMATO ..Default::default() }) .insert(LifeState { @@ -156,11 +153,11 @@ pub fn sync_window_size( /// Runs after LifeState components are updated, updates their rendered representation pub fn update_rendered_state( mut assets: ResMut>, - query: Query<(&LifeState, &Handle)>, + query: Query<(&LifeState, &Sprite)>, ) { for (new_state, old_rendered_state) in query.iter() { let old_rendered_state = assets - .get_mut(old_rendered_state) + .get_mut(&old_rendered_state.image) .expect("World is not setup correctly"); old_rendered_state.data = new_state.cells.clone(); diff --git a/examples/rhai/game_of_life.rs b/examples/rhai/game_of_life.rs index aa203448be..a7a5eff99c 100644 --- a/examples/rhai/game_of_life.rs +++ b/examples/rhai/game_of_life.rs @@ -91,18 +91,15 @@ pub fn setup( let script_path = "scripts/game_of_life.rhai"; - commands.spawn(Camera2dBundle::default()); + commands.spawn(Camera2d); commands - .spawn(SpriteBundle { - texture: assets.add(image), - sprite: Sprite { - custom_size: Some(Vec2::new( - settings.display_grid_dimensions.0 as f32, - settings.display_grid_dimensions.1 as f32, - )), - color: Color::srgb(1.0, 0.388, 0.278), // TOMATO - ..Default::default() - }, + .spawn(Sprite { + image: assets.add(image), + custom_size: Some(Vec2::new( + settings.display_grid_dimensions.0 as f32, + settings.display_grid_dimensions.1 as f32, + )), + color: Color::srgb(1.0, 0.388, 0.278), // TOMATO ..Default::default() }) .insert(LifeState { @@ -161,11 +158,11 @@ pub fn sync_window_size( /// Runs after LifeState components are updated, updates their rendered representation pub fn update_rendered_state( mut assets: ResMut>, - query: Query<(&LifeState, &Handle)>, + query: Query<(&LifeState, &Sprite)>, ) { for (new_state, old_rendered_state) in query.iter() { let old_rendered_state = assets - .get_mut(old_rendered_state) + .get_mut(&old_rendered_state.image) .expect("World is not setup correctly"); old_rendered_state.data = new_state.cells.clone(); diff --git a/makefile b/makefile index 74ed9a9f79..3362ee6c6c 100644 --- a/makefile +++ b/makefile @@ -21,9 +21,9 @@ PACKAGE=bevy_mod_scripting TEST_NAME= # # valgrind outputs a callgrind.out.. We can analyze this with kcachegrind # kcachegrind -NIGHTLY_VERSION=nightly-2024-05-20 -BEVY_VERSION=0.14.2 -GLAM_VERSION=0.28.0 +NIGHTLY_VERSION=nightly-2024-11-05 +BEVY_VERSION=0.15.0-rc.2 +GLAM_VERSION=0.29.0 CODEGEN_PATH=${PWD}/target/codegen BEVY_PATH=${CODEGEN_PATH}/bevy GLAM_PATH=${CODEGEN_PATH}/glam @@ -61,10 +61,10 @@ clean_bevy: cd ${BEVY_PATH} && cargo clean generate_bevy: - cd ${BEVY_PATH} && cargo +${NIGHTLY_VERSION} bevy-api-gen generate --output ${OUTPUT_PATH} --template-args '{ "self_is_bevy_script_api": true}' --features ${GEN_BEVY_FEATURES} + cd ${BEVY_PATH} && cargo +${NIGHTLY_VERSION} bevy-api-gen generate --output ${OUTPUT_PATH} --template-args '{ "self_is_bevy_script_api": true}' --features ${GEN_BEVY_FEATURES} -vv collect_bevy: - cd ${BEVY_PATH} && cargo +${NIGHTLY_VERSION} bevy-api-gen collect --output ${OUTPUT_PATH} --template-args '{ "self_is_bevy_script_api": true}' + cd ${BEVY_PATH} && cargo +${NIGHTLY_VERSION} bevy-api-gen collect --output ${OUTPUT_PATH} --template-args '{ "self_is_bevy_script_api": true}' -vv deletion_confirmation: @echo -n "This action will delete ALL files in directories: '${GENERATED_SRC_PATH}' amd ${OUTPUT_PATH} (y/N) " From 0a7a22b119f06df8dc483b9ac93c6c6272775642 Mon Sep 17 00:00:00 2001 From: Maksymilian Mozolewski Date: Sat, 9 Nov 2024 15:38:27 +0000 Subject: [PATCH 02/12] Fix typo in workflow (#142) fix typo --- .github/workflows/release-plz.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release-plz.yml b/.github/workflows/release-plz.yml index a18df1d672..0c16e7328c 100644 --- a/.github/workflows/release-plz.yml +++ b/.github/workflows/release-plz.yml @@ -7,7 +7,8 @@ permissions: on: push: branches: - - [main, staging] + - main + - staging jobs: From 2afb31f8ea881cce78cb75bbfaf19633c1086f94 Mon Sep 17 00:00:00 2001 From: Maksymilian Mozolewski Date: Sun, 10 Nov 2024 13:09:19 +0000 Subject: [PATCH 03/12] Bump Bevy release candidate (#143) * bump release candidate * bump release candidate * optimize ci matrix * don't run many checks on same branch * add missing example link * fix missing commas * fix missing dolah --- .github/workflows/bevy_mod_scripting.yml | 29 +- Cargo.toml | 2 +- .../src/providers/bevy_core.rs | 12 +- .../bevy_script_api/src/providers/bevy_ecs.rs | 76 +- .../src/providers/bevy_hierarchy.rs | 12 +- .../src/providers/bevy_input.rs | 526 +- .../src/providers/bevy_math.rs | 1132 ++- .../src/providers/bevy_reflect.rs | 6127 ++++++++--------- .../src/providers/bevy_time.rs | 44 +- .../src/providers/bevy_transform.rs | 157 +- .../src/providers/bevy_window.rs | 433 +- crates/macro_tests/Cargo.toml | 2 +- makefile | 2 +- readme.md | 1 + 14 files changed, 4162 insertions(+), 4393 deletions(-) diff --git a/.github/workflows/bevy_mod_scripting.yml b/.github/workflows/bevy_mod_scripting.yml index f95933ea09..8524716b1a 100644 --- a/.github/workflows/bevy_mod_scripting.yml +++ b/.github/workflows/bevy_mod_scripting.yml @@ -12,22 +12,29 @@ on: name: Check and Lint - bevy_mod_scripting +concurrency: + # Use github.run_id on main branch + # Use github.event.pull_request.number on pull requests, so it's unique per pull request + # Use github.ref on other branches, so it's unique per branch + group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/main' && github.run_id || github.event.pull_request.number || github.ref }} + cancel-in-progress: true + jobs: check: - name: Check + name: Check - ${{ matrix.run_args.label }} runs-on: ${{ matrix.run_args.os }} strategy: matrix: run_args: [ - {os: windows-latest, lua: lua54, cross: x86_64-pc-windows-msvc}, - {os: macOS-latest, lua: lua54, cross: x86_64-apple-darwin}, - {os: ubuntu-latest, lua: lua54, cross: aarch64-unknown-linux-gnu}, - {os: ubuntu-latest, lua: lua51, cross: x86_64-unknown-linux-gnu}, - {os: ubuntu-latest, lua: lua52, cross: x86_64-unknown-linux-gnu}, - {os: ubuntu-latest, lua: lua53, cross: x86_64-unknown-linux-gnu}, - {os: ubuntu-latest, lua: lua54, cross: x86_64-unknown-linux-gnu}, - {os: ubuntu-latest, lua: luajit, cross: x86_64-unknown-linux-gnu}, - {os: ubuntu-latest, lua: luajit52, cross: x86_64-unknown-linux-gnu} + {label: Windows - All Features, os: windows-latest, features: "lua54,rhai,teal,lua_script_api,rhai_script_api,rune", cross: x86_64-pc-windows-msvc }, + {label: MacOS - All Features, os: macOS-latest, features: "lua54,rhai,teal,lua_script_api,rhai_script_api,rune", cross: x86_64-apple-darwin }, + {label: Ubuntu - All Features, os: ubuntu-latest, features: "lua54,lua_script_api,rhai,teal,rhai_script_api,rune", cross: x86_64-unknown-linux-gnu }, + {label: Ubuntu Aarch64 - All Features, os: ubuntu-latest, features: "lua54,rhai,teal,lua_script_api,rhai_script_api,rune", cross: aarch64-unknown-linux-gnu }, + {label: Ubuntu - Lua51, os: ubuntu-latest, features: "lua51,lua_script_api", cross: x86_64-unknown-linux-gnu }, + {label: Ubuntu - Lua52, os: ubuntu-latest, features: "lua52,lua_script_api", cross: x86_64-unknown-linux-gnu }, + {label: Ubuntu - Lua53, os: ubuntu-latest, features: "lua53,lua_script_api", cross: x86_64-unknown-linux-gnu }, + {label: Ubuntu - Luajit, os: ubuntu-latest, features: "luajit,lua_script_api", cross: x86_64-unknown-linux-gnu }, + {label: Ubuntu - Luajit52, os: ubuntu-latest, features: "luajit52,lua_script_api", cross: x86_64-unknown-linux-gnu } ] steps: - if: runner.os == 'linux' @@ -48,7 +55,7 @@ jobs: with: command: check target: ${{ matrix.run_args.cross }} - args: --workspace --features=${{ matrix.run_args.lua }},rhai,teal,lua_script_api,rhai_script_api,rune --profile=ephemeral-build + args: --workspace --features=${{ matrix.run_args.features }} --profile=ephemeral-build fmt: name: Rustfmt diff --git a/Cargo.toml b/Cargo.toml index 8d83969bd5..3a6d981df3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -70,7 +70,7 @@ bevy_script_api = { path = "crates/bevy_script_api", version = "0.8.0-alpha.0", [workspace.dependencies] -bevy = { version = "0.15.0-rc.2", default-features = false } +bevy = { version = "0.15.0-rc.3", default-features = false } bevy_mod_scripting_core = { path = "crates/bevy_mod_scripting_core", version = "0.8.0-alpha.0" } bevy_mod_scripting_common = { path = "crates/bevy_mod_scripting_common", version = "0.8.0-alpha.0" } diff --git a/crates/bevy_script_api/src/providers/bevy_core.rs b/crates/bevy_script_api/src/providers/bevy_core.rs index 762e6fb772..f205ff73bd 100644 --- a/crates/bevy_script_api/src/providers/bevy_core.rs +++ b/crates/bevy_script_api/src/providers/bevy_core.rs @@ -14,6 +14,12 @@ use bevy_script_api::{ remote = "bevy::core::prelude::Name", functions[r#" + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::core::prelude::Name; + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -22,12 +28,6 @@ use bevy_script_api::{ )] fn eq(&self, #[proxy] other: &name::Name) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::core::prelude::Name; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] diff --git a/crates/bevy_script_api/src/providers/bevy_ecs.rs b/crates/bevy_script_api/src/providers/bevy_ecs.rs index 003a862146..8f3b5d4e27 100644 --- a/crates/bevy_script_api/src/providers/bevy_ecs.rs +++ b/crates/bevy_script_api/src/providers/bevy_ecs.rs @@ -13,13 +13,8 @@ use bevy_script_api::{ remote = "bevy::ecs::entity::Entity", functions[r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &entity::Entity) -> bool; + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::ecs::entity::Entity; "#, r#" @@ -78,8 +73,13 @@ use bevy_script_api::{ "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::ecs::entity::Entity; + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &entity::Entity) -> bool; "#, r#" @@ -144,18 +144,6 @@ struct OnReplace {} remote = "bevy::ecs::component::ComponentId", functions[r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::ecs::component::ComponentId; - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -180,6 +168,18 @@ struct OnReplace {} #[lua(kind = "Method")] fn index(self) -> usize; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::ecs::component::ComponentId; + +"#, + r#" + + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -198,6 +198,17 @@ struct ComponentId(); #[lua(as_trait = "std::cmp::Eq", kind = "Method")] fn assert_receiver_is_total_eq(&self) -> (); +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &component::Tick) -> bool; + "#, r#" @@ -239,17 +250,6 @@ struct ComponentId(); this_run: bevy::ecs::component::Tick, ) -> bool; -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &component::Tick) -> bool; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -342,6 +342,12 @@ struct ComponentTicks {} remote = "bevy::ecs::identifier::Identifier", functions[r#" + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::ecs::identifier::Identifier; + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -381,12 +387,6 @@ struct ComponentTicks {} #[lua(kind = "Function", output(proxy))] fn from_bits(value: u64) -> bevy::ecs::identifier::Identifier; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::ecs::identifier::Identifier; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] diff --git a/crates/bevy_script_api/src/providers/bevy_hierarchy.rs b/crates/bevy_script_api/src/providers/bevy_hierarchy.rs index e1bfc68d25..2cb1efa99e 100644 --- a/crates/bevy_script_api/src/providers/bevy_hierarchy.rs +++ b/crates/bevy_script_api/src/providers/bevy_hierarchy.rs @@ -34,6 +34,12 @@ struct Children(); remote = "bevy::hierarchy::prelude::Parent", functions[r#" + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -49,12 +55,6 @@ struct Children(); #[lua(kind = "Method", output(proxy))] fn get(&self) -> bevy::ecs::entity::Entity; -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] diff --git a/crates/bevy_script_api/src/providers/bevy_input.rs b/crates/bevy_script_api/src/providers/bevy_input.rs index 973bde558b..f13ae2f8ef 100644 --- a/crates/bevy_script_api/src/providers/bevy_input.rs +++ b/crates/bevy_script_api/src/providers/bevy_input.rs @@ -4,6 +4,7 @@ #![cfg_attr(rustfmt, rustfmt_skip)] use super::bevy_ecs::*; use super::bevy_reflect::*; +use super::bevy_core::*; use super::bevy_math::*; extern crate self as bevy_script_api; use bevy_script_api::{ @@ -13,23 +14,7 @@ use bevy_script_api::{ #[proxy( derive(), remote = "bevy::input::gamepad::Gamepad", - functions[ - // r#" -// /// Returns the USB vendor ID as assigned by the USB-IF, if available. - -// #[lua(kind = "Method")] -// fn vendor_id(&self) -> std::option::Option; - -// "#, -// r#" -// /// Returns the USB product ID as assigned by the [vendor], if available. -// /// [vendor]: Self::vendor_id - -// #[lua(kind = "Method")] -// fn product_id(&self) -> std::option::Option; - -// "#, - r#" + functions[r#" /// Returns the left stick as a [`Vec2`] #[lua(kind = "Method", output(proxy))] @@ -50,37 +35,6 @@ use bevy_script_api::{ fn dpad(&self) -> bevy::math::Vec2; "#, -// r#" -// /// Returns `true` if the [`GamepadButton`] has been pressed. - -// #[lua(kind = "Method")] -// fn pressed(&self, #[proxy] button_type: bevy::input::gamepad::GamepadButton) -> bool; - -// "#, -// r#" -// /// Returns `true` if the [`GamepadButton`] has been pressed during the current frame. -// /// Note: This function does not imply information regarding the current state of [`ButtonInput::pressed`] or [`ButtonInput::just_released`]. - -// #[lua(kind = "Method")] -// fn just_pressed( -// &self, -// #[proxy] -// button_type: bevy::input::gamepad::GamepadButton, -// ) -> bool; - -// "#, -// r#" -// /// Returns `true` if the [`GamepadButton`] has been released during the current frame. -// /// Note: This function does not imply information regarding the current state of [`ButtonInput::pressed`] or [`ButtonInput::just_pressed`]. - -// #[lua(kind = "Method")] -// fn just_released( -// &self, -// #[proxy] -// button_type: bevy::input::gamepad::GamepadButton, -// ) -> bool; - -// "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] fn index(&self) -> String { @@ -88,15 +42,25 @@ fn index(&self) -> String { } "#] )] -struct Gamepad {} +struct Gamepad { + vendor_id: std::option::Option, + product_id: std::option::Option, + digital: ReflectedValue, + analog: ReflectedValue, +} #[derive(bevy_mod_scripting_lua_derive::LuaProxy)] #[proxy( derive(clone), remote = "bevy::input::gamepad::GamepadAxis", functions[r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &gamepad::GamepadAxis) -> bool; "#, r#" @@ -107,13 +71,8 @@ struct Gamepad {} "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &gamepad::GamepadAxis) -> bool; + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); "#, r#" @@ -130,13 +89,8 @@ struct GamepadAxis {} remote = "bevy::input::gamepad::GamepadButton", functions[r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &gamepad::GamepadButton) -> bool; + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::gamepad::GamepadButton; "#, r#" @@ -147,8 +101,13 @@ struct GamepadAxis {} "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::gamepad::GamepadButton; + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &gamepad::GamepadButton) -> bool; "#, r#" @@ -193,8 +152,13 @@ struct GamepadSettings { remote = "bevy::input::keyboard::KeyCode", functions[r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &keyboard::KeyCode) -> bool; "#, r#" @@ -205,13 +169,8 @@ struct GamepadSettings { "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &keyboard::KeyCode) -> bool; + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); "#, r#" @@ -301,12 +260,6 @@ struct TouchInput { remote = "bevy::input::keyboard::KeyboardFocusLost", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::keyboard::KeyboardFocusLost; - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -315,6 +268,12 @@ struct TouchInput { )] fn eq(&self, #[proxy] other: &keyboard::KeyboardFocusLost) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::keyboard::KeyboardFocusLost; + "#, r#" @@ -336,12 +295,6 @@ struct KeyboardFocusLost {} remote = "bevy::input::keyboard::KeyboardInput", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::keyboard::KeyboardInput; - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -350,6 +303,12 @@ struct KeyboardFocusLost {} )] fn eq(&self, #[proxy] other: &keyboard::KeyboardInput) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::keyboard::KeyboardInput; + "#, r#" @@ -381,12 +340,6 @@ struct KeyboardInput { remote = "bevy::input::mouse::AccumulatedMouseMotion", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::mouse::AccumulatedMouseMotion; - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -395,6 +348,12 @@ struct KeyboardInput { )] fn eq(&self, #[proxy] other: &mouse::AccumulatedMouseMotion) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::mouse::AccumulatedMouseMotion; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -447,6 +406,12 @@ struct AccumulatedMouseScroll { remote = "bevy::input::mouse::MouseButtonInput", functions[r#" + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -461,12 +426,6 @@ struct AccumulatedMouseScroll { #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] fn clone(&self) -> bevy::input::mouse::MouseButtonInput; -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -557,6 +516,17 @@ struct MouseWheel { remote = "bevy::input::gamepad::GamepadAxisChangedEvent", functions[r#" + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &gamepad::GamepadAxisChangedEvent) -> bool; + +"#, + r#" + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] fn clone(&self) -> bevy::input::gamepad::GamepadAxisChangedEvent; @@ -573,17 +543,6 @@ struct MouseWheel { value: f32, ) -> bevy::input::gamepad::GamepadAxisChangedEvent; -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &gamepad::GamepadAxisChangedEvent) -> bool; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -656,14 +615,17 @@ struct GamepadButtonChangedEvent { derive(clone), remote = "bevy::input::gamepad::GamepadButtonStateChangedEvent", functions[r#" +/// Creates a new [`GamepadButtonStateChangedEvent`] - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &gamepad::GamepadButtonStateChangedEvent) -> bool; + #[lua(kind = "Function", output(proxy))] + fn new( + #[proxy] + entity: bevy::ecs::entity::Entity, + #[proxy] + button: bevy::input::gamepad::GamepadButton, + #[proxy] + state: bevy::input::ButtonState, + ) -> bevy::input::gamepad::GamepadButtonStateChangedEvent; "#, r#" @@ -679,17 +641,14 @@ struct GamepadButtonChangedEvent { "#, r#" -/// Creates a new [`GamepadButtonStateChangedEvent`] - #[lua(kind = "Function", output(proxy))] - fn new( - #[proxy] - entity: bevy::ecs::entity::Entity, - #[proxy] - button: bevy::input::gamepad::GamepadButton, - #[proxy] - state: bevy::input::ButtonState, - ) -> bevy::input::gamepad::GamepadButtonStateChangedEvent; + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &gamepad::GamepadButtonStateChangedEvent) -> bool; "#, r#" @@ -741,6 +700,23 @@ struct GamepadConnection {} derive(clone), remote = "bevy::input::gamepad::GamepadConnectionEvent", functions[r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::gamepad::GamepadConnectionEvent; + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &gamepad::GamepadConnectionEvent) -> bool; + +"#, + r#" /// Creates a [`GamepadConnectionEvent`]. #[lua(kind = "Function", output(proxy))] @@ -765,23 +741,6 @@ struct GamepadConnection {} #[lua(kind = "Method")] fn disconnected(&self) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::gamepad::GamepadConnectionEvent; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &gamepad::GamepadConnectionEvent) -> bool; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -825,57 +784,12 @@ fn index(&self) -> String { "#] )] struct GamepadEvent {} -// #[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -// #[proxy( -// derive(clone), -// remote = "bevy::input::gamepad::GamepadInfo", -// functions[r#" - -// #[lua( -// as_trait = "std::cmp::PartialEq", -// kind = "MetaFunction", -// composite = "eq", -// metamethod = "Eq", -// )] -// fn eq(&self, #[proxy] other: &gamepad::GamepadInfo) -> bool; - -// "#, -// r#" - -// #[lua(as_trait = "std::cmp::Eq", kind = "Method")] -// fn assert_receiver_is_total_eq(&self) -> (); - -// "#, -// r#" - -// #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] -// fn clone(&self) -> bevy::input::gamepad::GamepadInfo; - -// "#, -// r#" -// #[lua(kind="MetaMethod", metamethod="ToString")] -// fn index(&self) -> String { -// format!("{:?}", _self) -// } -// "#] -// )] -// struct GamepadInfo { -// name: std::string::String, -// vendor_id: std::option::Option, -// product_id: std::option::Option, -// } #[derive(bevy_mod_scripting_lua_derive::LuaProxy)] #[proxy( derive(clone), remote = "bevy::input::gamepad::GamepadInput", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::gamepad::GamepadInput; - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -884,6 +798,12 @@ struct GamepadEvent {} )] fn eq(&self, #[proxy] other: &gamepad::GamepadInput) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::gamepad::GamepadInput; + "#, r#" @@ -924,12 +844,6 @@ struct GamepadRumbleRequest {} remote = "bevy::input::gamepad::RawGamepadAxisChangedEvent", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::gamepad::RawGamepadAxisChangedEvent; - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -938,6 +852,12 @@ struct GamepadRumbleRequest {} )] fn eq(&self, #[proxy] other: &gamepad::RawGamepadAxisChangedEvent) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::gamepad::RawGamepadAxisChangedEvent; + "#, r#" /// Creates a [`RawGamepadAxisChangedEvent`]. @@ -975,6 +895,17 @@ struct RawGamepadAxisChangedEvent { #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] fn clone(&self) -> bevy::input::gamepad::RawGamepadButtonChangedEvent; +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &gamepad::RawGamepadButtonChangedEvent) -> bool; + "#, r#" /// Creates a [`RawGamepadButtonChangedEvent`]. @@ -988,17 +919,6 @@ struct RawGamepadAxisChangedEvent { value: f32, ) -> bevy::input::gamepad::RawGamepadButtonChangedEvent; -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &gamepad::RawGamepadButtonChangedEvent) -> bool; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -1020,12 +940,6 @@ struct RawGamepadButtonChangedEvent { remote = "bevy::input::gamepad::RawGamepadEvent", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::gamepad::RawGamepadEvent; - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -1034,6 +948,12 @@ struct RawGamepadButtonChangedEvent { )] fn eq(&self, #[proxy] other: &gamepad::RawGamepadEvent) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::gamepad::RawGamepadEvent; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -1049,12 +969,6 @@ struct RawGamepadEvent {} remote = "bevy::input::gestures::PinchGesture", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::gestures::PinchGesture; - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -1063,6 +977,12 @@ struct RawGamepadEvent {} )] fn eq(&self, #[proxy] other: &gestures::PinchGesture) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::gestures::PinchGesture; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -1078,12 +998,6 @@ struct PinchGesture(f32); remote = "bevy::input::gestures::RotationGesture", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::gestures::RotationGesture; - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -1092,6 +1006,12 @@ struct PinchGesture(f32); )] fn eq(&self, #[proxy] other: &gestures::RotationGesture) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::gestures::RotationGesture; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -1107,12 +1027,6 @@ struct RotationGesture(f32); remote = "bevy::input::gestures::DoubleTapGesture", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::gestures::DoubleTapGesture; - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -1121,6 +1035,12 @@ struct RotationGesture(f32); )] fn eq(&self, #[proxy] other: &gestures::DoubleTapGesture) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::gestures::DoubleTapGesture; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -1136,6 +1056,12 @@ struct DoubleTapGesture {} remote = "bevy::input::gestures::PanGesture", functions[r#" + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::gestures::PanGesture; + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -1144,12 +1070,6 @@ struct DoubleTapGesture {} )] fn eq(&self, #[proxy] other: &gestures::PanGesture) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::gestures::PanGesture; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -1168,12 +1088,6 @@ struct PanGesture(#[lua(output(proxy))] bevy::math::Vec2); #[lua(as_trait = "std::cmp::Eq", kind = "Method")] fn assert_receiver_is_total_eq(&self) -> (); -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::ButtonState; - "#, r#" /// Is this button pressed? @@ -1192,6 +1106,12 @@ struct PanGesture(#[lua(output(proxy))] bevy::math::Vec2); )] fn eq(&self, #[proxy] other: &ButtonState) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::ButtonState; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -1207,8 +1127,13 @@ struct ButtonState {} remote = "bevy::input::gamepad::ButtonSettings", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::gamepad::ButtonSettings; + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &gamepad::ButtonSettings) -> bool; "#, r#" @@ -1261,13 +1186,8 @@ struct ButtonState {} "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &gamepad::ButtonSettings) -> bool; + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::gamepad::ButtonSettings; "#, r#" @@ -1284,13 +1204,8 @@ struct ButtonSettings {} remote = "bevy::input::gamepad::AxisSettings", functions[r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &gamepad::AxisSettings) -> bool; + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::gamepad::AxisSettings; "#, r#" @@ -1399,8 +1314,13 @@ struct ButtonSettings {} "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::gamepad::AxisSettings; + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &gamepad::AxisSettings) -> bool; "#, r#" @@ -1416,12 +1336,6 @@ struct AxisSettings {} derive(clone), remote = "bevy::input::gamepad::ButtonAxisSettings", functions[r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::gamepad::ButtonAxisSettings; - -"#, - r#" /// Filters the `new_value` based on the `old_value`, according to the [`ButtonAxisSettings`]. /// Returns the clamped `new_value`, according to the [`ButtonAxisSettings`], if the change /// exceeds the settings threshold, and `None` otherwise. @@ -1433,6 +1347,12 @@ struct AxisSettings {} old_value: std::option::Option, ) -> std::option::Option; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::gamepad::ButtonAxisSettings; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -1451,19 +1371,9 @@ struct ButtonAxisSettings { derive(clone), remote = "bevy::input::gamepad::GamepadRumbleIntensity", functions[r#" -/// Creates a new rumble intensity with weak motor intensity set to the given value. -/// Clamped within the `0.0` to `1.0` range. - #[lua(kind = "Function", output(proxy))] - fn weak_motor(intensity: f32) -> bevy::input::gamepad::GamepadRumbleIntensity; - -"#, - r#" -/// Creates a new rumble intensity with strong motor intensity set to the given value. -/// Clamped within the `0.0` to `1.0` range. - - #[lua(kind = "Function", output(proxy))] - fn strong_motor(intensity: f32) -> bevy::input::gamepad::GamepadRumbleIntensity; + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::gamepad::GamepadRumbleIntensity; "#, r#" @@ -1478,9 +1388,19 @@ struct ButtonAxisSettings { "#, r#" +/// Creates a new rumble intensity with weak motor intensity set to the given value. +/// Clamped within the `0.0` to `1.0` range. + + #[lua(kind = "Function", output(proxy))] + fn weak_motor(intensity: f32) -> bevy::input::gamepad::GamepadRumbleIntensity; + +"#, + r#" +/// Creates a new rumble intensity with strong motor intensity set to the given value. +/// Clamped within the `0.0` to `1.0` range. - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::gamepad::GamepadRumbleIntensity; + #[lua(kind = "Function", output(proxy))] + fn strong_motor(intensity: f32) -> bevy::input::gamepad::GamepadRumbleIntensity; "#, r#" @@ -1570,12 +1490,6 @@ struct NativeKeyCode {} remote = "bevy::input::keyboard::NativeKey", functions[r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -1590,6 +1504,12 @@ struct NativeKeyCode {} #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] fn clone(&self) -> bevy::input::keyboard::NativeKey; +"#, + r#" + + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -1605,6 +1525,12 @@ struct NativeKey {} remote = "bevy::input::mouse::MouseScrollUnit", functions[r#" + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::mouse::MouseScrollUnit; + +"#, + r#" + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] fn assert_receiver_is_total_eq(&self) -> (); @@ -1619,12 +1545,6 @@ struct NativeKey {} )] fn eq(&self, #[proxy] other: &mouse::MouseScrollUnit) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::mouse::MouseScrollUnit; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -1640,8 +1560,13 @@ struct MouseScrollUnit {} remote = "bevy::input::touch::TouchPhase", functions[r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &touch::TouchPhase) -> bool; "#, r#" @@ -1652,13 +1577,8 @@ struct MouseScrollUnit {} "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &touch::TouchPhase) -> bool; + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); "#, r#" @@ -1819,7 +1739,6 @@ impl bevy_mod_scripting_core::hosts::APIProvider for BevyInputAPIProvider { >, >() .process_type::() - // .process_type::() .process_type::() .process_type::() .process_type::() @@ -1899,7 +1818,6 @@ impl bevy_mod_scripting_core::hosts::APIProvider for BevyInputAPIProvider { app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); - // app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); app.register_foreign_lua_type::(); app.register_foreign_lua_type::< diff --git a/crates/bevy_script_api/src/providers/bevy_math.rs b/crates/bevy_script_api/src/providers/bevy_math.rs index 62142da498..822cdb30a3 100644 --- a/crates/bevy_script_api/src/providers/bevy_math.rs +++ b/crates/bevy_script_api/src/providers/bevy_math.rs @@ -13,12 +13,6 @@ use bevy_script_api::{ remote = "bevy::math::AspectRatio", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::AspectRatio; - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -62,6 +56,12 @@ use bevy_script_api::{ #[lua(kind = "Method")] fn is_square(&self) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::AspectRatio; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -77,12 +77,6 @@ struct AspectRatio(); remote = "bevy::math::CompassOctant", functions[r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - -"#, - r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] fn clone(&self) -> bevy::math::CompassOctant; @@ -97,6 +91,12 @@ struct AspectRatio(); )] fn eq(&self, #[proxy] other: &compass::CompassOctant) -> bool; +"#, + r#" + + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -154,19 +154,13 @@ struct CompassQuadrant {} composite = "mul", metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: bevy::math::prelude::Vec2) -> bevy::math::prelude::Vec2; + fn mul(self, #[proxy] rhs: bevy::math::Isometry2d) -> bevy::math::Isometry2d; "#, r#" - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: bevy::math::Isometry2d) -> bevy::math::Isometry2d; + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::Isometry2d; "#, r#" @@ -252,8 +246,14 @@ struct CompassQuadrant {} "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::Isometry2d; + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: bevy::math::prelude::Vec2) -> bevy::math::prelude::Vec2; "#, r#" @@ -297,36 +297,6 @@ struct Isometry2d { derive(clone), remote = "bevy::math::Isometry3d", functions[r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: bevy::math::prelude::Dir3) -> bevy::math::prelude::Dir3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: bevy::math::prelude::Vec3) -> bevy::math::prelude::Vec3; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::Isometry3d; - -"#, - r#" /// Create a three-dimensional isometry from a rotation. #[lua(kind = "Function", output(proxy))] @@ -362,6 +332,18 @@ struct Isometry2d { rhs: bevy::math::Isometry3d, ) -> bevy::math::Isometry3d; +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: bevy::math::prelude::Vec3) -> bevy::math::prelude::Vec3; + "#, r#" @@ -373,6 +355,12 @@ struct Isometry2d { )] fn eq(&self, #[proxy] other: &isometry::Isometry3d) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::Isometry3d; + "#, r#" @@ -383,7 +371,7 @@ struct Isometry2d { composite = "mul", metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: bevy::math::Isometry3d) -> bevy::math::Isometry3d; + fn mul(self, #[proxy] rhs: bevy::math::prelude::Dir3) -> bevy::math::prelude::Dir3; "#, r#" @@ -397,6 +385,18 @@ struct Isometry2d { )] fn mul(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: bevy::math::Isometry3d) -> bevy::math::Isometry3d; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -417,6 +417,12 @@ struct Isometry3d { remote = "bevy::math::Ray2d", functions[r#" + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::Ray2d; + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -425,12 +431,6 @@ struct Isometry3d { )] fn eq(&self, #[proxy] other: &ray::Ray2d) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::Ray2d; - "#, r#" /// Create a new `Ray2d` from a given origin and direction @@ -549,13 +549,21 @@ struct Ray3d { remote = "bevy::math::Rot2", functions[r#" + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::Rot2; + +"#, + r#" +/// Rotates a [`Vec2`] by a [`Rot2`]. + #[lua( - as_trait = "std::cmp::PartialEq", + as_trait = "std::ops::Mul", kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", + output(proxy), + composite = "mul", + metamethod = "Mul", )] - fn eq(&self, #[proxy] other: &rotation2d::Rot2) -> bool; + fn mul(self, #[proxy] rhs: bevy::math::prelude::Vec2) -> bevy::math::prelude::Vec2; "#, r#" @@ -569,6 +577,23 @@ struct Ray3d { )] fn mul(self, #[proxy] rhs: bevy::math::Rot2) -> bevy::math::Rot2; +"#, + r#" +/// Rotates the [`Dir2`] using a [`Rot2`]. + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul( + self, + #[proxy] + direction: bevy::math::prelude::Dir2, + ) -> bevy::math::prelude::Dir2; + "#, r#" /// Creates a [`Rot2`] from a counterclockwise angle in radians. @@ -821,38 +846,13 @@ struct Ray3d { "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::Rot2; - -"#, - r#" -/// Rotates a [`Vec2`] by a [`Rot2`]. - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: bevy::math::prelude::Vec2) -> bevy::math::prelude::Vec2; - -"#, - r#" -/// Rotates the [`Dir2`] using a [`Rot2`]. - #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::cmp::PartialEq", kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "eq", + metamethod = "Eq", )] - fn mul( - self, - #[proxy] - direction: bevy::math::prelude::Dir2, - ) -> bevy::math::prelude::Dir2; + fn eq(&self, #[proxy] other: &rotation2d::Rot2) -> bool; "#, r#" @@ -871,35 +871,6 @@ struct Rot2 { derive(clone), remote = "bevy::math::prelude::Dir2", functions[r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::prelude::Dir2; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &direction::Dir2) -> bool; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Neg", - kind = "MetaFunction", - output(proxy), - composite = "neg", - metamethod = "Unm", - )] - fn neg(self) -> bevy::math::prelude::Dir2; - -"#, - r#" /// Create a [`Dir2`] from a [`Vec2`] that is already normalized. /// # Warning /// `value` must be normalized, i.e its length must be `1.0`. @@ -1009,6 +980,35 @@ struct Rot2 { #[lua(kind = "Method", output(proxy))] fn fast_renormalize(self) -> bevy::math::prelude::Dir2; +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &direction::Dir2) -> bool; + +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::prelude::Dir2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Neg", + kind = "MetaFunction", + output(proxy), + composite = "neg", + metamethod = "Unm", + )] + fn neg(self) -> bevy::math::prelude::Dir2; + "#, r#" @@ -1037,20 +1037,37 @@ struct Dir2(); functions[r#" #[lua( - as_trait = "std::ops::Neg", + as_trait = "std::cmp::PartialEq", kind = "MetaFunction", - output(proxy), - composite = "neg", - metamethod = "Unm", + composite = "eq", + metamethod = "Eq", )] - fn neg(self) -> bevy::math::prelude::Dir3; + fn eq(&self, #[proxy] other: &direction::Dir3) -> bool; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::prelude::Dir3; - + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, rhs: f32) -> bevy::math::prelude::Vec3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Neg", + kind = "MetaFunction", + output(proxy), + composite = "neg", + metamethod = "Unm", + )] + fn neg(self) -> bevy::math::prelude::Dir3; + "#, r#" /// Create a [`Dir3`] from a [`Vec3`] that is already normalized. @@ -1145,25 +1162,8 @@ struct Dir2(); "#, r#" - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, rhs: f32) -> bevy::math::prelude::Vec3; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &direction::Dir3) -> bool; + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::prelude::Dir3; "#, r#" @@ -1179,36 +1179,6 @@ struct Dir3(); derive(clone), remote = "bevy::math::prelude::Dir3A", functions[r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, rhs: f32) -> bevy::math::Vec3A; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Neg", - kind = "MetaFunction", - output(proxy), - composite = "neg", - metamethod = "Unm", - )] - fn neg(self) -> bevy::math::prelude::Dir3A; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::prelude::Dir3A; - -"#, - r#" /// Create a [`Dir3A`] from a [`Vec3A`] that is already normalized. /// # Warning /// `value` must be normalized, i.e its length must be `1.0`. @@ -1273,6 +1243,12 @@ struct Dir3(); #[lua(kind = "Method", output(proxy))] fn fast_renormalize(self) -> bevy::math::prelude::Dir3A; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::prelude::Dir3A; + "#, r#" @@ -1284,6 +1260,30 @@ struct Dir3(); )] fn eq(&self, #[proxy] other: &direction::Dir3A) -> bool; +"#, + r#" + + #[lua( + as_trait = "std::ops::Neg", + kind = "MetaFunction", + output(proxy), + composite = "neg", + metamethod = "Unm", + )] + fn neg(self) -> bevy::math::prelude::Dir3A; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, rhs: f32) -> bevy::math::Vec3A; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -1298,12 +1298,6 @@ struct Dir3A(); derive(clone), remote = "bevy::math::prelude::IRect", functions[r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::prelude::IRect; - -"#, - r#" /// Create a new rectangle from two corner points. /// The two points do not need to be the minimum and/or maximum corners. /// They only need to be two opposite corners. @@ -1598,6 +1592,12 @@ struct Dir3A(); )] fn eq(&self, #[proxy] other: &rects::irect::IRect) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::prelude::IRect; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -1617,23 +1617,6 @@ struct IRect { derive(clone), remote = "bevy::math::prelude::Rect", functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &rects::rect::Rect) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::prelude::Rect; - -"#, - r#" /// Create a new rectangle from two corner points. /// The two points do not need to be the minimum and/or maximum corners. /// They only need to be two opposite corners. @@ -1928,6 +1911,23 @@ struct IRect { #[lua(kind = "Method", output(proxy))] fn as_urect(&self) -> bevy::math::prelude::URect; +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &rects::rect::Rect) -> bool; + +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::prelude::Rect; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -1947,6 +1947,29 @@ struct Rect { derive(clone), remote = "bevy::math::prelude::URect", functions[r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::prelude::URect; + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &rects::urect::URect) -> bool; + +"#, + r#" + + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); + +"#, + r#" /// Create a new rectangle from two corner points. /// The two points do not need to be the minimum and/or maximum corners. /// They only need to be two opposite corners. @@ -2224,29 +2247,6 @@ struct Rect { #[lua(kind = "Method", output(proxy))] fn as_irect(&self) -> bevy::math::prelude::IRect; -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &rects::urect::URect) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::prelude::URect; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -2329,12 +2329,6 @@ struct Aabb2d { derive(clone), remote = "bevy::math::bounding::BoundingCircle", functions[r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::bounding::BoundingCircle; - -"#, - r#" /// Constructs a bounding circle from its center and radius. #[lua(kind = "Function", output(proxy))] @@ -2371,6 +2365,12 @@ struct Aabb2d { point: bevy::math::prelude::Vec2, ) -> bevy::math::prelude::Vec2; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::bounding::BoundingCircle; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -2390,23 +2390,6 @@ struct BoundingCircle { derive(clone), remote = "bevy::math::primitives::Circle", functions[r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::Circle; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &primitives::dim2::Circle) -> bool; - -"#, - r#" /// Create a new [`Circle`] from a `radius` #[lua(kind = "Function", output(proxy))] @@ -2432,6 +2415,23 @@ struct BoundingCircle { point: bevy::math::prelude::Vec2, ) -> bevy::math::prelude::Vec2; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::primitives::Circle; + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &primitives::dim2::Circle) -> bool; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -2449,6 +2449,12 @@ struct Circle { remote = "bevy::math::primitives::Annulus", functions[r#" + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::primitives::Annulus; + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -2457,12 +2463,6 @@ struct Circle { )] fn eq(&self, #[proxy] other: &primitives::dim2::Annulus) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::Annulus; - "#, r#" /// Create a new [`Annulus`] from the radii of the inner and outer circle @@ -2517,13 +2517,7 @@ struct Annulus { derive(clone), remote = "bevy::math::primitives::Arc2d", functions[r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::Arc2d; - -"#, - r#" -/// Create a new [`Arc2d`] from a `radius` and a `half_angle` +/// Create a new [`Arc2d`] from a `radius` and a `half_angle` #[lua(kind = "Function", output(proxy))] fn new(radius: f32, half_angle: f32) -> bevy::math::primitives::Arc2d; @@ -2642,6 +2636,12 @@ struct Annulus { #[lua(kind = "Method")] fn is_major(&self) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::primitives::Arc2d; + "#, r#" @@ -2670,6 +2670,17 @@ struct Arc2d { derive(clone), remote = "bevy::math::primitives::Capsule2d", functions[r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &primitives::dim2::Capsule2d) -> bool; + +"#, + r#" /// Create a new `Capsule2d` from a radius and length #[lua(kind = "Function", output(proxy))] @@ -2688,17 +2699,6 @@ struct Arc2d { #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] fn clone(&self) -> bevy::math::primitives::Capsule2d; -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &primitives::dim2::Capsule2d) -> bool; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -2716,23 +2716,6 @@ struct Capsule2d { derive(clone), remote = "bevy::math::primitives::CircularSector", functions[r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::CircularSector; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &primitives::dim2::CircularSector) -> bool; - -"#, - r#" /// Create a new [`CircularSector`] from a `radius` and an `angle` #[lua(kind = "Function", output(proxy))] @@ -2829,13 +2812,23 @@ struct Capsule2d { fn sagitta(&self) -> f32; "#, -// r#" -// /// Returns the area of this sector + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::primitives::CircularSector; + +"#, + r#" -// #[lua(kind = "Method")] -// fn area(&self) -> f32; + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &primitives::dim2::CircularSector) -> bool; -// "#, +"#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] fn index(&self) -> String { @@ -2852,6 +2845,23 @@ struct CircularSector { derive(clone), remote = "bevy::math::primitives::CircularSegment", functions[r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::primitives::CircularSegment; + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &primitives::dim2::CircularSegment) -> bool; + +"#, + r#" /// Create a new [`CircularSegment`] from a `radius`, and an `angle` #[lua(kind = "Function", output(proxy))] @@ -2945,30 +2955,6 @@ struct CircularSector { #[lua(kind = "Method")] fn sagitta(&self) -> f32; -"#, -// r#" -// /// Returns the area of this segment - -// #[lua(kind = "Method")] -// fn area(&self) -> f32; - -// "#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &primitives::dim2::CircularSegment) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::CircularSegment; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -2986,6 +2972,23 @@ struct CircularSegment { derive(clone), remote = "bevy::math::primitives::Ellipse", functions[r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &primitives::dim2::Ellipse) -> bool; + +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::primitives::Ellipse; + +"#, + r#" /// Create a new `Ellipse` from half of its width and height. /// This corresponds to the two perpendicular radii defining the ellipse. @@ -3034,23 +3037,6 @@ struct CircularSegment { #[lua(kind = "Method")] fn semi_minor(&self) -> f32; -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &primitives::dim2::Ellipse) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::Ellipse; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -3104,17 +3090,6 @@ struct Line2d { #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] fn clone(&self) -> bevy::math::primitives::Plane2d; -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &primitives::dim2::Plane2d) -> bool; - "#, r#" /// Create a new `Plane2d` from a normal @@ -3127,6 +3102,17 @@ struct Line2d { normal: bevy::math::prelude::Vec2, ) -> bevy::math::primitives::Plane2d; +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &primitives::dim2::Plane2d) -> bool; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -3144,6 +3130,23 @@ struct Plane2d { derive(clone), remote = "bevy::math::primitives::Rectangle", functions[r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::primitives::Rectangle; + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &primitives::dim2::Rectangle) -> bool; + +"#, + r#" /// Create a new `Rectangle` from a full width and height #[lua(kind = "Function", output(proxy))] @@ -3199,23 +3202,6 @@ struct Plane2d { point: bevy::math::prelude::Vec2, ) -> bevy::math::prelude::Vec2; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::Rectangle; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &primitives::dim2::Rectangle) -> bool; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -3233,6 +3219,12 @@ struct Rectangle { derive(clone), remote = "bevy::math::primitives::RegularPolygon", functions[r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::primitives::RegularPolygon; + +"#, + r#" /// Create a new `RegularPolygon` /// from the radius of the circumcircle and a number of sides /// # Panics @@ -3312,12 +3304,6 @@ struct Rectangle { )] fn eq(&self, #[proxy] other: &primitives::dim2::RegularPolygon) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::RegularPolygon; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -3337,6 +3323,12 @@ struct RegularPolygon { remote = "bevy::math::primitives::Rhombus", functions[r#" + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::primitives::Rhombus; + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -3345,12 +3337,6 @@ struct RegularPolygon { )] fn eq(&self, #[proxy] other: &primitives::dim2::Rhombus) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::Rhombus; - "#, r#" /// Create a new `Rhombus` from a vertical and horizontal diagonal sizes. @@ -3428,17 +3414,6 @@ struct Rhombus { derive(clone), remote = "bevy::math::primitives::Segment2d", functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &primitives::dim2::Segment2d) -> bool; - -"#, - r#" /// Create a new `Segment2d` from a direction and full length of the segment #[lua(kind = "Function", output(proxy))] @@ -3462,6 +3437,17 @@ struct Rhombus { #[lua(kind = "Method", output(proxy))] fn point2(&self) -> bevy::math::prelude::Vec2; +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &primitives::dim2::Segment2d) -> bool; + "#, r#" @@ -3486,6 +3472,17 @@ struct Segment2d { derive(clone), remote = "bevy::math::primitives::Triangle2d", functions[r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &primitives::dim2::Triangle2d) -> bool; + +"#, + r#" /// Create a new `Triangle2d` from points `a`, `b`, and `c` #[lua(kind = "Function", output(proxy))] @@ -3539,19 +3536,8 @@ struct Segment2d { "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &primitives::dim2::Triangle2d) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::Triangle2d; + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::primitives::Triangle2d; "#, r#" @@ -3640,6 +3626,17 @@ struct BoundingSphere { #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] fn clone(&self) -> bevy::math::primitives::Sphere; +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &primitives::dim3::Sphere) -> bool; + "#, r#" /// Create a new [`Sphere`] from a `radius` @@ -3667,17 +3664,6 @@ struct BoundingSphere { point: bevy::math::prelude::Vec3, ) -> bevy::math::prelude::Vec3; -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &primitives::dim3::Sphere) -> bool; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -3753,12 +3739,6 @@ struct Sphere { point: bevy::math::prelude::Vec3, ) -> bevy::math::prelude::Vec3; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::Cuboid; - "#, r#" @@ -3770,6 +3750,12 @@ struct Sphere { )] fn eq(&self, #[proxy] other: &primitives::dim3::Cuboid) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::primitives::Cuboid; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -3788,17 +3774,6 @@ struct Cuboid { remote = "bevy::math::primitives::Cylinder", functions[r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &primitives::dim3::Cylinder) -> bool; - -"#, - r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] fn clone(&self) -> bevy::math::primitives::Cylinder; @@ -3831,6 +3806,17 @@ struct Cuboid { #[lua(kind = "Method")] fn base_area(&self) -> f32; +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &primitives::dim3::Cylinder) -> bool; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -3848,6 +3834,17 @@ struct Cylinder { derive(clone), remote = "bevy::math::primitives::Capsule3d", functions[r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &primitives::dim3::Capsule3d) -> bool; + +"#, + r#" /// Create a new `Capsule3d` from a radius and length #[lua(kind = "Function", output(proxy))] @@ -3867,17 +3864,6 @@ struct Cylinder { #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] fn clone(&self) -> bevy::math::primitives::Capsule3d; -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &primitives::dim3::Capsule3d) -> bool; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -3904,6 +3890,12 @@ struct Capsule3d { )] fn eq(&self, #[proxy] other: &primitives::dim3::Cone) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::primitives::Cone; + "#, r#" /// Create a new [`Cone`] from a radius and height. @@ -3941,12 +3933,6 @@ struct Capsule3d { #[lua(kind = "Method")] fn base_area(&self) -> f32; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::Cone; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -3965,6 +3951,12 @@ struct Cone { remote = "bevy::math::primitives::ConicalFrustum", functions[r#" + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::primitives::ConicalFrustum; + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -3973,12 +3965,6 @@ struct Cone { )] fn eq(&self, #[proxy] other: &primitives::dim3::ConicalFrustum) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::ConicalFrustum; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -3998,13 +3984,8 @@ struct ConicalFrustum { remote = "bevy::math::primitives::InfinitePlane3d", functions[r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &primitives::dim3::InfinitePlane3d) -> bool; + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::primitives::InfinitePlane3d; "#, r#" @@ -4065,8 +4046,13 @@ struct ConicalFrustum { "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::InfinitePlane3d; + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &primitives::dim3::InfinitePlane3d) -> bool; "#, r#" @@ -4118,6 +4104,17 @@ struct Line3d { remote = "bevy::math::primitives::Segment3d", functions[r#" + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &primitives::dim3::Segment3d) -> bool; + +"#, + r#" + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] fn clone(&self) -> bevy::math::primitives::Segment3d; @@ -4146,17 +4143,6 @@ struct Line3d { #[lua(kind = "Method", output(proxy))] fn point2(&self) -> bevy::math::prelude::Vec3; -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &primitives::dim3::Segment3d) -> bool; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -4176,6 +4162,17 @@ struct Segment3d { remote = "bevy::math::primitives::Torus", functions[r#" + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &primitives::dim3::Torus) -> bool; + +"#, + r#" + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] fn clone(&self) -> bevy::math::primitives::Torus; @@ -4206,17 +4203,6 @@ struct Segment3d { #[lua(kind = "Method")] fn outer_radius(&self) -> f32; -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &primitives::dim3::Torus) -> bool; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -4234,23 +4220,6 @@ struct Torus { derive(clone), remote = "bevy::math::primitives::Triangle3d", functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &primitives::dim3::Triangle3d) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::Triangle3d; - -"#, - r#" /// Create a new [`Triangle3d`] from points `a`, `b`, and `c`. #[lua(kind = "Function", output(proxy))] @@ -4316,6 +4285,23 @@ struct Torus { #[lua(kind = "Method", output(proxy))] fn circumcenter(&self) -> bevy::math::prelude::Vec3; +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &primitives::dim3::Triangle3d) -> bool; + +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::primitives::Triangle3d; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -4407,12 +4393,6 @@ struct RayCast2d { derive(clone), remote = "bevy::math::bounding::AabbCast2d", functions[r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::bounding::AabbCast2d; - -"#, - r#" /// Construct an [`AabbCast2d`] from an [`Aabb2d`], origin, [`Dir2`], and max distance. #[lua(kind = "Function", output(proxy))] @@ -4450,6 +4430,12 @@ struct RayCast2d { aabb: bevy::math::bounding::Aabb2d, ) -> std::option::Option; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::bounding::AabbCast2d; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -4469,6 +4455,12 @@ struct AabbCast2d { derive(clone), remote = "bevy::math::bounding::BoundingCircleCast", functions[r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::bounding::BoundingCircleCast; + +"#, + r#" /// Construct a [`BoundingCircleCast`] from a [`BoundingCircle`], origin, [`Dir2`], and max distance. #[lua(kind = "Function", output(proxy))] @@ -4506,12 +4498,6 @@ struct AabbCast2d { circle: bevy::math::bounding::BoundingCircle, ) -> std::option::Option; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::bounding::BoundingCircleCast; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -4531,6 +4517,12 @@ struct BoundingCircleCast { derive(clone), remote = "bevy::math::bounding::RayCast3d", functions[r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::bounding::RayCast3d; + +"#, + r#" /// Construct a [`RayCast3d`] from a [`Ray3d`] and max distance. #[lua(kind = "Function", output(proxy))] @@ -4569,12 +4561,6 @@ struct BoundingCircleCast { sphere: &bounding::bounded3d::BoundingSphere, ) -> std::option::Option; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::bounding::RayCast3d; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -4595,6 +4581,12 @@ struct RayCast3d { derive(clone), remote = "bevy::math::bounding::AabbCast3d", functions[r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::bounding::AabbCast3d; + +"#, + r#" /// Construct an [`AabbCast3d`] from an [`Aabb3d`], [`Ray3d`], and max distance. #[lua(kind = "Function", output(proxy))] @@ -4617,12 +4609,6 @@ struct RayCast3d { aabb: bevy::math::bounding::Aabb3d, ) -> std::option::Option; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::bounding::AabbCast3d; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -4689,6 +4675,17 @@ struct BoundingSphereCast { derive(clone), remote = "bevy::math::curve::interval::Interval", functions[r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &curve::interval::Interval) -> bool; + +"#, + r#" /// Get the start of this interval. #[lua(kind = "Method")] @@ -4756,17 +4753,6 @@ struct BoundingSphereCast { #[lua(kind = "Method")] fn clamp(self, value: f32) -> f32; -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &curve::interval::Interval) -> bool; - "#, r#" @@ -4788,55 +4774,55 @@ struct Interval {} remote = "bevy::math::FloatOrd", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::FloatOrd; + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &float_ord::FloatOrd) -> bool; "#, r#" - #[lua(as_trait = "std::cmp::PartialOrd", kind = "Method")] - fn lt(&self, #[proxy] other: &float_ord::FloatOrd) -> bool; + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::FloatOrd; "#, r#" - #[lua(as_trait = "std::cmp::PartialOrd", kind = "Method")] - fn le(&self, #[proxy] other: &float_ord::FloatOrd) -> bool; + #[lua( + as_trait = "std::ops::Neg", + kind = "MetaFunction", + output(proxy), + composite = "neg", + metamethod = "Unm", + )] + fn neg(self) -> bevy::math::FloatOrd; "#, r#" #[lua(as_trait = "std::cmp::PartialOrd", kind = "Method")] - fn gt(&self, #[proxy] other: &float_ord::FloatOrd) -> bool; + fn lt(&self, #[proxy] other: &float_ord::FloatOrd) -> bool; "#, r#" #[lua(as_trait = "std::cmp::PartialOrd", kind = "Method")] - fn ge(&self, #[proxy] other: &float_ord::FloatOrd) -> bool; + fn le(&self, #[proxy] other: &float_ord::FloatOrd) -> bool; "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &float_ord::FloatOrd) -> bool; + #[lua(as_trait = "std::cmp::PartialOrd", kind = "Method")] + fn gt(&self, #[proxy] other: &float_ord::FloatOrd) -> bool; "#, r#" - #[lua( - as_trait = "std::ops::Neg", - kind = "MetaFunction", - output(proxy), - composite = "neg", - metamethod = "Unm", - )] - fn neg(self) -> bevy::math::FloatOrd; + #[lua(as_trait = "std::cmp::PartialOrd", kind = "Method")] + fn ge(&self, #[proxy] other: &float_ord::FloatOrd) -> bool; "#, r#" @@ -4900,6 +4886,23 @@ struct Plane3d { derive(clone), remote = "bevy::math::primitives::Tetrahedron", functions[r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &primitives::dim3::Tetrahedron) -> bool; + +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::primitives::Tetrahedron; + +"#, + r#" /// Create a new [`Tetrahedron`] from points `a`, `b`, `c` and `d`. #[lua(kind = "Function", output(proxy))] @@ -4933,23 +4936,6 @@ struct Plane3d { #[lua(kind = "Method", output(proxy))] fn centroid(&self) -> bevy::math::prelude::Vec3; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::Tetrahedron; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &primitives::dim3::Tetrahedron) -> bool; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] diff --git a/crates/bevy_script_api/src/providers/bevy_reflect.rs b/crates/bevy_script_api/src/providers/bevy_reflect.rs index 6fe8ad6aed..e6a6d54b92 100644 --- a/crates/bevy_script_api/src/providers/bevy_reflect.rs +++ b/crates/bevy_script_api/src/providers/bevy_reflect.rs @@ -23,21 +23,6 @@ use bevy_script_api::{ fn new(v: bool) -> std::sync::atomic::AtomicBool; "#, -// r#" -// /// Consumes the atomic and returns the contained value. -// /// This is safe because passing `self` by value guarantees that no other threads are -// /// concurrently accessing the atomic data. -// /// # Examples -// /// ``` -// /// use std::sync::atomic::AtomicBool; -// /// let some_bool = AtomicBool::new(true); -// /// assert_eq!(some_bool.into_inner(), true); -// /// ``` - -// #[lua(kind = "Method")] -// fn into_inner(self) -> bool; - -// "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] fn index(&self) -> String { @@ -62,21 +47,6 @@ struct AtomicBool {} fn new(v: i16) -> std::sync::atomic::AtomicI16; "#, -// r#" -// /// Consumes the atomic and returns the contained value. -// /// This is safe because passing `self` by value guarantees that no other threads are -// /// concurrently accessing the atomic data. -// /// # Examples -// /// ``` -// ///use std::sync::atomic::AtomicI16; -// ///let some_var = AtomicI16::new(5); -// /// assert_eq!(some_var.into_inner(), 5); -// /// ``` - -// #[lua(kind = "Method")] -// fn into_inner(self) -> i16; - -// "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] fn index(&self) -> String { @@ -101,21 +71,6 @@ struct AtomicI16 {} fn new(v: i32) -> std::sync::atomic::AtomicI32; "#, -// r#" -// /// Consumes the atomic and returns the contained value. -// /// This is safe because passing `self` by value guarantees that no other threads are -// /// concurrently accessing the atomic data. -// /// # Examples -// /// ``` -// ///use std::sync::atomic::AtomicI32; -// ///let some_var = AtomicI32::new(5); -// /// assert_eq!(some_var.into_inner(), 5); -// /// ``` - -// #[lua(kind = "Method")] -// fn into_inner(self) -> i32; - -// "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] fn index(&self) -> String { @@ -140,21 +95,6 @@ struct AtomicI32 {} fn new(v: i64) -> std::sync::atomic::AtomicI64; "#, -// r#" -// /// Consumes the atomic and returns the contained value. -// /// This is safe because passing `self` by value guarantees that no other threads are -// /// concurrently accessing the atomic data. -// /// # Examples -// /// ``` -// ///use std::sync::atomic::AtomicI64; -// ///let some_var = AtomicI64::new(5); -// /// assert_eq!(some_var.into_inner(), 5); -// /// ``` - -// #[lua(kind = "Method")] -// fn into_inner(self) -> i64; - -// "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] fn index(&self) -> String { @@ -179,21 +119,6 @@ struct AtomicI64 {} fn new(v: i8) -> std::sync::atomic::AtomicI8; "#, -// r#" -// /// Consumes the atomic and returns the contained value. -// /// This is safe because passing `self` by value guarantees that no other threads are -// /// concurrently accessing the atomic data. -// /// # Examples -// /// ``` -// ///use std::sync::atomic::AtomicI8; -// ///let some_var = AtomicI8::new(5); -// /// assert_eq!(some_var.into_inner(), 5); -// /// ``` - -// #[lua(kind = "Method")] -// fn into_inner(self) -> i8; - -// "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] fn index(&self) -> String { @@ -218,21 +143,6 @@ struct AtomicI8 {} fn new(v: isize) -> std::sync::atomic::AtomicIsize; "#, -// r#" -// /// Consumes the atomic and returns the contained value. -// /// This is safe because passing `self` by value guarantees that no other threads are -// /// concurrently accessing the atomic data. -// /// # Examples -// /// ``` -// ///use std::sync::atomic::AtomicIsize; -// ///let some_var = AtomicIsize::new(5); -// /// assert_eq!(some_var.into_inner(), 5); -// /// ``` - -// #[lua(kind = "Method")] -// fn into_inner(self) -> isize; - -// "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] fn index(&self) -> String { @@ -257,21 +167,6 @@ struct AtomicIsize {} fn new(v: u16) -> std::sync::atomic::AtomicU16; "#, -// r#" -// /// Consumes the atomic and returns the contained value. -// /// This is safe because passing `self` by value guarantees that no other threads are -// /// concurrently accessing the atomic data. -// /// # Examples -// /// ``` -// ///use std::sync::atomic::AtomicU16; -// ///let some_var = AtomicU16::new(5); -// /// assert_eq!(some_var.into_inner(), 5); -// /// ``` - -// #[lua(kind = "Method")] -// fn into_inner(self) -> u16; - -// "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] fn index(&self) -> String { @@ -296,21 +191,6 @@ struct AtomicU16 {} fn new(v: u32) -> std::sync::atomic::AtomicU32; "#, -// r#" -// /// Consumes the atomic and returns the contained value. -// /// This is safe because passing `self` by value guarantees that no other threads are -// /// concurrently accessing the atomic data. -// /// # Examples -// /// ``` -// ///use std::sync::atomic::AtomicU32; -// ///let some_var = AtomicU32::new(5); -// /// assert_eq!(some_var.into_inner(), 5); -// /// ``` - -// #[lua(kind = "Method")] -// fn into_inner(self) -> u32; - -// "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] fn index(&self) -> String { @@ -335,21 +215,6 @@ struct AtomicU32 {} fn new(v: u64) -> std::sync::atomic::AtomicU64; "#, -// r#" -// /// Consumes the atomic and returns the contained value. -// /// This is safe because passing `self` by value guarantees that no other threads are -// /// concurrently accessing the atomic data. -// /// # Examples -// /// ``` -// ///use std::sync::atomic::AtomicU64; -// ///let some_var = AtomicU64::new(5); -// /// assert_eq!(some_var.into_inner(), 5); -// /// ``` - -// #[lua(kind = "Method")] -// fn into_inner(self) -> u64; - -// "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] fn index(&self) -> String { @@ -374,21 +239,6 @@ struct AtomicU64 {} fn new(v: u8) -> std::sync::atomic::AtomicU8; "#, -// r#" -// /// Consumes the atomic and returns the contained value. -// /// This is safe because passing `self` by value guarantees that no other threads are -// /// concurrently accessing the atomic data. -// /// # Examples -// /// ``` -// ///use std::sync::atomic::AtomicU8; -// ///let some_var = AtomicU8::new(5); -// /// assert_eq!(some_var.into_inner(), 5); -// /// ``` - -// #[lua(kind = "Method")] -// fn into_inner(self) -> u8; - -// "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] fn index(&self) -> String { @@ -413,21 +263,6 @@ struct AtomicU8 {} fn new(v: usize) -> std::sync::atomic::AtomicUsize; "#, -// r#" -// /// Consumes the atomic and returns the contained value. -// /// This is safe because passing `self` by value guarantees that no other threads are -// /// concurrently accessing the atomic data. -// /// # Examples -// /// ``` -// ///use std::sync::atomic::AtomicUsize; -// ///let some_var = AtomicUsize::new(5); -// /// assert_eq!(some_var.into_inner(), 5); -// /// ``` - -// #[lua(kind = "Method")] -// fn into_inner(self) -> usize; - -// "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] fn index(&self) -> String { @@ -1329,9 +1164,73 @@ struct RangeFull {} derive(clone), remote = "bevy::math::Quat", functions[r#" -/// Multiplies a quaternion and a 3D vector, returning the rotated vector. + + #[lua( + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", + output(proxy), + )] + fn clone(&self) -> bevy::math::Quat; + +"#, + r#" +/// Divides a quaternion by a scalar value. +/// The quotient is not guaranteed to be normalized. + + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, rhs: f32) -> bevy::math::Quat; + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] rhs: &glam::Quat) -> bool; + +"#, + r#" +/// Multiplies a quaternion by a scalar value. +/// The product is not guaranteed to be normalized. + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, rhs: f32) -> bevy::math::Quat; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Neg", + kind = "MetaFunction", + output(proxy), + composite = "neg", + metamethod = "Unm", + )] + fn neg(self) -> bevy::math::Quat; + +"#, + r#" +/// Multiplies two quaternions. If they each represent a rotation, the result will +/// represent the combined rotation. +/// Note that due to floating point rounding the result may not be perfectly +/// normalized. /// # Panics -/// Will panic if `self` is not normalized when `glam_assert` is enabled. +/// Will panic if `self` or `rhs` are not normalized when `glam_assert` is enabled. #[lua( as_trait = "std::ops::Mul", @@ -1340,7 +1239,37 @@ struct RangeFull {} composite = "mul", metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; + fn mul(self, #[proxy] rhs: bevy::math::Quat) -> bevy::math::Quat; + +"#, + r#" +/// Subtracts the `rhs` quaternion from `self`. +/// The difference is not guaranteed to be normalized. + + #[lua( + as_trait = "std::ops::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(self, #[proxy] rhs: bevy::math::Quat) -> bevy::math::Quat; + +"#, + r#" +/// Adds two quaternions. +/// The sum is not guaranteed to be normalized. +/// Note that addition is not the same as combining the rotations represented by the +/// two quaternions! That corresponds to multiplication. + + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, #[proxy] rhs: bevy::math::Quat) -> bevy::math::Quat; "#, r#" @@ -1750,61 +1679,9 @@ struct RangeFull {} "#, r#" - - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::Quat; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Neg", - kind = "MetaFunction", - output(proxy), - composite = "neg", - metamethod = "Unm", - )] - fn neg(self) -> bevy::math::Quat; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] rhs: &glam::Quat) -> bool; - -"#, - r#" -/// Adds two quaternions. -/// The sum is not guaranteed to be normalized. -/// Note that addition is not the same as combining the rotations represented by the -/// two quaternions! That corresponds to multiplication. - - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, #[proxy] rhs: bevy::math::Quat) -> bevy::math::Quat; - -"#, - r#" -/// Multiplies two quaternions. If they each represent a rotation, the result will -/// represent the combined rotation. -/// Note that due to floating point rounding the result may not be perfectly -/// normalized. +/// Multiplies a quaternion and a 3D vector, returning the rotated vector. /// # Panics -/// Will panic if `self` or `rhs` are not normalized when `glam_assert` is enabled. +/// Will panic if `self` is not normalized when `glam_assert` is enabled. #[lua( as_trait = "std::ops::Mul", @@ -1813,35 +1690,7 @@ struct RangeFull {} composite = "mul", metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: bevy::math::Quat) -> bevy::math::Quat; - -"#, - r#" -/// Divides a quaternion by a scalar value. -/// The quotient is not guaranteed to be normalized. - - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, rhs: f32) -> bevy::math::Quat; - -"#, - r#" -/// Subtracts the `rhs` quaternion from `self`. -/// The difference is not guaranteed to be normalized. - - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, #[proxy] rhs: bevy::math::Quat) -> bevy::math::Quat; + fn mul(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; "#, r#" @@ -1855,20 +1704,6 @@ struct RangeFull {} )] fn mul(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; -"#, - r#" -/// Multiplies a quaternion by a scalar value. -/// The product is not guaranteed to be normalized. - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, rhs: f32) -> bevy::math::Quat; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -1885,13 +1720,13 @@ struct Quat(); functions[r#" #[lua( - as_trait = "std::ops::Sub", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "sub", - metamethod = "Sub", + composite = "mul", + metamethod = "Mul", )] - fn sub(self, rhs: f32) -> bevy::math::Vec3; + fn mul(self, rhs: f32) -> bevy::math::Vec3; "#, r#" @@ -1903,43 +1738,43 @@ struct Quat(); composite = "rem", metamethod = "Mod", )] - fn rem(self, rhs: f32) -> bevy::math::Vec3; + fn rem(self, #[proxy] rhs: &glam::Vec3) -> bevy::math::Vec3; "#, r#" #[lua( - as_trait = "std::ops::Rem", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "rem", - metamethod = "Mod", + composite = "mul", + metamethod = "Mul", )] - fn rem(self, #[proxy] rhs: &glam::Vec3) -> bevy::math::Vec3; + fn mul(self, #[proxy] rhs: &glam::Vec3) -> bevy::math::Vec3; "#, r#" #[lua( - as_trait = "std::ops::Sub", + as_trait = "std::ops::Div", kind = "MetaFunction", output(proxy), - composite = "sub", - metamethod = "Sub", + composite = "div", + metamethod = "Div", )] - fn sub(self, #[proxy] rhs: &glam::Vec3) -> bevy::math::Vec3; + fn div(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; "#, r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "add", + metamethod = "Add", )] - fn div(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; + fn add(self, #[proxy] rhs: &glam::Vec3) -> bevy::math::Vec3; "#, r#" @@ -1951,55 +1786,7 @@ struct Quat(); composite = "mul", metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: &glam::Vec3) -> bevy::math::Vec3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, #[proxy] rhs: &glam::Vec3) -> bevy::math::Vec3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, rhs: f32) -> bevy::math::Vec3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, #[proxy] rhs: &glam::Vec3) -> bevy::math::Vec3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; + fn mul(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; "#, r#" @@ -2678,13 +2465,13 @@ struct Quat(); r#" #[lua( - as_trait = "std::ops::Add", + as_trait = "std::ops::Rem", kind = "MetaFunction", output(proxy), - composite = "add", - metamethod = "Add", + composite = "rem", + metamethod = "Mod", )] - fn add(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; + fn rem(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; "#, r#" @@ -2702,35 +2489,37 @@ struct Quat(); r#" #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", + as_trait = "std::ops::Rem", + kind = "MetaFunction", output(proxy), + composite = "rem", + metamethod = "Mod", )] - fn clone(&self) -> bevy::math::Vec3; + fn rem(self, rhs: f32) -> bevy::math::Vec3; "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Sub", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "sub", + metamethod = "Sub", )] - fn mul(self, rhs: f32) -> bevy::math::Vec3; + fn sub(self, #[proxy] rhs: &glam::Vec3) -> bevy::math::Vec3; "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Div", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "div", + metamethod = "Div", )] - fn mul(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; + fn div(self, rhs: f32) -> bevy::math::Vec3; "#, r#" @@ -2747,13 +2536,59 @@ struct Quat(); r#" #[lua( - as_trait = "std::ops::Rem", + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", + output(proxy), + )] + fn clone(&self) -> bevy::math::Vec3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "rem", - metamethod = "Mod", + composite = "add", + metamethod = "Add", )] - fn rem(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; + fn add(self, rhs: f32) -> bevy::math::Vec3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(self, rhs: f32) -> bevy::math::Vec3; "#, r#" @@ -2765,7 +2600,7 @@ struct Quat(); composite = "div", metamethod = "Div", )] - fn div(self, rhs: f32) -> bevy::math::Vec3; + fn div(self, #[proxy] rhs: &glam::Vec3) -> bevy::math::Vec3; "#, r#" @@ -2797,6 +2632,18 @@ struct Vec3 { derive(clone), remote = "bevy::math::IVec2", functions[r#" + + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, rhs: i32) -> bevy::math::IVec2; + +"#, + r#" /// Creates a new vector. #[lua(kind = "Function", output(proxy))] @@ -3224,25 +3071,25 @@ struct Vec3 { r#" #[lua( - as_trait = "std::ops::Add", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "add", - metamethod = "Add", + composite = "mul", + metamethod = "Mul", )] - fn add(self, rhs: i32) -> bevy::math::IVec2; + fn mul(self, #[proxy] rhs: bevy::math::IVec2) -> bevy::math::IVec2; "#, r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Sub", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "sub", + metamethod = "Sub", )] - fn div(self, rhs: i32) -> bevy::math::IVec2; + fn sub(self, #[proxy] rhs: &glam::IVec2) -> bevy::math::IVec2; "#, r#" @@ -3254,55 +3101,53 @@ struct Vec3 { composite = "div", metamethod = "Div", )] - fn div(self, #[proxy] rhs: &glam::IVec2) -> bevy::math::IVec2; + fn div(self, #[proxy] rhs: bevy::math::IVec2) -> bevy::math::IVec2; "#, r#" #[lua( - as_trait = "std::ops::Add", + as_trait = "std::ops::Neg", kind = "MetaFunction", output(proxy), - composite = "add", - metamethod = "Add", + composite = "neg", + metamethod = "Unm", )] - fn add(self, #[proxy] rhs: &glam::IVec2) -> bevy::math::IVec2; + fn neg(self) -> bevy::math::IVec2; "#, r#" #[lua( - as_trait = "std::ops::Add", + as_trait = "std::ops::Rem", kind = "MetaFunction", output(proxy), - composite = "add", - metamethod = "Add", + composite = "rem", + metamethod = "Mod", )] - fn add(self, #[proxy] rhs: bevy::math::IVec2) -> bevy::math::IVec2; + fn rem(self, rhs: i32) -> bevy::math::IVec2; "#, r#" #[lua( - as_trait = "std::ops::Neg", + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "neg", - metamethod = "Unm", + composite = "add", + metamethod = "Add", )] - fn neg(self) -> bevy::math::IVec2; + fn add(self, #[proxy] rhs: &glam::IVec2) -> bevy::math::IVec2; "#, r#" #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", output(proxy), - composite = "sub", - metamethod = "Sub", )] - fn sub(self, #[proxy] rhs: &glam::IVec2) -> bevy::math::IVec2; + fn clone(&self) -> bevy::math::IVec2; "#, r#" @@ -3314,25 +3159,24 @@ struct Vec3 { r#" #[lua( - as_trait = "std::ops::Rem", + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "rem", - metamethod = "Mod", + composite = "add", + metamethod = "Add", )] - fn rem(self, rhs: i32) -> bevy::math::IVec2; + fn add(self, #[proxy] rhs: bevy::math::IVec2) -> bevy::math::IVec2; "#, r#" #[lua( - as_trait = "std::ops::Rem", + as_trait = "std::cmp::PartialEq", kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", + composite = "eq", + metamethod = "Eq", )] - fn rem(self, #[proxy] rhs: bevy::math::IVec2) -> bevy::math::IVec2; + fn eq(&self, #[proxy] other: &glam::IVec2) -> bool; "#, r#" @@ -3344,19 +3188,31 @@ struct Vec3 { composite = "sub", metamethod = "Sub", )] - fn sub(self, #[proxy] rhs: bevy::math::IVec2) -> bevy::math::IVec2; + fn sub(self, rhs: i32) -> bevy::math::IVec2; "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Rem", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "rem", + metamethod = "Mod", )] - fn mul(self, #[proxy] rhs: &glam::IVec2) -> bevy::math::IVec2; + fn rem(self, #[proxy] rhs: &glam::IVec2) -> bevy::math::IVec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, #[proxy] rhs: &glam::IVec2) -> bevy::math::IVec2; "#, r#" @@ -3368,7 +3224,7 @@ struct Vec3 { composite = "sub", metamethod = "Sub", )] - fn sub(self, rhs: i32) -> bevy::math::IVec2; + fn sub(self, #[proxy] rhs: bevy::math::IVec2) -> bevy::math::IVec2; "#, r#" @@ -3380,64 +3236,43 @@ struct Vec3 { composite = "mul", metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: bevy::math::IVec2) -> bevy::math::IVec2; + fn mul(self, rhs: i32) -> bevy::math::IVec2; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", + as_trait = "std::ops::Mul", kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", + output(proxy), + composite = "mul", + metamethod = "Mul", )] - fn eq(&self, #[proxy] other: &glam::IVec2) -> bool; + fn mul(self, #[proxy] rhs: &glam::IVec2) -> bevy::math::IVec2; "#, r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Rem", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "rem", + metamethod = "Mod", )] - fn div(self, #[proxy] rhs: bevy::math::IVec2) -> bevy::math::IVec2; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, rhs: i32) -> bevy::math::IVec2; + fn rem(self, #[proxy] rhs: bevy::math::IVec2) -> bevy::math::IVec2; "#, r#" #[lua( - as_trait = "std::ops::Rem", + as_trait = "std::ops::Div", kind = "MetaFunction", output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, #[proxy] rhs: &glam::IVec2) -> bevy::math::IVec2; - -"#, - r#" - - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), + composite = "div", + metamethod = "Div", )] - fn clone(&self) -> bevy::math::IVec2; + fn div(self, rhs: i32) -> bevy::math::IVec2; "#, r#" @@ -3469,6 +3304,28 @@ struct IVec2 { remote = "bevy::math::IVec3", functions[r#" + #[lua( + as_trait = "std::ops::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, rhs: i32) -> bevy::math::IVec3; + +"#, + r#" + + #[lua( + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", + output(proxy), + )] + fn clone(&self) -> bevy::math::IVec3; + +"#, + r#" + #[lua( as_trait = "std::ops::Sub", kind = "MetaFunction", @@ -3476,7 +3333,19 @@ struct IVec2 { composite = "sub", metamethod = "Sub", )] - fn sub(self, #[proxy] rhs: &glam::IVec3) -> bevy::math::IVec3; + fn sub(self, rhs: i32) -> bevy::math::IVec3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: &glam::IVec3) -> bevy::math::IVec3; "#, r#" @@ -3493,37 +3362,37 @@ struct IVec2 { r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "add", + metamethod = "Add", )] - fn div(self, rhs: i32) -> bevy::math::IVec3; + fn add(self, rhs: i32) -> bevy::math::IVec3; "#, r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Sub", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "sub", + metamethod = "Sub", )] - fn div(self, #[proxy] rhs: &glam::IVec3) -> bevy::math::IVec3; + fn sub(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::IVec3; "#, r#" #[lua( - as_trait = "std::ops::Rem", + as_trait = "std::ops::Neg", kind = "MetaFunction", output(proxy), - composite = "rem", - metamethod = "Mod", + composite = "neg", + metamethod = "Unm", )] - fn rem(self, #[proxy] rhs: &glam::IVec3) -> bevy::math::IVec3; + fn neg(self) -> bevy::math::IVec3; "#, r#" @@ -3535,41 +3404,67 @@ struct IVec2 { composite = "mul", metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: &glam::IVec3) -> bevy::math::IVec3; + fn mul(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::IVec3; "#, r#" #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", + as_trait = "std::ops::Mul", + kind = "MetaFunction", output(proxy), + composite = "mul", + metamethod = "Mul", )] - fn clone(&self) -> bevy::math::IVec3; + fn mul(self, rhs: i32) -> bevy::math::IVec3; "#, r#" #[lua( - as_trait = "std::ops::Neg", + as_trait = "std::ops::Rem", kind = "MetaFunction", output(proxy), - composite = "neg", - metamethod = "Unm", + composite = "rem", + metamethod = "Mod", )] - fn neg(self) -> bevy::math::IVec3; + fn rem(self, #[proxy] rhs: &glam::IVec3) -> bevy::math::IVec3; "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Div", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "div", + metamethod = "Div", )] - fn mul(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::IVec3; + fn div(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::IVec3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, #[proxy] rhs: &glam::IVec3) -> bevy::math::IVec3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, #[proxy] rhs: &glam::IVec3) -> bevy::math::IVec3; "#, r#" @@ -3581,7 +3476,7 @@ struct IVec2 { composite = "sub", metamethod = "Sub", )] - fn sub(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::IVec3; + fn sub(self, #[proxy] rhs: &glam::IVec3) -> bevy::math::IVec3; "#, r#" @@ -3593,13 +3488,37 @@ struct IVec2 { r#" #[lua( - as_trait = "std::ops::Sub", + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "sub", - metamethod = "Sub", + composite = "add", + metamethod = "Add", )] - fn sub(self, rhs: i32) -> bevy::math::IVec3; + fn add(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::IVec3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::IVec3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, rhs: i32) -> bevy::math::IVec3; "#, r#" @@ -4033,51 +3952,67 @@ struct IVec2 { "#, r#" - - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, rhs: i32) -> bevy::math::IVec3; - +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#, + r#" +#[lua(kind="MetaMethod", raw , metamethod="Index")] +fn index(&self, lua: &Lua, idx: crate::lua::util::LuaIndex) -> Result { + Ok(self.inner()?[*idx]) +} "#, r#" +#[lua(kind="MutatingMetaMethod", raw, metamethod="NewIndex")] +fn index(&mut self, lua: &Lua, idx: crate::lua::util::LuaIndex, val: i32) -> Result<(),_> { + self.val_mut(|s| Ok(s[*idx] = val))? +} +"#] +)] +struct IVec3 { + x: i32, + y: i32, + z: i32, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::math::IVec4", + functions[r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Rem", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "rem", + metamethod = "Mod", )] - fn mul(self, rhs: i32) -> bevy::math::IVec3; + fn rem(self, rhs: i32) -> bevy::math::IVec4; "#, r#" #[lua( - as_trait = "std::ops::Rem", + as_trait = "std::ops::Div", kind = "MetaFunction", output(proxy), - composite = "rem", - metamethod = "Mod", + composite = "div", + metamethod = "Div", )] - fn rem(self, rhs: i32) -> bevy::math::IVec3; + fn div(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::IVec4; "#, r#" #[lua( - as_trait = "std::ops::Rem", + as_trait = "std::ops::Sub", kind = "MetaFunction", output(proxy), - composite = "rem", - metamethod = "Mod", + composite = "sub", + metamethod = "Sub", )] - fn rem(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::IVec3; + fn sub(self, rhs: i32) -> bevy::math::IVec4; "#, r#" @@ -4089,19 +4024,24 @@ struct IVec2 { composite = "add", metamethod = "Add", )] - fn add(self, #[proxy] rhs: &glam::IVec3) -> bevy::math::IVec3; + fn add(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::IVec4; "#, r#" #[lua( - as_trait = "std::ops::Add", + as_trait = "std::cmp::PartialEq", kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", + composite = "eq", + metamethod = "Eq", )] - fn add(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::IVec3; + fn eq(&self, #[proxy] other: &glam::IVec4) -> bool; + +"#, + r#" + + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); "#, r#" @@ -4113,57 +4053,31 @@ struct IVec2 { composite = "div", metamethod = "Div", )] - fn div(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::IVec3; + fn div(self, rhs: i32) -> bevy::math::IVec4; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#, - r#" -#[lua(kind="MetaMethod", raw , metamethod="Index")] -fn index(&self, lua: &Lua, idx: crate::lua::util::LuaIndex) -> Result { - Ok(self.inner()?[*idx]) -} -"#, - r#" -#[lua(kind="MutatingMetaMethod", raw, metamethod="NewIndex")] -fn index(&mut self, lua: &Lua, idx: crate::lua::util::LuaIndex, val: i32) -> Result<(),_> { - self.val_mut(|s| Ok(s[*idx] = val))? -} -"#] -)] -struct IVec3 { - x: i32, - y: i32, - z: i32, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::math::IVec4", - functions[r#" #[lua( - as_trait = "std::ops::Rem", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "rem", - metamethod = "Mod", + composite = "mul", + metamethod = "Mul", )] - fn rem(self, rhs: i32) -> bevy::math::IVec4; + fn mul(self, rhs: i32) -> bevy::math::IVec4; "#, r#" #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", + as_trait = "std::ops::Sub", + kind = "MetaFunction", output(proxy), + composite = "sub", + metamethod = "Sub", )] - fn clone(&self) -> bevy::math::IVec4; + fn sub(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::IVec4; "#, r#" @@ -4175,19 +4089,19 @@ struct IVec3 { composite = "add", metamethod = "Add", )] - fn add(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::IVec4; + fn add(self, rhs: i32) -> bevy::math::IVec4; "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Neg", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "neg", + metamethod = "Unm", )] - fn mul(self, #[proxy] rhs: &glam::IVec4) -> bevy::math::IVec4; + fn neg(self) -> bevy::math::IVec4; "#, r#" @@ -4199,7 +4113,17 @@ struct IVec3 { composite = "mul", metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::IVec4; + fn mul(self, #[proxy] rhs: &glam::IVec4) -> bevy::math::IVec4; + +"#, + r#" + + #[lua( + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", + output(proxy), + )] + fn clone(&self) -> bevy::math::IVec4; "#, r#" @@ -4617,54 +4541,6 @@ struct IVec3 { rhs: bevy::math::UVec4, ) -> bevy::math::IVec4; -"#, - r#" - - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, #[proxy] rhs: &glam::IVec4) -> bevy::math::IVec4; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, #[proxy] rhs: &glam::IVec4) -> bevy::math::IVec4; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, rhs: i32) -> bevy::math::IVec4; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, #[proxy] rhs: &glam::IVec4) -> bevy::math::IVec4; - "#, r#" @@ -4675,7 +4551,7 @@ struct IVec3 { composite = "add", metamethod = "Add", )] - fn add(self, rhs: i32) -> bevy::math::IVec4; + fn add(self, #[proxy] rhs: &glam::IVec4) -> bevy::math::IVec4; "#, r#" @@ -4687,19 +4563,19 @@ struct IVec3 { composite = "div", metamethod = "Div", )] - fn div(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::IVec4; + fn div(self, #[proxy] rhs: &glam::IVec4) -> bevy::math::IVec4; "#, r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "mul", + metamethod = "Mul", )] - fn div(self, rhs: i32) -> bevy::math::IVec4; + fn mul(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::IVec4; "#, r#" @@ -4713,30 +4589,6 @@ struct IVec3 { )] fn rem(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::IVec4; -"#, - r#" - - #[lua( - as_trait = "std::ops::Neg", - kind = "MetaFunction", - output(proxy), - composite = "neg", - metamethod = "Unm", - )] - fn neg(self) -> bevy::math::IVec4; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, #[proxy] rhs: &glam::IVec4) -> bevy::math::IVec4; - "#, r#" @@ -4747,36 +4599,19 @@ struct IVec3 { composite = "sub", metamethod = "Sub", )] - fn sub(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::IVec4; + fn sub(self, #[proxy] rhs: &glam::IVec4) -> bevy::math::IVec4; "#, r#" #[lua( - as_trait = "std::ops::Sub", + as_trait = "std::ops::Rem", kind = "MetaFunction", output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, rhs: i32) -> bevy::math::IVec4; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", + composite = "rem", + metamethod = "Mod", )] - fn eq(&self, #[proxy] other: &glam::IVec4) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + fn rem(self, #[proxy] rhs: &glam::IVec4) -> bevy::math::IVec4; "#, r#" @@ -5244,24 +5079,25 @@ struct IVec4 { r#" #[lua( - as_trait = "std::ops::Add", + as_trait = "std::ops::Div", kind = "MetaFunction", output(proxy), - composite = "add", - metamethod = "Add", + composite = "div", + metamethod = "Div", )] - fn add(self, rhs: i64) -> bevy::math::I64Vec2; + fn div(self, rhs: i64) -> bevy::math::I64Vec2; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", + as_trait = "std::ops::Mul", kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", + output(proxy), + composite = "mul", + metamethod = "Mul", )] - fn eq(&self, #[proxy] other: &glam::I64Vec2) -> bool; + fn mul(self, #[proxy] rhs: bevy::math::I64Vec2) -> bevy::math::I64Vec2; "#, r#" @@ -5277,61 +5113,61 @@ struct IVec4 { r#" #[lua( - as_trait = "std::ops::Sub", + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "sub", - metamethod = "Sub", + composite = "add", + metamethod = "Add", )] - fn sub(self, #[proxy] rhs: &glam::I64Vec2) -> bevy::math::I64Vec2; + fn add(self, rhs: i64) -> bevy::math::I64Vec2; "#, r#" #[lua( - as_trait = "std::ops::Neg", + as_trait = "std::ops::Rem", kind = "MetaFunction", output(proxy), - composite = "neg", - metamethod = "Unm", + composite = "rem", + metamethod = "Mod", )] - fn neg(self) -> bevy::math::I64Vec2; + fn rem(self, rhs: i64) -> bevy::math::I64Vec2; "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Rem", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "rem", + metamethod = "Mod", )] - fn mul(self, rhs: i64) -> bevy::math::I64Vec2; + fn rem(self, #[proxy] rhs: &glam::I64Vec2) -> bevy::math::I64Vec2; "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "add", + metamethod = "Add", )] - fn mul(self, #[proxy] rhs: &glam::I64Vec2) -> bevy::math::I64Vec2; + fn add(self, #[proxy] rhs: bevy::math::I64Vec2) -> bevy::math::I64Vec2; "#, r#" #[lua( - as_trait = "std::ops::Rem", + as_trait = "std::ops::Div", kind = "MetaFunction", output(proxy), - composite = "rem", - metamethod = "Mod", + composite = "div", + metamethod = "Div", )] - fn rem(self, #[proxy] rhs: &glam::I64Vec2) -> bevy::math::I64Vec2; + fn div(self, #[proxy] rhs: &glam::I64Vec2) -> bevy::math::I64Vec2; "#, r#" @@ -5349,67 +5185,36 @@ struct IVec4 { r#" #[lua( - as_trait = "std::ops::Add", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "add", - metamethod = "Add", + composite = "mul", + metamethod = "Mul", )] - fn add(self, #[proxy] rhs: &glam::I64Vec2) -> bevy::math::I64Vec2; + fn mul(self, rhs: i64) -> bevy::math::I64Vec2; "#, r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Neg", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "neg", + metamethod = "Unm", )] - fn div(self, #[proxy] rhs: bevy::math::I64Vec2) -> bevy::math::I64Vec2; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + fn neg(self) -> bevy::math::I64Vec2; "#, r#" #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, #[proxy] rhs: &glam::I64Vec2) -> bevy::math::I64Vec2; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, #[proxy] rhs: bevy::math::I64Vec2) -> bevy::math::I64Vec2; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Rem", + as_trait = "std::cmp::PartialEq", kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", + composite = "eq", + metamethod = "Eq", )] - fn rem(self, rhs: i64) -> bevy::math::I64Vec2; + fn eq(&self, #[proxy] other: &glam::I64Vec2) -> bool; "#, r#" @@ -5421,7 +5226,7 @@ struct IVec4 { composite = "add", metamethod = "Add", )] - fn add(self, #[proxy] rhs: bevy::math::I64Vec2) -> bevy::math::I64Vec2; + fn add(self, #[proxy] rhs: &glam::I64Vec2) -> bevy::math::I64Vec2; "#, r#" @@ -5433,19 +5238,19 @@ struct IVec4 { composite = "mul", metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: bevy::math::I64Vec2) -> bevy::math::I64Vec2; + fn mul(self, #[proxy] rhs: &glam::I64Vec2) -> bevy::math::I64Vec2; "#, r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Rem", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "rem", + metamethod = "Mod", )] - fn div(self, rhs: i64) -> bevy::math::I64Vec2; + fn rem(self, #[proxy] rhs: bevy::math::I64Vec2) -> bevy::math::I64Vec2; "#, r#" @@ -5459,87 +5264,12 @@ struct IVec4 { )] fn sub(self, rhs: i64) -> bevy::math::I64Vec2; -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct I64Vec2 { - x: i64, - y: i64, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::math::I64Vec3", - functions[r#" - - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, #[proxy] rhs: &glam::I64Vec3) -> bevy::math::I64Vec3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, rhs: i64) -> bevy::math::I64Vec3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, #[proxy] rhs: &glam::I64Vec3) -> bevy::math::I64Vec3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, #[proxy] rhs: bevy::math::I64Vec3) -> bevy::math::I64Vec3; - "#, r#" #[lua(as_trait = "std::cmp::Eq", kind = "Method")] fn assert_receiver_is_total_eq(&self) -> (); -"#, - r#" - - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, rhs: i64) -> bevy::math::I64Vec3; - "#, r#" @@ -5550,45 +5280,37 @@ struct I64Vec2 { composite = "sub", metamethod = "Sub", )] - fn sub(self, #[proxy] rhs: bevy::math::I64Vec3) -> bevy::math::I64Vec3; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &glam::I64Vec3) -> bool; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Neg", - kind = "MetaFunction", - output(proxy), - composite = "neg", - metamethod = "Unm", - )] - fn neg(self) -> bevy::math::I64Vec3; + fn sub(self, #[proxy] rhs: &glam::I64Vec2) -> bevy::math::I64Vec2; "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Div", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "div", + metamethod = "Div", )] - fn mul(self, rhs: i64) -> bevy::math::I64Vec3; + fn div(self, #[proxy] rhs: bevy::math::I64Vec2) -> bevy::math::I64Vec2; "#, r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct I64Vec2 { + x: i64, + y: i64, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::math::I64Vec3", + functions[r#" /// Creates a new vector. #[lua(kind = "Function", output(proxy))] @@ -6029,13 +5751,13 @@ struct I64Vec2 { r#" #[lua( - as_trait = "std::ops::Rem", + as_trait = "std::ops::Sub", kind = "MetaFunction", output(proxy), - composite = "rem", - metamethod = "Mod", + composite = "sub", + metamethod = "Sub", )] - fn rem(self, rhs: i64) -> bevy::math::I64Vec3; + fn sub(self, rhs: i64) -> bevy::math::I64Vec3; "#, r#" @@ -6047,31 +5769,19 @@ struct I64Vec2 { composite = "add", metamethod = "Add", )] - fn add(self, #[proxy] rhs: bevy::math::I64Vec3) -> bevy::math::I64Vec3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, rhs: i64) -> bevy::math::I64Vec3; + fn add(self, rhs: i64) -> bevy::math::I64Vec3; "#, r#" #[lua( - as_trait = "std::ops::Add", + as_trait = "std::ops::Rem", kind = "MetaFunction", output(proxy), - composite = "add", - metamethod = "Add", + composite = "rem", + metamethod = "Mod", )] - fn add(self, #[proxy] rhs: &glam::I64Vec3) -> bevy::math::I64Vec3; + fn rem(self, #[proxy] rhs: &glam::I64Vec3) -> bevy::math::I64Vec3; "#, r#" @@ -6087,37 +5797,30 @@ struct I64Vec2 { r#" #[lua( - as_trait = "std::ops::Rem", + as_trait = "std::ops::Neg", kind = "MetaFunction", output(proxy), - composite = "rem", - metamethod = "Mod", + composite = "neg", + metamethod = "Unm", )] - fn rem(self, #[proxy] rhs: bevy::math::I64Vec3) -> bevy::math::I64Vec3; + fn neg(self) -> bevy::math::I64Vec3; "#, r#" - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: bevy::math::I64Vec3) -> bevy::math::I64Vec3; + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::cmp::PartialEq", kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "eq", + metamethod = "Eq", )] - fn mul(self, #[proxy] rhs: &glam::I64Vec3) -> bevy::math::I64Vec3; + fn eq(&self, #[proxy] other: &glam::I64Vec3) -> bool; "#, r#" @@ -6129,41 +5832,115 @@ struct I64Vec2 { composite = "div", metamethod = "Div", )] - fn div(self, #[proxy] rhs: &glam::I64Vec3) -> bevy::math::I64Vec3; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct I64Vec3 { - x: i64, - y: i64, - z: i64, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::math::I64Vec4", - functions[r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + fn div(self, rhs: i64) -> bevy::math::I64Vec3; "#, r#" #[lua( - as_trait = "std::ops::Add", + as_trait = "std::ops::Sub", kind = "MetaFunction", output(proxy), - composite = "add", - metamethod = "Add", + composite = "sub", + metamethod = "Sub", )] - fn add(self, rhs: i64) -> bevy::math::I64Vec4; + fn sub(self, #[proxy] rhs: &glam::I64Vec3) -> bevy::math::I64Vec3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, rhs: i64) -> bevy::math::I64Vec3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, #[proxy] rhs: bevy::math::I64Vec3) -> bevy::math::I64Vec3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, #[proxy] rhs: bevy::math::I64Vec3) -> bevy::math::I64Vec3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(self, #[proxy] rhs: bevy::math::I64Vec3) -> bevy::math::I64Vec3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: bevy::math::I64Vec3) -> bevy::math::I64Vec3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, #[proxy] rhs: &glam::I64Vec3) -> bevy::math::I64Vec3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, rhs: i64) -> bevy::math::I64Vec3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: &glam::I64Vec3) -> bevy::math::I64Vec3; "#, r#" @@ -6175,7 +5952,47 @@ struct I64Vec3 { composite = "div", metamethod = "Div", )] - fn div(self, #[proxy] rhs: &glam::I64Vec4) -> bevy::math::I64Vec4; + fn div(self, #[proxy] rhs: bevy::math::I64Vec3) -> bevy::math::I64Vec3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, #[proxy] rhs: &glam::I64Vec3) -> bevy::math::I64Vec3; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct I64Vec3 { + x: i64, + y: i64, + z: i64, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::math::I64Vec4", + functions[r#" + + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, rhs: i64) -> bevy::math::I64Vec4; "#, r#" @@ -6191,13 +6008,48 @@ struct I64Vec3 { r#" #[lua( - as_trait = "std::ops::Neg", + as_trait = "std::ops::Sub", kind = "MetaFunction", output(proxy), - composite = "neg", - metamethod = "Unm", + composite = "sub", + metamethod = "Sub", )] - fn neg(self) -> bevy::math::I64Vec4; + fn sub(self, #[proxy] rhs: &glam::I64Vec4) -> bevy::math::I64Vec4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(self, #[proxy] rhs: bevy::math::I64Vec4) -> bevy::math::I64Vec4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, #[proxy] rhs: &glam::I64Vec4) -> bevy::math::I64Vec4; + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &glam::I64Vec4) -> bool; "#, r#" @@ -6623,17 +6475,23 @@ struct I64Vec3 { rhs: bevy::math::U64Vec4, ) -> bevy::math::I64Vec4; +"#, + r#" + + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); + "#, r#" #[lua( - as_trait = "std::ops::Add", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "add", - metamethod = "Add", + composite = "mul", + metamethod = "Mul", )] - fn add(self, #[proxy] rhs: &glam::I64Vec4) -> bevy::math::I64Vec4; + fn mul(self, #[proxy] rhs: &glam::I64Vec4) -> bevy::math::I64Vec4; "#, r#" @@ -6651,13 +6509,13 @@ struct I64Vec3 { r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "add", + metamethod = "Add", )] - fn div(self, rhs: i64) -> bevy::math::I64Vec4; + fn add(self, rhs: i64) -> bevy::math::I64Vec4; "#, r#" @@ -6671,30 +6529,6 @@ struct I64Vec3 { )] fn rem(self, #[proxy] rhs: &glam::I64Vec4) -> bevy::math::I64Vec4; -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, #[proxy] rhs: &glam::I64Vec4) -> bevy::math::I64Vec4; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: bevy::math::I64Vec4) -> bevy::math::I64Vec4; - "#, r#" @@ -6711,24 +6545,25 @@ struct I64Vec3 { r#" #[lua( - as_trait = "std::ops::Sub", + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "sub", - metamethod = "Sub", + composite = "add", + metamethod = "Add", )] - fn sub(self, rhs: i64) -> bevy::math::I64Vec4; + fn add(self, #[proxy] rhs: bevy::math::I64Vec4) -> bevy::math::I64Vec4; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", + as_trait = "std::ops::Neg", kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", + output(proxy), + composite = "neg", + metamethod = "Unm", )] - fn eq(&self, #[proxy] other: &glam::I64Vec4) -> bool; + fn neg(self) -> bevy::math::I64Vec4; "#, r#" @@ -6746,49 +6581,49 @@ struct I64Vec3 { r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "add", + metamethod = "Add", )] - fn div(self, #[proxy] rhs: bevy::math::I64Vec4) -> bevy::math::I64Vec4; + fn add(self, #[proxy] rhs: &glam::I64Vec4) -> bevy::math::I64Vec4; "#, r#" #[lua( - as_trait = "std::ops::Add", + as_trait = "std::ops::Sub", kind = "MetaFunction", output(proxy), - composite = "add", - metamethod = "Add", + composite = "sub", + metamethod = "Sub", )] - fn add(self, #[proxy] rhs: bevy::math::I64Vec4) -> bevy::math::I64Vec4; + fn sub(self, rhs: i64) -> bevy::math::I64Vec4; "#, r#" #[lua( - as_trait = "std::ops::Sub", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "sub", - metamethod = "Sub", + composite = "mul", + metamethod = "Mul", )] - fn sub(self, #[proxy] rhs: bevy::math::I64Vec4) -> bevy::math::I64Vec4; + fn mul(self, #[proxy] rhs: bevy::math::I64Vec4) -> bevy::math::I64Vec4; "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Div", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "div", + metamethod = "Div", )] - fn mul(self, #[proxy] rhs: &glam::I64Vec4) -> bevy::math::I64Vec4; + fn div(self, #[proxy] rhs: bevy::math::I64Vec4) -> bevy::math::I64Vec4; "#, r#" @@ -6810,18 +6645,6 @@ struct I64Vec4 { remote = "bevy::math::UVec2", functions[r#" - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, #[proxy] rhs: bevy::math::UVec2) -> bevy::math::UVec2; - -"#, - r#" - #[lua( as_trait = "std::ops::Sub", kind = "MetaFunction", @@ -6835,24 +6658,19 @@ struct I64Vec4 { r#" #[lua( - as_trait = "std::cmp::PartialEq", + as_trait = "std::ops::Div", kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", + output(proxy), + composite = "div", + metamethod = "Div", )] - fn eq(&self, #[proxy] other: &glam::UVec2) -> bool; + fn div(self, #[proxy] rhs: &glam::UVec2) -> bevy::math::UVec2; "#, r#" - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, rhs: u32) -> bevy::math::UVec2; + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); "#, r#" @@ -6868,25 +6686,13 @@ struct I64Vec4 { r#" #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, #[proxy] rhs: bevy::math::UVec2) -> bevy::math::UVec2; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add", + as_trait = "std::ops::Rem", kind = "MetaFunction", output(proxy), - composite = "add", - metamethod = "Add", + composite = "rem", + metamethod = "Mod", )] - fn add(self, rhs: u32) -> bevy::math::UVec2; + fn rem(self, rhs: u32) -> bevy::math::UVec2; "#, r#" @@ -6898,31 +6704,31 @@ struct I64Vec4 { composite = "add", metamethod = "Add", )] - fn add(self, #[proxy] rhs: &glam::UVec2) -> bevy::math::UVec2; + fn add(self, #[proxy] rhs: bevy::math::UVec2) -> bevy::math::UVec2; "#, r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Sub", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "sub", + metamethod = "Sub", )] - fn div(self, #[proxy] rhs: &glam::UVec2) -> bevy::math::UVec2; + fn sub(self, #[proxy] rhs: bevy::math::UVec2) -> bevy::math::UVec2; "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Sub", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "sub", + metamethod = "Sub", )] - fn mul(self, rhs: u32) -> bevy::math::UVec2; + fn sub(self, rhs: u32) -> bevy::math::UVec2; "#, r#" @@ -6934,37 +6740,19 @@ struct I64Vec4 { composite = "div", metamethod = "Div", )] - fn div(self, rhs: u32) -> bevy::math::UVec2; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, #[proxy] rhs: bevy::math::UVec2) -> bevy::math::UVec2; + fn div(self, #[proxy] rhs: bevy::math::UVec2) -> bevy::math::UVec2; "#, r#" #[lua( - as_trait = "std::ops::Rem", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "rem", - metamethod = "Mod", + composite = "mul", + metamethod = "Mul", )] - fn rem(self, rhs: u32) -> bevy::math::UVec2; + fn mul(self, #[proxy] rhs: bevy::math::UVec2) -> bevy::math::UVec2; "#, r#" @@ -7316,6 +7104,18 @@ struct I64Vec4 { )] fn rem(self, #[proxy] rhs: bevy::math::UVec2) -> bevy::math::UVec2; +"#, + r#" + + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, rhs: u32) -> bevy::math::UVec2; + "#, r#" @@ -7326,7 +7126,30 @@ struct I64Vec4 { composite = "mul", metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: &glam::UVec2) -> bevy::math::UVec2; + fn mul(self, rhs: u32) -> bevy::math::UVec2; + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &glam::UVec2) -> bool; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, rhs: u32) -> bevy::math::UVec2; "#, r#" @@ -7338,7 +7161,19 @@ struct I64Vec4 { composite = "mul", metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: bevy::math::UVec2) -> bevy::math::UVec2; + fn mul(self, #[proxy] rhs: &glam::UVec2) -> bevy::math::UVec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, #[proxy] rhs: &glam::UVec2) -> bevy::math::UVec2; "#, r#" @@ -7370,6 +7205,30 @@ struct UVec2 { remote = "bevy::math::UVec3", functions[r#" + #[lua( + as_trait = "std::ops::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::UVec3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, #[proxy] rhs: &glam::UVec3) -> bevy::math::UVec3; + +"#, + r#" + #[lua( as_trait = "std::ops::Div", kind = "MetaFunction", @@ -7377,7 +7236,7 @@ struct UVec2 { composite = "div", metamethod = "Div", )] - fn div(self, rhs: u32) -> bevy::math::UVec3; + fn div(self, #[proxy] rhs: &glam::UVec3) -> bevy::math::UVec3; "#, r#" @@ -7395,55 +7254,124 @@ struct UVec2 { r#" #[lua( - as_trait = "std::ops::Sub", + as_trait = "std::cmp::PartialEq", kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", + composite = "eq", + metamethod = "Eq", )] - fn sub(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::UVec3; + fn eq(&self, #[proxy] other: &glam::UVec3) -> bool; "#, r#" -/// Creates a new vector. - #[lua(kind = "Function", output(proxy))] - fn new(x: u32, y: u32, z: u32) -> bevy::math::UVec3; + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::UVec3; "#, r#" -/// Creates a vector with all elements set to `v`. - #[lua(kind = "Function", output(proxy))] - fn splat(v: u32) -> bevy::math::UVec3; + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: &glam::UVec3) -> bevy::math::UVec3; "#, r#" -/// Creates a vector from the elements in `if_true` and `if_false`, selecting which to use -/// for each element of `self`. -/// A true element in the mask uses the corresponding element from `if_true`, and false -/// uses the element from `if_false`. - #[lua(kind = "Function", output(proxy))] - fn select( - #[proxy] - mask: bevy::math::BVec3, - #[proxy] - if_true: bevy::math::UVec3, - #[proxy] - if_false: bevy::math::UVec3, - ) -> bevy::math::UVec3; + #[lua( + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", + output(proxy), + )] + fn clone(&self) -> bevy::math::UVec3; "#, r#" -/// Creates a new vector from an array. - #[lua(kind = "Function", output(proxy))] - fn from_array(a: [u32; 3]) -> bevy::math::UVec3; + #[lua( + as_trait = "std::ops::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, rhs: u32) -> bevy::math::UVec3; "#, r#" -/// `[x, y, z]` + + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, rhs: u32) -> bevy::math::UVec3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(self, rhs: u32) -> bevy::math::UVec3; + +"#, + r#" +/// Creates a new vector. + + #[lua(kind = "Function", output(proxy))] + fn new(x: u32, y: u32, z: u32) -> bevy::math::UVec3; + +"#, + r#" +/// Creates a vector with all elements set to `v`. + + #[lua(kind = "Function", output(proxy))] + fn splat(v: u32) -> bevy::math::UVec3; + +"#, + r#" +/// Creates a vector from the elements in `if_true` and `if_false`, selecting which to use +/// for each element of `self`. +/// A true element in the mask uses the corresponding element from `if_true`, and false +/// uses the element from `if_false`. + + #[lua(kind = "Function", output(proxy))] + fn select( + #[proxy] + mask: bevy::math::BVec3, + #[proxy] + if_true: bevy::math::UVec3, + #[proxy] + if_false: bevy::math::UVec3, + ) -> bevy::math::UVec3; + +"#, + r#" +/// Creates a new vector from an array. + + #[lua(kind = "Function", output(proxy))] + fn from_array(a: [u32; 3]) -> bevy::math::UVec3; + +"#, + r#" +/// `[x, y, z]` #[lua(kind = "Method")] fn to_array(&self) -> [u32; 3]; @@ -7758,30 +7686,6 @@ struct UVec2 { #[lua(kind = "Method", output(proxy))] fn saturating_add_signed(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::UVec3; -"#, - r#" - - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, rhs: u32) -> bevy::math::UVec3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, rhs: u32) -> bevy::math::UVec3; - "#, r#" @@ -7804,17 +7708,19 @@ struct UVec2 { composite = "div", metamethod = "Div", )] - fn div(self, #[proxy] rhs: &glam::UVec3) -> bevy::math::UVec3; + fn div(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::UVec3; "#, r#" #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", + as_trait = "std::ops::Mul", + kind = "MetaFunction", output(proxy), + composite = "mul", + metamethod = "Mul", )] - fn clone(&self) -> bevy::math::UVec3; + fn mul(self, rhs: u32) -> bevy::math::UVec3; "#, r#" @@ -7826,72 +7732,7 @@ struct UVec2 { composite = "add", metamethod = "Add", )] - fn add(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::UVec3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::UVec3; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &glam::UVec3) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - -"#, - r#" - - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::UVec3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, rhs: u32) -> bevy::math::UVec3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: &glam::UVec3) -> bevy::math::UVec3; + fn add(self, #[proxy] rhs: &glam::UVec3) -> bevy::math::UVec3; "#, r#" @@ -7903,31 +7744,25 @@ struct UVec2 { composite = "add", metamethod = "Add", )] - fn add(self, #[proxy] rhs: &glam::UVec3) -> bevy::math::UVec3; + fn add(self, rhs: u32) -> bevy::math::UVec3; "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Sub", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "sub", + metamethod = "Sub", )] - fn mul(self, rhs: u32) -> bevy::math::UVec3; + fn sub(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::UVec3; "#, r#" - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, #[proxy] rhs: &glam::UVec3) -> bevy::math::UVec3; + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); "#, r#" @@ -7961,13 +7796,25 @@ struct UVec3 { functions[r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "add", + metamethod = "Add", )] - fn mul(self, #[proxy] rhs: bevy::math::UVec4) -> bevy::math::UVec4; + fn add(self, #[proxy] rhs: bevy::math::UVec4) -> bevy::math::UVec4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, #[proxy] rhs: bevy::math::UVec4) -> bevy::math::UVec4; "#, r#" @@ -7991,43 +7838,37 @@ struct UVec3 { composite = "rem", metamethod = "Mod", )] - fn rem(self, #[proxy] rhs: bevy::math::UVec4) -> bevy::math::UVec4; + fn rem(self, #[proxy] rhs: &glam::UVec4) -> bevy::math::UVec4; "#, r#" #[lua( - as_trait = "std::ops::Sub", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "sub", - metamethod = "Sub", + composite = "mul", + metamethod = "Mul", )] - fn sub(self, rhs: u32) -> bevy::math::UVec4; + fn mul(self, rhs: u32) -> bevy::math::UVec4; "#, r#" - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, rhs: u32) -> bevy::math::UVec4; + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); "#, r#" #[lua( - as_trait = "std::ops::Add", + as_trait = "std::ops::Rem", kind = "MetaFunction", output(proxy), - composite = "add", - metamethod = "Add", + composite = "rem", + metamethod = "Mod", )] - fn add(self, rhs: u32) -> bevy::math::UVec4; + fn rem(self, #[proxy] rhs: bevy::math::UVec4) -> bevy::math::UVec4; "#, r#" @@ -8384,25 +8225,25 @@ struct UVec3 { r#" #[lua( - as_trait = "std::ops::Add", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "add", - metamethod = "Add", + composite = "mul", + metamethod = "Mul", )] - fn add(self, #[proxy] rhs: &glam::UVec4) -> bevy::math::UVec4; + fn mul(self, #[proxy] rhs: bevy::math::UVec4) -> bevy::math::UVec4; "#, r#" #[lua( - as_trait = "std::ops::Add", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "add", - metamethod = "Add", + composite = "mul", + metamethod = "Mul", )] - fn add(self, #[proxy] rhs: bevy::math::UVec4) -> bevy::math::UVec4; + fn mul(self, #[proxy] rhs: &glam::UVec4) -> bevy::math::UVec4; "#, r#" @@ -8414,7 +8255,7 @@ struct UVec3 { composite = "sub", metamethod = "Sub", )] - fn sub(self, #[proxy] rhs: bevy::math::UVec4) -> bevy::math::UVec4; + fn sub(self, rhs: u32) -> bevy::math::UVec4; "#, r#" @@ -8432,36 +8273,25 @@ struct UVec3 { r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &glam::UVec4) -> bool; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "add", + metamethod = "Add", )] - fn mul(self, rhs: u32) -> bevy::math::UVec4; + fn add(self, rhs: u32) -> bevy::math::UVec4; "#, r#" #[lua( - as_trait = "std::ops::Rem", + as_trait = "std::ops::Sub", kind = "MetaFunction", output(proxy), - composite = "rem", - metamethod = "Mod", + composite = "sub", + metamethod = "Sub", )] - fn rem(self, #[proxy] rhs: &glam::UVec4) -> bevy::math::UVec4; + fn sub(self, #[proxy] rhs: bevy::math::UVec4) -> bevy::math::UVec4; "#, r#" @@ -8479,31 +8309,36 @@ struct UVec3 { r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::cmp::PartialEq", kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "eq", + metamethod = "Eq", )] - fn mul(self, #[proxy] rhs: &glam::UVec4) -> bevy::math::UVec4; + fn eq(&self, #[proxy] other: &glam::UVec4) -> bool; "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua( + as_trait = "std::ops::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, rhs: u32) -> bevy::math::UVec4; "#, r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "add", + metamethod = "Add", )] - fn div(self, #[proxy] rhs: bevy::math::UVec4) -> bevy::math::UVec4; + fn add(self, #[proxy] rhs: &glam::UVec4) -> bevy::math::UVec4; "#, r#" @@ -8537,26 +8372,8 @@ struct UVec4 { remote = "bevy::math::U64Vec2", functions[r#" - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, #[proxy] rhs: &glam::U64Vec2) -> bevy::math::U64Vec2; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::U64Vec2; + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); "#, r#" @@ -8568,73 +8385,7 @@ struct UVec4 { composite = "sub", metamethod = "Sub", )] - fn sub(self, rhs: u64) -> bevy::math::U64Vec2; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::U64Vec2; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: &glam::U64Vec2) -> bevy::math::U64Vec2; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, #[proxy] rhs: &glam::U64Vec2) -> bevy::math::U64Vec2; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, #[proxy] rhs: &glam::U64Vec2) -> bevy::math::U64Vec2; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, rhs: u64) -> bevy::math::U64Vec2; + fn sub(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::U64Vec2; "#, r#" @@ -8970,17 +8721,6 @@ struct UVec4 { rhs: bevy::math::I64Vec2, ) -> bevy::math::U64Vec2; -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &glam::U64Vec2) -> bool; - "#, r#" @@ -8997,37 +8737,25 @@ struct UVec4 { r#" #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, rhs: u64) -> bevy::math::U64Vec2; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "add", - metamethod = "Add", + composite = "mul", + metamethod = "Mul", )] - fn add(self, rhs: u64) -> bevy::math::U64Vec2; + fn mul(self, #[proxy] rhs: &glam::U64Vec2) -> bevy::math::U64Vec2; "#, r#" #[lua( - as_trait = "std::ops::Add", + as_trait = "std::ops::Div", kind = "MetaFunction", output(proxy), - composite = "add", - metamethod = "Add", + composite = "div", + metamethod = "Div", )] - fn add(self, #[proxy] rhs: &glam::U64Vec2) -> bevy::math::U64Vec2; + fn div(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::U64Vec2; "#, r#" @@ -9039,80 +8767,67 @@ struct UVec4 { composite = "sub", metamethod = "Sub", )] - fn sub(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::U64Vec2; + fn sub(self, rhs: u64) -> bevy::math::U64Vec2; "#, r#" #[lua( - as_trait = "std::ops::Rem", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "rem", - metamethod = "Mod", + composite = "mul", + metamethod = "Mul", )] - fn rem(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::U64Vec2; + fn mul(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::U64Vec2; "#, r#" #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", + as_trait = "std::ops::Mul", + kind = "MetaFunction", output(proxy), + composite = "mul", + metamethod = "Mul", )] - fn clone(&self) -> bevy::math::U64Vec2; + fn mul(self, rhs: u64) -> bevy::math::U64Vec2; "#, r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "add", + metamethod = "Add", )] - fn div(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::U64Vec2; + fn add(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::U64Vec2; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct U64Vec2 { - x: u64, - y: u64, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::math::U64Vec3", - functions[r#" #[lua( - as_trait = "std::ops::Add", + as_trait = "std::ops::Rem", kind = "MetaFunction", output(proxy), - composite = "add", - metamethod = "Add", + composite = "rem", + metamethod = "Mod", )] - fn add(self, #[proxy] rhs: bevy::math::U64Vec3) -> bevy::math::U64Vec3; + fn rem(self, #[proxy] rhs: &glam::U64Vec2) -> bevy::math::U64Vec2; "#, r#" #[lua( - as_trait = "std::ops::Sub", + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "sub", - metamethod = "Sub", + composite = "add", + metamethod = "Add", )] - fn sub(self, #[proxy] rhs: &glam::U64Vec3) -> bevy::math::U64Vec3; + fn add(self, #[proxy] rhs: &glam::U64Vec2) -> bevy::math::U64Vec2; "#, r#" @@ -9124,19 +8839,19 @@ struct U64Vec2 { composite = "add", metamethod = "Add", )] - fn add(self, rhs: u64) -> bevy::math::U64Vec3; + fn add(self, rhs: u64) -> bevy::math::U64Vec2; "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Rem", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "rem", + metamethod = "Mod", )] - fn mul(self, #[proxy] rhs: &glam::U64Vec3) -> bevy::math::U64Vec3; + fn rem(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::U64Vec2; "#, r#" @@ -9148,31 +8863,18 @@ struct U64Vec2 { composite = "div", metamethod = "Div", )] - fn div(self, #[proxy] rhs: &glam::U64Vec3) -> bevy::math::U64Vec3; + fn div(self, #[proxy] rhs: &glam::U64Vec2) -> bevy::math::U64Vec2; "#, r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::cmp::PartialEq", kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", + composite = "eq", + metamethod = "Eq", )] - fn div(self, rhs: u64) -> bevy::math::U64Vec3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, #[proxy] rhs: bevy::math::U64Vec3) -> bevy::math::U64Vec3; + fn eq(&self, #[proxy] other: &glam::U64Vec2) -> bool; "#, r#" @@ -9184,25 +8886,17 @@ struct U64Vec2 { composite = "sub", metamethod = "Sub", )] - fn sub(self, #[proxy] rhs: bevy::math::U64Vec3) -> bevy::math::U64Vec3; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + fn sub(self, #[proxy] rhs: &glam::U64Vec2) -> bevy::math::U64Vec2; "#, r#" #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", output(proxy), - composite = "div", - metamethod = "Div", )] - fn div(self, #[proxy] rhs: bevy::math::U64Vec3) -> bevy::math::U64Vec3; + fn clone(&self) -> bevy::math::U64Vec2; "#, r#" @@ -9214,30 +8908,46 @@ struct U64Vec2 { composite = "rem", metamethod = "Mod", )] - fn rem(self, rhs: u64) -> bevy::math::U64Vec3; + fn rem(self, rhs: u64) -> bevy::math::U64Vec2; "#, r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct U64Vec2 { + x: u64, + y: u64, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::math::U64Vec3", + functions[r#" #[lua( - as_trait = "std::ops::Rem", + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "rem", - metamethod = "Mod", + composite = "add", + metamethod = "Add", )] - fn rem(self, #[proxy] rhs: &glam::U64Vec3) -> bevy::math::U64Vec3; + fn add(self, rhs: u64) -> bevy::math::U64Vec3; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", + as_trait = "std::ops::Sub", kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", + output(proxy), + composite = "sub", + metamethod = "Sub", )] - fn eq(&self, #[proxy] other: &glam::U64Vec3) -> bool; + fn sub(self, #[proxy] rhs: bevy::math::U64Vec3) -> bevy::math::U64Vec3; "#, r#" @@ -9255,13 +8965,13 @@ struct U64Vec2 { r#" #[lua( - as_trait = "std::ops::Sub", + as_trait = "std::ops::Rem", kind = "MetaFunction", output(proxy), - composite = "sub", - metamethod = "Sub", + composite = "rem", + metamethod = "Mod", )] - fn sub(self, rhs: u64) -> bevy::math::U64Vec3; + fn rem(self, rhs: u64) -> bevy::math::U64Vec3; "#, r#" @@ -9279,23 +8989,25 @@ struct U64Vec2 { r#" #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", + as_trait = "std::ops::Rem", + kind = "MetaFunction", output(proxy), + composite = "rem", + metamethod = "Mod", )] - fn clone(&self) -> bevy::math::U64Vec3; + fn rem(self, #[proxy] rhs: bevy::math::U64Vec3) -> bevy::math::U64Vec3; "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Sub", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "sub", + metamethod = "Sub", )] - fn mul(self, rhs: u64) -> bevy::math::U64Vec3; + fn sub(self, rhs: u64) -> bevy::math::U64Vec3; "#, r#" @@ -9662,31 +9374,44 @@ struct U64Vec2 { "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct U64Vec3 { - x: u64, - y: u64, - z: u64, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::math::U64Vec4", - functions[r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "add", + metamethod = "Add", )] - fn div(self, #[proxy] rhs: &glam::U64Vec4) -> bevy::math::U64Vec4; + fn add(self, #[proxy] rhs: bevy::math::U64Vec3) -> bevy::math::U64Vec3; + +"#, + r#" + + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &glam::U64Vec3) -> bool; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, rhs: u64) -> bevy::math::U64Vec3; "#, r#" @@ -9698,25 +9423,31 @@ struct U64Vec3 { composite = "div", metamethod = "Div", )] - fn div(self, rhs: u64) -> bevy::math::U64Vec4; + fn div(self, #[proxy] rhs: &glam::U64Vec3) -> bevy::math::U64Vec3; "#, r#" #[lua( - as_trait = "std::ops::Sub", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "sub", - metamethod = "Sub", + composite = "mul", + metamethod = "Mul", )] - fn sub(self, #[proxy] rhs: bevy::math::U64Vec4) -> bevy::math::U64Vec4; + fn mul(self, #[proxy] rhs: &glam::U64Vec3) -> bevy::math::U64Vec3; "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, rhs: u64) -> bevy::math::U64Vec3; "#, r#" @@ -9728,19 +9459,19 @@ struct U64Vec3 { composite = "rem", metamethod = "Mod", )] - fn rem(self, #[proxy] rhs: &glam::U64Vec4) -> bevy::math::U64Vec4; + fn rem(self, #[proxy] rhs: &glam::U64Vec3) -> bevy::math::U64Vec3; "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Sub", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "sub", + metamethod = "Sub", )] - fn mul(self, rhs: u64) -> bevy::math::U64Vec4; + fn sub(self, #[proxy] rhs: &glam::U64Vec3) -> bevy::math::U64Vec3; "#, r#" @@ -9750,71 +9481,258 @@ struct U64Vec3 { kind = "Method", output(proxy), )] - fn clone(&self) -> bevy::math::U64Vec4; + fn clone(&self) -> bevy::math::U64Vec3; "#, r#" #[lua( - as_trait = "std::ops::Add", + as_trait = "std::ops::Div", kind = "MetaFunction", output(proxy), - composite = "add", - metamethod = "Add", + composite = "div", + metamethod = "Div", )] - fn add(self, rhs: u64) -> bevy::math::U64Vec4; + fn div(self, #[proxy] rhs: bevy::math::U64Vec3) -> bevy::math::U64Vec3; "#, r#" -/// Creates a new vector. +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct U64Vec3 { + x: u64, + y: u64, + z: u64, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::math::U64Vec4", + functions[r#" - #[lua(kind = "Function", output(proxy))] - fn new(x: u64, y: u64, z: u64, w: u64) -> bevy::math::U64Vec4; + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, rhs: u64) -> bevy::math::U64Vec4; "#, r#" -/// Creates a vector with all elements set to `v`. - #[lua(kind = "Function", output(proxy))] - fn splat(v: u64) -> bevy::math::U64Vec4; + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); "#, r#" -/// Creates a vector from the elements in `if_true` and `if_false`, selecting which to use -/// for each element of `self`. -/// A true element in the mask uses the corresponding element from `if_true`, and false -/// uses the element from `if_false`. - #[lua(kind = "Function", output(proxy))] - fn select( - #[proxy] - mask: bevy::math::BVec4, - #[proxy] - if_true: bevy::math::U64Vec4, - #[proxy] - if_false: bevy::math::U64Vec4, - ) -> bevy::math::U64Vec4; + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, rhs: u64) -> bevy::math::U64Vec4; "#, r#" -/// Creates a new vector from an array. - #[lua(kind = "Function", output(proxy))] - fn from_array(a: [u64; 4]) -> bevy::math::U64Vec4; + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: &glam::U64Vec4) -> bevy::math::U64Vec4; "#, r#" -/// `[x, y, z, w]` - #[lua(kind = "Method")] - fn to_array(&self) -> [u64; 4]; + #[lua( + as_trait = "std::ops::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, #[proxy] rhs: bevy::math::U64Vec4) -> bevy::math::U64Vec4; "#, r#" -/// Creates a 3D vector from the `x`, `y` and `z` elements of `self`, discarding `w`. -/// Truncation to [`U64Vec3`] may also be performed by using [`self.xyz()`][crate::swizzles::Vec4Swizzles::xyz()]. - #[lua(kind = "Method", output(proxy))] + #[lua( + as_trait = "std::ops::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, #[proxy] rhs: &glam::U64Vec4) -> bevy::math::U64Vec4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, #[proxy] rhs: bevy::math::U64Vec4) -> bevy::math::U64Vec4; + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &glam::U64Vec4) -> bool; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, #[proxy] rhs: bevy::math::U64Vec4) -> bevy::math::U64Vec4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, rhs: u64) -> bevy::math::U64Vec4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(self, #[proxy] rhs: bevy::math::U64Vec4) -> bevy::math::U64Vec4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: bevy::math::U64Vec4) -> bevy::math::U64Vec4; + +"#, + r#" + + #[lua( + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", + output(proxy), + )] + fn clone(&self) -> bevy::math::U64Vec4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, #[proxy] rhs: &glam::U64Vec4) -> bevy::math::U64Vec4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(self, #[proxy] rhs: &glam::U64Vec4) -> bevy::math::U64Vec4; + +"#, + r#" +/// Creates a new vector. + + #[lua(kind = "Function", output(proxy))] + fn new(x: u64, y: u64, z: u64, w: u64) -> bevy::math::U64Vec4; + +"#, + r#" +/// Creates a vector with all elements set to `v`. + + #[lua(kind = "Function", output(proxy))] + fn splat(v: u64) -> bevy::math::U64Vec4; + +"#, + r#" +/// Creates a vector from the elements in `if_true` and `if_false`, selecting which to use +/// for each element of `self`. +/// A true element in the mask uses the corresponding element from `if_true`, and false +/// uses the element from `if_false`. + + #[lua(kind = "Function", output(proxy))] + fn select( + #[proxy] + mask: bevy::math::BVec4, + #[proxy] + if_true: bevy::math::U64Vec4, + #[proxy] + if_false: bevy::math::U64Vec4, + ) -> bevy::math::U64Vec4; + +"#, + r#" +/// Creates a new vector from an array. + + #[lua(kind = "Function", output(proxy))] + fn from_array(a: [u64; 4]) -> bevy::math::U64Vec4; + +"#, + r#" +/// `[x, y, z, w]` + + #[lua(kind = "Method")] + fn to_array(&self) -> [u64; 4]; + +"#, + r#" +/// Creates a 3D vector from the `x`, `y` and `z` elements of `self`, discarding `w`. +/// Truncation to [`U64Vec3`] may also be performed by using [`self.xyz()`][crate::swizzles::Vec4Swizzles::xyz()]. + + #[lua(kind = "Method", output(proxy))] fn truncate(self) -> bevy::math::U64Vec3; "#, @@ -10117,25 +10035,25 @@ struct U64Vec3 { r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Sub", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "sub", + metamethod = "Sub", )] - fn div(self, #[proxy] rhs: bevy::math::U64Vec4) -> bevy::math::U64Vec4; + fn sub(self, rhs: u64) -> bevy::math::U64Vec4; "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "add", + metamethod = "Add", )] - fn mul(self, #[proxy] rhs: bevy::math::U64Vec4) -> bevy::math::U64Vec4; + fn add(self, #[proxy] rhs: &glam::U64Vec4) -> bevy::math::U64Vec4; "#, r#" @@ -10147,7 +10065,36 @@ struct U64Vec3 { composite = "add", metamethod = "Add", )] - fn add(self, #[proxy] rhs: bevy::math::U64Vec4) -> bevy::math::U64Vec4; + fn add(self, rhs: u64) -> bevy::math::U64Vec4; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct U64Vec4 { + x: u64, + y: u64, + z: u64, + w: u64, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::math::Vec2", + functions[r#" + + #[lua( + as_trait = "std::ops::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, rhs: f32) -> bevy::math::Vec2; "#, r#" @@ -10159,7 +10106,7 @@ struct U64Vec3 { composite = "add", metamethod = "Add", )] - fn add(self, #[proxy] rhs: &glam::U64Vec4) -> bevy::math::U64Vec4; + fn add(self, rhs: f32) -> bevy::math::Vec2; "#, r#" @@ -10171,30 +10118,31 @@ struct U64Vec3 { composite = "sub", metamethod = "Sub", )] - fn sub(self, rhs: u64) -> bevy::math::U64Vec4; + fn sub(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", + as_trait = "std::ops::Add", kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", + output(proxy), + composite = "add", + metamethod = "Add", )] - fn eq(&self, #[proxy] other: &glam::U64Vec4) -> bool; + fn add(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; "#, r#" #[lua( - as_trait = "std::ops::Rem", + as_trait = "std::ops::Div", kind = "MetaFunction", output(proxy), - composite = "rem", - metamethod = "Mod", + composite = "div", + metamethod = "Div", )] - fn rem(self, rhs: u64) -> bevy::math::U64Vec4; + fn div(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; "#, r#" @@ -10206,7 +10154,18 @@ struct U64Vec3 { composite = "rem", metamethod = "Mod", )] - fn rem(self, #[proxy] rhs: bevy::math::U64Vec4) -> bevy::math::U64Vec4; + fn rem(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &glam::Vec2) -> bool; "#, r#" @@ -10218,96 +10177,19 @@ struct U64Vec3 { composite = "mul", metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: &glam::U64Vec4) -> bevy::math::U64Vec4; + fn mul(self, #[proxy] rhs: &glam::Vec2) -> bevy::math::Vec2; "#, r#" #[lua( - as_trait = "std::ops::Sub", + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "sub", - metamethod = "Sub", + composite = "add", + metamethod = "Add", )] - fn sub(self, #[proxy] rhs: &glam::U64Vec4) -> bevy::math::U64Vec4; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct U64Vec4 { - x: u64, - y: u64, - z: u64, - w: u64, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::math::Vec2", - functions[r#" - - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Neg", - kind = "MetaFunction", - output(proxy), - composite = "neg", - metamethod = "Unm", - )] - fn neg(self) -> bevy::math::Vec2; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, rhs: f32) -> bevy::math::Vec2; + fn add(self, #[proxy] rhs: &glam::Vec2) -> bevy::math::Vec2; "#, r#" @@ -10331,88 +10213,7 @@ struct U64Vec4 { composite = "mul", metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: &glam::Vec2) -> bevy::math::Vec2; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, #[proxy] rhs: &glam::Vec2) -> bevy::math::Vec2; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, #[proxy] rhs: &glam::Vec2) -> bevy::math::Vec2; - -"#, - r#" - - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::Vec2; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &glam::Vec2) -> bool; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, #[proxy] rhs: &glam::Vec2) -> bevy::math::Vec2; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, rhs: f32) -> bevy::math::Vec2; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; + fn mul(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; "#, r#" @@ -11112,13 +10913,13 @@ struct U64Vec4 { r#" #[lua( - as_trait = "std::ops::Add", + as_trait = "std::ops::Neg", kind = "MetaFunction", output(proxy), - composite = "add", - metamethod = "Add", + composite = "neg", + metamethod = "Unm", )] - fn add(self, #[proxy] rhs: &glam::Vec2) -> bevy::math::Vec2; + fn neg(self) -> bevy::math::Vec2; "#, r#" @@ -11130,7 +10931,7 @@ struct U64Vec4 { composite = "mul", metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; + fn mul(self, rhs: f32) -> bevy::math::Vec2; "#, r#" @@ -11142,19 +10943,53 @@ struct U64Vec4 { composite = "rem", metamethod = "Mod", )] - fn rem(self, rhs: f32) -> bevy::math::Vec2; + fn rem(self, #[proxy] rhs: &glam::Vec2) -> bevy::math::Vec2; "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Sub", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "sub", + metamethod = "Sub", )] - fn mul(self, rhs: f32) -> bevy::math::Vec2; + fn sub(self, #[proxy] rhs: &glam::Vec2) -> bevy::math::Vec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, #[proxy] rhs: &glam::Vec2) -> bevy::math::Vec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, rhs: f32) -> bevy::math::Vec2; + +"#, + r#" + + #[lua( + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", + output(proxy), + )] + fn clone(&self) -> bevy::math::Vec2; "#, r#" @@ -11187,47 +11022,237 @@ struct Vec2 { functions[r#" #[lua( - as_trait = "std::ops::Sub", + as_trait = "std::ops::Rem", kind = "MetaFunction", output(proxy), - composite = "sub", - metamethod = "Sub", + composite = "rem", + metamethod = "Mod", )] - fn sub(self, #[proxy] rhs: &glam::Vec3A) -> bevy::math::Vec3A; + fn rem(self, rhs: f32) -> bevy::math::Vec3A; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", + as_trait = "std::ops::Sub", kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", + output(proxy), + composite = "sub", + metamethod = "Sub", )] - fn eq(&self, #[proxy] rhs: &glam::Vec3A) -> bool; + fn sub(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; "#, r#" -/// Creates a new vector. - #[lua(kind = "Function", output(proxy))] - fn new(x: f32, y: f32, z: f32) -> bevy::math::Vec3A; + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; "#, r#" -/// Creates a vector with all elements set to `v`. - #[lua(kind = "Function", output(proxy))] - fn splat(v: f32) -> bevy::math::Vec3A; + #[lua( + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", + output(proxy), + )] + fn clone(&self) -> bevy::math::Vec3A; "#, r#" -/// Creates a vector from the elements in `if_true` and `if_false`, selecting which to use -/// for each element of `self`. -/// A true element in the mask uses the corresponding element from `if_true`, and false -/// uses the element from `if_false`. - #[lua(kind = "Function", output(proxy))] + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, rhs: f32) -> bevy::math::Vec3A; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, rhs: f32) -> bevy::math::Vec3A; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, #[proxy] rhs: &glam::Vec3A) -> bevy::math::Vec3A; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(self, rhs: f32) -> bevy::math::Vec3A; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, rhs: f32) -> bevy::math::Vec3A; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(self, #[proxy] rhs: &glam::Vec3A) -> bevy::math::Vec3A; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, #[proxy] rhs: &glam::Vec3A) -> bevy::math::Vec3A; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, #[proxy] rhs: &glam::Vec3A) -> bevy::math::Vec3A; + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] rhs: &glam::Vec3A) -> bool; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Neg", + kind = "MetaFunction", + output(proxy), + composite = "neg", + metamethod = "Unm", + )] + fn neg(self) -> bevy::math::Vec3A; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: &glam::Vec3A) -> bevy::math::Vec3A; + +"#, + r#" +/// Creates a new vector. + + #[lua(kind = "Function", output(proxy))] + fn new(x: f32, y: f32, z: f32) -> bevy::math::Vec3A; + +"#, + r#" +/// Creates a vector with all elements set to `v`. + + #[lua(kind = "Function", output(proxy))] + fn splat(v: f32) -> bevy::math::Vec3A; + +"#, + r#" +/// Creates a vector from the elements in `if_true` and `if_false`, selecting which to use +/// for each element of `self`. +/// A true element in the mask uses the corresponding element from `if_true`, and false +/// uses the element from `if_false`. + + #[lua(kind = "Function", output(proxy))] fn select( #[proxy] mask: bevy::math::BVec3A, @@ -11897,18 +11922,30 @@ struct Vec2 { "#, r#" - - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, rhs: f32) -> bevy::math::Vec3A; - +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} "#, r#" +#[lua(kind="MetaMethod", raw , metamethod="Index")] +fn index(&self, lua: &Lua, idx: crate::lua::util::LuaIndex) -> Result { + Ok(self.inner()?[*idx]) +} +"#, + r#" +#[lua(kind="MutatingMetaMethod", raw, metamethod="NewIndex")] +fn index(&mut self, lua: &Lua, idx: crate::lua::util::LuaIndex, val: f32) -> Result<(),_> { + self.val_mut(|s| Ok(s[*idx] = val))? +} +"#] +)] +struct Vec3A(); +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::math::Vec4", + functions[r#" #[lua( as_trait = "std::ops::Div", @@ -11917,19 +11954,7 @@ struct Vec2 { composite = "div", metamethod = "Div", )] - fn div(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, #[proxy] rhs: &glam::Vec3A) -> bevy::math::Vec3A; + fn div(self, rhs: f32) -> bevy::math::Vec4; "#, r#" @@ -11941,19 +11966,17 @@ struct Vec2 { composite = "mul", metamethod = "Mul", )] - fn mul(self, rhs: f32) -> bevy::math::Vec3A; + fn mul(self, rhs: f32) -> bevy::math::Vec4; "#, r#" #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", output(proxy), - composite = "mul", - metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; + fn clone(&self) -> bevy::math::Vec4; "#, r#" @@ -11965,31 +11988,31 @@ struct Vec2 { composite = "div", metamethod = "Div", )] - fn div(self, rhs: f32) -> bevy::math::Vec3A; + fn div(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::Vec4; "#, r#" #[lua( - as_trait = "std::ops::Neg", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "neg", - metamethod = "Unm", + composite = "mul", + metamethod = "Mul", )] - fn neg(self) -> bevy::math::Vec3A; + fn mul(self, #[proxy] rhs: &glam::Vec4) -> bevy::math::Vec4; "#, r#" #[lua( - as_trait = "std::ops::Add", + as_trait = "std::ops::Rem", kind = "MetaFunction", output(proxy), - composite = "add", - metamethod = "Add", + composite = "rem", + metamethod = "Mod", )] - fn add(self, #[proxy] rhs: &glam::Vec3A) -> bevy::math::Vec3A; + fn rem(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::Vec4; "#, r#" @@ -12001,31 +12024,30 @@ struct Vec2 { composite = "add", metamethod = "Add", )] - fn add(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; + fn add(self, rhs: f32) -> bevy::math::Vec4; "#, r#" #[lua( - as_trait = "std::ops::Sub", + as_trait = "std::ops::Rem", kind = "MetaFunction", output(proxy), - composite = "sub", - metamethod = "Sub", + composite = "rem", + metamethod = "Mod", )] - fn sub(self, rhs: f32) -> bevy::math::Vec3A; + fn rem(self, #[proxy] rhs: &glam::Vec4) -> bevy::math::Vec4; "#, r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::cmp::PartialEq", kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", + composite = "eq", + metamethod = "Eq", )] - fn div(self, #[proxy] rhs: &glam::Vec3A) -> bevy::math::Vec3A; + fn eq(&self, #[proxy] rhs: &glam::Vec4) -> bool; "#, r#" @@ -12037,7 +12059,7 @@ struct Vec2 { composite = "add", metamethod = "Add", )] - fn add(self, rhs: f32) -> bevy::math::Vec3A; + fn add(self, #[proxy] rhs: &glam::Vec4) -> bevy::math::Vec4; "#, r#" @@ -12049,68 +12071,46 @@ struct Vec2 { composite = "rem", metamethod = "Mod", )] - fn rem(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; + fn rem(self, rhs: f32) -> bevy::math::Vec4; "#, r#" #[lua( - as_trait = "std::ops::Sub", + as_trait = "std::ops::Neg", kind = "MetaFunction", output(proxy), - composite = "sub", - metamethod = "Sub", + composite = "neg", + metamethod = "Unm", )] - fn sub(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; + fn neg(self) -> bevy::math::Vec4; "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Div", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "div", + metamethod = "Div", )] - fn mul(self, #[proxy] rhs: &glam::Vec3A) -> bevy::math::Vec3A; + fn div(self, #[proxy] rhs: &glam::Vec4) -> bevy::math::Vec4; "#, r#" #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", + as_trait = "std::ops::Sub", + kind = "MetaFunction", output(proxy), + composite = "sub", + metamethod = "Sub", )] - fn clone(&self) -> bevy::math::Vec3A; + fn sub(self, #[proxy] rhs: &glam::Vec4) -> bevy::math::Vec4; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#, - r#" -#[lua(kind="MetaMethod", raw , metamethod="Index")] -fn index(&self, lua: &Lua, idx: crate::lua::util::LuaIndex) -> Result { - Ok(self.inner()?[*idx]) -} -"#, - r#" -#[lua(kind="MutatingMetaMethod", raw, metamethod="NewIndex")] -fn index(&mut self, lua: &Lua, idx: crate::lua::util::LuaIndex, val: f32) -> Result<(),_> { - self.val_mut(|s| Ok(s[*idx] = val))? -} -"#] -)] -struct Vec3A(); -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::math::Vec4", - functions[r#" /// Creates a new vector. #[lua(kind = "Function", output(proxy))] @@ -12752,49 +12752,37 @@ struct Vec3A(); r#" #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, rhs: f32) -> bevy::math::Vec4; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "add", + metamethod = "Add", )] - fn div(self, #[proxy] rhs: &glam::Vec4) -> bevy::math::Vec4; + fn add(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::Vec4; "#, r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "mul", + metamethod = "Mul", )] - fn div(self, rhs: f32) -> bevy::math::Vec4; + fn mul(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::Vec4; "#, r#" #[lua( - as_trait = "std::ops::Neg", + as_trait = "std::ops::Sub", kind = "MetaFunction", output(proxy), - composite = "neg", - metamethod = "Unm", + composite = "sub", + metamethod = "Sub", )] - fn neg(self) -> bevy::math::Vec4; + fn sub(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::Vec4; "#, r#" @@ -12806,160 +12794,118 @@ struct Vec3A(); composite = "sub", metamethod = "Sub", )] - fn sub(self, #[proxy] rhs: &glam::Vec4) -> bevy::math::Vec4; + fn sub(self, rhs: f32) -> bevy::math::Vec4; "#, r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#, + r#" +#[lua(kind="MetaMethod", raw , metamethod="Index")] +fn index(&self, lua: &Lua, idx: crate::lua::util::LuaIndex) -> Result { + Ok(self.inner()?[*idx]) +} +"#, + r#" +#[lua(kind="MutatingMetaMethod", raw, metamethod="NewIndex")] +fn index(&mut self, lua: &Lua, idx: crate::lua::util::LuaIndex, val: f32) -> Result<(),_> { + self.val_mut(|s| Ok(s[*idx] = val))? +} +"#] +)] +struct Vec4(); +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::math::BVec2", + functions[r#" #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", output(proxy), - composite = "add", - metamethod = "Add", )] - fn add(self, rhs: f32) -> bevy::math::Vec4; + fn clone(&self) -> bevy::math::BVec2; "#, r#" - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::Vec4; + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); "#, r#" +/// Creates a new vector mask. - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, #[proxy] rhs: &glam::Vec4) -> bevy::math::Vec4; + #[lua(kind = "Function", output(proxy))] + fn new(x: bool, y: bool) -> bevy::math::BVec2; "#, r#" +/// Creates a vector mask with all elements set to `v`. - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, rhs: f32) -> bevy::math::Vec4; + #[lua(kind = "Function", output(proxy))] + fn splat(v: bool) -> bevy::math::BVec2; "#, r#" +/// Creates a new vector mask from a bool array. - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::Vec4; + #[lua(kind = "Function", output(proxy))] + fn from_array(a: [bool; 2]) -> bevy::math::BVec2; "#, r#" +/// Returns a bitmask with the lowest 2 bits set from the elements of `self`. +/// A true element results in a `1` bit and a false element in a `0` bit. Element `x` goes +/// into the first lowest bit, element `y` into the second, etc. - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: &glam::Vec4) -> bevy::math::Vec4; + #[lua(kind = "Method")] + fn bitmask(self) -> u32; "#, r#" +/// Returns true if any of the elements are true, false otherwise. - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::Vec4; + #[lua(kind = "Method")] + fn any(self) -> bool; "#, r#" +/// Returns true if all the elements are true, false otherwise. - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] rhs: &glam::Vec4) -> bool; + #[lua(kind = "Method")] + fn all(self) -> bool; "#, r#" +/// Tests the value at `index`. +/// Panics if `index` is greater than 1. - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::Vec4; + #[lua(kind = "Method")] + fn test(&self, index: usize) -> bool; "#, r#" +/// Sets the element at `index`. +/// Panics if `index` is greater than 1. - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::Vec4; + #[lua(kind = "MutatingMethod")] + fn set(&mut self, index: usize, value: bool) -> (); "#, r#" #[lua( - as_trait = "std::ops::Add", + as_trait = "std::cmp::PartialEq", kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", + composite = "eq", + metamethod = "Eq", )] - fn add(self, #[proxy] rhs: &glam::Vec4) -> bevy::math::Vec4; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::Vec4; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, rhs: f32) -> bevy::math::Vec4; + fn eq(&self, #[proxy] other: &glam::BVec2) -> bool; "#, r#" @@ -12967,54 +12913,39 @@ struct Vec3A(); fn index(&self) -> String { format!("{:?}", _self) } -"#, - r#" -#[lua(kind="MetaMethod", raw , metamethod="Index")] -fn index(&self, lua: &Lua, idx: crate::lua::util::LuaIndex) -> Result { - Ok(self.inner()?[*idx]) -} -"#, - r#" -#[lua(kind="MutatingMetaMethod", raw, metamethod="NewIndex")] -fn index(&mut self, lua: &Lua, idx: crate::lua::util::LuaIndex, val: f32) -> Result<(),_> { - self.val_mut(|s| Ok(s[*idx] = val))? -} "#] )] -struct Vec4(); +struct BVec2 { + x: bool, + y: bool, +} #[derive(bevy_mod_scripting_lua_derive::LuaProxy)] #[proxy( derive(clone), - remote = "bevy::math::BVec2", + remote = "bevy::math::BVec3", functions[r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - -"#, - r#" /// Creates a new vector mask. #[lua(kind = "Function", output(proxy))] - fn new(x: bool, y: bool) -> bevy::math::BVec2; + fn new(x: bool, y: bool, z: bool) -> bevy::math::BVec3; "#, r#" /// Creates a vector mask with all elements set to `v`. #[lua(kind = "Function", output(proxy))] - fn splat(v: bool) -> bevy::math::BVec2; + fn splat(v: bool) -> bevy::math::BVec3; "#, r#" /// Creates a new vector mask from a bool array. #[lua(kind = "Function", output(proxy))] - fn from_array(a: [bool; 2]) -> bevy::math::BVec2; + fn from_array(a: [bool; 3]) -> bevy::math::BVec3; "#, r#" -/// Returns a bitmask with the lowest 2 bits set from the elements of `self`. +/// Returns a bitmask with the lowest 3 bits set from the elements of `self`. /// A true element results in a `1` bit and a false element in a `0` bit. Element `x` goes /// into the first lowest bit, element `y` into the second, etc. @@ -13038,7 +12969,7 @@ struct Vec4(); "#, r#" /// Tests the value at `index`. -/// Panics if `index` is greater than 1. +/// Panics if `index` is greater than 2. #[lua(kind = "Method")] fn test(&self, index: usize) -> bool; @@ -13046,7 +12977,7 @@ struct Vec4(); "#, r#" /// Sets the element at `index`. -/// Panics if `index` is greater than 1. +/// Panics if `index` is greater than 2. #[lua(kind = "MutatingMethod")] fn set(&mut self, index: usize, value: bool) -> (); @@ -13060,35 +12991,16 @@ struct Vec4(); composite = "eq", metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &glam::BVec2) -> bool; + fn eq(&self, #[proxy] other: &glam::BVec3) -> bool; "#, r#" - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::BVec2; + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct BVec2 { - x: bool, - y: bool, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::math::BVec3", - functions[r#" #[lua( as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", @@ -13097,83 +13009,6 @@ struct BVec2 { )] fn clone(&self) -> bevy::math::BVec3; -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - -"#, - r#" -/// Creates a new vector mask. - - #[lua(kind = "Function", output(proxy))] - fn new(x: bool, y: bool, z: bool) -> bevy::math::BVec3; - -"#, - r#" -/// Creates a vector mask with all elements set to `v`. - - #[lua(kind = "Function", output(proxy))] - fn splat(v: bool) -> bevy::math::BVec3; - -"#, - r#" -/// Creates a new vector mask from a bool array. - - #[lua(kind = "Function", output(proxy))] - fn from_array(a: [bool; 3]) -> bevy::math::BVec3; - -"#, - r#" -/// Returns a bitmask with the lowest 3 bits set from the elements of `self`. -/// A true element results in a `1` bit and a false element in a `0` bit. Element `x` goes -/// into the first lowest bit, element `y` into the second, etc. - - #[lua(kind = "Method")] - fn bitmask(self) -> u32; - -"#, - r#" -/// Returns true if any of the elements are true, false otherwise. - - #[lua(kind = "Method")] - fn any(self) -> bool; - -"#, - r#" -/// Returns true if all the elements are true, false otherwise. - - #[lua(kind = "Method")] - fn all(self) -> bool; - -"#, - r#" -/// Tests the value at `index`. -/// Panics if `index` is greater than 2. - - #[lua(kind = "Method")] - fn test(&self, index: usize) -> bool; - -"#, - r#" -/// Sets the element at `index`. -/// Panics if `index` is greater than 2. - - #[lua(kind = "MutatingMethod")] - fn set(&mut self, index: usize, value: bool) -> (); - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &glam::BVec3) -> bool; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -13193,6 +13028,12 @@ struct BVec3 { remote = "bevy::math::BVec4", functions[r#" + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -13261,12 +13102,6 @@ struct BVec3 { #[lua(kind = "MutatingMethod")] fn set(&mut self, index: usize, value: bool) -> (); -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - "#, r#" @@ -13298,83 +13133,85 @@ struct BVec4 { functions[r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Neg", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "neg", + metamethod = "Unm", )] - fn mul(self, #[proxy] rhs: &glam::DVec2) -> bevy::math::DVec2; + fn neg(self) -> bevy::math::DVec2; "#, r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Sub", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "sub", + metamethod = "Sub", )] - fn div(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; + fn sub(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; "#, r#" #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", + as_trait = "std::ops::Sub", + kind = "MetaFunction", output(proxy), + composite = "sub", + metamethod = "Sub", )] - fn clone(&self) -> bevy::math::DVec2; + fn sub(self, #[proxy] rhs: &glam::DVec2) -> bevy::math::DVec2; "#, r#" #[lua( - as_trait = "std::ops::Sub", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "sub", - metamethod = "Sub", + composite = "mul", + metamethod = "Mul", )] - fn sub(self, rhs: f64) -> bevy::math::DVec2; + fn mul(self, #[proxy] rhs: &glam::DVec2) -> bevy::math::DVec2; "#, r#" #[lua( - as_trait = "std::ops::Add", + as_trait = "std::ops::Div", kind = "MetaFunction", output(proxy), - composite = "add", - metamethod = "Add", + composite = "div", + metamethod = "Div", )] - fn add(self, #[proxy] rhs: &glam::DVec2) -> bevy::math::DVec2; + fn div(self, rhs: f64) -> bevy::math::DVec2; "#, r#" #[lua( - as_trait = "std::ops::Sub", + as_trait = "std::ops::Rem", kind = "MetaFunction", output(proxy), - composite = "sub", - metamethod = "Sub", + composite = "rem", + metamethod = "Mod", )] - fn sub(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; + fn rem(self, #[proxy] rhs: &glam::DVec2) -> bevy::math::DVec2; "#, r#" #[lua( - as_trait = "std::ops::Rem", + as_trait = "std::ops::Div", kind = "MetaFunction", output(proxy), - composite = "rem", - metamethod = "Mod", + composite = "div", + metamethod = "Div", )] - fn rem(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; + fn div(self, #[proxy] rhs: &glam::DVec2) -> bevy::math::DVec2; "#, r#" @@ -13386,7 +13223,7 @@ struct BVec4 { composite = "rem", metamethod = "Mod", )] - fn rem(self, rhs: f64) -> bevy::math::DVec2; + fn rem(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; "#, r#" @@ -13398,116 +13235,21 @@ struct BVec4 { composite = "sub", metamethod = "Sub", )] - fn sub(self, #[proxy] rhs: &glam::DVec2) -> bevy::math::DVec2; + fn sub(self, rhs: f64) -> bevy::math::DVec2; "#, r#" +/// Creates a new vector. - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &glam::DVec2) -> bool; + #[lua(kind = "Function", output(proxy))] + fn new(x: f64, y: f64) -> bevy::math::DVec2; "#, r#" +/// Creates a vector with all elements set to `v`. - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, rhs: f64) -> bevy::math::DVec2; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, rhs: f64) -> bevy::math::DVec2; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Neg", - kind = "MetaFunction", - output(proxy), - composite = "neg", - metamethod = "Unm", - )] - fn neg(self) -> bevy::math::DVec2; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, rhs: f64) -> bevy::math::DVec2; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, #[proxy] rhs: &glam::DVec2) -> bevy::math::DVec2; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; - -"#, - r#" -/// Creates a new vector. - - #[lua(kind = "Function", output(proxy))] - fn new(x: f64, y: f64) -> bevy::math::DVec2; - -"#, - r#" -/// Creates a vector with all elements set to `v`. - - #[lua(kind = "Function", output(proxy))] - fn splat(v: f64) -> bevy::math::DVec2; + #[lua(kind = "Function", output(proxy))] + fn splat(v: f64) -> bevy::math::DVec2; "#, r#" @@ -14197,6 +13939,18 @@ struct BVec4 { #[lua(kind = "Method", output(proxy))] fn as_u64vec2(&self) -> bevy::math::U64Vec2; +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, rhs: f64) -> bevy::math::DVec2; + "#, r#" @@ -14207,7 +13961,88 @@ struct BVec4 { composite = "div", metamethod = "Div", )] - fn div(self, #[proxy] rhs: &glam::DVec2) -> bevy::math::DVec2; + fn div(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, rhs: f64) -> bevy::math::DVec2; + +"#, + r#" + + #[lua( + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", + output(proxy), + )] + fn clone(&self) -> bevy::math::DVec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, #[proxy] rhs: &glam::DVec2) -> bevy::math::DVec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, rhs: f64) -> bevy::math::DVec2; + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &glam::DVec2) -> bool; "#, r#" @@ -14246,91 +14081,186 @@ struct DVec2 { composite = "add", metamethod = "Add", )] - fn add(self, #[proxy] rhs: &glam::DVec3) -> bevy::math::DVec3; + fn add(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; "#, r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "mul", + metamethod = "Mul", )] - fn div(self, #[proxy] rhs: &glam::DVec3) -> bevy::math::DVec3; + fn mul(self, #[proxy] rhs: &glam::DVec3) -> bevy::math::DVec3; "#, r#" #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", + as_trait = "std::ops::Sub", + kind = "MetaFunction", output(proxy), + composite = "sub", + metamethod = "Sub", )] - fn clone(&self) -> bevy::math::DVec3; + fn sub(self, #[proxy] rhs: &glam::DVec3) -> bevy::math::DVec3; "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Sub", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "sub", + metamethod = "Sub", )] - fn mul(self, rhs: f64) -> bevy::math::DVec3; + fn sub(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; "#, r#" #[lua( - as_trait = "std::ops::Rem", + as_trait = "std::ops::Div", kind = "MetaFunction", output(proxy), - composite = "rem", - metamethod = "Mod", + composite = "div", + metamethod = "Div", )] - fn rem(self, rhs: f64) -> bevy::math::DVec3; + fn div(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; "#, r#" -/// Creates a new vector. - #[lua(kind = "Function", output(proxy))] - fn new(x: f64, y: f64, z: f64) -> bevy::math::DVec3; + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; "#, r#" -/// Creates a vector with all elements set to `v`. - #[lua(kind = "Function", output(proxy))] - fn splat(v: f64) -> bevy::math::DVec3; + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, rhs: f64) -> bevy::math::DVec3; "#, r#" -/// Creates a vector from the elements in `if_true` and `if_false`, selecting which to use -/// for each element of `self`. -/// A true element in the mask uses the corresponding element from `if_true`, and false -/// uses the element from `if_false`. - #[lua(kind = "Function", output(proxy))] - fn select( - #[proxy] - mask: bevy::math::BVec3, - #[proxy] - if_true: bevy::math::DVec3, - #[proxy] - if_false: bevy::math::DVec3, - ) -> bevy::math::DVec3; + #[lua( + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", + output(proxy), + )] + fn clone(&self) -> bevy::math::DVec3; "#, r#" -/// Creates a new vector from an array. - #[lua(kind = "Function", output(proxy))] - fn from_array(a: [f64; 3]) -> bevy::math::DVec3; + #[lua( + as_trait = "std::ops::Neg", + kind = "MetaFunction", + output(proxy), + composite = "neg", + metamethod = "Unm", + )] + fn neg(self) -> bevy::math::DVec3; + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &glam::DVec3) -> bool; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(self, rhs: f64) -> bevy::math::DVec3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, rhs: f64) -> bevy::math::DVec3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, rhs: f64) -> bevy::math::DVec3; + +"#, + r#" +/// Creates a new vector. + + #[lua(kind = "Function", output(proxy))] + fn new(x: f64, y: f64, z: f64) -> bevy::math::DVec3; + +"#, + r#" +/// Creates a vector with all elements set to `v`. + + #[lua(kind = "Function", output(proxy))] + fn splat(v: f64) -> bevy::math::DVec3; + +"#, + r#" +/// Creates a vector from the elements in `if_true` and `if_false`, selecting which to use +/// for each element of `self`. +/// A true element in the mask uses the corresponding element from `if_true`, and false +/// uses the element from `if_false`. + + #[lua(kind = "Function", output(proxy))] + fn select( + #[proxy] + mask: bevy::math::BVec3, + #[proxy] + if_true: bevy::math::DVec3, + #[proxy] + if_false: bevy::math::DVec3, + ) -> bevy::math::DVec3; + +"#, + r#" +/// Creates a new vector from an array. + + #[lua(kind = "Function", output(proxy))] + fn from_array(a: [f64; 3]) -> bevy::math::DVec3; "#, r#" @@ -14982,18 +14912,6 @@ struct DVec2 { #[lua(kind = "Method", output(proxy))] fn as_u64vec3(&self) -> bevy::math::U64Vec3; -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; - "#, r#" @@ -15004,19 +14922,7 @@ struct DVec2 { composite = "div", metamethod = "Div", )] - fn div(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, rhs: f64) -> bevy::math::DVec3; + fn div(self, #[proxy] rhs: &glam::DVec3) -> bevy::math::DVec3; "#, r#" @@ -15030,54 +14936,6 @@ struct DVec2 { )] fn rem(self, #[proxy] rhs: &glam::DVec3) -> bevy::math::DVec3; -"#, - r#" - - #[lua( - as_trait = "std::ops::Neg", - kind = "MetaFunction", - output(proxy), - composite = "neg", - metamethod = "Unm", - )] - fn neg(self) -> bevy::math::DVec3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, #[proxy] rhs: &glam::DVec3) -> bevy::math::DVec3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, rhs: f64) -> bevy::math::DVec3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, rhs: f64) -> bevy::math::DVec3; - "#, r#" @@ -15090,18 +14948,6 @@ struct DVec2 { )] fn rem(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; - "#, r#" @@ -15112,7 +14958,7 @@ struct DVec2 { composite = "add", metamethod = "Add", )] - fn add(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; + fn add(self, #[proxy] rhs: &glam::DVec3) -> bevy::math::DVec3; "#, r#" @@ -15124,18 +14970,7 @@ struct DVec2 { composite = "mul", metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: &glam::DVec3) -> bevy::math::DVec3; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &glam::DVec3) -> bool; + fn mul(self, rhs: f64) -> bevy::math::DVec3; "#, r#" @@ -15169,13 +15004,23 @@ struct DVec3 { functions[r#" #[lua( - as_trait = "std::ops::Neg", + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", + output(proxy), + )] + fn clone(&self) -> bevy::math::DVec4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Rem", kind = "MetaFunction", output(proxy), - composite = "neg", - metamethod = "Unm", + composite = "rem", + metamethod = "Mod", )] - fn neg(self) -> bevy::math::DVec4; + fn rem(self, #[proxy] rhs: &glam::DVec4) -> bevy::math::DVec4; "#, r#" @@ -15187,7 +15032,7 @@ struct DVec3 { composite = "add", metamethod = "Add", )] - fn add(self, #[proxy] rhs: &glam::DVec4) -> bevy::math::DVec4; + fn add(self, rhs: f64) -> bevy::math::DVec4; "#, r#" @@ -15199,19 +15044,31 @@ struct DVec3 { composite = "mul", metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::DVec4; + fn mul(self, #[proxy] rhs: &glam::DVec4) -> bevy::math::DVec4; "#, r#" #[lua( - as_trait = "std::ops::Rem", + as_trait = "std::ops::Sub", kind = "MetaFunction", output(proxy), - composite = "rem", - metamethod = "Mod", + composite = "sub", + metamethod = "Sub", )] - fn rem(self, #[proxy] rhs: &glam::DVec4) -> bevy::math::DVec4; + fn sub(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::DVec4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::DVec4; "#, r#" @@ -15229,22 +15086,107 @@ struct DVec3 { r#" #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", + as_trait = "std::ops::Mul", + kind = "MetaFunction", output(proxy), + composite = "mul", + metamethod = "Mul", )] - fn clone(&self) -> bevy::math::DVec4; + fn mul(self, rhs: f64) -> bevy::math::DVec4; "#, r#" -/// Creates a new vector. - #[lua(kind = "Function", output(proxy))] - fn new(x: f64, y: f64, z: f64, w: f64) -> bevy::math::DVec4; + #[lua( + as_trait = "std::ops::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(self, #[proxy] rhs: &glam::DVec4) -> bevy::math::DVec4; "#, r#" -/// Creates a vector with all elements set to `v`. + + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, #[proxy] rhs: &glam::DVec4) -> bevy::math::DVec4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, #[proxy] rhs: &glam::DVec4) -> bevy::math::DVec4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, rhs: f64) -> bevy::math::DVec4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Neg", + kind = "MetaFunction", + output(proxy), + composite = "neg", + metamethod = "Unm", + )] + fn neg(self) -> bevy::math::DVec4; + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &glam::DVec4) -> bool; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::DVec4; + +"#, + r#" +/// Creates a new vector. + + #[lua(kind = "Function", output(proxy))] + fn new(x: f64, y: f64, z: f64, w: f64) -> bevy::math::DVec4; + +"#, + r#" +/// Creates a vector with all elements set to `v`. #[lua(kind = "Function", output(proxy))] fn splat(v: f64) -> bevy::math::DVec4; @@ -15881,42 +15823,6 @@ struct DVec3 { #[lua(kind = "Method", output(proxy))] fn as_u64vec4(&self) -> bevy::math::U64Vec4; -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, #[proxy] rhs: &glam::DVec4) -> bevy::math::DVec4; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::DVec4; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::DVec4; - "#, r#" @@ -15927,19 +15833,7 @@ struct DVec3 { composite = "div", metamethod = "Div", )] - fn div(self, rhs: f64) -> bevy::math::DVec4; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, rhs: f64) -> bevy::math::DVec4; + fn div(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::DVec4; "#, r#" @@ -15953,53 +15847,6 @@ struct DVec3 { )] fn sub(self, rhs: f64) -> bevy::math::DVec4; -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &glam::DVec4) -> bool; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::DVec4; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, rhs: f64) -> bevy::math::DVec4; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: &glam::DVec4) -> bevy::math::DVec4; - "#, r#" @@ -16012,18 +15859,6 @@ struct DVec3 { )] fn add(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::DVec4; -"#, - r#" - - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, #[proxy] rhs: &glam::DVec4) -> bevy::math::DVec4; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -16057,135 +15892,53 @@ struct DVec4 { functions[r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Neg", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "neg", + metamethod = "Unm", )] - fn mul(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; + fn neg(self) -> bevy::math::Mat2; "#, r#" +/// Creates a 2x2 matrix from two column vectors. - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, rhs: f32) -> bevy::math::Mat2; + #[lua(kind = "Function", output(proxy))] + fn from_cols( + #[proxy] + x_axis: bevy::math::Vec2, + #[proxy] + y_axis: bevy::math::Vec2, + ) -> bevy::math::Mat2; "#, r#" +/// Creates a `[f32; 4]` array storing data in column major order. +/// If you require data in row major order `transpose` the matrix first. - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, #[proxy] rhs: bevy::math::Mat2) -> bevy::math::Mat2; + #[lua(kind = "Method")] + fn to_cols_array(&self) -> [f32; 4]; "#, r#" +/// Creates a `[[f32; 2]; 2]` 2D array storing data in column major order. +/// If you require data in row major order `transpose` the matrix first. - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: bevy::math::Mat2) -> bevy::math::Mat2; + #[lua(kind = "Method")] + fn to_cols_array_2d(&self) -> [[f32; 2]; 2]; "#, r#" +/// Creates a 2x2 matrix with its diagonal set to `diagonal` and all other entries set to 0. - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::Mat2; + #[lua(kind = "Function", output(proxy))] + fn from_diagonal(#[proxy] diagonal: bevy::math::Vec2) -> bevy::math::Mat2; "#, r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, rhs: f32) -> bevy::math::Mat2; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Neg", - kind = "MetaFunction", - output(proxy), - composite = "neg", - metamethod = "Unm", - )] - fn neg(self) -> bevy::math::Mat2; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, #[proxy] rhs: bevy::math::Mat2) -> bevy::math::Mat2; - -"#, - r#" -/// Creates a 2x2 matrix from two column vectors. - - #[lua(kind = "Function", output(proxy))] - fn from_cols( - #[proxy] - x_axis: bevy::math::Vec2, - #[proxy] - y_axis: bevy::math::Vec2, - ) -> bevy::math::Mat2; - -"#, - r#" -/// Creates a `[f32; 4]` array storing data in column major order. -/// If you require data in row major order `transpose` the matrix first. - - #[lua(kind = "Method")] - fn to_cols_array(&self) -> [f32; 4]; - -"#, - r#" -/// Creates a `[[f32; 2]; 2]` 2D array storing data in column major order. -/// If you require data in row major order `transpose` the matrix first. - - #[lua(kind = "Method")] - fn to_cols_array_2d(&self) -> [[f32; 2]; 2]; - -"#, - r#" -/// Creates a 2x2 matrix with its diagonal set to `diagonal` and all other entries set to 0. - - #[lua(kind = "Function", output(proxy))] - fn from_diagonal(#[proxy] diagonal: bevy::math::Vec2) -> bevy::math::Mat2; - -"#, - r#" -/// Creates a 2x2 matrix containing the combining non-uniform `scale` and rotation of -/// `angle` (in radians). +/// Creates a 2x2 matrix containing the combining non-uniform `scale` and rotation of +/// `angle` (in radians). #[lua(kind = "Function", output(proxy))] fn from_scale_angle( @@ -16370,6 +16123,52 @@ struct DVec4 { #[lua(kind = "Method", output(proxy))] fn as_dmat2(&self) -> bevy::math::DMat2; +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: bevy::math::Mat2) -> bevy::math::Mat2; + +"#, + r#" + + #[lua( + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", + output(proxy), + )] + fn clone(&self) -> bevy::math::Mat2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, rhs: f32) -> bevy::math::Mat2; + "#, r#" @@ -16381,6 +16180,42 @@ struct DVec4 { )] fn eq(&self, #[proxy] rhs: &glam::Mat2) -> bool; +"#, + r#" + + #[lua( + as_trait = "std::ops::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(self, #[proxy] rhs: bevy::math::Mat2) -> bevy::math::Mat2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, rhs: f32) -> bevy::math::Mat2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, #[proxy] rhs: bevy::math::Mat2) -> bevy::math::Mat2; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -16419,6 +16254,54 @@ struct Mat2(); derive(clone), remote = "bevy::math::Mat3", functions[r#" + + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, #[proxy] rhs: bevy::math::Mat3) -> bevy::math::Mat3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, rhs: f32) -> bevy::math::Mat3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: bevy::math::Mat3) -> bevy::math::Mat3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Neg", + kind = "MetaFunction", + output(proxy), + composite = "neg", + metamethod = "Unm", + )] + fn neg(self) -> bevy::math::Mat3; + +"#, + r#" /// Creates a 3x3 matrix from three column vectors. #[lua(kind = "Function", output(proxy))] @@ -16750,54 +16633,6 @@ struct Mat2(); #[lua(kind = "Method", output(proxy))] fn as_dmat3(&self) -> bevy::math::DMat3; -"#, - r#" - - #[lua( - as_trait = "std::ops::Neg", - kind = "MetaFunction", - output(proxy), - composite = "neg", - metamethod = "Unm", - )] - fn neg(self) -> bevy::math::Mat3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, rhs: f32) -> bevy::math::Mat3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: bevy::math::Mat3) -> bevy::math::Mat3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; - "#, r#" @@ -16830,7 +16665,7 @@ struct Mat2(); composite = "mul", metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: bevy::math::Affine2) -> bevy::math::Mat3; + fn mul(self, rhs: f32) -> bevy::math::Mat3; "#, r#" @@ -16859,13 +16694,13 @@ struct Mat2(); r#" #[lua( - as_trait = "std::ops::Add", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "add", - metamethod = "Add", + composite = "mul", + metamethod = "Mul", )] - fn add(self, #[proxy] rhs: bevy::math::Mat3) -> bevy::math::Mat3; + fn mul(self, #[proxy] rhs: bevy::math::Affine2) -> bevy::math::Mat3; "#, r#" @@ -16877,7 +16712,7 @@ struct Mat2(); composite = "mul", metamethod = "Mul", )] - fn mul(self, rhs: f32) -> bevy::math::Mat3; + fn mul(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; "#, r#" @@ -16924,29 +16759,7 @@ struct Mat3 { derive(clone), remote = "bevy::math::Mat3A", functions[r#" - - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::Mat3A; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, #[proxy] rhs: bevy::math::Mat3A) -> bevy::math::Mat3A; - -"#, - r#" -/// Creates a 3x3 matrix from three column vectors. +/// Creates a 3x3 matrix from three column vectors. #[lua(kind = "Function", output(proxy))] fn from_cols( @@ -17281,61 +17094,82 @@ struct Mat3 { r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Neg", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "neg", + metamethod = "Unm", )] - fn mul(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; + fn neg(self) -> bevy::math::Mat3A; "#, r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "add", + metamethod = "Add", )] - fn div(self, rhs: f32) -> bevy::math::Mat3A; + fn add(self, #[proxy] rhs: bevy::math::Mat3A) -> bevy::math::Mat3A; "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Sub", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "sub", + metamethod = "Sub", )] - fn mul(self, #[proxy] rhs: bevy::math::Mat3A) -> bevy::math::Mat3A; + fn sub(self, #[proxy] rhs: bevy::math::Mat3A) -> bevy::math::Mat3A; "#, r#" #[lua( - as_trait = "std::ops::Sub", + as_trait = "std::cmp::PartialEq", kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] rhs: &glam::Mat3A) -> bool; + +"#, + r#" + + #[lua( + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", output(proxy), - composite = "sub", - metamethod = "Sub", )] - fn sub(self, #[proxy] rhs: bevy::math::Mat3A) -> bevy::math::Mat3A; + fn clone(&self) -> bevy::math::Mat3A; "#, r#" #[lua( - as_trait = "std::ops::Neg", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "neg", - metamethod = "Unm", + composite = "mul", + metamethod = "Mul", )] - fn neg(self) -> bevy::math::Mat3A; + fn mul(self, #[proxy] rhs: bevy::math::Mat3A) -> bevy::math::Mat3A; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, rhs: f32) -> bevy::math::Mat3A; "#, r#" @@ -17353,12 +17187,13 @@ struct Mat3 { r#" #[lua( - as_trait = "std::cmp::PartialEq", + as_trait = "std::ops::Div", kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", + output(proxy), + composite = "div", + metamethod = "Div", )] - fn eq(&self, #[proxy] rhs: &glam::Mat3A) -> bool; + fn div(self, rhs: f32) -> bevy::math::Mat3A; "#, r#" @@ -17370,7 +17205,7 @@ struct Mat3 { composite = "mul", metamethod = "Mul", )] - fn mul(self, rhs: f32) -> bevy::math::Mat3A; + fn mul(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; "#, r#" @@ -17382,7 +17217,7 @@ struct Mat3 { composite = "mul", metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; + fn mul(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; "#, r#" @@ -17431,37 +17266,13 @@ struct Mat3A { functions[r#" #[lua( - as_trait = "std::ops::Neg", - kind = "MetaFunction", - output(proxy), - composite = "neg", - metamethod = "Unm", - )] - fn neg(self) -> bevy::math::Mat4; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, #[proxy] rhs: bevy::math::Mat4) -> bevy::math::Mat4; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Div", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "div", + metamethod = "Div", )] - fn mul(self, #[proxy] rhs: bevy::math::Affine3A) -> bevy::math::Mat4; + fn div(self, rhs: f32) -> bevy::math::Mat4; "#, r#" @@ -17475,39 +17286,6 @@ struct Mat3A { )] fn mul(self, #[proxy] rhs: bevy::math::Mat4) -> bevy::math::Mat4; -"#, - r#" - - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::Mat4; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, rhs: f32) -> bevy::math::Mat4; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] rhs: &glam::Mat4) -> bool; - "#, r#" /// Creates a 4x4 matrix from four column vectors. @@ -18113,6 +17891,18 @@ struct Mat3A { #[lua(kind = "Method", output(proxy))] fn as_dmat4(&self) -> bevy::math::DMat4; +"#, + r#" + + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, #[proxy] rhs: bevy::math::Mat4) -> bevy::math::Mat4; + "#, r#" @@ -18129,25 +17919,70 @@ struct Mat3A { r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "mul", + metamethod = "Mul", )] - fn div(self, rhs: f32) -> bevy::math::Mat4; + fn mul(self, rhs: f32) -> bevy::math::Mat4; "#, r#" #[lua( - as_trait = "std::ops::Add", + as_trait = "std::ops::Neg", kind = "MetaFunction", output(proxy), - composite = "add", - metamethod = "Add", + composite = "neg", + metamethod = "Unm", )] - fn add(self, #[proxy] rhs: bevy::math::Mat4) -> bevy::math::Mat4; + fn neg(self) -> bevy::math::Mat4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: bevy::math::Affine3A) -> bevy::math::Mat4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(self, #[proxy] rhs: bevy::math::Mat4) -> bevy::math::Mat4; + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] rhs: &glam::Mat4) -> bool; + +"#, + r#" + + #[lua( + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", + output(proxy), + )] + fn clone(&self) -> bevy::math::Mat4; "#, r#" @@ -18198,13 +18033,25 @@ struct Mat4 { functions[r#" #[lua( - as_trait = "std::ops::Sub", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "sub", - metamethod = "Sub", + composite = "mul", + metamethod = "Mul", )] - fn sub(self, #[proxy] rhs: bevy::math::DMat2) -> bevy::math::DMat2; + fn mul(self, rhs: f64) -> bevy::math::DMat2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; "#, r#" @@ -18222,25 +18069,23 @@ struct Mat4 { r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "add", + metamethod = "Add", )] - fn mul(self, rhs: f64) -> bevy::math::DMat2; + fn add(self, #[proxy] rhs: bevy::math::DMat2) -> bevy::math::DMat2; "#, r#" #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", output(proxy), - composite = "div", - metamethod = "Div", )] - fn div(self, rhs: f64) -> bevy::math::DMat2; + fn clone(&self) -> bevy::math::DMat2; "#, r#" @@ -18253,16 +18098,6 @@ struct Mat4 { )] fn eq(&self, #[proxy] rhs: &glam::DMat2) -> bool; -"#, - r#" - - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::DMat2; - "#, r#" /// Creates a 2x2 matrix from two column vectors. @@ -18468,13 +18303,13 @@ struct Mat4 { r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Sub", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "sub", + metamethod = "Sub", )] - fn mul(self, #[proxy] rhs: bevy::math::DMat2) -> bevy::math::DMat2; + fn sub(self, #[proxy] rhs: bevy::math::DMat2) -> bevy::math::DMat2; "#, r#" @@ -18486,19 +18321,19 @@ struct Mat4 { composite = "mul", metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; + fn mul(self, #[proxy] rhs: bevy::math::DMat2) -> bevy::math::DMat2; "#, r#" #[lua( - as_trait = "std::ops::Add", + as_trait = "std::ops::Div", kind = "MetaFunction", output(proxy), - composite = "add", - metamethod = "Add", + composite = "div", + metamethod = "Div", )] - fn add(self, #[proxy] rhs: bevy::math::DMat2) -> bevy::math::DMat2; + fn div(self, rhs: f64) -> bevy::math::DMat2; "#, r#" @@ -18551,53 +18386,41 @@ struct DMat2 { composite = "mul", metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; - -"#, - r#" - - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::DMat3; + fn mul(self, #[proxy] rhs: bevy::math::DAffine2) -> bevy::math::DMat3; "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Sub", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "sub", + metamethod = "Sub", )] - fn mul(self, rhs: f64) -> bevy::math::DMat3; + fn sub(self, #[proxy] rhs: bevy::math::DMat3) -> bevy::math::DMat3; "#, r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "add", + metamethod = "Add", )] - fn div(self, rhs: f64) -> bevy::math::DMat3; + fn add(self, #[proxy] rhs: bevy::math::DMat3) -> bevy::math::DMat3; "#, r#" #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", output(proxy), - composite = "mul", - metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: bevy::math::DMat3) -> bevy::math::DMat3; + fn clone(&self) -> bevy::math::DMat3; "#, r#" @@ -18614,37 +18437,37 @@ struct DMat2 { r#" #[lua( - as_trait = "std::ops::Add", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "add", - metamethod = "Add", + composite = "mul", + metamethod = "Mul", )] - fn add(self, #[proxy] rhs: bevy::math::DMat3) -> bevy::math::DMat3; + fn mul(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; "#, r#" #[lua( - as_trait = "std::ops::Sub", + as_trait = "std::ops::Neg", kind = "MetaFunction", output(proxy), - composite = "sub", - metamethod = "Sub", + composite = "neg", + metamethod = "Unm", )] - fn sub(self, #[proxy] rhs: bevy::math::DMat3) -> bevy::math::DMat3; + fn neg(self) -> bevy::math::DMat3; "#, r#" #[lua( - as_trait = "std::ops::Neg", + as_trait = "std::ops::Div", kind = "MetaFunction", output(proxy), - composite = "neg", - metamethod = "Unm", + composite = "div", + metamethod = "Div", )] - fn neg(self) -> bevy::math::DMat3; + fn div(self, rhs: f64) -> bevy::math::DMat3; "#, r#" @@ -18986,7 +18809,19 @@ struct DMat2 { composite = "mul", metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: bevy::math::DAffine2) -> bevy::math::DMat3; + fn mul(self, #[proxy] rhs: bevy::math::DMat3) -> bevy::math::DMat3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, rhs: f64) -> bevy::math::DMat3; "#, r#" @@ -19035,72 +18870,13 @@ struct DMat3 { functions[r#" #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: bevy::math::DMat4) -> bevy::math::DMat4; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, rhs: f64) -> bevy::math::DMat4; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] rhs: &glam::DMat4) -> bool; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Neg", - kind = "MetaFunction", - output(proxy), - composite = "neg", - metamethod = "Unm", - )] - fn neg(self) -> bevy::math::DMat4; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, #[proxy] rhs: bevy::math::DMat4) -> bevy::math::DMat4; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Sub", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "sub", + metamethod = "Sub", )] - fn mul(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::DVec4; + fn sub(self, #[proxy] rhs: bevy::math::DMat4) -> bevy::math::DMat4; "#, r#" @@ -19685,6 +19461,30 @@ struct DMat3 { )] fn clone(&self) -> bevy::math::DMat4; +"#, + r#" + + #[lua( + as_trait = "std::ops::Neg", + kind = "MetaFunction", + output(proxy), + composite = "neg", + metamethod = "Unm", + )] + fn neg(self) -> bevy::math::DMat4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, #[proxy] rhs: bevy::math::DMat4) -> bevy::math::DMat4; + "#, r#" @@ -19697,6 +19497,18 @@ struct DMat3 { )] fn mul(self, #[proxy] rhs: bevy::math::DAffine3) -> bevy::math::DMat4; +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: bevy::math::DMat4) -> bevy::math::DMat4; + "#, r#" @@ -19713,13 +19525,36 @@ struct DMat3 { r#" #[lua( - as_trait = "std::ops::Sub", + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] rhs: &glam::DMat4) -> bool; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "sub", - metamethod = "Sub", + composite = "mul", + metamethod = "Mul", )] - fn sub(self, #[proxy] rhs: bevy::math::DMat4) -> bevy::math::DMat4; + fn mul(self, rhs: f64) -> bevy::math::DMat4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::DVec4; "#, r#" @@ -19946,19 +19781,18 @@ struct DMat4 { composite = "mul", metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: bevy::math::Mat3A) -> bevy::math::Mat3A; + fn mul(self, #[proxy] rhs: bevy::math::Affine2) -> bevy::math::Affine2; "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::cmp::PartialEq", kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "eq", + metamethod = "Eq", )] - fn mul(self, #[proxy] rhs: bevy::math::Mat3) -> bevy::math::Mat3; + fn eq(&self, #[proxy] rhs: &glam::Affine2) -> bool; "#, r#" @@ -19970,18 +19804,19 @@ struct DMat4 { composite = "mul", metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: bevy::math::Affine2) -> bevy::math::Affine2; + fn mul(self, #[proxy] rhs: bevy::math::Mat3) -> bevy::math::Mat3; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", + as_trait = "std::ops::Mul", kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", + output(proxy), + composite = "mul", + metamethod = "Mul", )] - fn eq(&self, #[proxy] rhs: &glam::Affine2) -> bool; + fn mul(self, #[proxy] rhs: bevy::math::Mat3A) -> bevy::math::Mat3A; "#, r#" @@ -20014,34 +19849,23 @@ struct Affine2 { functions[r#" #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::Affine3A; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", + as_trait = "std::ops::Mul", kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", + output(proxy), + composite = "mul", + metamethod = "Mul", )] - fn eq(&self, #[proxy] rhs: &glam::Affine3A) -> bool; + fn mul(self, #[proxy] rhs: bevy::math::Affine3A) -> bevy::math::Affine3A; "#, r#" #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", output(proxy), - composite = "mul", - metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: bevy::math::Mat4) -> bevy::math::Mat4; + fn clone(&self) -> bevy::math::Affine3A; "#, r#" @@ -20053,7 +19877,7 @@ struct Affine2 { composite = "mul", metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: bevy::math::Affine3A) -> bevy::math::Affine3A; + fn mul(self, #[proxy] rhs: bevy::math::Mat4) -> bevy::math::Mat4; "#, r#" @@ -20342,6 +20166,17 @@ struct Affine2 { #[lua(kind = "Method", output(proxy))] fn inverse(&self) -> bevy::math::Affine3A; +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] rhs: &glam::Affine3A) -> bool; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -20362,16 +20197,6 @@ struct Affine3A { remote = "bevy::math::DAffine2", functions[r#" - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::DAffine2; - -"#, - r#" - #[lua( as_trait = "std::ops::Mul", kind = "MetaFunction", @@ -20379,7 +20204,7 @@ struct Affine3A { composite = "mul", metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: bevy::math::DAffine2) -> bevy::math::DAffine2; + fn mul(self, #[proxy] rhs: bevy::math::DMat3) -> bevy::math::DMat3; "#, r#" @@ -20391,7 +20216,7 @@ struct Affine3A { composite = "mul", metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: bevy::math::DMat3) -> bevy::math::DMat3; + fn mul(self, #[proxy] rhs: bevy::math::DAffine2) -> bevy::math::DAffine2; "#, r#" @@ -20404,6 +20229,16 @@ struct Affine3A { )] fn eq(&self, #[proxy] rhs: &glam::DAffine2) -> bool; +"#, + r#" + + #[lua( + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", + output(proxy), + )] + fn clone(&self) -> bevy::math::DAffine2; + "#, r#" /// Creates an affine transform from three column vectors. @@ -20586,51 +20421,6 @@ struct DAffine2 { derive(clone), remote = "bevy::math::DAffine3", functions[r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: bevy::math::DAffine3) -> bevy::math::DAffine3; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] rhs: &glam::DAffine3) -> bool; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: bevy::math::DMat4) -> bevy::math::DMat4; - -"#, - r#" - - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::DAffine3; - -"#, - r#" /// Creates an affine transform from three column vectors. #[lua(kind = "Function", output(proxy))] @@ -20900,6 +20690,51 @@ struct DAffine2 { #[lua(kind = "Method", output(proxy))] fn inverse(&self) -> bevy::math::DAffine3; +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] rhs: &glam::DAffine3) -> bool; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: bevy::math::DAffine3) -> bevy::math::DAffine3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: bevy::math::DMat4) -> bevy::math::DMat4; + +"#, + r#" + + #[lua( + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", + output(proxy), + )] + fn clone(&self) -> bevy::math::DAffine3; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -20919,20 +20754,6 @@ struct DAffine3 { derive(clone), remote = "bevy::math::DQuat", functions[r#" -/// Divides a quaternion by a scalar value. -/// The quotient is not guaranteed to be normalized. - - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, rhs: f64) -> bevy::math::DQuat; - -"#, - r#" /// Subtracts the `rhs` quaternion from `self`. /// The difference is not guaranteed to be normalized. @@ -20945,20 +20766,6 @@ struct DAffine3 { )] fn sub(self, #[proxy] rhs: bevy::math::DQuat) -> bevy::math::DQuat; -"#, - r#" -/// Multiplies a quaternion by a scalar value. -/// The product is not guaranteed to be normalized. - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, rhs: f64) -> bevy::math::DQuat; - "#, r#" @@ -20973,12 +20780,8 @@ struct DAffine3 { "#, r#" -/// Multiplies two quaternions. If they each represent a rotation, the result will -/// represent the combined rotation. -/// Note that due to floating point rounding the result may not be perfectly -/// normalized. -/// # Panics -/// Will panic if `self` or `rhs` are not normalized when `glam_assert` is enabled. +/// Multiplies a quaternion by a scalar value. +/// The product is not guaranteed to be normalized. #[lua( as_trait = "std::ops::Mul", @@ -20987,7 +20790,7 @@ struct DAffine3 { composite = "mul", metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: bevy::math::DQuat) -> bevy::math::DQuat; + fn mul(self, rhs: f64) -> bevy::math::DQuat; "#, r#" @@ -21030,6 +20833,38 @@ struct DAffine3 { )] fn clone(&self) -> bevy::math::DQuat; +"#, + r#" +/// Divides a quaternion by a scalar value. +/// The quotient is not guaranteed to be normalized. + + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, rhs: f64) -> bevy::math::DQuat; + +"#, + r#" +/// Multiplies two quaternions. If they each represent a rotation, the result will +/// represent the combined rotation. +/// Note that due to floating point rounding the result may not be perfectly +/// normalized. +/// # Panics +/// Will panic if `self` or `rhs` are not normalized when `glam_assert` is enabled. + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: bevy::math::DQuat) -> bevy::math::DQuat; + "#, r#" @@ -21460,6 +21295,12 @@ struct DQuat { )] fn clone(&self) -> bevy::math::EulerRot; +"#, + r#" + + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); + "#, r#" @@ -21471,12 +21312,6 @@ struct DQuat { )] fn eq(&self, #[proxy] other: &glam::EulerRot) -> bool; -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -21585,17 +21420,6 @@ struct BVec3A(); remote = "bevy::math::BVec4A", functions[r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] rhs: &glam::BVec4A) -> bool; - -"#, - r#" - #[lua( as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", kind = "Method", @@ -21663,6 +21487,17 @@ struct BVec3A(); #[lua(kind = "MutatingMethod")] fn set(&mut self, index: usize, value: bool) -> (); +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] rhs: &glam::BVec4A) -> bool; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -21734,6 +21569,12 @@ struct SmolStr(); derive(clone), remote = "uuid::Uuid", functions[r#" + + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); + +"#, + r#" /// Creates a random UUID. /// This uses the [`getrandom`] crate to utilise the operating system's RNG /// as the source of random numbers. If you'd like to use a custom @@ -21758,170 +21599,6 @@ struct SmolStr(); #[lua(kind = "Function", output(proxy))] fn new_v4() -> uuid::Uuid; -"#, - r#" - - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> uuid::Uuid; - -"#, - r#" -/// The 'nil UUID' (all zeros). -/// The nil UUID is a special form of UUID that is specified to have all -/// 128 bits set to zero. -/// # References -/// * [Nil UUID in RFC 9562](https://www.ietf.org/rfc/rfc9562.html#section-5.9) -/// # Examples -/// Basic usage: -/// ``` -/// # use uuid::Uuid; -/// let uuid = Uuid::nil(); -/// assert_eq!( -/// "00000000-0000-0000-0000-000000000000", -/// uuid.hyphenated().to_string(), -/// ); -/// ``` - - #[lua(kind = "Function", output(proxy))] - fn nil() -> uuid::Uuid; - -"#, - r#" -/// The 'max UUID' (all ones). -/// The max UUID is a special form of UUID that is specified to have all -/// 128 bits set to one. -/// # References -/// * [Max UUID in RFC 9562](https://www.ietf.org/rfc/rfc9562.html#section-5.10) -/// # Examples -/// Basic usage: -/// ``` -/// # use uuid::Uuid; -/// let uuid = Uuid::max(); -/// assert_eq!( -/// "ffffffff-ffff-ffff-ffff-ffffffffffff", -/// uuid.hyphenated().to_string(), -/// ); -/// ``` - - #[lua(kind = "Function", output(proxy))] - fn max() -> uuid::Uuid; - -"#, - r#" -/// Creates a UUID from a 128bit value. -/// # Examples -/// Basic usage: -/// ``` -/// # use uuid::Uuid; -/// let v = 0xa1a2a3a4b1b2c1c2d1d2d3d4d5d6d7d8u128; -/// let uuid = Uuid::from_u128(v); -/// assert_eq!( -/// "a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8", -/// uuid.hyphenated().to_string(), -/// ); -/// ``` - - #[lua(kind = "Function", output(proxy))] - fn from_u128(v: u128) -> uuid::Uuid; - -"#, - r#" -/// Creates a UUID from a 128bit value in little-endian order. -/// The entire value will be flipped to convert into big-endian order. -/// This is based on the endianness of the UUID, rather than the target -/// environment so bytes will be flipped on both big and little endian -/// machines. -/// # Examples -/// Basic usage: -/// ``` -/// # use uuid::Uuid; -/// let v = 0xa1a2a3a4b1b2c1c2d1d2d3d4d5d6d7d8u128; -/// let uuid = Uuid::from_u128_le(v); -/// assert_eq!( -/// "d8d7d6d5-d4d3-d2d1-c2c1-b2b1a4a3a2a1", -/// uuid.hyphenated().to_string(), -/// ); -/// ``` - - #[lua(kind = "Function", output(proxy))] - fn from_u128_le(v: u128) -> uuid::Uuid; - -"#, - r#" -/// Creates a UUID from two 64bit values. -/// # Examples -/// Basic usage: -/// ``` -/// # use uuid::Uuid; -/// let hi = 0xa1a2a3a4b1b2c1c2u64; -/// let lo = 0xd1d2d3d4d5d6d7d8u64; -/// let uuid = Uuid::from_u64_pair(hi, lo); -/// assert_eq!( -/// "a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8", -/// uuid.hyphenated().to_string(), -/// ); -/// ``` - - #[lua(kind = "Function", output(proxy))] - fn from_u64_pair(high_bits: u64, low_bits: u64) -> uuid::Uuid; - -"#, - r#" -/// Creates a UUID using the supplied bytes. -/// # Examples -/// Basic usage: -/// ``` -/// # fn main() -> Result<(), uuid::Error> { -/// # use uuid::Uuid; -/// let bytes = [ -/// 0xa1, 0xa2, 0xa3, 0xa4, -/// 0xb1, 0xb2, -/// 0xc1, 0xc2, -/// 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, -/// ]; -/// let uuid = Uuid::from_bytes(bytes); -/// assert_eq!( -/// uuid.hyphenated().to_string(), -/// "a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8" -/// ); -/// # Ok(()) -/// # } -/// ``` - - #[lua(kind = "Function", output(proxy))] - fn from_bytes(bytes: [u8; 16]) -> uuid::Uuid; - -"#, - r#" -/// Creates a UUID using the supplied bytes in little endian order. -/// The individual fields encoded in the buffer will be flipped. -/// # Examples -/// Basic usage: -/// ``` -/// # fn main() -> Result<(), uuid::Error> { -/// # use uuid::Uuid; -/// let bytes = [ -/// 0xa1, 0xa2, 0xa3, 0xa4, -/// 0xb1, 0xb2, -/// 0xc1, 0xc2, -/// 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, -/// ]; -/// let uuid = Uuid::from_bytes_le(bytes); -/// assert_eq!( -/// "a4a3a2a1-b2b1-c2c1-d1d2-d3d4d5d6d7d8", -/// uuid.hyphenated().to_string(), -/// ); -/// # Ok(()) -/// # } -/// ``` - - #[lua(kind = "Function", output(proxy))] - fn from_bytes_le(b: [u8; 16]) -> uuid::Uuid; - "#, r#" /// Returns the version number of the UUID. @@ -22107,9 +21784,157 @@ struct SmolStr(); "#, r#" +/// The 'nil UUID' (all zeros). +/// The nil UUID is a special form of UUID that is specified to have all +/// 128 bits set to zero. +/// # References +/// * [Nil UUID in RFC 9562](https://www.ietf.org/rfc/rfc9562.html#section-5.9) +/// # Examples +/// Basic usage: +/// ``` +/// # use uuid::Uuid; +/// let uuid = Uuid::nil(); +/// assert_eq!( +/// "00000000-0000-0000-0000-000000000000", +/// uuid.hyphenated().to_string(), +/// ); +/// ``` - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(kind = "Function", output(proxy))] + fn nil() -> uuid::Uuid; + +"#, + r#" +/// The 'max UUID' (all ones). +/// The max UUID is a special form of UUID that is specified to have all +/// 128 bits set to one. +/// # References +/// * [Max UUID in RFC 9562](https://www.ietf.org/rfc/rfc9562.html#section-5.10) +/// # Examples +/// Basic usage: +/// ``` +/// # use uuid::Uuid; +/// let uuid = Uuid::max(); +/// assert_eq!( +/// "ffffffff-ffff-ffff-ffff-ffffffffffff", +/// uuid.hyphenated().to_string(), +/// ); +/// ``` + + #[lua(kind = "Function", output(proxy))] + fn max() -> uuid::Uuid; + +"#, + r#" +/// Creates a UUID from a 128bit value. +/// # Examples +/// Basic usage: +/// ``` +/// # use uuid::Uuid; +/// let v = 0xa1a2a3a4b1b2c1c2d1d2d3d4d5d6d7d8u128; +/// let uuid = Uuid::from_u128(v); +/// assert_eq!( +/// "a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8", +/// uuid.hyphenated().to_string(), +/// ); +/// ``` + + #[lua(kind = "Function", output(proxy))] + fn from_u128(v: u128) -> uuid::Uuid; + +"#, + r#" +/// Creates a UUID from a 128bit value in little-endian order. +/// The entire value will be flipped to convert into big-endian order. +/// This is based on the endianness of the UUID, rather than the target +/// environment so bytes will be flipped on both big and little endian +/// machines. +/// # Examples +/// Basic usage: +/// ``` +/// # use uuid::Uuid; +/// let v = 0xa1a2a3a4b1b2c1c2d1d2d3d4d5d6d7d8u128; +/// let uuid = Uuid::from_u128_le(v); +/// assert_eq!( +/// "d8d7d6d5-d4d3-d2d1-c2c1-b2b1a4a3a2a1", +/// uuid.hyphenated().to_string(), +/// ); +/// ``` + + #[lua(kind = "Function", output(proxy))] + fn from_u128_le(v: u128) -> uuid::Uuid; + +"#, + r#" +/// Creates a UUID from two 64bit values. +/// # Examples +/// Basic usage: +/// ``` +/// # use uuid::Uuid; +/// let hi = 0xa1a2a3a4b1b2c1c2u64; +/// let lo = 0xd1d2d3d4d5d6d7d8u64; +/// let uuid = Uuid::from_u64_pair(hi, lo); +/// assert_eq!( +/// "a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8", +/// uuid.hyphenated().to_string(), +/// ); +/// ``` + + #[lua(kind = "Function", output(proxy))] + fn from_u64_pair(high_bits: u64, low_bits: u64) -> uuid::Uuid; + +"#, + r#" +/// Creates a UUID using the supplied bytes. +/// # Examples +/// Basic usage: +/// ``` +/// # fn main() -> Result<(), uuid::Error> { +/// # use uuid::Uuid; +/// let bytes = [ +/// 0xa1, 0xa2, 0xa3, 0xa4, +/// 0xb1, 0xb2, +/// 0xc1, 0xc2, +/// 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, +/// ]; +/// let uuid = Uuid::from_bytes(bytes); +/// assert_eq!( +/// uuid.hyphenated().to_string(), +/// "a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8" +/// ); +/// # Ok(()) +/// # } +/// ``` + + #[lua(kind = "Function", output(proxy))] + fn from_bytes(bytes: [u8; 16]) -> uuid::Uuid; + +"#, + r#" +/// Creates a UUID using the supplied bytes in little endian order. +/// The individual fields encoded in the buffer will be flipped. +/// # Examples +/// Basic usage: +/// ``` +/// # fn main() -> Result<(), uuid::Error> { +/// # use uuid::Uuid; +/// let bytes = [ +/// 0xa1, 0xa2, 0xa3, 0xa4, +/// 0xb1, 0xb2, +/// 0xc1, 0xc2, +/// 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, +/// ]; +/// let uuid = Uuid::from_bytes_le(bytes); +/// assert_eq!( +/// "a4a3a2a1-b2b1-c2c1-d1d2-d3d4d5d6d7d8", +/// uuid.hyphenated().to_string(), +/// ); +/// # Ok(()) +/// # } +/// ``` + + #[lua(kind = "Function", output(proxy))] + fn from_bytes_le(b: [u8; 16]) -> uuid::Uuid; "#, r#" @@ -22122,6 +21947,16 @@ struct SmolStr(); )] fn eq(&self, #[proxy] other: &uuid::Uuid) -> bool; +"#, + r#" + + #[lua( + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", + output(proxy), + )] + fn clone(&self) -> uuid::Uuid; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] diff --git a/crates/bevy_script_api/src/providers/bevy_time.rs b/crates/bevy_script_api/src/providers/bevy_time.rs index 5f5629cda5..8910927aea 100644 --- a/crates/bevy_script_api/src/providers/bevy_time.rs +++ b/crates/bevy_script_api/src/providers/bevy_time.rs @@ -50,8 +50,8 @@ struct Real {} remote = "bevy::time::prelude::Timer", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::time::prelude::Timer; + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); "#, r#" @@ -391,8 +391,8 @@ struct Real {} "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::time::prelude::Timer; "#, r#" @@ -420,6 +420,12 @@ struct Timer {} remote = "bevy::time::prelude::TimerMode", functions[r#" + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -428,12 +434,6 @@ struct Timer {} )] fn eq(&self, #[proxy] other: &timer::TimerMode) -> bool; -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - "#, r#" @@ -473,6 +473,18 @@ struct Virtual {} remote = "bevy::time::Stopwatch", functions[r#" + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); + +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::time::Stopwatch; + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -481,12 +493,6 @@ struct Virtual {} )] fn eq(&self, #[proxy] other: &stopwatch::Stopwatch) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::time::Stopwatch; - "#, r#" /// Create a new unpaused `Stopwatch` with no elapsed time. @@ -635,12 +641,6 @@ struct Virtual {} #[lua(kind = "MutatingMethod")] fn reset(&mut self) -> (); -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] diff --git a/crates/bevy_script_api/src/providers/bevy_transform.rs b/crates/bevy_script_api/src/providers/bevy_transform.rs index bb78e6d345..d6e093de4a 100644 --- a/crates/bevy_script_api/src/providers/bevy_transform.rs +++ b/crates/bevy_script_api/src/providers/bevy_transform.rs @@ -18,13 +18,12 @@ use bevy_script_api::{ functions[r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::cmp::PartialEq", kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "eq", + metamethod = "Eq", )] - fn mul(self, #[proxy] value: bevy::math::Vec3) -> bevy::math::Vec3; + fn eq(&self, #[proxy] other: &components::global_transform::GlobalTransform) -> bool; "#, r#" @@ -39,9 +38,27 @@ use bevy_script_api::{ fn mul( self, #[proxy] - global_transform: bevy::transform::components::GlobalTransform, + transform: bevy::transform::components::Transform, ) -> bevy::transform::components::GlobalTransform; +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] value: bevy::math::Vec3) -> bevy::math::Vec3; + +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::transform::components::GlobalTransform; + "#, r#" @@ -214,6 +231,27 @@ use bevy_script_api::{ #[lua(kind = "Method", output(proxy))] fn translation_vec3a(&self) -> bevy::math::Vec3A; +"#, + r#" +/// Get the rotation as a [`Quat`]. +/// The transform is expected to be non-degenerate and without shearing, or the output will be invalid. +/// # Warning +/// This is calculated using `to_scale_rotation_translation`, meaning that you +/// should probably use it directly if you also need translation or scale. + + #[lua(kind = "Method", output(proxy))] + fn rotation(&self) -> bevy::math::Quat; + +"#, + r#" +/// Get the scale as a [`Vec3`]. +/// The transform is expected to be non-degenerate and without shearing, or the output will be invalid. +/// Some of the computations overlap with `to_scale_rotation_translation`, which means you should use +/// it instead if you also need rotation. + + #[lua(kind = "Method", output(proxy))] + fn scale(&self) -> bevy::math::Vec3; + "#, r#" /// Get an upper bound of the radius from the given `extents`. @@ -268,23 +306,6 @@ use bevy_script_api::{ transform: bevy::transform::components::Transform, ) -> bevy::transform::components::GlobalTransform; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::transform::components::GlobalTransform; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &components::global_transform::GlobalTransform) -> bool; - "#, r#" @@ -298,7 +319,7 @@ use bevy_script_api::{ fn mul( self, #[proxy] - transform: bevy::transform::components::Transform, + global_transform: bevy::transform::components::GlobalTransform, ) -> bevy::transform::components::GlobalTransform; "#, @@ -324,50 +345,6 @@ struct GlobalTransform(); )] fn eq(&self, #[proxy] other: &components::transform::Transform) -> bool; -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul( - self, - #[proxy] - global_transform: bevy::transform::components::GlobalTransform, - ) -> bevy::transform::components::GlobalTransform; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul( - self, - #[proxy] - transform: bevy::transform::components::Transform, - ) -> bevy::transform::components::Transform; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] value: bevy::math::Vec3) -> bevy::math::Vec3; - "#, r#" /// Creates a new [`Transform`] at the position `(x, y, z)`. In 2d, the `z` component @@ -694,12 +671,56 @@ struct GlobalTransform(); #[lua(kind = "Method", output(proxy))] fn to_isometry(&self) -> bevy::math::Isometry3d; +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul( + self, + #[proxy] + global_transform: bevy::transform::components::GlobalTransform, + ) -> bevy::transform::components::GlobalTransform; + "#, r#" #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] fn clone(&self) -> bevy::transform::components::Transform; +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] value: bevy::math::Vec3) -> bevy::math::Vec3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul( + self, + #[proxy] + transform: bevy::transform::components::Transform, + ) -> bevy::transform::components::Transform; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] diff --git a/crates/bevy_script_api/src/providers/bevy_window.rs b/crates/bevy_script_api/src/providers/bevy_window.rs index 3ec16478e8..75ee99eaa8 100644 --- a/crates/bevy_script_api/src/providers/bevy_window.rs +++ b/crates/bevy_script_api/src/providers/bevy_window.rs @@ -5,6 +5,7 @@ use super::bevy_a11y::*; use super::bevy_ecs::*; use super::bevy_reflect::*; +use super::bevy_core::*; use super::bevy_input::*; use super::bevy_math::*; extern crate self as bevy_script_api; @@ -17,25 +18,25 @@ use bevy_script_api::{ remote = "bevy::window::prelude::CursorEntered", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::prelude::CursorEntered; + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &event::CursorEntered) -> bool; "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::window::prelude::CursorEntered; "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &event::CursorEntered) -> bool; + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); "#, r#" @@ -55,6 +56,12 @@ struct CursorEntered { remote = "bevy::window::prelude::CursorLeft", functions[r#" + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::window::prelude::CursorLeft; + +"#, + r#" + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] fn assert_receiver_is_total_eq(&self) -> (); @@ -69,12 +76,6 @@ struct CursorEntered { )] fn eq(&self, #[proxy] other: &event::CursorLeft) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::prelude::CursorLeft; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -128,25 +129,25 @@ struct CursorMoved { remote = "bevy::window::prelude::FileDragAndDrop", functions[r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &event::FileDragAndDrop) -> bool; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::prelude::FileDragAndDrop; + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &event::FileDragAndDrop) -> bool; + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::window::prelude::FileDragAndDrop; "#, r#" @@ -198,6 +199,12 @@ struct Ime {} remote = "bevy::window::prelude::MonitorSelection", functions[r#" + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::window::prelude::MonitorSelection; + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -206,12 +213,6 @@ struct Ime {} )] fn eq(&self, #[proxy] other: &window::MonitorSelection) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::prelude::MonitorSelection; - "#, r#" @@ -389,12 +390,6 @@ struct Window { remote = "bevy::window::prelude::WindowMoved", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::prelude::WindowMoved; - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -403,6 +398,12 @@ struct Window { )] fn eq(&self, #[proxy] other: &event::WindowMoved) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::window::prelude::WindowMoved; + "#, r#" @@ -428,6 +429,23 @@ struct WindowMoved { derive(clone), remote = "bevy::window::prelude::WindowPosition", functions[r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::window::prelude::WindowPosition; + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &window::WindowPosition) -> bool; + +"#, + r#" /// Creates a new [`WindowPosition`] at a position. #[lua(kind = "Function", output(proxy))] @@ -454,23 +472,6 @@ struct WindowMoved { monitor: bevy::window::prelude::MonitorSelection, ) -> (); -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &window::WindowPosition) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::prelude::WindowPosition; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -485,14 +486,6 @@ struct WindowPosition {} derive(clone), remote = "bevy::window::prelude::WindowResizeConstraints", functions[r#" -/// Checks if the constraints are valid. -/// Will output warnings if it isn't. - - #[lua(kind = "Method", output(proxy))] - fn check_constraints(&self) -> bevy::window::prelude::WindowResizeConstraints; - -"#, - r#" #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] fn clone(&self) -> bevy::window::prelude::WindowResizeConstraints; @@ -508,6 +501,14 @@ struct WindowPosition {} )] fn eq(&self, #[proxy] other: &window::WindowResizeConstraints) -> bool; +"#, + r#" +/// Checks if the constraints are valid. +/// Will output warnings if it isn't. + + #[lua(kind = "Method", output(proxy))] + fn check_constraints(&self) -> bevy::window::prelude::WindowResizeConstraints; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -528,12 +529,6 @@ struct WindowResizeConstraints { remote = "bevy::window::WindowEvent", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::WindowEvent; - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -542,6 +537,12 @@ struct WindowResizeConstraints { )] fn eq(&self, #[proxy] other: &event::WindowEvent) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::window::WindowEvent; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -591,12 +592,6 @@ struct WindowResized { remote = "bevy::window::WindowCreated", functions[r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - -"#, - r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] fn clone(&self) -> bevy::window::WindowCreated; @@ -611,6 +606,12 @@ struct WindowResized { )] fn eq(&self, #[proxy] other: &event::WindowCreated) -> bool; +"#, + r#" + + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -670,12 +671,6 @@ struct WindowClosing { #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] fn clone(&self) -> bevy::window::WindowClosed; -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - "#, r#" @@ -687,6 +682,12 @@ struct WindowClosing { )] fn eq(&self, #[proxy] other: &event::WindowClosed) -> bool; +"#, + r#" + + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -705,13 +706,8 @@ struct WindowClosed { remote = "bevy::window::WindowCloseRequested", functions[r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &event::WindowCloseRequested) -> bool; + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); "#, r#" @@ -722,8 +718,13 @@ struct WindowClosed { "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &event::WindowCloseRequested) -> bool; "#, r#" @@ -743,12 +744,6 @@ struct WindowCloseRequested { remote = "bevy::window::WindowDestroyed", functions[r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -757,6 +752,12 @@ struct WindowCloseRequested { )] fn eq(&self, #[proxy] other: &event::WindowDestroyed) -> bool; +"#, + r#" + + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); + "#, r#" @@ -784,12 +785,6 @@ struct WindowDestroyed { #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] fn clone(&self) -> bevy::window::RequestRedraw; -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - "#, r#" @@ -801,6 +796,12 @@ struct WindowDestroyed { )] fn eq(&self, #[proxy] other: &event::RequestRedraw) -> bool; +"#, + r#" + + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -816,8 +817,8 @@ struct RequestRedraw {} remote = "bevy::window::WindowFocused", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::WindowFocused; + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); "#, r#" @@ -833,8 +834,8 @@ struct RequestRedraw {} "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::window::WindowFocused; "#, r#" @@ -894,12 +895,6 @@ struct WindowOccluded { remote = "bevy::window::WindowScaleFactorChanged", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::WindowScaleFactorChanged; - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -908,6 +903,12 @@ struct WindowOccluded { )] fn eq(&self, #[proxy] other: &event::WindowScaleFactorChanged) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::window::WindowScaleFactorChanged; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -927,6 +928,12 @@ struct WindowScaleFactorChanged { remote = "bevy::window::WindowBackendScaleFactorChanged", functions[r#" + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::window::WindowBackendScaleFactorChanged; + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -935,12 +942,6 @@ struct WindowScaleFactorChanged { )] fn eq(&self, #[proxy] other: &event::WindowBackendScaleFactorChanged) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::WindowBackendScaleFactorChanged; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -1000,6 +1001,12 @@ struct WindowThemeChanged { remote = "bevy::window::AppLifecycle", functions[r#" + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::window::AppLifecycle; + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -1010,9 +1017,10 @@ struct WindowThemeChanged { "#, r#" +/// Return `true` if the app can be updated. - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::AppLifecycle; + #[lua(kind = "Method")] + fn is_active(&self) -> bool; "#, r#" @@ -1020,13 +1028,6 @@ struct WindowThemeChanged { #[lua(as_trait = "std::cmp::Eq", kind = "Method")] fn assert_receiver_is_total_eq(&self) -> (); -"#, - r#" -/// Return `true` if the app can be updated. - - #[lua(kind = "Method")] - fn is_active(&self) -> bool; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -1045,12 +1046,6 @@ struct AppLifecycle {} #[lua(as_trait = "std::cmp::Eq", kind = "Method")] fn assert_receiver_is_total_eq(&self) -> (); -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::PrimaryWindow; - "#, r#" @@ -1062,6 +1057,12 @@ struct AppLifecycle {} )] fn eq(&self, #[proxy] other: &window::PrimaryWindow) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::window::PrimaryWindow; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -1077,12 +1078,6 @@ struct PrimaryWindow {} remote = "bevy::window::WindowTheme", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::WindowTheme; - -"#, - r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] fn assert_receiver_is_total_eq(&self) -> (); @@ -1097,6 +1092,12 @@ struct PrimaryWindow {} )] fn eq(&self, #[proxy] other: &window::WindowTheme) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::window::WindowTheme; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -1111,16 +1112,16 @@ struct WindowTheme {} derive(clone), remote = "bevy::window::Monitor", functions[r#" +/// Returns the physical size of the monitor in pixels - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::Monitor; + #[lua(kind = "Method", output(proxy))] + fn physical_size(&self) -> bevy::math::UVec2; "#, r#" -/// Returns the physical size of the monitor in pixels - #[lua(kind = "Method", output(proxy))] - fn physical_size(&self) -> bevy::math::UVec2; + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::window::Monitor; "#, r#" @@ -1187,17 +1188,6 @@ struct PrimaryMonitor {} remote = "bevy::window::SystemCursorIcon", functions[r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &system_cursor::SystemCursorIcon) -> bool; - -"#, - r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] fn clone(&self) -> bevy::window::SystemCursorIcon; @@ -1207,6 +1197,17 @@ struct PrimaryMonitor {} #[lua(as_trait = "std::cmp::Eq", kind = "Method")] fn assert_receiver_is_total_eq(&self) -> (); +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &system_cursor::SystemCursorIcon) -> bool; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -1249,6 +1250,13 @@ struct WindowRef {} #[lua(as_trait = "std::cmp::Eq", kind = "Method")] fn assert_receiver_is_total_eq(&self) -> (); +"#, + r#" +/// Fetch the entity of this window reference + + #[lua(kind = "Method", output(proxy))] + fn entity(&self) -> bevy::ecs::entity::Entity; + "#, r#" @@ -1260,13 +1268,6 @@ struct WindowRef {} )] fn eq(&self, #[proxy] other: &window::NormalizedWindowRef) -> bool; -"#, - r#" -/// Fetch the entity of this window reference - - #[lua(kind = "Method", output(proxy))] - fn entity(&self) -> bevy::ecs::entity::Entity; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -1308,6 +1309,12 @@ struct CursorOptions { #[lua(as_trait = "std::cmp::Eq", kind = "Method")] fn assert_receiver_is_total_eq(&self) -> (); +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::window::PresentMode; + "#, r#" @@ -1319,12 +1326,6 @@ struct CursorOptions { )] fn eq(&self, #[proxy] other: &window::PresentMode) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::PresentMode; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -1340,25 +1341,25 @@ struct PresentMode {} remote = "bevy::window::WindowMode", functions[r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &window::WindowMode) -> bool; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::WindowMode; + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &window::WindowMode) -> bool; + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::window::WindowMode; "#, r#" @@ -1532,12 +1533,6 @@ struct WindowResolution {} remote = "bevy::window::CompositeAlphaMode", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::CompositeAlphaMode; - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -1546,6 +1541,12 @@ struct WindowResolution {} )] fn eq(&self, #[proxy] other: &window::CompositeAlphaMode) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::window::CompositeAlphaMode; + "#, r#" @@ -1600,6 +1601,12 @@ struct EnabledButtons { remote = "bevy::window::WindowLevel", functions[r#" + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -1614,12 +1621,6 @@ struct EnabledButtons { #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] fn clone(&self) -> bevy::window::WindowLevel; -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -1634,23 +1635,6 @@ struct WindowLevel {} derive(clone), remote = "bevy::window::InternalWindowState", functions[r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::InternalWindowState; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &window::InternalWindowState) -> bool; - -"#, - r#" /// Consumes the current maximize request, if it exists. This should only be called by window backends. #[lua(kind = "MutatingMethod")] @@ -1670,6 +1654,23 @@ struct WindowLevel {} #[lua(kind = "MutatingMethod")] fn take_move_request(&mut self) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::window::InternalWindowState; + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &window::InternalWindowState) -> bool; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -1685,12 +1686,6 @@ struct InternalWindowState {} remote = "bevy::window::CursorGrabMode", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::CursorGrabMode; - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -1705,6 +1700,12 @@ struct InternalWindowState {} #[lua(as_trait = "std::cmp::Eq", kind = "Method")] fn assert_receiver_is_total_eq(&self) -> (); +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::window::CursorGrabMode; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] diff --git a/crates/macro_tests/Cargo.toml b/crates/macro_tests/Cargo.toml index 9cc1a7bdba..89eb194ccb 100644 --- a/crates/macro_tests/Cargo.toml +++ b/crates/macro_tests/Cargo.toml @@ -15,7 +15,7 @@ debug = false [dev-dependencies] trybuild = "1.0" -bevy = { version = "0.15.0-rc.2", default-features = false } +bevy = { version = "0.15.0-rc.3", default-features = false } bevy_mod_scripting = { path = "../../", features = [ "lua", "lua_script_api", diff --git a/makefile b/makefile index 3362ee6c6c..fdd2efe86c 100644 --- a/makefile +++ b/makefile @@ -22,7 +22,7 @@ TEST_NAME= # # valgrind outputs a callgrind.out.. We can analyze this with kcachegrind # kcachegrind NIGHTLY_VERSION=nightly-2024-11-05 -BEVY_VERSION=0.15.0-rc.2 +BEVY_VERSION=0.15.0-rc.3 GLAM_VERSION=0.29.0 CODEGEN_PATH=${PWD}/target/codegen BEVY_PATH=${CODEGEN_PATH}/bevy diff --git a/readme.md b/readme.md index fb0dc2cdc6..e983242cc5 100644 --- a/readme.md +++ b/readme.md @@ -264,6 +264,7 @@ To see more complex applications of this library have a look at the examples: - [generating statically typed lua wrappers + ReflectReference system](examples/wrappers.rs) - [lua - documentation generation + lua static typing](examples/lua/documentation_gen.rs) - [lua - bevy console integration](examples/lua/console_integration.rs) +- [lua - dynamic queryies](examples/lua/dynamic_queries.rs) - [rhai - bevy console integration](examples/rhai/console_integration.rs) - [lua - game of life with teal](examples/lua/game_of_life.rs) - [rhai - game of life](examples/rhai/game_of_life.rs) From b3615f9ce5107ea2ed24c943438e2df46cd053b1 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 10 Nov 2024 13:26:01 +0000 Subject: [PATCH 04/12] chore: release v0.8.0-alpha.1 (#145) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- CHANGELOG.md | 7 +++++++ Cargo.toml | 14 +++++++------- crates/bevy_event_priority/CHANGELOG.md | 6 ++++++ crates/bevy_event_priority/Cargo.toml | 2 +- crates/bevy_mod_scripting_common/Cargo.toml | 2 +- crates/bevy_mod_scripting_core/CHANGELOG.md | 6 ++++++ crates/bevy_mod_scripting_core/Cargo.toml | 4 ++-- crates/bevy_script_api/CHANGELOG.md | 6 ++++++ crates/bevy_script_api/Cargo.toml | 8 ++++---- .../languages/bevy_mod_scripting_lua/CHANGELOG.md | 6 ++++++ crates/languages/bevy_mod_scripting_lua/Cargo.toml | 2 +- .../bevy_mod_scripting_lua_derive/Cargo.toml | 4 ++-- .../languages/bevy_mod_scripting_rhai/CHANGELOG.md | 6 ++++++ .../languages/bevy_mod_scripting_rhai/Cargo.toml | 2 +- .../bevy_mod_scripting_rhai_derive/Cargo.toml | 4 ++-- .../languages/bevy_mod_scripting_rune/CHANGELOG.md | 6 ++++++ .../languages/bevy_mod_scripting_rune/Cargo.toml | 2 +- 17 files changed, 65 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eafa9f40c6..b79589ee50 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [0.8.0-alpha.1](https://github.com/makspll/bevy_mod_scripting/compare/v0.8.0-alpha.0...v0.8.0-alpha.1) - 2024-11-10 + +### Other + +- Bump Bevy release candidate ([#143](https://github.com/makspll/bevy_mod_scripting/pull/143)) +- update Cargo.toml dependencies + ## [0.7.1](https://github.com/makspll/bevy_mod_scripting/compare/bevy_mod_scripting-v0.7.0...bevy_mod_scripting-v0.7.1) - 2024-11-03 ### Other diff --git a/Cargo.toml b/Cargo.toml index 3a6d981df3..f515af7b42 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bevy_mod_scripting" -version = "0.8.0-alpha.0" +version = "0.8.0-alpha.1" authors = ["Maksymilian Mozolewski "] edition = "2021" license = "MIT OR Apache-2.0" @@ -63,16 +63,16 @@ rune = ["bevy_mod_scripting_rune"] [dependencies] bevy = { workspace = true } bevy_mod_scripting_core = { workspace = true } -bevy_mod_scripting_lua = { path = "crates/languages/bevy_mod_scripting_lua", version = "0.8.0-alpha.0", optional = true } -bevy_mod_scripting_rhai = { path = "crates/languages/bevy_mod_scripting_rhai", version = "0.8.0-alpha.0", optional = true } -bevy_mod_scripting_rune = { path = "crates/languages/bevy_mod_scripting_rune", version = "0.8.0-alpha.0", optional = true } -bevy_script_api = { path = "crates/bevy_script_api", version = "0.8.0-alpha.0", optional = true } +bevy_mod_scripting_lua = { path = "crates/languages/bevy_mod_scripting_lua", version = "0.8.0-alpha.1", optional = true } +bevy_mod_scripting_rhai = { path = "crates/languages/bevy_mod_scripting_rhai", version = "0.8.0-alpha.1", optional = true } +bevy_mod_scripting_rune = { path = "crates/languages/bevy_mod_scripting_rune", version = "0.8.0-alpha.1", optional = true } +bevy_script_api = { path = "crates/bevy_script_api", version = "0.8.0-alpha.1", optional = true } [workspace.dependencies] bevy = { version = "0.15.0-rc.3", default-features = false } -bevy_mod_scripting_core = { path = "crates/bevy_mod_scripting_core", version = "0.8.0-alpha.0" } -bevy_mod_scripting_common = { path = "crates/bevy_mod_scripting_common", version = "0.8.0-alpha.0" } +bevy_mod_scripting_core = { path = "crates/bevy_mod_scripting_core", version = "0.8.0-alpha.1" } +bevy_mod_scripting_common = { path = "crates/bevy_mod_scripting_common", version = "0.8.0-alpha.1" } [dev-dependencies] bevy = { workspace = true, default-features = true } diff --git a/crates/bevy_event_priority/CHANGELOG.md b/crates/bevy_event_priority/CHANGELOG.md index 3d3cbfbb1d..53c36fc4a2 100644 --- a/crates/bevy_event_priority/CHANGELOG.md +++ b/crates/bevy_event_priority/CHANGELOG.md @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.8.0-alpha.1](https://github.com/makspll/bevy_mod_scripting/compare/bevy_event_priority-v0.8.0-alpha.0...bevy_event_priority-v0.8.0-alpha.1) - 2024-11-10 + +### Other + +- update Cargo.toml dependencies + ## [0.7.0](https://github.com/makspll/bevy_mod_scripting/compare/bevy_event_priority-v0.6.0...bevy_event_priority-v0.7.0) - 2024-11-03 ### Other diff --git a/crates/bevy_event_priority/Cargo.toml b/crates/bevy_event_priority/Cargo.toml index f13818d2b2..13375577df 100644 --- a/crates/bevy_event_priority/Cargo.toml +++ b/crates/bevy_event_priority/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bevy_event_priority" -version = "0.8.0-alpha.0" +version = "0.8.0-alpha.1" authors = ["Maksymilian Mozolewski "] edition = "2021" license = "MIT OR Apache-2.0" diff --git a/crates/bevy_mod_scripting_common/Cargo.toml b/crates/bevy_mod_scripting_common/Cargo.toml index a9f4032eea..5a80b9e7e3 100644 --- a/crates/bevy_mod_scripting_common/Cargo.toml +++ b/crates/bevy_mod_scripting_common/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bevy_mod_scripting_common" -version = "0.8.0-alpha.0" +version = "0.8.0-alpha.1" authors = ["Maksymilian Mozolewski "] edition = "2021" license = "MIT OR Apache-2.0" diff --git a/crates/bevy_mod_scripting_core/CHANGELOG.md b/crates/bevy_mod_scripting_core/CHANGELOG.md index 948a69efe9..268db95be2 100644 --- a/crates/bevy_mod_scripting_core/CHANGELOG.md +++ b/crates/bevy_mod_scripting_core/CHANGELOG.md @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.8.0-alpha.1](https://github.com/makspll/bevy_mod_scripting/compare/bevy_mod_scripting_core-v0.8.0-alpha.0...bevy_mod_scripting_core-v0.8.0-alpha.1) - 2024-11-10 + +### Other + +- update Cargo.toml dependencies + ## [0.7.0](https://github.com/makspll/bevy_mod_scripting/compare/bevy_mod_scripting_core-v0.6.0...bevy_mod_scripting_core-v0.7.0) - 2024-11-03 ### Other diff --git a/crates/bevy_mod_scripting_core/Cargo.toml b/crates/bevy_mod_scripting_core/Cargo.toml index 402f7c2798..027bd286c5 100644 --- a/crates/bevy_mod_scripting_core/Cargo.toml +++ b/crates/bevy_mod_scripting_core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bevy_mod_scripting_core" -version = "0.8.0-alpha.0" +version = "0.8.0-alpha.1" authors = ["Maksymilian Mozolewski "] edition = "2021" license = "MIT OR Apache-2.0" @@ -32,7 +32,7 @@ bevy = { workspace = true, default-features = false, features = [ "bevy_text", "bevy_sprite", ] } -bevy_event_priority = { path = "../bevy_event_priority", version = "0.8.0-alpha.0" } +bevy_event_priority = { path = "../bevy_event_priority", version = "0.8.0-alpha.1" } thiserror = "1.0.31" paste = "1.0.7" parking_lot = "0.12.1" diff --git a/crates/bevy_script_api/CHANGELOG.md b/crates/bevy_script_api/CHANGELOG.md index bff45034a4..6febb59f56 100644 --- a/crates/bevy_script_api/CHANGELOG.md +++ b/crates/bevy_script_api/CHANGELOG.md @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.8.0-alpha.1](https://github.com/makspll/bevy_mod_scripting/compare/bevy_script_api-v0.8.0-alpha.0...bevy_script_api-v0.8.0-alpha.1) - 2024-11-10 + +### Other + +- Bump Bevy release candidate ([#143](https://github.com/makspll/bevy_mod_scripting/pull/143)) + ## [0.7.0](https://github.com/makspll/bevy_mod_scripting/compare/bevy_script_api-v0.6.0...bevy_script_api-v0.7.0) - 2024-11-03 ### Other diff --git a/crates/bevy_script_api/Cargo.toml b/crates/bevy_script_api/Cargo.toml index caaf350d5b..ddde7b14ef 100644 --- a/crates/bevy_script_api/Cargo.toml +++ b/crates/bevy_script_api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bevy_script_api" -version = "0.8.0-alpha.0" +version = "0.8.0-alpha.1" authors = ["Maksymilian Mozolewski "] edition = "2021" license = "MIT OR Apache-2.0" @@ -35,8 +35,8 @@ parking_lot = "0.12.1" paste = "1.0.7" thiserror = "1.0.32" # lua -bevy_mod_scripting_lua = { path = "../languages/bevy_mod_scripting_lua", version = "0.8.0-alpha.0", optional = true } -bevy_mod_scripting_lua_derive = { path = "../languages/bevy_mod_scripting_lua_derive", version = "0.8.0-alpha.0", optional = true } -bevy_mod_scripting_rhai = { path = "../languages/bevy_mod_scripting_rhai", version = "0.8.0-alpha.0", optional = true } +bevy_mod_scripting_lua = { path = "../languages/bevy_mod_scripting_lua", version = "0.8.0-alpha.1", optional = true } +bevy_mod_scripting_lua_derive = { path = "../languages/bevy_mod_scripting_lua_derive", version = "0.8.0-alpha.1", optional = true } +bevy_mod_scripting_rhai = { path = "../languages/bevy_mod_scripting_rhai", version = "0.8.0-alpha.1", optional = true } smol_str = "0.2" allocator-api2 = "0.2" diff --git a/crates/languages/bevy_mod_scripting_lua/CHANGELOG.md b/crates/languages/bevy_mod_scripting_lua/CHANGELOG.md index 9fb02650d8..77d043cd80 100644 --- a/crates/languages/bevy_mod_scripting_lua/CHANGELOG.md +++ b/crates/languages/bevy_mod_scripting_lua/CHANGELOG.md @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.8.0-alpha.1](https://github.com/makspll/bevy_mod_scripting/compare/bevy_mod_scripting_lua-v0.8.0-alpha.0...bevy_mod_scripting_lua-v0.8.0-alpha.1) - 2024-11-10 + +### Other + +- update Cargo.toml dependencies + ## [0.7.1](https://github.com/makspll/bevy_mod_scripting/compare/bevy_mod_scripting_lua-v0.7.0...bevy_mod_scripting_lua-v0.7.1) - 2024-11-03 ### Other diff --git a/crates/languages/bevy_mod_scripting_lua/Cargo.toml b/crates/languages/bevy_mod_scripting_lua/Cargo.toml index 35cde6047a..f8288805d8 100644 --- a/crates/languages/bevy_mod_scripting_lua/Cargo.toml +++ b/crates/languages/bevy_mod_scripting_lua/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bevy_mod_scripting_lua" -version = "0.8.0-alpha.0" +version = "0.8.0-alpha.1" authors = ["Maksymilian Mozolewski "] edition = "2021" license = "MIT OR Apache-2.0" diff --git a/crates/languages/bevy_mod_scripting_lua_derive/Cargo.toml b/crates/languages/bevy_mod_scripting_lua_derive/Cargo.toml index 9cddc7886e..5fb4250aa9 100644 --- a/crates/languages/bevy_mod_scripting_lua_derive/Cargo.toml +++ b/crates/languages/bevy_mod_scripting_lua_derive/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bevy_mod_scripting_lua_derive" -version = "0.8.0-alpha.0" +version = "0.8.0-alpha.1" authors = ["Maksymilian Mozolewski "] edition = "2021" license = "MIT OR Apache-2.0" @@ -23,7 +23,7 @@ path = "src/lib.rs" proc-macro = true [dependencies] -bevy_mod_scripting_common = { path = "../../bevy_mod_scripting_common", version = "0.8.0-alpha.0" } +bevy_mod_scripting_common = { path = "../../bevy_mod_scripting_common", version = "0.8.0-alpha.1" } paste = "1.0.7" darling = "0.20" syn = { version = "2.0.38", features = ["full", "fold", "extra-traits"] } diff --git a/crates/languages/bevy_mod_scripting_rhai/CHANGELOG.md b/crates/languages/bevy_mod_scripting_rhai/CHANGELOG.md index dda344c62b..b7edac2cb6 100644 --- a/crates/languages/bevy_mod_scripting_rhai/CHANGELOG.md +++ b/crates/languages/bevy_mod_scripting_rhai/CHANGELOG.md @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.8.0-alpha.1](https://github.com/makspll/bevy_mod_scripting/compare/bevy_mod_scripting_rhai-v0.8.0-alpha.0...bevy_mod_scripting_rhai-v0.8.0-alpha.1) - 2024-11-10 + +### Other + +- update Cargo.toml dependencies + ## [0.7.0](https://github.com/makspll/bevy_mod_scripting/compare/bevy_mod_scripting_rhai-v0.6.0...bevy_mod_scripting_rhai-v0.7.0) - 2024-11-03 ### Other diff --git a/crates/languages/bevy_mod_scripting_rhai/Cargo.toml b/crates/languages/bevy_mod_scripting_rhai/Cargo.toml index fb5abd3edf..1694e161a3 100644 --- a/crates/languages/bevy_mod_scripting_rhai/Cargo.toml +++ b/crates/languages/bevy_mod_scripting_rhai/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bevy_mod_scripting_rhai" -version = "0.8.0-alpha.0" +version = "0.8.0-alpha.1" authors = ["Maksymilian Mozolewski "] edition = "2021" license = "MIT OR Apache-2.0" diff --git a/crates/languages/bevy_mod_scripting_rhai_derive/Cargo.toml b/crates/languages/bevy_mod_scripting_rhai_derive/Cargo.toml index 2e60540d04..3fa47eddb3 100644 --- a/crates/languages/bevy_mod_scripting_rhai_derive/Cargo.toml +++ b/crates/languages/bevy_mod_scripting_rhai_derive/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bevy_mod_scripting_rhai_derive" -version = "0.8.0-alpha.0" +version = "0.8.0-alpha.1" authors = ["Maksymilian Mozolewski "] edition = "2021" license = "MIT OR Apache-2.0" @@ -17,7 +17,7 @@ path = "src/lib.rs" proc-macro = true [dependencies] -bevy_mod_scripting_common = { path = "../../bevy_mod_scripting_common", version = "0.8.0-alpha.0" } +bevy_mod_scripting_common = { path = "../../bevy_mod_scripting_common", version = "0.8.0-alpha.1" } paste = "1.0.7" syn = { version = "1.0.57", features = ["full", "fold", "extra-traits"] } quote = "1.0.8" diff --git a/crates/languages/bevy_mod_scripting_rune/CHANGELOG.md b/crates/languages/bevy_mod_scripting_rune/CHANGELOG.md index 511cdf6703..bd11342e16 100644 --- a/crates/languages/bevy_mod_scripting_rune/CHANGELOG.md +++ b/crates/languages/bevy_mod_scripting_rune/CHANGELOG.md @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.8.0-alpha.1](https://github.com/makspll/bevy_mod_scripting/compare/bevy_mod_scripting_rune-v0.8.0-alpha.0...bevy_mod_scripting_rune-v0.8.0-alpha.1) - 2024-11-10 + +### Other + +- update Cargo.toml dependencies + ## [0.7.0](https://github.com/makspll/bevy_mod_scripting/compare/bevy_mod_scripting_rune-v0.6.0...bevy_mod_scripting_rune-v0.7.0) - 2024-11-03 ### Other diff --git a/crates/languages/bevy_mod_scripting_rune/Cargo.toml b/crates/languages/bevy_mod_scripting_rune/Cargo.toml index 2bfcb90384..f32169d108 100644 --- a/crates/languages/bevy_mod_scripting_rune/Cargo.toml +++ b/crates/languages/bevy_mod_scripting_rune/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bevy_mod_scripting_rune" -version = "0.8.0-alpha.0" +version = "0.8.0-alpha.1" edition = "2021" license = "MIT OR Apache-2.0" description = "Necessary functionality for Rune support with bevy_mod_scripting" From 553f02eeb6ad1e66bc56292295c925aea94b42c8 Mon Sep 17 00:00:00 2001 From: Maksymilian Mozolewski Date: Sun, 10 Nov 2024 14:08:11 +0000 Subject: [PATCH 05/12] Fix failing doctest (#146) fix doctest --- crates/languages/bevy_mod_scripting_lua/src/util.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/languages/bevy_mod_scripting_lua/src/util.rs b/crates/languages/bevy_mod_scripting_lua/src/util.rs index bbf7bb52a0..8a558cd2ce 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/util.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/util.rs @@ -35,7 +35,7 @@ macro_rules! lua_path { /// /// Current configuration will provide "/scripts/*.lua" paths /// ```rust -/// use bevy_mod_scripting::lua_path; +/// use bevy_mod_scripting_lua::lua_path; /// assert_eq!("scripts/build/my_script.lua",lua_path!("my_script")) /// ``` #[cfg(not(feature = "teal"))] From 1dfe12ef3b20355d5fe0d4d39759ecfcb37858a1 Mon Sep 17 00:00:00 2001 From: Maksymilian Mozolewski Date: Sun, 10 Nov 2024 15:12:03 +0000 Subject: [PATCH 06/12] fix: bug when compiling without `teal` feature (#148) fix failing doctest logic --- crates/languages/bevy_mod_scripting_lua/src/util.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/languages/bevy_mod_scripting_lua/src/util.rs b/crates/languages/bevy_mod_scripting_lua/src/util.rs index 8a558cd2ce..9b84ba5584 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/util.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/util.rs @@ -36,7 +36,7 @@ macro_rules! lua_path { /// Current configuration will provide "/scripts/*.lua" paths /// ```rust /// use bevy_mod_scripting_lua::lua_path; -/// assert_eq!("scripts/build/my_script.lua",lua_path!("my_script")) +/// assert_eq!("scripts/my_script.lua",lua_path!("my_script")) /// ``` #[cfg(not(feature = "teal"))] #[macro_export] From c222a0304ce8bea3d8f32e426ae3cbb95a292e4c Mon Sep 17 00:00:00 2001 From: Maksymilian Mozolewski Date: Tue, 3 Dec 2024 09:03:47 +0000 Subject: [PATCH 07/12] Bump bevy & bevy console (#153) * bump bevy console * bump rest of bevy * remove bevy_gltf --- Cargo.toml | 43 +- crates/bevy_mod_scripting_core/Cargo.toml | 1 - .../src/providers/bevy_a11y.rs | 69 - .../src/providers/bevy_core.rs | 12 +- .../bevy_script_api/src/providers/bevy_ecs.rs | 107 +- .../src/providers/bevy_hierarchy.rs | 8 +- .../src/providers/bevy_input.rs | 451 +- .../src/providers/bevy_math.rs | 1041 +-- .../src/providers/bevy_reflect.rs | 6282 ++++++++--------- .../src/providers/bevy_time.rs | 64 +- .../src/providers/bevy_transform.rs | 86 +- .../src/providers/bevy_window.rs | 1879 ----- crates/bevy_script_api/src/providers/mod.rs | 8 - crates/macro_tests/Cargo.toml | 2 +- examples/lua/game_of_life.rs | 2 +- examples/rhai/game_of_life.rs | 2 +- makefile | 4 +- 17 files changed, 4082 insertions(+), 5979 deletions(-) delete mode 100644 crates/bevy_script_api/src/providers/bevy_a11y.rs delete mode 100644 crates/bevy_script_api/src/providers/bevy_window.rs diff --git a/Cargo.toml b/Cargo.toml index f515af7b42..8a84bc61da 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -70,7 +70,7 @@ bevy_script_api = { path = "crates/bevy_script_api", version = "0.8.0-alpha.1", [workspace.dependencies] -bevy = { version = "0.15.0-rc.3", default-features = false } +bevy = { version = "0.15.0", default-features = false } bevy_mod_scripting_core = { path = "crates/bevy_mod_scripting_core", version = "0.8.0-alpha.1" } bevy_mod_scripting_common = { path = "crates/bevy_mod_scripting_common", version = "0.8.0-alpha.1" } @@ -78,7 +78,7 @@ bevy_mod_scripting_common = { path = "crates/bevy_mod_scripting_common", version bevy = { workspace = true, default-features = true } clap = { version = "4.1", features = ["derive"] } rand = "0.8.5" -bevy_console = "0.12" +bevy_console = "0.13" rhai-rand = "0.1" [workspace] @@ -111,26 +111,25 @@ codegen-units = 8 incremental = false debug = false -# TODO: bump once bevy is released and the lib is updated -# [[example]] -# name = "console_integration_lua" -# path = "examples/lua/console_integration.rs" -# required-features = [ -# "lua54", -# "lua_script_api", -# "bevy/file_watcher", -# "bevy/multi_threaded", -# ] - -# [[example]] -# name = "console_integration_rhai" -# path = "examples/rhai/console_integration.rs" -# required-features = [ -# "rhai", -# "rhai_script_api", -# "bevy/file_watcher", -# "bevy/multi_threaded", -# ] +[[example]] +name = "console_integration_lua" +path = "examples/lua/console_integration.rs" +required-features = [ + "lua54", + "lua_script_api", + "bevy/file_watcher", + "bevy/multi_threaded", +] + +[[example]] +name = "console_integration_rhai" +path = "examples/rhai/console_integration.rs" +required-features = [ + "rhai", + "rhai_script_api", + "bevy/file_watcher", + "bevy/multi_threaded", +] [[example]] name = "complex_game_loop_lua" diff --git a/crates/bevy_mod_scripting_core/Cargo.toml b/crates/bevy_mod_scripting_core/Cargo.toml index 027bd286c5..4f5e07f6db 100644 --- a/crates/bevy_mod_scripting_core/Cargo.toml +++ b/crates/bevy_mod_scripting_core/Cargo.toml @@ -23,7 +23,6 @@ doc_always = [] [dependencies] bevy = { workspace = true, default-features = false, features = [ "bevy_asset", - "bevy_gltf", "bevy_animation", "bevy_core_pipeline", "bevy_ui", diff --git a/crates/bevy_script_api/src/providers/bevy_a11y.rs b/crates/bevy_script_api/src/providers/bevy_a11y.rs deleted file mode 100644 index b6ef3788e4..0000000000 --- a/crates/bevy_script_api/src/providers/bevy_a11y.rs +++ /dev/null @@ -1,69 +0,0 @@ -// @generated by cargo bevy-api-gen generate, modify the templates not this file -#![allow(clippy::all)] -#![allow(unused, deprecated, dead_code)] -#![cfg_attr(rustfmt, rustfmt_skip)] -use super::bevy_ecs::*; -use super::bevy_reflect::*; -extern crate self as bevy_script_api; -use bevy_script_api::{ - lua::RegisterForeignLuaType, ReflectedValue, common::bevy::GetWorld, -}; -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy(derive(), remote = "bevy::a11y::Focus", functions[])] -struct Focus(ReflectedValue); -#[derive(Default)] -pub(crate) struct Globals; -impl bevy_mod_scripting_lua::tealr::mlu::ExportInstances for Globals { - fn add_instances< - 'lua, - T: bevy_mod_scripting_lua::tealr::mlu::InstanceCollector<'lua>, - >(self, instances: &mut T) -> bevy_mod_scripting_lua::tealr::mlu::mlua::Result<()> { - Ok(()) - } -} -pub struct BevyA11YAPIProvider; -impl bevy_mod_scripting_core::hosts::APIProvider for BevyA11YAPIProvider { - type APITarget = std::sync::Mutex; - type ScriptContext = std::sync::Mutex; - type DocTarget = bevy_mod_scripting_lua::docs::LuaDocFragment; - fn attach_api( - &mut self, - ctx: &mut Self::APITarget, - ) -> Result<(), bevy_mod_scripting_core::error::ScriptError> { - let ctx = ctx.get_mut().expect("Unable to acquire lock on Lua context"); - bevy_mod_scripting_lua::tealr::mlu::set_global_env(Globals, ctx) - .map_err(|e| bevy_mod_scripting_core::error::ScriptError::Other( - e.to_string(), - )) - } - fn get_doc_fragment(&self) -> Option { - Some( - bevy_mod_scripting_lua::docs::LuaDocFragment::new( - "BevyA11YAPI", - |tw| { - tw.document_global_instance::() - .expect("Something went wrong documenting globals") - .process_type::() - }, - ), - ) - } - fn setup_script( - &mut self, - script_data: &bevy_mod_scripting_core::hosts::ScriptData, - ctx: &mut Self::ScriptContext, - ) -> Result<(), bevy_mod_scripting_core::error::ScriptError> { - Ok(()) - } - fn setup_script_runtime( - &mut self, - world_ptr: bevy_mod_scripting_core::world::WorldPointer, - _script_data: &bevy_mod_scripting_core::hosts::ScriptData, - ctx: &mut Self::ScriptContext, - ) -> Result<(), bevy_mod_scripting_core::error::ScriptError> { - Ok(()) - } - fn register_with_app(&self, app: &mut bevy::app::App) { - app.register_foreign_lua_type::(); - } -} diff --git a/crates/bevy_script_api/src/providers/bevy_core.rs b/crates/bevy_script_api/src/providers/bevy_core.rs index f205ff73bd..762e6fb772 100644 --- a/crates/bevy_script_api/src/providers/bevy_core.rs +++ b/crates/bevy_script_api/src/providers/bevy_core.rs @@ -14,12 +14,6 @@ use bevy_script_api::{ remote = "bevy::core::prelude::Name", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::core::prelude::Name; - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -28,6 +22,12 @@ use bevy_script_api::{ )] fn eq(&self, #[proxy] other: &name::Name) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::core::prelude::Name; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] diff --git a/crates/bevy_script_api/src/providers/bevy_ecs.rs b/crates/bevy_script_api/src/providers/bevy_ecs.rs index 8f3b5d4e27..a790dbc9a4 100644 --- a/crates/bevy_script_api/src/providers/bevy_ecs.rs +++ b/crates/bevy_script_api/src/providers/bevy_ecs.rs @@ -13,8 +13,13 @@ use bevy_script_api::{ remote = "bevy::ecs::entity::Entity", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::ecs::entity::Entity; + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &entity::Entity) -> bool; "#, r#" @@ -73,13 +78,8 @@ use bevy_script_api::{ "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &entity::Entity) -> bool; + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::ecs::entity::Entity; "#, r#" @@ -143,17 +143,6 @@ struct OnReplace {} derive(clone), remote = "bevy::ecs::component::ComponentId", functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &component::ComponentId) -> bool; - -"#, - r#" /// Creates a new [`ComponentId`]. /// The `index` is a unique value associated with each type of component in a given world. /// Usually, this value is taken from a counter incremented for each type of component registered with the world. @@ -174,6 +163,17 @@ struct OnReplace {} #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] fn clone(&self) -> bevy::ecs::component::ComponentId; +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &component::ComponentId) -> bool; + "#, r#" @@ -195,8 +195,8 @@ struct ComponentId(); remote = "bevy::ecs::component::Tick", functions[r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::ecs::component::Tick; "#, r#" @@ -212,8 +212,8 @@ struct ComponentId(); "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::ecs::component::Tick; + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); "#, r#" @@ -264,12 +264,6 @@ struct Tick {} derive(clone), remote = "bevy::ecs::component::ComponentTicks", functions[r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::ecs::component::ComponentTicks; - -"#, - r#" /// Returns `true` if the component or resource was added after the system last ran /// (or the system is running for the first time). @@ -298,17 +292,13 @@ struct Tick {} "#, r#" -/// Returns the tick recording the time this component or resource was most recently changed. +/// Creates a new instance with the same change tick for `added` and `changed`. - #[lua(kind = "Method", output(proxy))] - fn last_changed_tick(&self) -> bevy::ecs::component::Tick; - -"#, - r#" -/// Returns the tick recording the time this component or resource was added. - - #[lua(kind = "Method", output(proxy))] - fn added_tick(&self) -> bevy::ecs::component::Tick; + #[lua(kind = "Function", output(proxy))] + fn new( + #[proxy] + change_tick: bevy::ecs::component::Tick, + ) -> bevy::ecs::component::ComponentTicks; "#, r#" @@ -327,6 +317,12 @@ struct Tick {} #[lua(kind = "MutatingMethod")] fn set_changed(&mut self, #[proxy] change_tick: bevy::ecs::component::Tick) -> (); +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::ecs::component::ComponentTicks; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -335,19 +331,18 @@ fn index(&self) -> String { } "#] )] -struct ComponentTicks {} +struct ComponentTicks { + #[lua(output(proxy))] + added: bevy::ecs::component::Tick, + #[lua(output(proxy))] + changed: bevy::ecs::component::Tick, +} #[derive(bevy_mod_scripting_lua_derive::LuaProxy)] #[proxy( derive(clone), remote = "bevy::ecs::identifier::Identifier", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::ecs::identifier::Identifier; - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -387,6 +382,12 @@ struct ComponentTicks {} #[lua(kind = "Function", output(proxy))] fn from_bits(value: u64) -> bevy::ecs::identifier::Identifier; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::ecs::identifier::Identifier; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -451,6 +452,13 @@ impl bevy_mod_scripting_lua::tealr::mlu::ExportInstances for Globals { "Tick", bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, )?; + instances + .add_instance( + "ComponentTicks", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::< + LuaComponentTicks, + >::new, + )?; instances .add_instance( "Identifier", @@ -500,6 +508,11 @@ impl bevy_mod_scripting_core::hosts::APIProvider for BevyEcsAPIProvider { bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, >() .process_type::() + .process_type::< + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< + LuaComponentTicks, + >, + >() .process_type::() .process_type::< bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< diff --git a/crates/bevy_script_api/src/providers/bevy_hierarchy.rs b/crates/bevy_script_api/src/providers/bevy_hierarchy.rs index 2cb1efa99e..23708e43fc 100644 --- a/crates/bevy_script_api/src/providers/bevy_hierarchy.rs +++ b/crates/bevy_script_api/src/providers/bevy_hierarchy.rs @@ -70,8 +70,8 @@ struct Parent(); remote = "bevy::hierarchy::HierarchyEvent", functions[r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::hierarchy::HierarchyEvent; "#, r#" @@ -87,8 +87,8 @@ struct Parent(); "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::hierarchy::HierarchyEvent; + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); "#, r#" diff --git a/crates/bevy_script_api/src/providers/bevy_input.rs b/crates/bevy_script_api/src/providers/bevy_input.rs index f13ae2f8ef..852d5a9058 100644 --- a/crates/bevy_script_api/src/providers/bevy_input.rs +++ b/crates/bevy_script_api/src/providers/bevy_input.rs @@ -15,6 +15,21 @@ use bevy_script_api::{ derive(), remote = "bevy::input::gamepad::Gamepad", functions[r#" +/// Returns the USB vendor ID as assigned by the USB-IF, if available. + + #[lua(kind = "Method")] + fn vendor_id(&self) -> std::option::Option; + +"#, + r#" +/// Returns the USB product ID as assigned by the [vendor], if available. +/// [vendor]: Self::vendor_id + + #[lua(kind = "Method")] + fn product_id(&self) -> std::option::Option; + +"#, + r#" /// Returns the left stick as a [`Vec2`] #[lua(kind = "Method", output(proxy))] @@ -34,6 +49,37 @@ use bevy_script_api::{ #[lua(kind = "Method", output(proxy))] fn dpad(&self) -> bevy::math::Vec2; +"#, + r#" +/// Returns `true` if the [`GamepadButton`] has been pressed. + + #[lua(kind = "Method")] + fn pressed(&self, #[proxy] button_type: bevy::input::gamepad::GamepadButton) -> bool; + +"#, + r#" +/// Returns `true` if the [`GamepadButton`] has been pressed during the current frame. +/// Note: This function does not imply information regarding the current state of [`ButtonInput::pressed`] or [`ButtonInput::just_released`]. + + #[lua(kind = "Method")] + fn just_pressed( + &self, + #[proxy] + button_type: bevy::input::gamepad::GamepadButton, + ) -> bool; + +"#, + r#" +/// Returns `true` if the [`GamepadButton`] has been released during the current frame. +/// Note: This function does not imply information regarding the current state of [`ButtonInput::pressed`] or [`ButtonInput::just_pressed`]. + + #[lua(kind = "Method")] + fn just_released( + &self, + #[proxy] + button_type: bevy::input::gamepad::GamepadButton, + ) -> bool; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -42,25 +88,15 @@ fn index(&self) -> String { } "#] )] -struct Gamepad { - vendor_id: std::option::Option, - product_id: std::option::Option, - digital: ReflectedValue, - analog: ReflectedValue, -} +struct Gamepad {} #[derive(bevy_mod_scripting_lua_derive::LuaProxy)] #[proxy( derive(clone), remote = "bevy::input::gamepad::GamepadAxis", functions[r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &gamepad::GamepadAxis) -> bool; + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); "#, r#" @@ -71,8 +107,13 @@ struct Gamepad { "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &gamepad::GamepadAxis) -> bool; "#, r#" @@ -89,8 +130,13 @@ struct GamepadAxis {} remote = "bevy::input::gamepad::GamepadButton", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::gamepad::GamepadButton; + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &gamepad::GamepadButton) -> bool; "#, r#" @@ -101,13 +147,8 @@ struct GamepadAxis {} "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &gamepad::GamepadButton) -> bool; + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::gamepad::GamepadButton; "#, r#" @@ -152,13 +193,8 @@ struct GamepadSettings { remote = "bevy::input::keyboard::KeyCode", functions[r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &keyboard::KeyCode) -> bool; + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); "#, r#" @@ -169,8 +205,13 @@ struct GamepadSettings { "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &keyboard::KeyCode) -> bool; "#, r#" @@ -187,12 +228,6 @@ struct KeyCode {} remote = "bevy::input::mouse::MouseButton", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::mouse::MouseButton; - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -201,6 +236,12 @@ struct KeyCode {} )] fn eq(&self, #[proxy] other: &mouse::MouseButton) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::mouse::MouseButton; + "#, r#" @@ -260,6 +301,12 @@ struct TouchInput { remote = "bevy::input::keyboard::KeyboardFocusLost", functions[r#" + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -274,12 +321,6 @@ struct TouchInput { #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] fn clone(&self) -> bevy::input::keyboard::KeyboardFocusLost; -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -372,12 +413,6 @@ struct AccumulatedMouseMotion { remote = "bevy::input::mouse::AccumulatedMouseScroll", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::mouse::AccumulatedMouseScroll; - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -386,6 +421,12 @@ struct AccumulatedMouseMotion { )] fn eq(&self, #[proxy] other: &mouse::AccumulatedMouseScroll) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::mouse::AccumulatedMouseScroll; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -409,6 +450,12 @@ struct AccumulatedMouseScroll { #[lua(as_trait = "std::cmp::Eq", kind = "Method")] fn assert_receiver_is_total_eq(&self) -> (); +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::mouse::MouseButtonInput; + "#, r#" @@ -420,12 +467,6 @@ struct AccumulatedMouseScroll { )] fn eq(&self, #[proxy] other: &mouse::MouseButtonInput) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::mouse::MouseButtonInput; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -516,6 +557,12 @@ struct MouseWheel { remote = "bevy::input::gamepad::GamepadAxisChangedEvent", functions[r#" + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::gamepad::GamepadAxisChangedEvent; + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -524,12 +571,6 @@ struct MouseWheel { )] fn eq(&self, #[proxy] other: &gamepad::GamepadAxisChangedEvent) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::gamepad::GamepadAxisChangedEvent; - "#, r#" /// Creates a new [`GamepadAxisChangedEvent`] @@ -563,23 +604,6 @@ struct GamepadAxisChangedEvent { derive(clone), remote = "bevy::input::gamepad::GamepadButtonChangedEvent", functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &gamepad::GamepadButtonChangedEvent) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::gamepad::GamepadButtonChangedEvent; - -"#, - r#" /// Creates a new [`GamepadButtonChangedEvent`] #[lua(kind = "Function", output(proxy))] @@ -593,6 +617,23 @@ struct GamepadAxisChangedEvent { value: f32, ) -> bevy::input::gamepad::GamepadButtonChangedEvent; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::gamepad::GamepadButtonChangedEvent; + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &gamepad::GamepadButtonChangedEvent) -> bool; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -627,12 +668,6 @@ struct GamepadButtonChangedEvent { state: bevy::input::ButtonState, ) -> bevy::input::gamepad::GamepadButtonStateChangedEvent; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::gamepad::GamepadButtonStateChangedEvent; - "#, r#" @@ -650,6 +685,12 @@ struct GamepadButtonChangedEvent { )] fn eq(&self, #[proxy] other: &gamepad::GamepadButtonStateChangedEvent) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::gamepad::GamepadButtonStateChangedEvent; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -701,12 +742,6 @@ struct GamepadConnection {} remote = "bevy::input::gamepad::GamepadConnectionEvent", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::gamepad::GamepadConnectionEvent; - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -741,6 +776,12 @@ struct GamepadConnection {} #[lua(kind = "Method")] fn disconnected(&self) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::gamepad::GamepadConnectionEvent; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -790,6 +831,12 @@ struct GamepadEvent {} remote = "bevy::input::gamepad::GamepadInput", functions[r#" + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -804,12 +851,6 @@ struct GamepadEvent {} #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] fn clone(&self) -> bevy::input::gamepad::GamepadInput; -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -824,16 +865,16 @@ struct GamepadInput {} derive(clone), remote = "bevy::input::gamepad::GamepadRumbleRequest", functions[r#" -/// Get the [`Entity`] associated with this request. - #[lua(kind = "Method", output(proxy))] - fn gamepad(&self) -> bevy::ecs::entity::Entity; + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::gamepad::GamepadRumbleRequest; "#, r#" +/// Get the [`Entity`] associated with this request. - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::gamepad::GamepadRumbleRequest; + #[lua(kind = "Method", output(proxy))] + fn gamepad(&self) -> bevy::ecs::entity::Entity; "#] )] @@ -843,6 +884,19 @@ struct GamepadRumbleRequest {} derive(clone), remote = "bevy::input::gamepad::RawGamepadAxisChangedEvent", functions[r#" +/// Creates a [`RawGamepadAxisChangedEvent`]. + + #[lua(kind = "Function", output(proxy))] + fn new( + #[proxy] + gamepad: bevy::ecs::entity::Entity, + #[proxy] + axis_type: bevy::input::gamepad::GamepadAxis, + value: f32, + ) -> bevy::input::gamepad::RawGamepadAxisChangedEvent; + +"#, + r#" #[lua( as_trait = "std::cmp::PartialEq", @@ -858,19 +912,6 @@ struct GamepadRumbleRequest {} #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] fn clone(&self) -> bevy::input::gamepad::RawGamepadAxisChangedEvent; -"#, - r#" -/// Creates a [`RawGamepadAxisChangedEvent`]. - - #[lua(kind = "Function", output(proxy))] - fn new( - #[proxy] - gamepad: bevy::ecs::entity::Entity, - #[proxy] - axis_type: bevy::input::gamepad::GamepadAxis, - value: f32, - ) -> bevy::input::gamepad::RawGamepadAxisChangedEvent; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -892,12 +933,6 @@ struct RawGamepadAxisChangedEvent { remote = "bevy::input::gamepad::RawGamepadButtonChangedEvent", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::gamepad::RawGamepadButtonChangedEvent; - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -919,6 +954,12 @@ struct RawGamepadAxisChangedEvent { value: f32, ) -> bevy::input::gamepad::RawGamepadButtonChangedEvent; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::gamepad::RawGamepadButtonChangedEvent; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -998,6 +1039,12 @@ struct PinchGesture(f32); remote = "bevy::input::gestures::RotationGesture", functions[r#" + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::gestures::RotationGesture; + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -1006,12 +1053,6 @@ struct PinchGesture(f32); )] fn eq(&self, #[proxy] other: &gestures::RotationGesture) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::gestures::RotationGesture; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -1056,12 +1097,6 @@ struct DoubleTapGesture {} remote = "bevy::input::gestures::PanGesture", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::gestures::PanGesture; - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -1070,6 +1105,12 @@ struct DoubleTapGesture {} )] fn eq(&self, #[proxy] other: &gestures::PanGesture) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::gestures::PanGesture; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -1088,13 +1129,6 @@ struct PanGesture(#[lua(output(proxy))] bevy::math::Vec2); #[lua(as_trait = "std::cmp::Eq", kind = "Method")] fn assert_receiver_is_total_eq(&self) -> (); -"#, - r#" -/// Is this button pressed? - - #[lua(kind = "Method")] - fn is_pressed(&self) -> bool; - "#, r#" @@ -1112,6 +1146,13 @@ struct PanGesture(#[lua(output(proxy))] bevy::math::Vec2); #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] fn clone(&self) -> bevy::input::ButtonState; +"#, + r#" +/// Is this button pressed? + + #[lua(kind = "Method")] + fn is_pressed(&self) -> bool; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -1135,6 +1176,12 @@ struct ButtonState {} )] fn eq(&self, #[proxy] other: &gamepad::ButtonSettings) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::gamepad::ButtonSettings; + "#, r#" /// Returns `true` if the button is pressed. @@ -1183,12 +1230,6 @@ struct ButtonState {} #[lua(kind = "MutatingMethod")] fn set_release_threshold(&mut self, value: f32) -> f32; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::gamepad::ButtonSettings; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -1204,8 +1245,13 @@ struct ButtonSettings {} remote = "bevy::input::gamepad::AxisSettings", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::gamepad::AxisSettings; + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &gamepad::AxisSettings) -> bool; "#, r#" @@ -1314,13 +1360,8 @@ struct ButtonSettings {} "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &gamepad::AxisSettings) -> bool; + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::gamepad::AxisSettings; "#, r#" @@ -1336,6 +1377,12 @@ struct AxisSettings {} derive(clone), remote = "bevy::input::gamepad::ButtonAxisSettings", functions[r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::gamepad::ButtonAxisSettings; + +"#, + r#" /// Filters the `new_value` based on the `old_value`, according to the [`ButtonAxisSettings`]. /// Returns the clamped `new_value`, according to the [`ButtonAxisSettings`], if the change /// exceeds the settings threshold, and `None` otherwise. @@ -1347,12 +1394,6 @@ struct AxisSettings {} old_value: std::option::Option, ) -> std::option::Option; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::gamepad::ButtonAxisSettings; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -1372,12 +1413,6 @@ struct ButtonAxisSettings { remote = "bevy::input::gamepad::GamepadRumbleIntensity", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::gamepad::GamepadRumbleIntensity; - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -1386,6 +1421,12 @@ struct ButtonAxisSettings { )] fn eq(&self, #[proxy] other: &gamepad::GamepadRumbleIntensity) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::gamepad::GamepadRumbleIntensity; + "#, r#" /// Creates a new rumble intensity with weak motor intensity set to the given value. @@ -1420,8 +1461,8 @@ struct GamepadRumbleIntensity { remote = "bevy::input::keyboard::Key", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::keyboard::Key; + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); "#, r#" @@ -1437,8 +1478,8 @@ struct GamepadRumbleIntensity { "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::keyboard::Key; "#, r#" @@ -1455,25 +1496,25 @@ struct Key {} remote = "bevy::input::keyboard::NativeKeyCode", functions[r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &keyboard::NativeKeyCode) -> bool; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::keyboard::NativeKeyCode; + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &keyboard::NativeKeyCode) -> bool; + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::keyboard::NativeKeyCode; "#, r#" @@ -1490,13 +1531,8 @@ struct NativeKeyCode {} remote = "bevy::input::keyboard::NativeKey", functions[r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &keyboard::NativeKey) -> bool; + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); "#, r#" @@ -1507,8 +1543,13 @@ struct NativeKeyCode {} "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &keyboard::NativeKey) -> bool; "#, r#" @@ -1525,14 +1566,14 @@ struct NativeKey {} remote = "bevy::input::mouse::MouseScrollUnit", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::mouse::MouseScrollUnit; + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::mouse::MouseScrollUnit; "#, r#" @@ -1560,13 +1601,8 @@ struct MouseScrollUnit {} remote = "bevy::input::touch::TouchPhase", functions[r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &touch::TouchPhase) -> bool; + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); "#, r#" @@ -1577,8 +1613,13 @@ struct MouseScrollUnit {} "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &touch::TouchPhase) -> bool; "#, r#" diff --git a/crates/bevy_script_api/src/providers/bevy_math.rs b/crates/bevy_script_api/src/providers/bevy_math.rs index 822cdb30a3..57cd3657ff 100644 --- a/crates/bevy_script_api/src/providers/bevy_math.rs +++ b/crates/bevy_script_api/src/providers/bevy_math.rs @@ -13,13 +13,8 @@ use bevy_script_api::{ remote = "bevy::math::AspectRatio", functions[r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &aspect_ratio::AspectRatio) -> bool; + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::AspectRatio; "#, r#" @@ -59,8 +54,13 @@ use bevy_script_api::{ "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::AspectRatio; + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &aspect_ratio::AspectRatio) -> bool; "#, r#" @@ -80,6 +80,12 @@ struct AspectRatio(); #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] fn clone(&self) -> bevy::math::CompassOctant; +"#, + r#" + + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); + "#, r#" @@ -91,12 +97,6 @@ struct AspectRatio(); )] fn eq(&self, #[proxy] other: &compass::CompassOctant) -> bool; -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -112,6 +112,12 @@ struct CompassOctant {} remote = "bevy::math::CompassQuadrant", functions[r#" + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -126,12 +132,6 @@ struct CompassOctant {} #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] fn clone(&self) -> bevy::math::CompassQuadrant; -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -147,6 +147,30 @@ struct CompassQuadrant {} remote = "bevy::math::Isometry2d", functions[r#" + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: bevy::math::prelude::Dir2) -> bevy::math::prelude::Dir2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: bevy::math::prelude::Vec2) -> bevy::math::prelude::Vec2; + +"#, + r#" + #[lua( as_trait = "std::ops::Mul", kind = "MetaFunction", @@ -156,6 +180,17 @@ struct CompassQuadrant {} )] fn mul(self, #[proxy] rhs: bevy::math::Isometry2d) -> bevy::math::Isometry2d; +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &isometry::Isometry2d) -> bool; + "#, r#" @@ -243,41 +278,6 @@ struct CompassQuadrant {} point: bevy::math::prelude::Vec2, ) -> bevy::math::prelude::Vec2; -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: bevy::math::prelude::Vec2) -> bevy::math::prelude::Vec2; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &isometry::Isometry2d) -> bool; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: bevy::math::prelude::Dir2) -> bevy::math::prelude::Dir2; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -297,6 +297,24 @@ struct Isometry2d { derive(clone), remote = "bevy::math::Isometry3d", functions[r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::Isometry3d; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; + +"#, + r#" /// Create a three-dimensional isometry from a rotation. #[lua(kind = "Function", output(proxy))] @@ -342,7 +360,7 @@ struct Isometry2d { composite = "mul", metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: bevy::math::prelude::Vec3) -> bevy::math::prelude::Vec3; + fn mul(self, #[proxy] rhs: bevy::math::Isometry3d) -> bevy::math::Isometry3d; "#, r#" @@ -355,12 +373,6 @@ struct Isometry2d { )] fn eq(&self, #[proxy] other: &isometry::Isometry3d) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::Isometry3d; - "#, r#" @@ -371,19 +383,7 @@ struct Isometry2d { composite = "mul", metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: bevy::math::prelude::Dir3) -> bevy::math::prelude::Dir3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; + fn mul(self, #[proxy] rhs: bevy::math::prelude::Vec3) -> bevy::math::prelude::Vec3; "#, r#" @@ -395,7 +395,7 @@ struct Isometry2d { composite = "mul", metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: bevy::math::Isometry3d) -> bevy::math::Isometry3d; + fn mul(self, #[proxy] rhs: bevy::math::prelude::Dir3) -> bevy::math::prelude::Dir3; "#, r#" @@ -416,23 +416,6 @@ struct Isometry3d { derive(clone), remote = "bevy::math::Ray2d", functions[r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::Ray2d; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &ray::Ray2d) -> bool; - -"#, - r#" /// Create a new `Ray2d` from a given origin and direction #[lua(kind = "Function", output(proxy))] @@ -463,6 +446,23 @@ struct Isometry3d { plane: bevy::math::primitives::Plane2d, ) -> std::option::Option; +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &ray::Ray2d) -> bool; + +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::Ray2d; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -483,8 +483,13 @@ struct Ray2d { remote = "bevy::math::Ray3d", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::Ray3d; + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &ray::Ray3d) -> bool; "#, r#" @@ -521,13 +526,8 @@ struct Ray2d { "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &ray::Ray3d) -> bool; + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::Ray3d; "#, r#" @@ -548,13 +548,7 @@ struct Ray3d { derive(clone), remote = "bevy::math::Rot2", functions[r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::Rot2; - -"#, - r#" -/// Rotates a [`Vec2`] by a [`Rot2`]. +/// Rotates the [`Dir2`] using a [`Rot2`]. #[lua( as_trait = "std::ops::Mul", @@ -563,7 +557,11 @@ struct Ray3d { composite = "mul", metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: bevy::math::prelude::Vec2) -> bevy::math::prelude::Vec2; + fn mul( + self, + #[proxy] + direction: bevy::math::prelude::Dir2, + ) -> bevy::math::prelude::Dir2; "#, r#" @@ -577,23 +575,6 @@ struct Ray3d { )] fn mul(self, #[proxy] rhs: bevy::math::Rot2) -> bevy::math::Rot2; -"#, - r#" -/// Rotates the [`Dir2`] using a [`Rot2`]. - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul( - self, - #[proxy] - direction: bevy::math::prelude::Dir2, - ) -> bevy::math::prelude::Dir2; - "#, r#" /// Creates a [`Rot2`] from a counterclockwise angle in radians. @@ -778,6 +759,13 @@ struct Ray3d { #[lua(kind = "Method")] fn angle_between(self, #[proxy] other: bevy::math::Rot2) -> f32; +"#, + r#" +/// Returns the angle in radians needed to make `self` and `other` coincide. + + #[lua(kind = "Method")] + fn angle_to(self, #[proxy] other: bevy::math::Rot2) -> f32; + "#, r#" /// Returns the inverse of the rotation. This is also the conjugate @@ -843,6 +831,19 @@ struct Ray3d { #[lua(kind = "Method", output(proxy))] fn slerp(self, #[proxy] end: bevy::math::Rot2, s: f32) -> bevy::math::Rot2; +"#, + r#" +/// Rotates a [`Vec2`] by a [`Rot2`]. + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: bevy::math::prelude::Vec2) -> bevy::math::prelude::Vec2; + "#, r#" @@ -854,6 +855,12 @@ struct Ray3d { )] fn eq(&self, #[proxy] other: &rotation2d::Rot2) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::Rot2; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -871,6 +878,17 @@ struct Rot2 { derive(clone), remote = "bevy::math::prelude::Dir2", functions[r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &direction::Dir2) -> bool; + +"#, + r#" /// Create a [`Dir2`] from a [`Vec2`] that is already normalized. /// # Warning /// `value` must be normalized, i.e its length must be `1.0`. @@ -984,12 +1002,13 @@ struct Rot2 { r#" #[lua( - as_trait = "std::cmp::PartialEq", + as_trait = "std::ops::Neg", kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", + output(proxy), + composite = "neg", + metamethod = "Unm", )] - fn eq(&self, #[proxy] other: &direction::Dir2) -> bool; + fn neg(self) -> bevy::math::prelude::Dir2; "#, r#" @@ -997,18 +1016,6 @@ struct Rot2 { #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] fn clone(&self) -> bevy::math::prelude::Dir2; -"#, - r#" - - #[lua( - as_trait = "std::ops::Neg", - kind = "MetaFunction", - output(proxy), - composite = "neg", - metamethod = "Unm", - )] - fn neg(self) -> bevy::math::prelude::Dir2; - "#, r#" @@ -1036,13 +1043,8 @@ struct Dir2(); remote = "bevy::math::prelude::Dir3", functions[r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &direction::Dir3) -> bool; + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::prelude::Dir3; "#, r#" @@ -1068,6 +1070,17 @@ struct Dir2(); )] fn neg(self) -> bevy::math::prelude::Dir3; +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &direction::Dir3) -> bool; + "#, r#" /// Create a [`Dir3`] from a [`Vec3`] that is already normalized. @@ -1159,12 +1172,6 @@ struct Dir2(); #[lua(kind = "Method", output(proxy))] fn fast_renormalize(self) -> bevy::math::prelude::Dir3; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::prelude::Dir3; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -1243,12 +1250,6 @@ struct Dir3(); #[lua(kind = "Method", output(proxy))] fn fast_renormalize(self) -> bevy::math::prelude::Dir3A; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::prelude::Dir3A; - "#, r#" @@ -1264,25 +1265,31 @@ struct Dir3(); r#" #[lua( - as_trait = "std::ops::Neg", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "neg", - metamethod = "Unm", + composite = "mul", + metamethod = "Mul", )] - fn neg(self) -> bevy::math::prelude::Dir3A; + fn mul(self, rhs: f32) -> bevy::math::Vec3A; "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Neg", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "neg", + metamethod = "Unm", )] - fn mul(self, rhs: f32) -> bevy::math::Vec3A; + fn neg(self) -> bevy::math::prelude::Dir3A; + +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::prelude::Dir3A; "#, r#" @@ -1298,6 +1305,29 @@ struct Dir3A(); derive(clone), remote = "bevy::math::prelude::IRect", functions[r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &rects::irect::IRect) -> bool; + +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::prelude::IRect; + +"#, + r#" + + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); + +"#, + r#" /// Create a new rectangle from two corner points. /// The two points do not need to be the minimum and/or maximum corners. /// They only need to be two opposite corners. @@ -1575,29 +1605,6 @@ struct Dir3A(); #[lua(kind = "Method", output(proxy))] fn as_urect(&self) -> bevy::math::prelude::URect; -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &rects::irect::IRect) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::prelude::IRect; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -1617,6 +1624,23 @@ struct IRect { derive(clone), remote = "bevy::math::prelude::Rect", functions[r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::prelude::Rect; + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &rects::rect::Rect) -> bool; + +"#, + r#" /// Create a new rectangle from two corner points. /// The two points do not need to be the minimum and/or maximum corners. /// They only need to be two opposite corners. @@ -1911,23 +1935,6 @@ struct IRect { #[lua(kind = "Method", output(proxy))] fn as_urect(&self) -> bevy::math::prelude::URect; -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &rects::rect::Rect) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::prelude::Rect; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -2390,6 +2397,12 @@ struct BoundingCircle { derive(clone), remote = "bevy::math::primitives::Circle", functions[r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::primitives::Circle; + +"#, + r#" /// Create a new [`Circle`] from a `radius` #[lua(kind = "Function", output(proxy))] @@ -2415,12 +2428,6 @@ struct BoundingCircle { point: bevy::math::prelude::Vec2, ) -> bevy::math::prelude::Vec2; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::Circle; - "#, r#" @@ -2449,12 +2456,6 @@ struct Circle { remote = "bevy::math::primitives::Annulus", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::Annulus; - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -2463,6 +2464,12 @@ struct Circle { )] fn eq(&self, #[proxy] other: &primitives::dim2::Annulus) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::primitives::Annulus; + "#, r#" /// Create a new [`Annulus`] from the radii of the inner and outer circle @@ -2517,6 +2524,23 @@ struct Annulus { derive(clone), remote = "bevy::math::primitives::Arc2d", functions[r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::primitives::Arc2d; + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &primitives::dim2::Arc2d) -> bool; + +"#, + r#" /// Create a new [`Arc2d`] from a `radius` and a `half_angle` #[lua(kind = "Function", output(proxy))] @@ -2636,23 +2660,6 @@ struct Annulus { #[lua(kind = "Method")] fn is_major(&self) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::Arc2d; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &primitives::dim2::Arc2d) -> bool; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -2679,6 +2686,12 @@ struct Arc2d { )] fn eq(&self, #[proxy] other: &primitives::dim2::Capsule2d) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::primitives::Capsule2d; + "#, r#" /// Create a new `Capsule2d` from a radius and length @@ -2693,12 +2706,6 @@ struct Arc2d { #[lua(kind = "Method", output(proxy))] fn to_inner_rectangle(&self) -> bevy::math::primitives::Rectangle; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::Capsule2d; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -2845,23 +2852,6 @@ struct CircularSector { derive(clone), remote = "bevy::math::primitives::CircularSegment", functions[r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::CircularSegment; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &primitives::dim2::CircularSegment) -> bool; - -"#, - r#" /// Create a new [`CircularSegment`] from a `radius`, and an `angle` #[lua(kind = "Function", output(proxy))] @@ -2944,16 +2934,33 @@ struct CircularSector { /// which is the signed distance between the segment and the center of its circle /// See [`Arc2d::apothem`] - #[lua(kind = "Method")] - fn apothem(&self) -> f32; + #[lua(kind = "Method")] + fn apothem(&self) -> f32; + +"#, + r#" +/// Get the length of the sagitta of this segment, also known as its height +/// See [`Arc2d::sagitta`] + + #[lua(kind = "Method")] + fn sagitta(&self) -> f32; + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &primitives::dim2::CircularSegment) -> bool; "#, r#" -/// Get the length of the sagitta of this segment, also known as its height -/// See [`Arc2d::sagitta`] - #[lua(kind = "Method")] - fn sagitta(&self) -> f32; + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::primitives::CircularSegment; "#, r#" @@ -2972,23 +2979,6 @@ struct CircularSegment { derive(clone), remote = "bevy::math::primitives::Ellipse", functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &primitives::dim2::Ellipse) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::Ellipse; - -"#, - r#" /// Create a new `Ellipse` from half of its width and height. /// This corresponds to the two perpendicular radii defining the ellipse. @@ -3037,6 +3027,23 @@ struct CircularSegment { #[lua(kind = "Method")] fn semi_minor(&self) -> f32; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::primitives::Ellipse; + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &primitives::dim2::Ellipse) -> bool; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -3055,12 +3062,6 @@ struct Ellipse { remote = "bevy::math::primitives::Line2d", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::Line2d; - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -3069,6 +3070,12 @@ struct Ellipse { )] fn eq(&self, #[proxy] other: &primitives::dim2::Line2d) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::primitives::Line2d; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -3087,8 +3094,13 @@ struct Line2d { remote = "bevy::math::primitives::Plane2d", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::Plane2d; + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &primitives::dim2::Plane2d) -> bool; "#, r#" @@ -3105,13 +3117,8 @@ struct Line2d { "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &primitives::dim2::Plane2d) -> bool; + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::primitives::Plane2d; "#, r#" @@ -3131,12 +3138,6 @@ struct Plane2d { remote = "bevy::math::primitives::Rectangle", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::Rectangle; - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -3202,6 +3203,12 @@ struct Plane2d { point: bevy::math::prelude::Vec2, ) -> bevy::math::prelude::Vec2; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::primitives::Rectangle; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -3223,6 +3230,17 @@ struct Rectangle { #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] fn clone(&self) -> bevy::math::primitives::RegularPolygon; +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &primitives::dim2::RegularPolygon) -> bool; + "#, r#" /// Create a new `RegularPolygon` @@ -3293,17 +3311,6 @@ struct Rectangle { #[lua(kind = "Method")] fn external_angle_radians(&self) -> f32; -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &primitives::dim2::RegularPolygon) -> bool; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -3322,23 +3329,6 @@ struct RegularPolygon { derive(clone), remote = "bevy::math::primitives::Rhombus", functions[r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::Rhombus; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &primitives::dim2::Rhombus) -> bool; - -"#, - r#" /// Create a new `Rhombus` from a vertical and horizontal diagonal sizes. #[lua(kind = "Function", output(proxy))] @@ -3397,6 +3387,23 @@ struct RegularPolygon { point: bevy::math::prelude::Vec2, ) -> bevy::math::prelude::Vec2; +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &primitives::dim2::Rhombus) -> bool; + +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::primitives::Rhombus; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -3414,6 +3421,23 @@ struct Rhombus { derive(clone), remote = "bevy::math::primitives::Segment2d", functions[r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &primitives::dim2::Segment2d) -> bool; + +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::primitives::Segment2d; + +"#, + r#" /// Create a new `Segment2d` from a direction and full length of the segment #[lua(kind = "Function", output(proxy))] @@ -3437,23 +3461,6 @@ struct Rhombus { #[lua(kind = "Method", output(proxy))] fn point2(&self) -> bevy::math::prelude::Vec2; -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &primitives::dim2::Segment2d) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::Segment2d; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -3481,6 +3488,12 @@ struct Segment2d { )] fn eq(&self, #[proxy] other: &primitives::dim2::Triangle2d) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::primitives::Triangle2d; + "#, r#" /// Create a new `Triangle2d` from points `a`, `b`, and `c` @@ -3533,12 +3546,6 @@ struct Segment2d { #[lua(kind = "Method", output(proxy))] fn reversed(self) -> bevy::math::primitives::Triangle2d; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::Triangle2d; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -3623,12 +3630,6 @@ struct BoundingSphere { remote = "bevy::math::primitives::Sphere", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::Sphere; - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -3664,6 +3665,12 @@ struct BoundingSphere { point: bevy::math::prelude::Vec3, ) -> bevy::math::prelude::Vec3; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::primitives::Sphere; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -3680,6 +3687,12 @@ struct Sphere { derive(clone), remote = "bevy::math::primitives::Cuboid", functions[r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::primitives::Cuboid; + +"#, + r#" /// Create a new `Cuboid` from a full x, y, and z length #[lua(kind = "Function", output(proxy))] @@ -3750,12 +3763,6 @@ struct Sphere { )] fn eq(&self, #[proxy] other: &primitives::dim3::Cuboid) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::Cuboid; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -3774,8 +3781,13 @@ struct Cuboid { remote = "bevy::math::primitives::Cylinder", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::Cylinder; + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &primitives::dim3::Cylinder) -> bool; "#, r#" @@ -3809,13 +3821,8 @@ struct Cuboid { "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &primitives::dim3::Cylinder) -> bool; + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::primitives::Cylinder; "#, r#" @@ -3834,17 +3841,6 @@ struct Cylinder { derive(clone), remote = "bevy::math::primitives::Capsule3d", functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &primitives::dim3::Capsule3d) -> bool; - -"#, - r#" /// Create a new `Capsule3d` from a radius and length #[lua(kind = "Function", output(proxy))] @@ -3864,6 +3860,17 @@ struct Cylinder { #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] fn clone(&self) -> bevy::math::primitives::Capsule3d; +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &primitives::dim3::Capsule3d) -> bool; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -3890,12 +3897,6 @@ struct Capsule3d { )] fn eq(&self, #[proxy] other: &primitives::dim3::Cone) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::Cone; - "#, r#" /// Create a new [`Cone`] from a radius and height. @@ -3933,6 +3934,12 @@ struct Capsule3d { #[lua(kind = "Method")] fn base_area(&self) -> f32; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::primitives::Cone; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -3983,12 +3990,6 @@ struct ConicalFrustum { derive(clone), remote = "bevy::math::primitives::InfinitePlane3d", functions[r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::InfinitePlane3d; - -"#, - r#" /// Computes an [`Isometry3d`] which transforms points from the plane in 3D space with the given /// `origin` to the XY-plane. /// ## Guarantees @@ -4043,6 +4044,12 @@ struct ConicalFrustum { origin: bevy::math::prelude::Vec3, ) -> bevy::math::Isometry3d; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::primitives::InfinitePlane3d; + "#, r#" @@ -4072,6 +4079,12 @@ struct InfinitePlane3d { remote = "bevy::math::primitives::Line3d", functions[r#" + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::primitives::Line3d; + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -4080,12 +4093,6 @@ struct InfinitePlane3d { )] fn eq(&self, #[proxy] other: &primitives::dim3::Line3d) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::Line3d; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -4104,17 +4111,6 @@ struct Line3d { remote = "bevy::math::primitives::Segment3d", functions[r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &primitives::dim3::Segment3d) -> bool; - -"#, - r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] fn clone(&self) -> bevy::math::primitives::Segment3d; @@ -4143,6 +4139,17 @@ struct Line3d { #[lua(kind = "Method", output(proxy))] fn point2(&self) -> bevy::math::prelude::Vec3; +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &primitives::dim3::Segment3d) -> bool; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -4161,23 +4168,6 @@ struct Segment3d { derive(clone), remote = "bevy::math::primitives::Torus", functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &primitives::dim3::Torus) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::Torus; - -"#, - r#" /// Create a new `Torus` from an inner and outer radius. /// The inner radius is the radius of the hole, and the outer radius /// is the radius of the entire object @@ -4203,6 +4193,23 @@ struct Segment3d { #[lua(kind = "Method")] fn outer_radius(&self) -> f32; +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &primitives::dim3::Torus) -> bool; + +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::primitives::Torus; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -4318,6 +4325,12 @@ struct Triangle3d { derive(clone), remote = "bevy::math::bounding::RayCast2d", functions[r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::bounding::RayCast2d; + +"#, + r#" /// Construct a [`RayCast2d`] from an origin, [`Dir2`], and max distance. #[lua(kind = "Function", output(proxy))] @@ -4369,12 +4382,6 @@ struct Triangle3d { circle: &bounding::bounded2d::BoundingCircle, ) -> std::option::Option; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::bounding::RayCast2d; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -4455,12 +4462,6 @@ struct AabbCast2d { derive(clone), remote = "bevy::math::bounding::BoundingCircleCast", functions[r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::bounding::BoundingCircleCast; - -"#, - r#" /// Construct a [`BoundingCircleCast`] from a [`BoundingCircle`], origin, [`Dir2`], and max distance. #[lua(kind = "Function", output(proxy))] @@ -4498,6 +4499,12 @@ struct AabbCast2d { circle: bevy::math::bounding::BoundingCircle, ) -> std::option::Option; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::bounding::BoundingCircleCast; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -4581,12 +4588,6 @@ struct RayCast3d { derive(clone), remote = "bevy::math::bounding::AabbCast3d", functions[r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::bounding::AabbCast3d; - -"#, - r#" /// Construct an [`AabbCast3d`] from an [`Aabb3d`], [`Ray3d`], and max distance. #[lua(kind = "Function", output(proxy))] @@ -4609,6 +4610,12 @@ struct RayCast3d { aabb: bevy::math::bounding::Aabb3d, ) -> std::option::Option; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::bounding::AabbCast3d; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -4675,17 +4682,6 @@ struct BoundingSphereCast { derive(clone), remote = "bevy::math::curve::interval::Interval", functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &curve::interval::Interval) -> bool; - -"#, - r#" /// Get the start of this interval. #[lua(kind = "Method")] @@ -4759,6 +4755,17 @@ struct BoundingSphereCast { #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] fn clone(&self) -> bevy::math::curve::interval::Interval; +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &curve::interval::Interval) -> bool; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -4774,55 +4781,55 @@ struct Interval {} remote = "bevy::math::FloatOrd", functions[r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &float_ord::FloatOrd) -> bool; + #[lua(as_trait = "std::cmp::PartialOrd", kind = "Method")] + fn lt(&self, #[proxy] other: &float_ord::FloatOrd) -> bool; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::FloatOrd; + #[lua(as_trait = "std::cmp::PartialOrd", kind = "Method")] + fn le(&self, #[proxy] other: &float_ord::FloatOrd) -> bool; "#, r#" - #[lua( - as_trait = "std::ops::Neg", - kind = "MetaFunction", - output(proxy), - composite = "neg", - metamethod = "Unm", - )] - fn neg(self) -> bevy::math::FloatOrd; + #[lua(as_trait = "std::cmp::PartialOrd", kind = "Method")] + fn gt(&self, #[proxy] other: &float_ord::FloatOrd) -> bool; "#, r#" #[lua(as_trait = "std::cmp::PartialOrd", kind = "Method")] - fn lt(&self, #[proxy] other: &float_ord::FloatOrd) -> bool; + fn ge(&self, #[proxy] other: &float_ord::FloatOrd) -> bool; "#, r#" - #[lua(as_trait = "std::cmp::PartialOrd", kind = "Method")] - fn le(&self, #[proxy] other: &float_ord::FloatOrd) -> bool; + #[lua( + as_trait = "std::ops::Neg", + kind = "MetaFunction", + output(proxy), + composite = "neg", + metamethod = "Unm", + )] + fn neg(self) -> bevy::math::FloatOrd; "#, r#" - #[lua(as_trait = "std::cmp::PartialOrd", kind = "Method")] - fn gt(&self, #[proxy] other: &float_ord::FloatOrd) -> bool; + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &float_ord::FloatOrd) -> bool; "#, r#" - #[lua(as_trait = "std::cmp::PartialOrd", kind = "Method")] - fn ge(&self, #[proxy] other: &float_ord::FloatOrd) -> bool; + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::FloatOrd; "#, r#" @@ -4838,17 +4845,6 @@ struct FloatOrd(f32); derive(clone), remote = "bevy::math::primitives::Plane3d", functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &primitives::dim3::Plane3d) -> bool; - -"#, - r#" /// Create a new `Plane3d` from a normal and a half size /// # Panics /// Panics if the given `normal` is zero (or very close to zero), or non-finite. @@ -4867,6 +4863,17 @@ struct FloatOrd(f32); #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] fn clone(&self) -> bevy::math::primitives::Plane3d; +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &primitives::dim3::Plane3d) -> bool; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -4887,17 +4894,6 @@ struct Plane3d { remote = "bevy::math::primitives::Tetrahedron", functions[r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &primitives::dim3::Tetrahedron) -> bool; - -"#, - r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] fn clone(&self) -> bevy::math::primitives::Tetrahedron; @@ -4936,6 +4932,17 @@ struct Plane3d { #[lua(kind = "Method", output(proxy))] fn centroid(&self) -> bevy::math::prelude::Vec3; +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &primitives::dim3::Tetrahedron) -> bool; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -4953,6 +4960,12 @@ struct Tetrahedron { remote = "bevy::math::curve::easing::EaseFunction", functions[r#" + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::curve::easing::EaseFunction; + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -4961,12 +4974,6 @@ struct Tetrahedron { )] fn eq(&self, #[proxy] other: &curve::easing::EaseFunction) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::curve::easing::EaseFunction; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] diff --git a/crates/bevy_script_api/src/providers/bevy_reflect.rs b/crates/bevy_script_api/src/providers/bevy_reflect.rs index e6a6d54b92..45daa85da3 100644 --- a/crates/bevy_script_api/src/providers/bevy_reflect.rs +++ b/crates/bevy_script_api/src/providers/bevy_reflect.rs @@ -1164,38 +1164,17 @@ struct RangeFull {} derive(clone), remote = "bevy::math::Quat", functions[r#" +/// Subtracts the `rhs` quaternion from `self`. +/// The difference is not guaranteed to be normalized. #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::Quat; - -"#, - r#" -/// Divides a quaternion by a scalar value. -/// The quotient is not guaranteed to be normalized. - - #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Sub", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, rhs: f32) -> bevy::math::Quat; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", + composite = "sub", + metamethod = "Sub", )] - fn eq(&self, #[proxy] rhs: &glam::Quat) -> bool; + fn sub(self, #[proxy] rhs: bevy::math::Quat) -> bevy::math::Quat; "#, r#" @@ -1211,6 +1190,16 @@ struct RangeFull {} )] fn mul(self, rhs: f32) -> bevy::math::Quat; +"#, + r#" + + #[lua( + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", + output(proxy), + )] + fn clone(&self) -> bevy::math::Quat; + "#, r#" @@ -1225,12 +1214,6 @@ struct RangeFull {} "#, r#" -/// Multiplies two quaternions. If they each represent a rotation, the result will -/// represent the combined rotation. -/// Note that due to floating point rounding the result may not be perfectly -/// normalized. -/// # Panics -/// Will panic if `self` or `rhs` are not normalized when `glam_assert` is enabled. #[lua( as_trait = "std::ops::Mul", @@ -1239,21 +1222,22 @@ struct RangeFull {} composite = "mul", metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: bevy::math::Quat) -> bevy::math::Quat; + fn mul(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; "#, r#" -/// Subtracts the `rhs` quaternion from `self`. -/// The difference is not guaranteed to be normalized. +/// Multiplies a quaternion and a 3D vector, returning the rotated vector. +/// # Panics +/// Will panic if `self` is not normalized when `glam_assert` is enabled. #[lua( - as_trait = "std::ops::Sub", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "sub", - metamethod = "Sub", + composite = "mul", + metamethod = "Mul", )] - fn sub(self, #[proxy] rhs: bevy::math::Quat) -> bevy::math::Quat; + fn mul(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; "#, r#" @@ -1271,6 +1255,31 @@ struct RangeFull {} )] fn add(self, #[proxy] rhs: bevy::math::Quat) -> bevy::math::Quat; +"#, + r#" +/// Divides a quaternion by a scalar value. +/// The quotient is not guaranteed to be normalized. + + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, rhs: f32) -> bevy::math::Quat; + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] rhs: &glam::Quat) -> bool; + "#, r#" /// Creates a new rotation quaternion. @@ -1679,21 +1688,12 @@ struct RangeFull {} "#, r#" -/// Multiplies a quaternion and a 3D vector, returning the rotated vector. +/// Multiplies two quaternions. If they each represent a rotation, the result will +/// represent the combined rotation. +/// Note that due to floating point rounding the result may not be perfectly +/// normalized. /// # Panics -/// Will panic if `self` is not normalized when `glam_assert` is enabled. - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; - -"#, - r#" +/// Will panic if `self` or `rhs` are not normalized when `glam_assert` is enabled. #[lua( as_trait = "std::ops::Mul", @@ -1702,7 +1702,7 @@ struct RangeFull {} composite = "mul", metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; + fn mul(self, #[proxy] rhs: bevy::math::Quat) -> bevy::math::Quat; "#, r#" @@ -1728,66 +1728,6 @@ struct Quat(); )] fn mul(self, rhs: f32) -> bevy::math::Vec3; -"#, - r#" - - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, #[proxy] rhs: &glam::Vec3) -> bevy::math::Vec3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: &glam::Vec3) -> bevy::math::Vec3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, #[proxy] rhs: &glam::Vec3) -> bevy::math::Vec3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; - "#, r#" /// Creates a new vector. @@ -2465,49 +2405,49 @@ struct Quat(); r#" #[lua( - as_trait = "std::ops::Rem", + as_trait = "std::ops::Div", kind = "MetaFunction", output(proxy), - composite = "rem", - metamethod = "Mod", + composite = "div", + metamethod = "Div", )] - fn rem(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; + fn div(self, rhs: f32) -> bevy::math::Vec3; "#, r#" #[lua( - as_trait = "std::ops::Neg", + as_trait = "std::ops::Sub", kind = "MetaFunction", output(proxy), - composite = "neg", - metamethod = "Unm", + composite = "sub", + metamethod = "Sub", )] - fn neg(self) -> bevy::math::Vec3; + fn sub(self, rhs: f32) -> bevy::math::Vec3; "#, r#" #[lua( - as_trait = "std::ops::Rem", + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "rem", - metamethod = "Mod", + composite = "add", + metamethod = "Add", )] - fn rem(self, rhs: f32) -> bevy::math::Vec3; + fn add(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; "#, r#" #[lua( - as_trait = "std::ops::Sub", + as_trait = "std::ops::Rem", kind = "MetaFunction", output(proxy), - composite = "sub", - metamethod = "Sub", + composite = "rem", + metamethod = "Mod", )] - fn sub(self, #[proxy] rhs: &glam::Vec3) -> bevy::math::Vec3; + fn rem(self, rhs: f32) -> bevy::math::Vec3; "#, r#" @@ -2519,64 +2459,67 @@ struct Quat(); composite = "div", metamethod = "Div", )] - fn div(self, rhs: f32) -> bevy::math::Vec3; + fn div(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", + as_trait = "std::ops::Sub", kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", + output(proxy), + composite = "sub", + metamethod = "Sub", )] - fn eq(&self, #[proxy] other: &glam::Vec3) -> bool; + fn sub(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; "#, r#" #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", + as_trait = "std::ops::Add", + kind = "MetaFunction", output(proxy), + composite = "add", + metamethod = "Add", )] - fn clone(&self) -> bevy::math::Vec3; + fn add(self, rhs: f32) -> bevy::math::Vec3; "#, r#" #[lua( - as_trait = "std::ops::Add", + as_trait = "std::ops::Div", kind = "MetaFunction", output(proxy), - composite = "add", - metamethod = "Add", + composite = "div", + metamethod = "Div", )] - fn add(self, rhs: f32) -> bevy::math::Vec3; + fn div(self, #[proxy] rhs: &glam::Vec3) -> bevy::math::Vec3; "#, r#" #[lua( - as_trait = "std::ops::Add", + as_trait = "std::ops::Neg", kind = "MetaFunction", output(proxy), - composite = "add", - metamethod = "Add", + composite = "neg", + metamethod = "Unm", )] - fn add(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; + fn neg(self) -> bevy::math::Vec3; "#, r#" #[lua( - as_trait = "std::ops::Sub", + as_trait = "std::ops::Rem", kind = "MetaFunction", output(proxy), - composite = "sub", - metamethod = "Sub", + composite = "rem", + metamethod = "Mod", )] - fn sub(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; + fn rem(self, #[proxy] rhs: &glam::Vec3) -> bevy::math::Vec3; "#, r#" @@ -2588,23 +2531,80 @@ struct Quat(); composite = "sub", metamethod = "Sub", )] - fn sub(self, rhs: f32) -> bevy::math::Vec3; + fn sub(self, #[proxy] rhs: &glam::Vec3) -> bevy::math::Vec3; "#, r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Rem", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "rem", + metamethod = "Mod", )] - fn div(self, #[proxy] rhs: &glam::Vec3) -> bevy::math::Vec3; + fn rem(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: &glam::Vec3) -> bevy::math::Vec3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, #[proxy] rhs: &glam::Vec3) -> bevy::math::Vec3; + +"#, + r#" + + #[lua( + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", + output(proxy), + )] + fn clone(&self) -> bevy::math::Vec3; + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &glam::Vec3) -> bool; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } @@ -2633,6 +2633,189 @@ struct Vec3 { remote = "bevy::math::IVec2", functions[r#" + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, #[proxy] rhs: bevy::math::IVec2) -> bevy::math::IVec2; + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &glam::IVec2) -> bool; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, #[proxy] rhs: &glam::IVec2) -> bevy::math::IVec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, rhs: i32) -> bevy::math::IVec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: &glam::IVec2) -> bevy::math::IVec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, #[proxy] rhs: bevy::math::IVec2) -> bevy::math::IVec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(self, #[proxy] rhs: bevy::math::IVec2) -> bevy::math::IVec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: bevy::math::IVec2) -> bevy::math::IVec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, rhs: i32) -> bevy::math::IVec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, #[proxy] rhs: &glam::IVec2) -> bevy::math::IVec2; + +"#, + r#" + + #[lua( + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", + output(proxy), + )] + fn clone(&self) -> bevy::math::IVec2; + +"#, + r#" + + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); + +"#, + r#" + + #[lua( + as_trait = "std::ops::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(self, rhs: i32) -> bevy::math::IVec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, rhs: i32) -> bevy::math::IVec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, #[proxy] rhs: &glam::IVec2) -> bevy::math::IVec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, #[proxy] rhs: bevy::math::IVec2) -> bevy::math::IVec2; + +"#, + r#" + #[lua( as_trait = "std::ops::Add", kind = "MetaFunction", @@ -2642,6 +2825,18 @@ struct Vec3 { )] fn add(self, rhs: i32) -> bevy::math::IVec2; +"#, + r#" + + #[lua( + as_trait = "std::ops::Neg", + kind = "MetaFunction", + output(proxy), + composite = "neg", + metamethod = "Unm", + )] + fn neg(self) -> bevy::math::IVec2; + "#, r#" /// Creates a new vector. @@ -3071,19 +3266,7 @@ struct Vec3 { r#" #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: bevy::math::IVec2) -> bevy::math::IVec2; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub", + as_trait = "std::ops::Sub", kind = "MetaFunction", output(proxy), composite = "sub", @@ -3093,42 +3276,33 @@ struct Vec3 { "#, r#" - - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, #[proxy] rhs: bevy::math::IVec2) -> bevy::math::IVec2; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Neg", - kind = "MetaFunction", - output(proxy), - composite = "neg", - metamethod = "Unm", - )] - fn neg(self) -> bevy::math::IVec2; - +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} "#, r#" - - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, rhs: i32) -> bevy::math::IVec2; - +#[lua(kind="MetaMethod", raw , metamethod="Index")] +fn index(&self, lua: &Lua, idx: crate::lua::util::LuaIndex) -> Result { + Ok(self.inner()?[*idx]) +} "#, r#" +#[lua(kind="MutatingMetaMethod", raw, metamethod="NewIndex")] +fn index(&mut self, lua: &Lua, idx: crate::lua::util::LuaIndex, val: i32) -> Result<(),_> { + self.val_mut(|s| Ok(s[*idx] = val))? +} +"#] +)] +struct IVec2 { + x: i32, + y: i32, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::math::IVec3", + functions[r#" #[lua( as_trait = "std::ops::Add", @@ -3137,17 +3311,7 @@ struct Vec3 { composite = "add", metamethod = "Add", )] - fn add(self, #[proxy] rhs: &glam::IVec2) -> bevy::math::IVec2; - -"#, - r#" - - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::IVec2; + fn add(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::IVec3; "#, r#" @@ -3159,24 +3323,13 @@ struct Vec3 { r#" #[lua( - as_trait = "std::ops::Add", + as_trait = "std::ops::Div", kind = "MetaFunction", output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, #[proxy] rhs: bevy::math::IVec2) -> bevy::math::IVec2; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", + composite = "div", + metamethod = "Div", )] - fn eq(&self, #[proxy] other: &glam::IVec2) -> bool; + fn div(self, rhs: i32) -> bevy::math::IVec3; "#, r#" @@ -3188,19 +3341,19 @@ struct Vec3 { composite = "sub", metamethod = "Sub", )] - fn sub(self, rhs: i32) -> bevy::math::IVec2; + fn sub(self, #[proxy] rhs: &glam::IVec3) -> bevy::math::IVec3; "#, r#" #[lua( - as_trait = "std::ops::Rem", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "rem", - metamethod = "Mod", + composite = "mul", + metamethod = "Mul", )] - fn rem(self, #[proxy] rhs: &glam::IVec2) -> bevy::math::IVec2; + fn mul(self, rhs: i32) -> bevy::math::IVec3; "#, r#" @@ -3212,97 +3365,67 @@ struct Vec3 { composite = "div", metamethod = "Div", )] - fn div(self, #[proxy] rhs: &glam::IVec2) -> bevy::math::IVec2; + fn div(self, #[proxy] rhs: &glam::IVec3) -> bevy::math::IVec3; "#, r#" #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", output(proxy), - composite = "sub", - metamethod = "Sub", )] - fn sub(self, #[proxy] rhs: bevy::math::IVec2) -> bevy::math::IVec2; + fn clone(&self) -> bevy::math::IVec3; "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "add", + metamethod = "Add", )] - fn mul(self, rhs: i32) -> bevy::math::IVec2; + fn add(self, #[proxy] rhs: &glam::IVec3) -> bevy::math::IVec3; "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Div", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "div", + metamethod = "Div", )] - fn mul(self, #[proxy] rhs: &glam::IVec2) -> bevy::math::IVec2; + fn div(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::IVec3; "#, r#" #[lua( - as_trait = "std::ops::Rem", + as_trait = "std::cmp::PartialEq", kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", + composite = "eq", + metamethod = "Eq", )] - fn rem(self, #[proxy] rhs: bevy::math::IVec2) -> bevy::math::IVec2; + fn eq(&self, #[proxy] other: &glam::IVec3) -> bool; "#, r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Neg", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "neg", + metamethod = "Unm", )] - fn div(self, rhs: i32) -> bevy::math::IVec2; + fn neg(self) -> bevy::math::IVec3; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#, - r#" -#[lua(kind="MetaMethod", raw , metamethod="Index")] -fn index(&self, lua: &Lua, idx: crate::lua::util::LuaIndex) -> Result { - Ok(self.inner()?[*idx]) -} -"#, - r#" -#[lua(kind="MutatingMetaMethod", raw, metamethod="NewIndex")] -fn index(&mut self, lua: &Lua, idx: crate::lua::util::LuaIndex, val: i32) -> Result<(),_> { - self.val_mut(|s| Ok(s[*idx] = val))? -} -"#] -)] -struct IVec2 { - x: i32, - y: i32, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::math::IVec3", - functions[r#" #[lua( as_trait = "std::ops::Rem", @@ -3311,17 +3434,7 @@ struct IVec2 { composite = "rem", metamethod = "Mod", )] - fn rem(self, rhs: i32) -> bevy::math::IVec3; - -"#, - r#" - - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::IVec3; + fn rem(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::IVec3; "#, r#" @@ -3333,30 +3446,31 @@ struct IVec2 { composite = "sub", metamethod = "Sub", )] - fn sub(self, rhs: i32) -> bevy::math::IVec3; + fn sub(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::IVec3; "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Rem", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "rem", + metamethod = "Mod", )] - fn mul(self, #[proxy] rhs: &glam::IVec3) -> bevy::math::IVec3; + fn rem(self, rhs: i32) -> bevy::math::IVec3; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", + as_trait = "std::ops::Mul", kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", + output(proxy), + composite = "mul", + metamethod = "Mul", )] - fn eq(&self, #[proxy] other: &glam::IVec3) -> bool; + fn mul(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::IVec3; "#, r#" @@ -3370,30 +3484,6 @@ struct IVec2 { )] fn add(self, rhs: i32) -> bevy::math::IVec3; -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::IVec3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Neg", - kind = "MetaFunction", - output(proxy), - composite = "neg", - metamethod = "Unm", - )] - fn neg(self) -> bevy::math::IVec3; - "#, r#" @@ -3404,135 +3494,21 @@ struct IVec2 { composite = "mul", metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::IVec3; + fn mul(self, #[proxy] rhs: &glam::IVec3) -> bevy::math::IVec3; "#, r#" +/// Creates a new vector. - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, rhs: i32) -> bevy::math::IVec3; + #[lua(kind = "Function", output(proxy))] + fn new(x: i32, y: i32, z: i32) -> bevy::math::IVec3; "#, r#" +/// Creates a vector with all elements set to `v`. - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, #[proxy] rhs: &glam::IVec3) -> bevy::math::IVec3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::IVec3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, #[proxy] rhs: &glam::IVec3) -> bevy::math::IVec3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, #[proxy] rhs: &glam::IVec3) -> bevy::math::IVec3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, #[proxy] rhs: &glam::IVec3) -> bevy::math::IVec3; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::IVec3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::IVec3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, rhs: i32) -> bevy::math::IVec3; - -"#, - r#" -/// Creates a new vector. - - #[lua(kind = "Function", output(proxy))] - fn new(x: i32, y: i32, z: i32) -> bevy::math::IVec3; - -"#, - r#" -/// Creates a vector with all elements set to `v`. - - #[lua(kind = "Function", output(proxy))] - fn splat(v: i32) -> bevy::math::IVec3; + #[lua(kind = "Function", output(proxy))] + fn splat(v: i32) -> bevy::math::IVec3; "#, r#" @@ -3950,6 +3926,30 @@ struct IVec2 { rhs: bevy::math::UVec3, ) -> bevy::math::IVec3; +"#, + r#" + + #[lua( + as_trait = "std::ops::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, #[proxy] rhs: &glam::IVec3) -> bevy::math::IVec3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(self, rhs: i32) -> bevy::math::IVec3; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -3982,49 +3982,47 @@ struct IVec3 { functions[r#" #[lua( - as_trait = "std::ops::Rem", + as_trait = "std::ops::Sub", kind = "MetaFunction", output(proxy), - composite = "rem", - metamethod = "Mod", + composite = "sub", + metamethod = "Sub", )] - fn rem(self, rhs: i32) -> bevy::math::IVec4; + fn sub(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::IVec4; "#, r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Rem", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "rem", + metamethod = "Mod", )] - fn div(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::IVec4; + fn rem(self, #[proxy] rhs: &glam::IVec4) -> bevy::math::IVec4; "#, r#" #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", output(proxy), - composite = "sub", - metamethod = "Sub", )] - fn sub(self, rhs: i32) -> bevy::math::IVec4; + fn clone(&self) -> bevy::math::IVec4; "#, r#" #[lua( - as_trait = "std::ops::Add", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "add", - metamethod = "Add", + composite = "mul", + metamethod = "Mul", )] - fn add(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::IVec4; + fn mul(self, rhs: i32) -> bevy::math::IVec4; "#, r#" @@ -4047,49 +4045,49 @@ struct IVec3 { r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Sub", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "sub", + metamethod = "Sub", )] - fn div(self, rhs: i32) -> bevy::math::IVec4; + fn sub(self, rhs: i32) -> bevy::math::IVec4; "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Rem", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "rem", + metamethod = "Mod", )] - fn mul(self, rhs: i32) -> bevy::math::IVec4; + fn rem(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::IVec4; "#, r#" #[lua( - as_trait = "std::ops::Sub", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "sub", - metamethod = "Sub", + composite = "mul", + metamethod = "Mul", )] - fn sub(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::IVec4; + fn mul(self, #[proxy] rhs: &glam::IVec4) -> bevy::math::IVec4; "#, r#" #[lua( - as_trait = "std::ops::Add", + as_trait = "std::ops::Sub", kind = "MetaFunction", output(proxy), - composite = "add", - metamethod = "Add", + composite = "sub", + metamethod = "Sub", )] - fn add(self, rhs: i32) -> bevy::math::IVec4; + fn sub(self, #[proxy] rhs: &glam::IVec4) -> bevy::math::IVec4; "#, r#" @@ -4113,55 +4111,129 @@ struct IVec3 { composite = "mul", metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: &glam::IVec4) -> bevy::math::IVec4; + fn mul(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::IVec4; "#, r#" #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", + as_trait = "std::ops::Div", + kind = "MetaFunction", output(proxy), + composite = "div", + metamethod = "Div", )] - fn clone(&self) -> bevy::math::IVec4; + fn div(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::IVec4; "#, r#" -/// Creates a new vector. - #[lua(kind = "Function", output(proxy))] - fn new(x: i32, y: i32, z: i32, w: i32) -> bevy::math::IVec4; + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, rhs: i32) -> bevy::math::IVec4; "#, r#" -/// Creates a vector with all elements set to `v`. - #[lua(kind = "Function", output(proxy))] - fn splat(v: i32) -> bevy::math::IVec4; + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, rhs: i32) -> bevy::math::IVec4; "#, r#" -/// Creates a vector from the elements in `if_true` and `if_false`, selecting which to use -/// for each element of `self`. -/// A true element in the mask uses the corresponding element from `if_true`, and false -/// uses the element from `if_false`. - #[lua(kind = "Function", output(proxy))] - fn select( - #[proxy] - mask: bevy::math::BVec4, - #[proxy] - if_true: bevy::math::IVec4, - #[proxy] - if_false: bevy::math::IVec4, - ) -> bevy::math::IVec4; + #[lua( + as_trait = "std::ops::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, rhs: i32) -> bevy::math::IVec4; "#, r#" -/// Creates a new vector from an array. - #[lua(kind = "Function", output(proxy))] - fn from_array(a: [i32; 4]) -> bevy::math::IVec4; + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, #[proxy] rhs: &glam::IVec4) -> bevy::math::IVec4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::IVec4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, #[proxy] rhs: &glam::IVec4) -> bevy::math::IVec4; + +"#, + r#" +/// Creates a new vector. + + #[lua(kind = "Function", output(proxy))] + fn new(x: i32, y: i32, z: i32, w: i32) -> bevy::math::IVec4; + +"#, + r#" +/// Creates a vector with all elements set to `v`. + + #[lua(kind = "Function", output(proxy))] + fn splat(v: i32) -> bevy::math::IVec4; + +"#, + r#" +/// Creates a vector from the elements in `if_true` and `if_false`, selecting which to use +/// for each element of `self`. +/// A true element in the mask uses the corresponding element from `if_true`, and false +/// uses the element from `if_false`. + + #[lua(kind = "Function", output(proxy))] + fn select( + #[proxy] + mask: bevy::math::BVec4, + #[proxy] + if_true: bevy::math::IVec4, + #[proxy] + if_false: bevy::math::IVec4, + ) -> bevy::math::IVec4; + +"#, + r#" +/// Creates a new vector from an array. + + #[lua(kind = "Function", output(proxy))] + fn from_array(a: [i32; 4]) -> bevy::math::IVec4; "#, r#" @@ -4543,27 +4615,56 @@ struct IVec3 { "#, r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#, + r#" +#[lua(kind="MetaMethod", raw , metamethod="Index")] +fn index(&self, lua: &Lua, idx: crate::lua::util::LuaIndex) -> Result { + Ok(self.inner()?[*idx]) +} +"#, + r#" +#[lua(kind="MutatingMetaMethod", raw, metamethod="NewIndex")] +fn index(&mut self, lua: &Lua, idx: crate::lua::util::LuaIndex, val: i32) -> Result<(),_> { + self.val_mut(|s| Ok(s[*idx] = val))? +} +"#] +)] +struct IVec4 { + x: i32, + y: i32, + z: i32, + w: i32, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::math::I64Vec2", + functions[r#" #[lua( - as_trait = "std::ops::Add", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "add", - metamethod = "Add", + composite = "mul", + metamethod = "Mul", )] - fn add(self, #[proxy] rhs: &glam::IVec4) -> bevy::math::IVec4; + fn mul(self, #[proxy] rhs: &glam::I64Vec2) -> bevy::math::I64Vec2; "#, r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Rem", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "rem", + metamethod = "Mod", )] - fn div(self, #[proxy] rhs: &glam::IVec4) -> bevy::math::IVec4; + fn rem(self, #[proxy] rhs: bevy::math::I64Vec2) -> bevy::math::I64Vec2; "#, r#" @@ -4575,19 +4676,19 @@ struct IVec3 { composite = "mul", metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::IVec4; + fn mul(self, rhs: i64) -> bevy::math::I64Vec2; "#, r#" #[lua( - as_trait = "std::ops::Rem", + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "rem", - metamethod = "Mod", + composite = "add", + metamethod = "Add", )] - fn rem(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::IVec4; + fn add(self, #[proxy] rhs: bevy::math::I64Vec2) -> bevy::math::I64Vec2; "#, r#" @@ -4599,7 +4700,25 @@ struct IVec3 { composite = "sub", metamethod = "Sub", )] - fn sub(self, #[proxy] rhs: &glam::IVec4) -> bevy::math::IVec4; + fn sub(self, #[proxy] rhs: &glam::I64Vec2) -> bevy::math::I64Vec2; + +"#, + r#" + + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); + +"#, + r#" + + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, rhs: i64) -> bevy::math::I64Vec2; "#, r#" @@ -4611,39 +4730,34 @@ struct IVec3 { composite = "rem", metamethod = "Mod", )] - fn rem(self, #[proxy] rhs: &glam::IVec4) -> bevy::math::IVec4; + fn rem(self, rhs: i64) -> bevy::math::I64Vec2; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} + + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, rhs: i64) -> bevy::math::I64Vec2; + "#, r#" -#[lua(kind="MetaMethod", raw , metamethod="Index")] -fn index(&self, lua: &Lua, idx: crate::lua::util::LuaIndex) -> Result { - Ok(self.inner()?[*idx]) -} + + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, #[proxy] rhs: &glam::I64Vec2) -> bevy::math::I64Vec2; + "#, r#" -#[lua(kind="MutatingMetaMethod", raw, metamethod="NewIndex")] -fn index(&mut self, lua: &Lua, idx: crate::lua::util::LuaIndex, val: i32) -> Result<(),_> { - self.val_mut(|s| Ok(s[*idx] = val))? -} -"#] -)] -struct IVec4 { - x: i32, - y: i32, - z: i32, - w: i32, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::math::I64Vec2", - functions[r#" /// Creates a new vector. #[lua(kind = "Function", output(proxy))] @@ -5079,71 +5193,70 @@ struct IVec4 { r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "mul", + metamethod = "Mul", )] - fn div(self, rhs: i64) -> bevy::math::I64Vec2; + fn mul(self, #[proxy] rhs: bevy::math::I64Vec2) -> bevy::math::I64Vec2; "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Sub", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "sub", + metamethod = "Sub", )] - fn mul(self, #[proxy] rhs: bevy::math::I64Vec2) -> bevy::math::I64Vec2; + fn sub(self, #[proxy] rhs: bevy::math::I64Vec2) -> bevy::math::I64Vec2; "#, r#" #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", + as_trait = "std::ops::Div", + kind = "MetaFunction", output(proxy), + composite = "div", + metamethod = "Div", )] - fn clone(&self) -> bevy::math::I64Vec2; + fn div(self, #[proxy] rhs: bevy::math::I64Vec2) -> bevy::math::I64Vec2; "#, r#" #[lua( - as_trait = "std::ops::Add", + as_trait = "std::cmp::PartialEq", kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", + composite = "eq", + metamethod = "Eq", )] - fn add(self, rhs: i64) -> bevy::math::I64Vec2; + fn eq(&self, #[proxy] other: &glam::I64Vec2) -> bool; "#, r#" #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", output(proxy), - composite = "rem", - metamethod = "Mod", )] - fn rem(self, rhs: i64) -> bevy::math::I64Vec2; + fn clone(&self) -> bevy::math::I64Vec2; "#, r#" #[lua( - as_trait = "std::ops::Rem", + as_trait = "std::ops::Sub", kind = "MetaFunction", output(proxy), - composite = "rem", - metamethod = "Mod", + composite = "sub", + metamethod = "Sub", )] - fn rem(self, #[proxy] rhs: &glam::I64Vec2) -> bevy::math::I64Vec2; + fn sub(self, rhs: i64) -> bevy::math::I64Vec2; "#, r#" @@ -5155,66 +5268,92 @@ struct IVec4 { composite = "add", metamethod = "Add", )] - fn add(self, #[proxy] rhs: bevy::math::I64Vec2) -> bevy::math::I64Vec2; + fn add(self, #[proxy] rhs: &glam::I64Vec2) -> bevy::math::I64Vec2; "#, r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Neg", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "neg", + metamethod = "Unm", )] - fn div(self, #[proxy] rhs: &glam::I64Vec2) -> bevy::math::I64Vec2; + fn neg(self) -> bevy::math::I64Vec2; "#, r#" #[lua( - as_trait = "std::ops::Sub", + as_trait = "std::ops::Rem", kind = "MetaFunction", output(proxy), - composite = "sub", - metamethod = "Sub", + composite = "rem", + metamethod = "Mod", )] - fn sub(self, #[proxy] rhs: bevy::math::I64Vec2) -> bevy::math::I64Vec2; + fn rem(self, #[proxy] rhs: &glam::I64Vec2) -> bevy::math::I64Vec2; "#, r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct I64Vec2 { + x: i64, + y: i64, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::math::I64Vec3", + functions[r#" + + #[lua( + as_trait = "std::ops::Neg", + kind = "MetaFunction", + output(proxy), + composite = "neg", + metamethod = "Unm", )] - fn mul(self, rhs: i64) -> bevy::math::I64Vec2; + fn neg(self) -> bevy::math::I64Vec3; "#, r#" #[lua( - as_trait = "std::ops::Neg", + as_trait = "std::ops::Div", kind = "MetaFunction", output(proxy), - composite = "neg", - metamethod = "Unm", + composite = "div", + metamethod = "Div", )] - fn neg(self) -> bevy::math::I64Vec2; + fn div(self, rhs: i64) -> bevy::math::I64Vec3; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", + output(proxy), + )] + fn clone(&self) -> bevy::math::I64Vec3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", + output(proxy), + composite = "mul", + metamethod = "Mul", )] - fn eq(&self, #[proxy] other: &glam::I64Vec2) -> bool; + fn mul(self, #[proxy] rhs: &glam::I64Vec3) -> bevy::math::I64Vec3; "#, r#" @@ -5226,7 +5365,7 @@ struct IVec4 { composite = "add", metamethod = "Add", )] - fn add(self, #[proxy] rhs: &glam::I64Vec2) -> bevy::math::I64Vec2; + fn add(self, rhs: i64) -> bevy::math::I64Vec3; "#, r#" @@ -5238,7 +5377,49 @@ struct IVec4 { composite = "mul", metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: &glam::I64Vec2) -> bevy::math::I64Vec2; + fn mul(self, rhs: i64) -> bevy::math::I64Vec3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, #[proxy] rhs: bevy::math::I64Vec3) -> bevy::math::I64Vec3; + +"#, + r#" + + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); + +"#, + r#" + + #[lua( + as_trait = "std::ops::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(self, #[proxy] rhs: bevy::math::I64Vec3) -> bevy::math::I64Vec3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, #[proxy] rhs: &glam::I64Vec3) -> bevy::math::I64Vec3; "#, r#" @@ -5250,7 +5431,54 @@ struct IVec4 { composite = "rem", metamethod = "Mod", )] - fn rem(self, #[proxy] rhs: bevy::math::I64Vec2) -> bevy::math::I64Vec2; + fn rem(self, #[proxy] rhs: &glam::I64Vec3) -> bevy::math::I64Vec3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: bevy::math::I64Vec3) -> bevy::math::I64Vec3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, rhs: i64) -> bevy::math::I64Vec3; + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &glam::I64Vec3) -> bool; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, #[proxy] rhs: bevy::math::I64Vec3) -> bevy::math::I64Vec3; "#, r#" @@ -5262,13 +5490,19 @@ struct IVec4 { composite = "sub", metamethod = "Sub", )] - fn sub(self, rhs: i64) -> bevy::math::I64Vec2; + fn sub(self, rhs: i64) -> bevy::math::I64Vec3; "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, #[proxy] rhs: &glam::I64Vec3) -> bevy::math::I64Vec3; "#, r#" @@ -5280,37 +5514,22 @@ struct IVec4 { composite = "sub", metamethod = "Sub", )] - fn sub(self, #[proxy] rhs: &glam::I64Vec2) -> bevy::math::I64Vec2; + fn sub(self, #[proxy] rhs: &glam::I64Vec3) -> bevy::math::I64Vec3; "#, r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "add", + metamethod = "Add", )] - fn div(self, #[proxy] rhs: bevy::math::I64Vec2) -> bevy::math::I64Vec2; + fn add(self, #[proxy] rhs: bevy::math::I64Vec3) -> bevy::math::I64Vec3; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct I64Vec2 { - x: i64, - y: i64, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::math::I64Vec3", - functions[r#" /// Creates a new vector. #[lua(kind = "Function", output(proxy))] @@ -5749,61 +5968,79 @@ struct I64Vec2 { "#, r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct I64Vec3 { + x: i64, + y: i64, + z: i64, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::math::I64Vec4", + functions[r#" #[lua( - as_trait = "std::ops::Sub", + as_trait = "std::ops::Div", kind = "MetaFunction", output(proxy), - composite = "sub", - metamethod = "Sub", + composite = "div", + metamethod = "Div", )] - fn sub(self, rhs: i64) -> bevy::math::I64Vec3; + fn div(self, #[proxy] rhs: bevy::math::I64Vec4) -> bevy::math::I64Vec4; "#, r#" #[lua( - as_trait = "std::ops::Add", + as_trait = "std::ops::Div", kind = "MetaFunction", output(proxy), - composite = "add", - metamethod = "Add", + composite = "div", + metamethod = "Div", )] - fn add(self, rhs: i64) -> bevy::math::I64Vec3; + fn div(self, rhs: i64) -> bevy::math::I64Vec4; "#, r#" #[lua( - as_trait = "std::ops::Rem", + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "rem", - metamethod = "Mod", + composite = "add", + metamethod = "Add", )] - fn rem(self, #[proxy] rhs: &glam::I64Vec3) -> bevy::math::I64Vec3; + fn add(self, rhs: i64) -> bevy::math::I64Vec4; "#, r#" #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", + as_trait = "std::ops::Rem", + kind = "MetaFunction", output(proxy), + composite = "rem", + metamethod = "Mod", )] - fn clone(&self) -> bevy::math::I64Vec3; + fn rem(self, #[proxy] rhs: bevy::math::I64Vec4) -> bevy::math::I64Vec4; "#, r#" #[lua( - as_trait = "std::ops::Neg", + as_trait = "std::ops::Div", kind = "MetaFunction", output(proxy), - composite = "neg", - metamethod = "Unm", + composite = "div", + metamethod = "Div", )] - fn neg(self) -> bevy::math::I64Vec3; + fn div(self, #[proxy] rhs: &glam::I64Vec4) -> bevy::math::I64Vec4; "#, r#" @@ -5815,24 +6052,25 @@ struct I64Vec2 { r#" #[lua( - as_trait = "std::cmp::PartialEq", + as_trait = "std::ops::Add", kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", + output(proxy), + composite = "add", + metamethod = "Add", )] - fn eq(&self, #[proxy] other: &glam::I64Vec3) -> bool; + fn add(self, #[proxy] rhs: bevy::math::I64Vec4) -> bevy::math::I64Vec4; "#, r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Rem", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "rem", + metamethod = "Mod", )] - fn div(self, rhs: i64) -> bevy::math::I64Vec3; + fn rem(self, rhs: i64) -> bevy::math::I64Vec4; "#, r#" @@ -5844,43 +6082,7 @@ struct I64Vec2 { composite = "sub", metamethod = "Sub", )] - fn sub(self, #[proxy] rhs: &glam::I64Vec3) -> bevy::math::I64Vec3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, rhs: i64) -> bevy::math::I64Vec3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, #[proxy] rhs: bevy::math::I64Vec3) -> bevy::math::I64Vec3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, #[proxy] rhs: bevy::math::I64Vec3) -> bevy::math::I64Vec3; + fn sub(self, rhs: i64) -> bevy::math::I64Vec4; "#, r#" @@ -5892,7 +6094,7 @@ struct I64Vec2 { composite = "sub", metamethod = "Sub", )] - fn sub(self, #[proxy] rhs: bevy::math::I64Vec3) -> bevy::math::I64Vec3; + fn sub(self, #[proxy] rhs: bevy::math::I64Vec4) -> bevy::math::I64Vec4; "#, r#" @@ -5904,31 +6106,7 @@ struct I64Vec2 { composite = "mul", metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: bevy::math::I64Vec3) -> bevy::math::I64Vec3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, #[proxy] rhs: &glam::I64Vec3) -> bevy::math::I64Vec3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, rhs: i64) -> bevy::math::I64Vec3; + fn mul(self, #[proxy] rhs: bevy::math::I64Vec4) -> bevy::math::I64Vec4; "#, r#" @@ -5940,69 +6118,7 @@ struct I64Vec2 { composite = "mul", metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: &glam::I64Vec3) -> bevy::math::I64Vec3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, #[proxy] rhs: bevy::math::I64Vec3) -> bevy::math::I64Vec3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, #[proxy] rhs: &glam::I64Vec3) -> bevy::math::I64Vec3; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct I64Vec3 { - x: i64, - y: i64, - z: i64, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::math::I64Vec4", - functions[r#" - - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, rhs: i64) -> bevy::math::I64Vec4; - -"#, - r#" - - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::I64Vec4; + fn mul(self, rhs: i64) -> bevy::math::I64Vec4; "#, r#" @@ -6020,25 +6136,13 @@ struct I64Vec3 { r#" #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, #[proxy] rhs: bevy::math::I64Vec4) -> bevy::math::I64Vec4; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "add", + metamethod = "Add", )] - fn div(self, #[proxy] rhs: &glam::I64Vec4) -> bevy::math::I64Vec4; + fn add(self, #[proxy] rhs: &glam::I64Vec4) -> bevy::math::I64Vec4; "#, r#" @@ -6475,95 +6579,110 @@ struct I64Vec3 { rhs: bevy::math::U64Vec4, ) -> bevy::math::I64Vec4; -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Rem", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "rem", + metamethod = "Mod", )] - fn mul(self, #[proxy] rhs: &glam::I64Vec4) -> bevy::math::I64Vec4; + fn rem(self, #[proxy] rhs: &glam::I64Vec4) -> bevy::math::I64Vec4; "#, r#" #[lua( - as_trait = "std::ops::Rem", + as_trait = "std::ops::Neg", kind = "MetaFunction", output(proxy), - composite = "rem", - metamethod = "Mod", + composite = "neg", + metamethod = "Unm", )] - fn rem(self, #[proxy] rhs: bevy::math::I64Vec4) -> bevy::math::I64Vec4; + fn neg(self) -> bevy::math::I64Vec4; "#, r#" #[lua( - as_trait = "std::ops::Add", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "add", - metamethod = "Add", + composite = "mul", + metamethod = "Mul", )] - fn add(self, rhs: i64) -> bevy::math::I64Vec4; + fn mul(self, #[proxy] rhs: &glam::I64Vec4) -> bevy::math::I64Vec4; "#, r#" #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", output(proxy), - composite = "rem", - metamethod = "Mod", )] - fn rem(self, #[proxy] rhs: &glam::I64Vec4) -> bevy::math::I64Vec4; + fn clone(&self) -> bevy::math::I64Vec4; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct I64Vec4 { + x: i64, + y: i64, + z: i64, + w: i64, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::math::UVec2", + functions[r#" + + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "add", + metamethod = "Add", )] - fn mul(self, rhs: i64) -> bevy::math::I64Vec4; + fn add(self, rhs: u32) -> bevy::math::UVec2; "#, r#" #[lua( - as_trait = "std::ops::Add", + as_trait = "std::ops::Div", kind = "MetaFunction", output(proxy), - composite = "add", - metamethod = "Add", + composite = "div", + metamethod = "Div", )] - fn add(self, #[proxy] rhs: bevy::math::I64Vec4) -> bevy::math::I64Vec4; + fn div(self, #[proxy] rhs: bevy::math::UVec2) -> bevy::math::UVec2; "#, r#" #[lua( - as_trait = "std::ops::Neg", + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "neg", - metamethod = "Unm", + composite = "add", + metamethod = "Add", )] - fn neg(self) -> bevy::math::I64Vec4; + fn add(self, #[proxy] rhs: bevy::math::UVec2) -> bevy::math::UVec2; "#, r#" @@ -6575,75 +6694,55 @@ struct I64Vec3 { composite = "rem", metamethod = "Mod", )] - fn rem(self, rhs: i64) -> bevy::math::I64Vec4; + fn rem(self, #[proxy] rhs: bevy::math::UVec2) -> bevy::math::UVec2; "#, r#" #[lua( - as_trait = "std::ops::Add", + as_trait = "std::cmp::PartialEq", kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", + composite = "eq", + metamethod = "Eq", )] - fn add(self, #[proxy] rhs: &glam::I64Vec4) -> bevy::math::I64Vec4; + fn eq(&self, #[proxy] other: &glam::UVec2) -> bool; "#, r#" #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", output(proxy), - composite = "sub", - metamethod = "Sub", )] - fn sub(self, rhs: i64) -> bevy::math::I64Vec4; + fn clone(&self) -> bevy::math::UVec2; "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Rem", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "rem", + metamethod = "Mod", )] - fn mul(self, #[proxy] rhs: bevy::math::I64Vec4) -> bevy::math::I64Vec4; + fn rem(self, #[proxy] rhs: &glam::UVec2) -> bevy::math::UVec2; "#, r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "mul", + metamethod = "Mul", )] - fn div(self, #[proxy] rhs: bevy::math::I64Vec4) -> bevy::math::I64Vec4; + fn mul(self, #[proxy] rhs: bevy::math::UVec2) -> bevy::math::UVec2; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct I64Vec4 { - x: i64, - y: i64, - z: i64, - w: i64, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::math::UVec2", - functions[r#" #[lua( as_trait = "std::ops::Sub", @@ -6654,34 +6753,6 @@ struct I64Vec4 { )] fn sub(self, #[proxy] rhs: &glam::UVec2) -> bevy::math::UVec2; -"#, - r#" - - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, #[proxy] rhs: &glam::UVec2) -> bevy::math::UVec2; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - -"#, - r#" - - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::UVec2; - "#, r#" @@ -6694,42 +6765,6 @@ struct I64Vec4 { )] fn rem(self, rhs: u32) -> bevy::math::UVec2; -"#, - r#" - - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, #[proxy] rhs: bevy::math::UVec2) -> bevy::math::UVec2; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, #[proxy] rhs: bevy::math::UVec2) -> bevy::math::UVec2; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, rhs: u32) -> bevy::math::UVec2; - "#, r#" @@ -6740,31 +6775,7 @@ struct I64Vec4 { composite = "div", metamethod = "Div", )] - fn div(self, #[proxy] rhs: bevy::math::UVec2) -> bevy::math::UVec2; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: bevy::math::UVec2) -> bevy::math::UVec2; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, #[proxy] rhs: &glam::UVec2) -> bevy::math::UVec2; + fn div(self, #[proxy] rhs: &glam::UVec2) -> bevy::math::UVec2; "#, r#" @@ -7096,25 +7107,13 @@ struct I64Vec4 { r#" #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, #[proxy] rhs: bevy::math::UVec2) -> bevy::math::UVec2; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Sub", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "sub", + metamethod = "Sub", )] - fn div(self, rhs: u32) -> bevy::math::UVec2; + fn sub(self, #[proxy] rhs: bevy::math::UVec2) -> bevy::math::UVec2; "#, r#" @@ -7126,30 +7125,19 @@ struct I64Vec4 { composite = "mul", metamethod = "Mul", )] - fn mul(self, rhs: u32) -> bevy::math::UVec2; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &glam::UVec2) -> bool; + fn mul(self, #[proxy] rhs: &glam::UVec2) -> bevy::math::UVec2; "#, r#" #[lua( - as_trait = "std::ops::Add", + as_trait = "std::ops::Sub", kind = "MetaFunction", output(proxy), - composite = "add", - metamethod = "Add", + composite = "sub", + metamethod = "Sub", )] - fn add(self, rhs: u32) -> bevy::math::UVec2; + fn sub(self, rhs: u32) -> bevy::math::UVec2; "#, r#" @@ -7161,7 +7149,7 @@ struct I64Vec4 { composite = "mul", metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: &glam::UVec2) -> bevy::math::UVec2; + fn mul(self, rhs: u32) -> bevy::math::UVec2; "#, r#" @@ -7175,6 +7163,18 @@ struct I64Vec4 { )] fn add(self, #[proxy] rhs: &glam::UVec2) -> bevy::math::UVec2; +"#, + r#" + + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, rhs: u32) -> bevy::math::UVec2; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -7206,37 +7206,37 @@ struct UVec2 { functions[r#" #[lua( - as_trait = "std::ops::Rem", + as_trait = "std::ops::Div", kind = "MetaFunction", output(proxy), - composite = "rem", - metamethod = "Mod", + composite = "div", + metamethod = "Div", )] - fn rem(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::UVec3; + fn div(self, #[proxy] rhs: &glam::UVec3) -> bevy::math::UVec3; "#, r#" #[lua( - as_trait = "std::ops::Rem", + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "rem", - metamethod = "Mod", + composite = "add", + metamethod = "Add", )] - fn rem(self, #[proxy] rhs: &glam::UVec3) -> bevy::math::UVec3; + fn add(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::UVec3; "#, r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "mul", + metamethod = "Mul", )] - fn div(self, #[proxy] rhs: &glam::UVec3) -> bevy::math::UVec3; + fn mul(self, #[proxy] rhs: &glam::UVec3) -> bevy::math::UVec3; "#, r#" @@ -7250,6 +7250,30 @@ struct UVec2 { )] fn mul(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::UVec3; +"#, + r#" + + #[lua( + as_trait = "std::ops::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(self, rhs: u32) -> bevy::math::UVec3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, #[proxy] rhs: &glam::UVec3) -> bevy::math::UVec3; + "#, r#" @@ -7271,29 +7295,31 @@ struct UVec2 { composite = "add", metamethod = "Add", )] - fn add(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::UVec3; + fn add(self, #[proxy] rhs: &glam::UVec3) -> bevy::math::UVec3; "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Div", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "div", + metamethod = "Div", )] - fn mul(self, #[proxy] rhs: &glam::UVec3) -> bevy::math::UVec3; + fn div(self, rhs: u32) -> bevy::math::UVec3; "#, r#" #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", + as_trait = "std::ops::Rem", + kind = "MetaFunction", output(proxy), + composite = "rem", + metamethod = "Mod", )] - fn clone(&self) -> bevy::math::UVec3; + fn rem(self, rhs: u32) -> bevy::math::UVec3; "#, r#" @@ -7305,19 +7331,17 @@ struct UVec2 { composite = "rem", metamethod = "Mod", )] - fn rem(self, rhs: u32) -> bevy::math::UVec3; + fn rem(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::UVec3; "#, r#" #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", output(proxy), - composite = "div", - metamethod = "Div", )] - fn div(self, rhs: u32) -> bevy::math::UVec3; + fn clone(&self) -> bevy::math::UVec3; "#, r#" @@ -7329,7 +7353,19 @@ struct UVec2 { composite = "sub", metamethod = "Sub", )] - fn sub(self, rhs: u32) -> bevy::math::UVec3; + fn sub(self, #[proxy] rhs: &glam::UVec3) -> bevy::math::UVec3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::UVec3; "#, r#" @@ -7690,25 +7726,19 @@ struct UVec2 { r#" #[lua( - as_trait = "std::ops::Sub", + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "sub", - metamethod = "Sub", + composite = "add", + metamethod = "Add", )] - fn sub(self, #[proxy] rhs: &glam::UVec3) -> bevy::math::UVec3; + fn add(self, rhs: u32) -> bevy::math::UVec3; "#, r#" - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::UVec3; + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); "#, r#" @@ -7722,30 +7752,6 @@ struct UVec2 { )] fn mul(self, rhs: u32) -> bevy::math::UVec3; -"#, - r#" - - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, #[proxy] rhs: &glam::UVec3) -> bevy::math::UVec3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, rhs: u32) -> bevy::math::UVec3; - "#, r#" @@ -7758,12 +7764,6 @@ struct UVec2 { )] fn sub(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::UVec3; -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -7796,13 +7796,13 @@ struct UVec3 { functions[r#" #[lua( - as_trait = "std::ops::Add", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "add", - metamethod = "Add", + composite = "mul", + metamethod = "Mul", )] - fn add(self, #[proxy] rhs: bevy::math::UVec4) -> bevy::math::UVec4; + fn mul(self, #[proxy] rhs: &glam::UVec4) -> bevy::math::UVec4; "#, r#" @@ -7814,61 +7814,19 @@ struct UVec3 { composite = "div", metamethod = "Div", )] - fn div(self, #[proxy] rhs: bevy::math::UVec4) -> bevy::math::UVec4; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, #[proxy] rhs: &glam::UVec4) -> bevy::math::UVec4; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, #[proxy] rhs: &glam::UVec4) -> bevy::math::UVec4; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, rhs: u32) -> bevy::math::UVec4; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + fn div(self, rhs: u32) -> bevy::math::UVec4; "#, r#" #[lua( - as_trait = "std::ops::Rem", + as_trait = "std::ops::Div", kind = "MetaFunction", output(proxy), - composite = "rem", - metamethod = "Mod", + composite = "div", + metamethod = "Div", )] - fn rem(self, #[proxy] rhs: bevy::math::UVec4) -> bevy::math::UVec4; + fn div(self, #[proxy] rhs: bevy::math::UVec4) -> bevy::math::UVec4; "#, r#" @@ -8211,6 +8169,18 @@ struct UVec3 { #[lua(kind = "Method", output(proxy))] fn saturating_add_signed(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::UVec4; +"#, + r#" + + #[lua( + as_trait = "std::ops::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(self, #[proxy] rhs: &glam::UVec4) -> bevy::math::UVec4; + "#, r#" @@ -8221,6 +8191,18 @@ struct UVec3 { )] fn clone(&self) -> bevy::math::UVec4; +"#, + r#" + + #[lua( + as_trait = "std::ops::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(self, #[proxy] rhs: bevy::math::UVec4) -> bevy::math::UVec4; + "#, r#" @@ -8237,37 +8219,55 @@ struct UVec3 { r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "add", + metamethod = "Add", )] - fn mul(self, #[proxy] rhs: &glam::UVec4) -> bevy::math::UVec4; + fn add(self, #[proxy] rhs: bevy::math::UVec4) -> bevy::math::UVec4; + +"#, + r#" + + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); "#, r#" #[lua( - as_trait = "std::ops::Sub", + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "sub", - metamethod = "Sub", + composite = "add", + metamethod = "Add", )] - fn sub(self, rhs: u32) -> bevy::math::UVec4; + fn add(self, #[proxy] rhs: &glam::UVec4) -> bevy::math::UVec4; "#, r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Rem", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "rem", + metamethod = "Mod", )] - fn div(self, #[proxy] rhs: &glam::UVec4) -> bevy::math::UVec4; + fn rem(self, #[proxy] rhs: bevy::math::UVec4) -> bevy::math::UVec4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, rhs: u32) -> bevy::math::UVec4; "#, r#" @@ -8285,25 +8285,25 @@ struct UVec3 { r#" #[lua( - as_trait = "std::ops::Sub", + as_trait = "std::ops::Div", kind = "MetaFunction", output(proxy), - composite = "sub", - metamethod = "Sub", + composite = "div", + metamethod = "Div", )] - fn sub(self, #[proxy] rhs: bevy::math::UVec4) -> bevy::math::UVec4; + fn div(self, #[proxy] rhs: &glam::UVec4) -> bevy::math::UVec4; "#, r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Rem", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "rem", + metamethod = "Mod", )] - fn div(self, rhs: u32) -> bevy::math::UVec4; + fn rem(self, #[proxy] rhs: &glam::UVec4) -> bevy::math::UVec4; "#, r#" @@ -8320,25 +8320,25 @@ struct UVec3 { r#" #[lua( - as_trait = "std::ops::Rem", + as_trait = "std::ops::Sub", kind = "MetaFunction", output(proxy), - composite = "rem", - metamethod = "Mod", + composite = "sub", + metamethod = "Sub", )] - fn rem(self, rhs: u32) -> bevy::math::UVec4; + fn sub(self, rhs: u32) -> bevy::math::UVec4; "#, r#" #[lua( - as_trait = "std::ops::Add", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "add", - metamethod = "Add", + composite = "mul", + metamethod = "Mul", )] - fn add(self, #[proxy] rhs: &glam::UVec4) -> bevy::math::UVec4; + fn mul(self, rhs: u32) -> bevy::math::UVec4; "#, r#" @@ -8372,20 +8372,209 @@ struct UVec4 { remote = "bevy::math::U64Vec2", functions[r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua( + as_trait = "std::ops::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::U64Vec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, rhs: u64) -> bevy::math::U64Vec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, #[proxy] rhs: &glam::U64Vec2) -> bevy::math::U64Vec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::U64Vec2; + +"#, + r#" + + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); + +"#, + r#" + + #[lua( + as_trait = "std::ops::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, rhs: u64) -> bevy::math::U64Vec2; + +"#, + r#" + + #[lua( + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", + output(proxy), + )] + fn clone(&self) -> bevy::math::U64Vec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(self, rhs: u64) -> bevy::math::U64Vec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, rhs: u64) -> bevy::math::U64Vec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, rhs: u64) -> bevy::math::U64Vec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(self, #[proxy] rhs: &glam::U64Vec2) -> bevy::math::U64Vec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, #[proxy] rhs: &glam::U64Vec2) -> bevy::math::U64Vec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, #[proxy] rhs: &glam::U64Vec2) -> bevy::math::U64Vec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::U64Vec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::U64Vec2; + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &glam::U64Vec2) -> bool; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: &glam::U64Vec2) -> bevy::math::U64Vec2; "#, r#" #[lua( - as_trait = "std::ops::Sub", + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "sub", - metamethod = "Sub", + composite = "add", + metamethod = "Add", )] - fn sub(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::U64Vec2; + fn add(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::U64Vec2; "#, r#" @@ -8609,408 +8798,135 @@ struct UVec4 { r#" /// Casts all elements of `self` to `f64`. - #[lua(kind = "Method", output(proxy))] - fn as_dvec2(&self) -> bevy::math::DVec2; - -"#, - r#" -/// Casts all elements of `self` to `i32`. - - #[lua(kind = "Method", output(proxy))] - fn as_ivec2(&self) -> bevy::math::IVec2; - -"#, - r#" -/// Casts all elements of `self` to `u32`. - - #[lua(kind = "Method", output(proxy))] - fn as_uvec2(&self) -> bevy::math::UVec2; - -"#, - r#" -/// Casts all elements of `self` to `i64`. - - #[lua(kind = "Method", output(proxy))] - fn as_i64vec2(&self) -> bevy::math::I64Vec2; - -"#, - r#" -/// Returns a vector containing the wrapping addition of `self` and `rhs`. -/// In other words this computes `[self.x.wrapping_add(rhs.x), self.y.wrapping_add(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn wrapping_add(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::U64Vec2; - -"#, - r#" -/// Returns a vector containing the wrapping subtraction of `self` and `rhs`. -/// In other words this computes `[self.x.wrapping_sub(rhs.x), self.y.wrapping_sub(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn wrapping_sub(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::U64Vec2; - -"#, - r#" -/// Returns a vector containing the wrapping multiplication of `self` and `rhs`. -/// In other words this computes `[self.x.wrapping_mul(rhs.x), self.y.wrapping_mul(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn wrapping_mul(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::U64Vec2; - -"#, - r#" -/// Returns a vector containing the wrapping division of `self` and `rhs`. -/// In other words this computes `[self.x.wrapping_div(rhs.x), self.y.wrapping_div(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn wrapping_div(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::U64Vec2; - -"#, - r#" -/// Returns a vector containing the saturating addition of `self` and `rhs`. -/// In other words this computes `[self.x.saturating_add(rhs.x), self.y.saturating_add(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn saturating_add(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::U64Vec2; - -"#, - r#" -/// Returns a vector containing the saturating subtraction of `self` and `rhs`. -/// In other words this computes `[self.x.saturating_sub(rhs.x), self.y.saturating_sub(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn saturating_sub(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::U64Vec2; - -"#, - r#" -/// Returns a vector containing the saturating multiplication of `self` and `rhs`. -/// In other words this computes `[self.x.saturating_mul(rhs.x), self.y.saturating_mul(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn saturating_mul(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::U64Vec2; - -"#, - r#" -/// Returns a vector containing the saturating division of `self` and `rhs`. -/// In other words this computes `[self.x.saturating_div(rhs.x), self.y.saturating_div(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn saturating_div(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::U64Vec2; - -"#, - r#" -/// Returns a vector containing the wrapping addition of `self` and signed vector `rhs`. -/// In other words this computes `[self.x.wrapping_add_signed(rhs.x), self.y.wrapping_add_signed(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn wrapping_add_signed( - self, - #[proxy] - rhs: bevy::math::I64Vec2, - ) -> bevy::math::U64Vec2; - -"#, - r#" -/// Returns a vector containing the saturating addition of `self` and signed vector `rhs`. -/// In other words this computes `[self.x.saturating_add_signed(rhs.x), self.y.saturating_add_signed(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn saturating_add_signed( - self, - #[proxy] - rhs: bevy::math::I64Vec2, - ) -> bevy::math::U64Vec2; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, rhs: u64) -> bevy::math::U64Vec2; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: &glam::U64Vec2) -> bevy::math::U64Vec2; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::U64Vec2; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, rhs: u64) -> bevy::math::U64Vec2; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::U64Vec2; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, rhs: u64) -> bevy::math::U64Vec2; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::U64Vec2; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, #[proxy] rhs: &glam::U64Vec2) -> bevy::math::U64Vec2; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, #[proxy] rhs: &glam::U64Vec2) -> bevy::math::U64Vec2; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, rhs: u64) -> bevy::math::U64Vec2; + #[lua(kind = "Method", output(proxy))] + fn as_dvec2(&self) -> bevy::math::DVec2; "#, r#" +/// Casts all elements of `self` to `i32`. - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::U64Vec2; + #[lua(kind = "Method", output(proxy))] + fn as_ivec2(&self) -> bevy::math::IVec2; "#, r#" +/// Casts all elements of `self` to `u32`. - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, #[proxy] rhs: &glam::U64Vec2) -> bevy::math::U64Vec2; + #[lua(kind = "Method", output(proxy))] + fn as_uvec2(&self) -> bevy::math::UVec2; "#, r#" +/// Casts all elements of `self` to `i64`. - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &glam::U64Vec2) -> bool; + #[lua(kind = "Method", output(proxy))] + fn as_i64vec2(&self) -> bevy::math::I64Vec2; "#, r#" +/// Returns a vector containing the wrapping addition of `self` and `rhs`. +/// In other words this computes `[self.x.wrapping_add(rhs.x), self.y.wrapping_add(rhs.y), ..]`. - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, #[proxy] rhs: &glam::U64Vec2) -> bevy::math::U64Vec2; + #[lua(kind = "Method", output(proxy))] + fn wrapping_add(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::U64Vec2; "#, r#" +/// Returns a vector containing the wrapping subtraction of `self` and `rhs`. +/// In other words this computes `[self.x.wrapping_sub(rhs.x), self.y.wrapping_sub(rhs.y), ..]`. - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::U64Vec2; + #[lua(kind = "Method", output(proxy))] + fn wrapping_sub(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::U64Vec2; "#, r#" +/// Returns a vector containing the wrapping multiplication of `self` and `rhs`. +/// In other words this computes `[self.x.wrapping_mul(rhs.x), self.y.wrapping_mul(rhs.y), ..]`. - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, rhs: u64) -> bevy::math::U64Vec2; + #[lua(kind = "Method", output(proxy))] + fn wrapping_mul(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::U64Vec2; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct U64Vec2 { - x: u64, - y: u64, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::math::U64Vec3", - functions[r#" +/// Returns a vector containing the wrapping division of `self` and `rhs`. +/// In other words this computes `[self.x.wrapping_div(rhs.x), self.y.wrapping_div(rhs.y), ..]`. - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, rhs: u64) -> bevy::math::U64Vec3; + #[lua(kind = "Method", output(proxy))] + fn wrapping_div(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::U64Vec2; "#, r#" +/// Returns a vector containing the saturating addition of `self` and `rhs`. +/// In other words this computes `[self.x.saturating_add(rhs.x), self.y.saturating_add(rhs.y), ..]`. - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, #[proxy] rhs: bevy::math::U64Vec3) -> bevy::math::U64Vec3; + #[lua(kind = "Method", output(proxy))] + fn saturating_add(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::U64Vec2; "#, r#" +/// Returns a vector containing the saturating subtraction of `self` and `rhs`. +/// In other words this computes `[self.x.saturating_sub(rhs.x), self.y.saturating_sub(rhs.y), ..]`. - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, #[proxy] rhs: &glam::U64Vec3) -> bevy::math::U64Vec3; + #[lua(kind = "Method", output(proxy))] + fn saturating_sub(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::U64Vec2; "#, r#" +/// Returns a vector containing the saturating multiplication of `self` and `rhs`. +/// In other words this computes `[self.x.saturating_mul(rhs.x), self.y.saturating_mul(rhs.y), ..]`. - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, rhs: u64) -> bevy::math::U64Vec3; + #[lua(kind = "Method", output(proxy))] + fn saturating_mul(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::U64Vec2; "#, r#" +/// Returns a vector containing the saturating division of `self` and `rhs`. +/// In other words this computes `[self.x.saturating_div(rhs.x), self.y.saturating_div(rhs.y), ..]`. - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: bevy::math::U64Vec3) -> bevy::math::U64Vec3; + #[lua(kind = "Method", output(proxy))] + fn saturating_div(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::U64Vec2; "#, r#" +/// Returns a vector containing the wrapping addition of `self` and signed vector `rhs`. +/// In other words this computes `[self.x.wrapping_add_signed(rhs.x), self.y.wrapping_add_signed(rhs.y), ..]`. - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, #[proxy] rhs: bevy::math::U64Vec3) -> bevy::math::U64Vec3; + #[lua(kind = "Method", output(proxy))] + fn wrapping_add_signed( + self, + #[proxy] + rhs: bevy::math::I64Vec2, + ) -> bevy::math::U64Vec2; "#, r#" +/// Returns a vector containing the saturating addition of `self` and signed vector `rhs`. +/// In other words this computes `[self.x.saturating_add_signed(rhs.x), self.y.saturating_add_signed(rhs.y), ..]`. - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, rhs: u64) -> bevy::math::U64Vec3; + #[lua(kind = "Method", output(proxy))] + fn saturating_add_signed( + self, + #[proxy] + rhs: bevy::math::I64Vec2, + ) -> bevy::math::U64Vec2; "#, r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct U64Vec2 { + x: u64, + y: u64, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::math::U64Vec3", + functions[r#" /// Creates a new vector. #[lua(kind = "Function", output(proxy))] @@ -9372,59 +9288,6 @@ struct U64Vec2 { rhs: bevy::math::I64Vec3, ) -> bevy::math::U64Vec3; -"#, - r#" - - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, #[proxy] rhs: bevy::math::U64Vec3) -> bevy::math::U64Vec3; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &glam::U64Vec3) -> bool; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, rhs: u64) -> bevy::math::U64Vec3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, #[proxy] rhs: &glam::U64Vec3) -> bevy::math::U64Vec3; - "#, r#" @@ -9435,19 +9298,7 @@ struct U64Vec2 { composite = "mul", metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: &glam::U64Vec3) -> bevy::math::U64Vec3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, rhs: u64) -> bevy::math::U64Vec3; + fn mul(self, rhs: u64) -> bevy::math::U64Vec3; "#, r#" @@ -9459,7 +9310,7 @@ struct U64Vec2 { composite = "rem", metamethod = "Mod", )] - fn rem(self, #[proxy] rhs: &glam::U64Vec3) -> bevy::math::U64Vec3; + fn rem(self, #[proxy] rhs: bevy::math::U64Vec3) -> bevy::math::U64Vec3; "#, r#" @@ -9477,11 +9328,13 @@ struct U64Vec2 { r#" #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", + as_trait = "std::ops::Div", + kind = "MetaFunction", output(proxy), + composite = "div", + metamethod = "Div", )] - fn clone(&self) -> bevy::math::U64Vec3; + fn div(self, rhs: u64) -> bevy::math::U64Vec3; "#, r#" @@ -9493,53 +9346,49 @@ struct U64Vec2 { composite = "div", metamethod = "Div", )] - fn div(self, #[proxy] rhs: bevy::math::U64Vec3) -> bevy::math::U64Vec3; + fn div(self, #[proxy] rhs: &glam::U64Vec3) -> bevy::math::U64Vec3; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct U64Vec3 { - x: u64, - y: u64, - z: u64, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::math::U64Vec4", - functions[r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "mul", + metamethod = "Mul", )] - fn div(self, rhs: u64) -> bevy::math::U64Vec4; + fn mul(self, #[proxy] rhs: bevy::math::U64Vec3) -> bevy::math::U64Vec3; "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua( + as_trait = "std::ops::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(self, rhs: u64) -> bevy::math::U64Vec3; "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "add", + metamethod = "Add", )] - fn mul(self, rhs: u64) -> bevy::math::U64Vec4; + fn add(self, #[proxy] rhs: &glam::U64Vec3) -> bevy::math::U64Vec3; + +"#, + r#" + + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); "#, r#" @@ -9551,43 +9400,43 @@ struct U64Vec3 { composite = "mul", metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: &glam::U64Vec4) -> bevy::math::U64Vec4; + fn mul(self, #[proxy] rhs: &glam::U64Vec3) -> bevy::math::U64Vec3; "#, r#" #[lua( - as_trait = "std::ops::Rem", + as_trait = "std::ops::Div", kind = "MetaFunction", output(proxy), - composite = "rem", - metamethod = "Mod", + composite = "div", + metamethod = "Div", )] - fn rem(self, #[proxy] rhs: bevy::math::U64Vec4) -> bevy::math::U64Vec4; + fn div(self, #[proxy] rhs: bevy::math::U64Vec3) -> bevy::math::U64Vec3; "#, r#" #[lua( - as_trait = "std::ops::Rem", + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "rem", - metamethod = "Mod", + composite = "add", + metamethod = "Add", )] - fn rem(self, #[proxy] rhs: &glam::U64Vec4) -> bevy::math::U64Vec4; + fn add(self, rhs: u64) -> bevy::math::U64Vec3; "#, r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Rem", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "rem", + metamethod = "Mod", )] - fn div(self, #[proxy] rhs: bevy::math::U64Vec4) -> bevy::math::U64Vec4; + fn rem(self, rhs: u64) -> bevy::math::U64Vec3; "#, r#" @@ -9598,7 +9447,7 @@ struct U64Vec3 { composite = "eq", metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &glam::U64Vec4) -> bool; + fn eq(&self, #[proxy] other: &glam::U64Vec3) -> bool; "#, r#" @@ -9610,19 +9459,17 @@ struct U64Vec3 { composite = "add", metamethod = "Add", )] - fn add(self, #[proxy] rhs: bevy::math::U64Vec4) -> bevy::math::U64Vec4; + fn add(self, #[proxy] rhs: bevy::math::U64Vec3) -> bevy::math::U64Vec3; "#, r#" #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", output(proxy), - composite = "rem", - metamethod = "Mod", )] - fn rem(self, rhs: u64) -> bevy::math::U64Vec4; + fn clone(&self) -> bevy::math::U64Vec3; "#, r#" @@ -9634,29 +9481,58 @@ struct U64Vec3 { composite = "sub", metamethod = "Sub", )] - fn sub(self, #[proxy] rhs: bevy::math::U64Vec4) -> bevy::math::U64Vec4; + fn sub(self, #[proxy] rhs: bevy::math::U64Vec3) -> bevy::math::U64Vec3; "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Rem", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "rem", + metamethod = "Mod", )] - fn mul(self, #[proxy] rhs: bevy::math::U64Vec4) -> bevy::math::U64Vec4; + fn rem(self, #[proxy] rhs: &glam::U64Vec3) -> bevy::math::U64Vec3; "#, r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct U64Vec3 { + x: u64, + y: u64, + z: u64, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::math::U64Vec4", + functions[r#" #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", + as_trait = "std::ops::Rem", + kind = "MetaFunction", output(proxy), + composite = "rem", + metamethod = "Mod", )] - fn clone(&self) -> bevy::math::U64Vec4; + fn rem(self, #[proxy] rhs: &glam::U64Vec4) -> bevy::math::U64Vec4; + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &glam::U64Vec4) -> bool; "#, r#" @@ -9668,19 +9544,43 @@ struct U64Vec3 { composite = "div", metamethod = "Div", )] - fn div(self, #[proxy] rhs: &glam::U64Vec4) -> bevy::math::U64Vec4; + fn div(self, rhs: u64) -> bevy::math::U64Vec4; "#, r#" #[lua( - as_trait = "std::ops::Sub", + as_trait = "std::ops::Div", kind = "MetaFunction", output(proxy), - composite = "sub", - metamethod = "Sub", + composite = "div", + metamethod = "Div", )] - fn sub(self, #[proxy] rhs: &glam::U64Vec4) -> bevy::math::U64Vec4; + fn div(self, #[proxy] rhs: bevy::math::U64Vec4) -> bevy::math::U64Vec4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, #[proxy] rhs: bevy::math::U64Vec4) -> bevy::math::U64Vec4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, rhs: u64) -> bevy::math::U64Vec4; "#, r#" @@ -10031,6 +9931,84 @@ struct U64Vec3 { rhs: bevy::math::I64Vec4, ) -> bevy::math::U64Vec4; +"#, + r#" + + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, rhs: u64) -> bevy::math::U64Vec4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: bevy::math::U64Vec4) -> bevy::math::U64Vec4; + +"#, + r#" + + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: &glam::U64Vec4) -> bevy::math::U64Vec4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(self, #[proxy] rhs: bevy::math::U64Vec4) -> bevy::math::U64Vec4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, #[proxy] rhs: &glam::U64Vec4) -> bevy::math::U64Vec4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, rhs: u64) -> bevy::math::U64Vec4; + "#, r#" @@ -10041,7 +10019,7 @@ struct U64Vec3 { composite = "sub", metamethod = "Sub", )] - fn sub(self, rhs: u64) -> bevy::math::U64Vec4; + fn sub(self, #[proxy] rhs: &glam::U64Vec4) -> bevy::math::U64Vec4; "#, r#" @@ -10053,19 +10031,41 @@ struct U64Vec3 { composite = "add", metamethod = "Add", )] - fn add(self, #[proxy] rhs: &glam::U64Vec4) -> bevy::math::U64Vec4; + fn add(self, #[proxy] rhs: bevy::math::U64Vec4) -> bevy::math::U64Vec4; "#, r#" #[lua( - as_trait = "std::ops::Add", + as_trait = "std::ops::Div", kind = "MetaFunction", output(proxy), - composite = "add", - metamethod = "Add", + composite = "div", + metamethod = "Div", )] - fn add(self, rhs: u64) -> bevy::math::U64Vec4; + fn div(self, #[proxy] rhs: &glam::U64Vec4) -> bevy::math::U64Vec4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(self, rhs: u64) -> bevy::math::U64Vec4; + +"#, + r#" + + #[lua( + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", + output(proxy), + )] + fn clone(&self) -> bevy::math::U64Vec4; "#, r#" @@ -10094,31 +10094,19 @@ struct U64Vec4 { composite = "rem", metamethod = "Mod", )] - fn rem(self, rhs: f32) -> bevy::math::Vec2; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, rhs: f32) -> bevy::math::Vec2; + fn rem(self, #[proxy] rhs: &glam::Vec2) -> bevy::math::Vec2; "#, r#" #[lua( - as_trait = "std::ops::Sub", + as_trait = "std::ops::Rem", kind = "MetaFunction", output(proxy), - composite = "sub", - metamethod = "Sub", + composite = "rem", + metamethod = "Mod", )] - fn sub(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; + fn rem(self, rhs: f32) -> bevy::math::Vec2; "#, r#" @@ -10130,7 +10118,7 @@ struct U64Vec4 { composite = "add", metamethod = "Add", )] - fn add(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; + fn add(self, #[proxy] rhs: &glam::Vec2) -> bevy::math::Vec2; "#, r#" @@ -10142,78 +10130,78 @@ struct U64Vec4 { composite = "div", metamethod = "Div", )] - fn div(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; + fn div(self, #[proxy] rhs: &glam::Vec2) -> bevy::math::Vec2; "#, r#" #[lua( - as_trait = "std::ops::Rem", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "rem", - metamethod = "Mod", + composite = "mul", + metamethod = "Mul", )] - fn rem(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; + fn mul(self, rhs: f32) -> bevy::math::Vec2; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", + as_trait = "std::ops::Add", kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", + output(proxy), + composite = "add", + metamethod = "Add", )] - fn eq(&self, #[proxy] other: &glam::Vec2) -> bool; + fn add(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Div", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "div", + metamethod = "Div", )] - fn mul(self, #[proxy] rhs: &glam::Vec2) -> bevy::math::Vec2; + fn div(self, rhs: f32) -> bevy::math::Vec2; "#, r#" #[lua( - as_trait = "std::ops::Add", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "add", - metamethod = "Add", + composite = "mul", + metamethod = "Mul", )] - fn add(self, #[proxy] rhs: &glam::Vec2) -> bevy::math::Vec2; + fn mul(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; "#, r#" #[lua( - as_trait = "std::ops::Sub", + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "sub", - metamethod = "Sub", + composite = "add", + metamethod = "Add", )] - fn sub(self, rhs: f32) -> bevy::math::Vec2; + fn add(self, rhs: f32) -> bevy::math::Vec2; "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::cmp::PartialEq", kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "eq", + metamethod = "Eq", )] - fn mul(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; + fn eq(&self, #[proxy] other: &glam::Vec2) -> bool; "#, r#" @@ -10913,49 +10901,47 @@ struct U64Vec4 { r#" #[lua( - as_trait = "std::ops::Neg", - kind = "MetaFunction", + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", output(proxy), - composite = "neg", - metamethod = "Unm", )] - fn neg(self) -> bevy::math::Vec2; + fn clone(&self) -> bevy::math::Vec2; "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Sub", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "sub", + metamethod = "Sub", )] - fn mul(self, rhs: f32) -> bevy::math::Vec2; + fn sub(self, rhs: f32) -> bevy::math::Vec2; "#, r#" #[lua( - as_trait = "std::ops::Rem", + as_trait = "std::ops::Sub", kind = "MetaFunction", output(proxy), - composite = "rem", - metamethod = "Mod", + composite = "sub", + metamethod = "Sub", )] - fn rem(self, #[proxy] rhs: &glam::Vec2) -> bevy::math::Vec2; + fn sub(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; "#, r#" #[lua( - as_trait = "std::ops::Sub", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "sub", - metamethod = "Sub", + composite = "mul", + metamethod = "Mul", )] - fn sub(self, #[proxy] rhs: &glam::Vec2) -> bevy::math::Vec2; + fn mul(self, #[proxy] rhs: &glam::Vec2) -> bevy::math::Vec2; "#, r#" @@ -10967,29 +10953,43 @@ struct U64Vec4 { composite = "div", metamethod = "Div", )] - fn div(self, #[proxy] rhs: &glam::Vec2) -> bevy::math::Vec2; + fn div(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; "#, r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Sub", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "sub", + metamethod = "Sub", )] - fn div(self, rhs: f32) -> bevy::math::Vec2; + fn sub(self, #[proxy] rhs: &glam::Vec2) -> bevy::math::Vec2; "#, r#" #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", + as_trait = "std::ops::Rem", + kind = "MetaFunction", output(proxy), + composite = "rem", + metamethod = "Mod", )] - fn clone(&self) -> bevy::math::Vec2; + fn rem(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Neg", + kind = "MetaFunction", + output(proxy), + composite = "neg", + metamethod = "Unm", + )] + fn neg(self) -> bevy::math::Vec2; "#, r#" @@ -11025,92 +11025,10 @@ struct Vec2 { as_trait = "std::ops::Rem", kind = "MetaFunction", output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, rhs: f32) -> bevy::math::Vec3A; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; - -"#, - r#" - - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::Vec3A; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, rhs: f32) -> bevy::math::Vec3A; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, rhs: f32) -> bevy::math::Vec3A; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", + composite = "rem", + metamethod = "Mod", )] - fn add(self, #[proxy] rhs: &glam::Vec3A) -> bevy::math::Vec3A; + fn rem(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; "#, r#" @@ -11122,7 +11040,7 @@ struct Vec2 { composite = "sub", metamethod = "Sub", )] - fn sub(self, rhs: f32) -> bevy::math::Vec3A; + fn sub(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; "#, r#" @@ -11140,49 +11058,49 @@ struct Vec2 { r#" #[lua( - as_trait = "std::ops::Add", + as_trait = "std::ops::Rem", kind = "MetaFunction", output(proxy), - composite = "add", - metamethod = "Add", + composite = "rem", + metamethod = "Mod", )] - fn add(self, rhs: f32) -> bevy::math::Vec3A; + fn rem(self, #[proxy] rhs: &glam::Vec3A) -> bevy::math::Vec3A; "#, r#" #[lua( - as_trait = "std::ops::Sub", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "sub", - metamethod = "Sub", + composite = "mul", + metamethod = "Mul", )] - fn sub(self, #[proxy] rhs: &glam::Vec3A) -> bevy::math::Vec3A; + fn mul(self, rhs: f32) -> bevy::math::Vec3A; "#, r#" #[lua( - as_trait = "std::ops::Rem", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "rem", - metamethod = "Mod", + composite = "mul", + metamethod = "Mul", )] - fn rem(self, #[proxy] rhs: &glam::Vec3A) -> bevy::math::Vec3A; + fn mul(self, #[proxy] rhs: &glam::Vec3A) -> bevy::math::Vec3A; "#, r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Rem", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "rem", + metamethod = "Mod", )] - fn div(self, #[proxy] rhs: &glam::Vec3A) -> bevy::math::Vec3A; + fn rem(self, rhs: f32) -> bevy::math::Vec3A; "#, r#" @@ -11199,13 +11117,13 @@ struct Vec2 { r#" #[lua( - as_trait = "std::ops::Rem", + as_trait = "std::ops::Sub", kind = "MetaFunction", output(proxy), - composite = "rem", - metamethod = "Mod", + composite = "sub", + metamethod = "Sub", )] - fn rem(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; + fn sub(self, #[proxy] rhs: &glam::Vec3A) -> bevy::math::Vec3A; "#, r#" @@ -11219,18 +11137,6 @@ struct Vec2 { )] fn neg(self) -> bevy::math::Vec3A; -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: &glam::Vec3A) -> bevy::math::Vec3A; - "#, r#" /// Creates a new vector. @@ -11920,6 +11826,100 @@ struct Vec2 { #[lua(kind = "Method", output(proxy))] fn as_u64vec3(&self) -> bevy::math::U64Vec3; +"#, + r#" + + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, #[proxy] rhs: &glam::Vec3A) -> bevy::math::Vec3A; + +"#, + r#" + + #[lua( + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", + output(proxy), + )] + fn clone(&self) -> bevy::math::Vec3A; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, rhs: f32) -> bevy::math::Vec3A; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(self, rhs: f32) -> bevy::math::Vec3A; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, #[proxy] rhs: &glam::Vec3A) -> bevy::math::Vec3A; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, rhs: f32) -> bevy::math::Vec3A; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -11947,6 +11947,18 @@ struct Vec3A(); remote = "bevy::math::Vec4", functions[r#" + #[lua( + as_trait = "std::ops::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::Vec4; + +"#, + r#" + #[lua( as_trait = "std::ops::Div", kind = "MetaFunction", @@ -11954,19 +11966,19 @@ struct Vec3A(); composite = "div", metamethod = "Div", )] - fn div(self, rhs: f32) -> bevy::math::Vec4; + fn div(self, #[proxy] rhs: &glam::Vec4) -> bevy::math::Vec4; "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Rem", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "rem", + metamethod = "Mod", )] - fn mul(self, rhs: f32) -> bevy::math::Vec4; + fn rem(self, rhs: f32) -> bevy::math::Vec4; "#, r#" @@ -11982,132 +11994,132 @@ struct Vec3A(); r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Rem", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "rem", + metamethod = "Mod", )] - fn div(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::Vec4; + fn rem(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::Vec4; "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Sub", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "sub", + metamethod = "Sub", )] - fn mul(self, #[proxy] rhs: &glam::Vec4) -> bevy::math::Vec4; + fn sub(self, rhs: f32) -> bevy::math::Vec4; "#, r#" #[lua( - as_trait = "std::ops::Rem", + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "rem", - metamethod = "Mod", + composite = "add", + metamethod = "Add", )] - fn rem(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::Vec4; + fn add(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::Vec4; "#, r#" #[lua( - as_trait = "std::ops::Add", + as_trait = "std::cmp::PartialEq", kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", + composite = "eq", + metamethod = "Eq", )] - fn add(self, rhs: f32) -> bevy::math::Vec4; + fn eq(&self, #[proxy] rhs: &glam::Vec4) -> bool; "#, r#" #[lua( - as_trait = "std::ops::Rem", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "rem", - metamethod = "Mod", + composite = "mul", + metamethod = "Mul", )] - fn rem(self, #[proxy] rhs: &glam::Vec4) -> bevy::math::Vec4; + fn mul(self, rhs: f32) -> bevy::math::Vec4; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", + as_trait = "std::ops::Mul", kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", + output(proxy), + composite = "mul", + metamethod = "Mul", )] - fn eq(&self, #[proxy] rhs: &glam::Vec4) -> bool; + fn mul(self, #[proxy] rhs: &glam::Vec4) -> bevy::math::Vec4; "#, r#" #[lua( - as_trait = "std::ops::Add", + as_trait = "std::ops::Div", kind = "MetaFunction", output(proxy), - composite = "add", - metamethod = "Add", + composite = "div", + metamethod = "Div", )] - fn add(self, #[proxy] rhs: &glam::Vec4) -> bevy::math::Vec4; + fn div(self, rhs: f32) -> bevy::math::Vec4; "#, r#" #[lua( - as_trait = "std::ops::Rem", + as_trait = "std::ops::Div", kind = "MetaFunction", output(proxy), - composite = "rem", - metamethod = "Mod", + composite = "div", + metamethod = "Div", )] - fn rem(self, rhs: f32) -> bevy::math::Vec4; + fn div(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::Vec4; "#, r#" #[lua( - as_trait = "std::ops::Neg", + as_trait = "std::ops::Sub", kind = "MetaFunction", output(proxy), - composite = "neg", - metamethod = "Unm", + composite = "sub", + metamethod = "Sub", )] - fn neg(self) -> bevy::math::Vec4; + fn sub(self, #[proxy] rhs: &glam::Vec4) -> bevy::math::Vec4; "#, r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "add", + metamethod = "Add", )] - fn div(self, #[proxy] rhs: &glam::Vec4) -> bevy::math::Vec4; + fn add(self, #[proxy] rhs: &glam::Vec4) -> bevy::math::Vec4; "#, r#" #[lua( - as_trait = "std::ops::Sub", + as_trait = "std::ops::Neg", kind = "MetaFunction", output(proxy), - composite = "sub", - metamethod = "Sub", + composite = "neg", + metamethod = "Unm", )] - fn sub(self, #[proxy] rhs: &glam::Vec4) -> bevy::math::Vec4; + fn neg(self) -> bevy::math::Vec4; "#, r#" @@ -12748,18 +12760,6 @@ struct Vec3A(); #[lua(kind = "Method", output(proxy))] fn as_u64vec4(&self) -> bevy::math::U64Vec4; -"#, - r#" - - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::Vec4; - "#, r#" @@ -12776,25 +12776,25 @@ struct Vec3A(); r#" #[lua( - as_trait = "std::ops::Sub", + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "sub", - metamethod = "Sub", + composite = "add", + metamethod = "Add", )] - fn sub(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::Vec4; + fn add(self, rhs: f32) -> bevy::math::Vec4; "#, r#" #[lua( - as_trait = "std::ops::Sub", + as_trait = "std::ops::Rem", kind = "MetaFunction", output(proxy), - composite = "sub", - metamethod = "Sub", + composite = "rem", + metamethod = "Mod", )] - fn sub(self, rhs: f32) -> bevy::math::Vec4; + fn rem(self, #[proxy] rhs: &glam::Vec4) -> bevy::math::Vec4; "#, r#" @@ -12824,17 +12824,12 @@ struct Vec4(); functions[r#" #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", )] - fn clone(&self) -> bevy::math::BVec2; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + fn eq(&self, #[proxy] other: &glam::BVec2) -> bool; "#, r#" @@ -12896,16 +12891,21 @@ struct Vec4(); #[lua(kind = "MutatingMethod")] fn set(&mut self, index: usize, value: bool) -> (); +"#, + r#" + + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); + "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", + output(proxy), )] - fn eq(&self, #[proxy] other: &glam::BVec2) -> bool; + fn clone(&self) -> bevy::math::BVec2; "#, r#" @@ -12993,12 +12993,6 @@ struct BVec2 { )] fn eq(&self, #[proxy] other: &glam::BVec3) -> bool; -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - "#, r#" @@ -13009,6 +13003,12 @@ struct BVec2 { )] fn clone(&self) -> bevy::math::BVec3; +"#, + r#" + + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -13028,12 +13028,6 @@ struct BVec3 { remote = "bevy::math::BVec4", functions[r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -13042,6 +13036,16 @@ struct BVec3 { )] fn eq(&self, #[proxy] other: &glam::BVec4) -> bool; +"#, + r#" + + #[lua( + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", + output(proxy), + )] + fn clone(&self) -> bevy::math::BVec4; + "#, r#" /// Creates a new vector mask. @@ -13105,12 +13109,8 @@ struct BVec3 { "#, r#" - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::BVec4; + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); "#, r#" @@ -13133,37 +13133,37 @@ struct BVec4 { functions[r#" #[lua( - as_trait = "std::ops::Neg", + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "neg", - metamethod = "Unm", + composite = "add", + metamethod = "Add", )] - fn neg(self) -> bevy::math::DVec2; + fn add(self, rhs: f64) -> bevy::math::DVec2; "#, r#" #[lua( - as_trait = "std::ops::Sub", + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "sub", - metamethod = "Sub", + composite = "add", + metamethod = "Add", )] - fn sub(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; + fn add(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; "#, r#" #[lua( - as_trait = "std::ops::Sub", + as_trait = "std::ops::Neg", kind = "MetaFunction", output(proxy), - composite = "sub", - metamethod = "Sub", + composite = "neg", + metamethod = "Unm", )] - fn sub(self, #[proxy] rhs: &glam::DVec2) -> bevy::math::DVec2; + fn neg(self) -> bevy::math::DVec2; "#, r#" @@ -13181,25 +13181,24 @@ struct BVec4 { r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::cmp::PartialEq", kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", + composite = "eq", + metamethod = "Eq", )] - fn div(self, rhs: f64) -> bevy::math::DVec2; + fn eq(&self, #[proxy] other: &glam::DVec2) -> bool; "#, r#" #[lua( - as_trait = "std::ops::Rem", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "rem", - metamethod = "Mod", + composite = "mul", + metamethod = "Mul", )] - fn rem(self, #[proxy] rhs: &glam::DVec2) -> bevy::math::DVec2; + fn mul(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; "#, r#" @@ -13211,7 +13210,19 @@ struct BVec4 { composite = "div", metamethod = "Div", )] - fn div(self, #[proxy] rhs: &glam::DVec2) -> bevy::math::DVec2; + fn div(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, rhs: f64) -> bevy::math::DVec2; "#, r#" @@ -13229,13 +13240,13 @@ struct BVec4 { r#" #[lua( - as_trait = "std::ops::Sub", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "sub", - metamethod = "Sub", + composite = "mul", + metamethod = "Mul", )] - fn sub(self, rhs: f64) -> bevy::math::DVec2; + fn mul(self, rhs: f64) -> bevy::math::DVec2; "#, r#" @@ -13943,13 +13954,13 @@ struct BVec4 { r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Sub", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "sub", + metamethod = "Sub", )] - fn mul(self, rhs: f64) -> bevy::math::DVec2; + fn sub(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; "#, r#" @@ -13961,19 +13972,19 @@ struct BVec4 { composite = "div", metamethod = "Div", )] - fn div(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; + fn div(self, #[proxy] rhs: &glam::DVec2) -> bevy::math::DVec2; "#, r#" #[lua( - as_trait = "std::ops::Rem", + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "rem", - metamethod = "Mod", + composite = "add", + metamethod = "Add", )] - fn rem(self, rhs: f64) -> bevy::math::DVec2; + fn add(self, #[proxy] rhs: &glam::DVec2) -> bevy::math::DVec2; "#, r#" @@ -13989,60 +14000,49 @@ struct BVec4 { r#" #[lua( - as_trait = "std::ops::Add", + as_trait = "std::ops::Div", kind = "MetaFunction", output(proxy), - composite = "add", - metamethod = "Add", + composite = "div", + metamethod = "Div", )] - fn add(self, #[proxy] rhs: &glam::DVec2) -> bevy::math::DVec2; + fn div(self, rhs: f64) -> bevy::math::DVec2; "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Sub", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "sub", + metamethod = "Sub", )] - fn mul(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; + fn sub(self, rhs: f64) -> bevy::math::DVec2; "#, r#" #[lua( - as_trait = "std::ops::Add", + as_trait = "std::ops::Rem", kind = "MetaFunction", output(proxy), - composite = "add", - metamethod = "Add", + composite = "rem", + metamethod = "Mod", )] - fn add(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; + fn rem(self, #[proxy] rhs: &glam::DVec2) -> bevy::math::DVec2; "#, r#" #[lua( - as_trait = "std::ops::Add", + as_trait = "std::ops::Sub", kind = "MetaFunction", output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, rhs: f64) -> bevy::math::DVec2; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", + composite = "sub", + metamethod = "Sub", )] - fn eq(&self, #[proxy] other: &glam::DVec2) -> bool; + fn sub(self, #[proxy] rhs: &glam::DVec2) -> bevy::math::DVec2; "#, r#" @@ -14075,49 +14075,47 @@ struct DVec2 { functions[r#" #[lua( - as_trait = "std::ops::Add", + as_trait = "std::ops::Rem", kind = "MetaFunction", output(proxy), - composite = "add", - metamethod = "Add", + composite = "rem", + metamethod = "Mod", )] - fn add(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; + fn rem(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "add", + metamethod = "Add", )] - fn mul(self, #[proxy] rhs: &glam::DVec3) -> bevy::math::DVec3; + fn add(self, rhs: f64) -> bevy::math::DVec3; "#, r#" #[lua( - as_trait = "std::ops::Sub", + as_trait = "std::ops::Div", kind = "MetaFunction", output(proxy), - composite = "sub", - metamethod = "Sub", + composite = "div", + metamethod = "Div", )] - fn sub(self, #[proxy] rhs: &glam::DVec3) -> bevy::math::DVec3; + fn div(self, rhs: f64) -> bevy::math::DVec3; "#, r#" #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", output(proxy), - composite = "sub", - metamethod = "Sub", )] - fn sub(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; + fn clone(&self) -> bevy::math::DVec3; "#, r#" @@ -14129,19 +14127,19 @@ struct DVec2 { composite = "div", metamethod = "Div", )] - fn div(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; + fn div(self, #[proxy] rhs: &glam::DVec3) -> bevy::math::DVec3; "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "add", + metamethod = "Add", )] - fn mul(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; + fn add(self, #[proxy] rhs: &glam::DVec3) -> bevy::math::DVec3; "#, r#" @@ -14153,40 +14151,43 @@ struct DVec2 { composite = "div", metamethod = "Div", )] - fn div(self, rhs: f64) -> bevy::math::DVec3; + fn div(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; "#, r#" #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", + as_trait = "std::ops::Sub", + kind = "MetaFunction", output(proxy), + composite = "sub", + metamethod = "Sub", )] - fn clone(&self) -> bevy::math::DVec3; + fn sub(self, rhs: f64) -> bevy::math::DVec3; "#, r#" #[lua( - as_trait = "std::ops::Neg", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "neg", - metamethod = "Unm", + composite = "mul", + metamethod = "Mul", )] - fn neg(self) -> bevy::math::DVec3; + fn mul(self, rhs: f64) -> bevy::math::DVec3; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", + as_trait = "std::ops::Rem", kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", + output(proxy), + composite = "rem", + metamethod = "Mod", )] - fn eq(&self, #[proxy] other: &glam::DVec3) -> bool; + fn rem(self, rhs: f64) -> bevy::math::DVec3; "#, r#" @@ -14198,19 +14199,19 @@ struct DVec2 { composite = "sub", metamethod = "Sub", )] - fn sub(self, rhs: f64) -> bevy::math::DVec3; + fn sub(self, #[proxy] rhs: &glam::DVec3) -> bevy::math::DVec3; "#, r#" #[lua( - as_trait = "std::ops::Add", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "add", - metamethod = "Add", + composite = "mul", + metamethod = "Mul", )] - fn add(self, rhs: f64) -> bevy::math::DVec3; + fn mul(self, #[proxy] rhs: &glam::DVec3) -> bevy::math::DVec3; "#, r#" @@ -14222,7 +14223,19 @@ struct DVec2 { composite = "rem", metamethod = "Mod", )] - fn rem(self, rhs: f64) -> bevy::math::DVec3; + fn rem(self, #[proxy] rhs: &glam::DVec3) -> bevy::math::DVec3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; "#, r#" @@ -14879,280 +14892,62 @@ struct DVec2 { "#, r#" -/// Casts all elements of `self` to `f32`. - - #[lua(kind = "Method", output(proxy))] - fn as_vec3a(&self) -> bevy::math::Vec3A; - -"#, - r#" -/// Casts all elements of `self` to `i32`. - - #[lua(kind = "Method", output(proxy))] - fn as_ivec3(&self) -> bevy::math::IVec3; - -"#, - r#" -/// Casts all elements of `self` to `u32`. - - #[lua(kind = "Method", output(proxy))] - fn as_uvec3(&self) -> bevy::math::UVec3; - -"#, - r#" -/// Casts all elements of `self` to `i64`. - - #[lua(kind = "Method", output(proxy))] - fn as_i64vec3(&self) -> bevy::math::I64Vec3; - -"#, - r#" -/// Casts all elements of `self` to `u64`. - - #[lua(kind = "Method", output(proxy))] - fn as_u64vec3(&self) -> bevy::math::U64Vec3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, #[proxy] rhs: &glam::DVec3) -> bevy::math::DVec3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, #[proxy] rhs: &glam::DVec3) -> bevy::math::DVec3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, #[proxy] rhs: &glam::DVec3) -> bevy::math::DVec3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, rhs: f64) -> bevy::math::DVec3; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#, - r#" -#[lua(kind="MetaMethod", raw , metamethod="Index")] -fn index(&self, lua: &Lua, idx: crate::lua::util::LuaIndex) -> Result { - Ok(self.inner()?[*idx]) -} -"#, - r#" -#[lua(kind="MutatingMetaMethod", raw, metamethod="NewIndex")] -fn index(&mut self, lua: &Lua, idx: crate::lua::util::LuaIndex, val: f64) -> Result<(),_> { - self.val_mut(|s| Ok(s[*idx] = val))? -} -"#] -)] -struct DVec3 { - x: f64, - y: f64, - z: f64, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::math::DVec4", - functions[r#" - - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::DVec4; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, #[proxy] rhs: &glam::DVec4) -> bevy::math::DVec4; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, rhs: f64) -> bevy::math::DVec4; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: &glam::DVec4) -> bevy::math::DVec4; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::DVec4; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::DVec4; - -"#, - r#" +/// Casts all elements of `self` to `f32`. - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, rhs: f64) -> bevy::math::DVec4; + #[lua(kind = "Method", output(proxy))] + fn as_vec3a(&self) -> bevy::math::Vec3A; "#, r#" +/// Casts all elements of `self` to `i32`. - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, rhs: f64) -> bevy::math::DVec4; + #[lua(kind = "Method", output(proxy))] + fn as_ivec3(&self) -> bevy::math::IVec3; "#, r#" +/// Casts all elements of `self` to `u32`. - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, #[proxy] rhs: &glam::DVec4) -> bevy::math::DVec4; + #[lua(kind = "Method", output(proxy))] + fn as_uvec3(&self) -> bevy::math::UVec3; "#, r#" +/// Casts all elements of `self` to `i64`. - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, #[proxy] rhs: &glam::DVec4) -> bevy::math::DVec4; + #[lua(kind = "Method", output(proxy))] + fn as_i64vec3(&self) -> bevy::math::I64Vec3; "#, r#" +/// Casts all elements of `self` to `u64`. - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, #[proxy] rhs: &glam::DVec4) -> bevy::math::DVec4; + #[lua(kind = "Method", output(proxy))] + fn as_u64vec3(&self) -> bevy::math::U64Vec3; "#, r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "add", + metamethod = "Add", )] - fn div(self, rhs: f64) -> bevy::math::DVec4; + fn add(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; "#, r#" #[lua( - as_trait = "std::ops::Neg", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "neg", - metamethod = "Unm", + composite = "mul", + metamethod = "Mul", )] - fn neg(self) -> bevy::math::DVec4; + fn mul(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; "#, r#" @@ -15163,22 +14958,50 @@ struct DVec3 { composite = "eq", metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &glam::DVec4) -> bool; + fn eq(&self, #[proxy] other: &glam::DVec3) -> bool; "#, r#" #[lua( - as_trait = "std::ops::Rem", + as_trait = "std::ops::Neg", kind = "MetaFunction", output(proxy), - composite = "rem", - metamethod = "Mod", + composite = "neg", + metamethod = "Unm", )] - fn rem(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::DVec4; + fn neg(self) -> bevy::math::DVec3; "#, r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#, + r#" +#[lua(kind="MetaMethod", raw , metamethod="Index")] +fn index(&self, lua: &Lua, idx: crate::lua::util::LuaIndex) -> Result { + Ok(self.inner()?[*idx]) +} +"#, + r#" +#[lua(kind="MutatingMetaMethod", raw, metamethod="NewIndex")] +fn index(&mut self, lua: &Lua, idx: crate::lua::util::LuaIndex, val: f64) -> Result<(),_> { + self.val_mut(|s| Ok(s[*idx] = val))? +} +"#] +)] +struct DVec3 { + x: f64, + y: f64, + z: f64, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::math::DVec4", + functions[r#" /// Creates a new vector. #[lua(kind = "Function", output(proxy))] @@ -15823,6 +15646,161 @@ struct DVec3 { #[lua(kind = "Method", output(proxy))] fn as_u64vec4(&self) -> bevy::math::U64Vec4; +"#, + r#" + + #[lua( + as_trait = "std::ops::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(self, #[proxy] rhs: &glam::DVec4) -> bevy::math::DVec4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, rhs: f64) -> bevy::math::DVec4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Neg", + kind = "MetaFunction", + output(proxy), + composite = "neg", + metamethod = "Unm", + )] + fn neg(self) -> bevy::math::DVec4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, #[proxy] rhs: &glam::DVec4) -> bevy::math::DVec4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::DVec4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: &glam::DVec4) -> bevy::math::DVec4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(self, rhs: f64) -> bevy::math::DVec4; + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &glam::DVec4) -> bool; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::DVec4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::DVec4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, rhs: f64) -> bevy::math::DVec4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, #[proxy] rhs: &glam::DVec4) -> bevy::math::DVec4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, rhs: f64) -> bevy::math::DVec4; + "#, r#" @@ -15833,7 +15811,7 @@ struct DVec3 { composite = "div", metamethod = "Div", )] - fn div(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::DVec4; + fn div(self, #[proxy] rhs: &glam::DVec4) -> bevy::math::DVec4; "#, r#" @@ -15845,19 +15823,41 @@ struct DVec3 { composite = "sub", metamethod = "Sub", )] - fn sub(self, rhs: f64) -> bevy::math::DVec4; + fn sub(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::DVec4; "#, r#" #[lua( - as_trait = "std::ops::Add", + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", + output(proxy), + )] + fn clone(&self) -> bevy::math::DVec4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Rem", kind = "MetaFunction", output(proxy), - composite = "add", - metamethod = "Add", + composite = "rem", + metamethod = "Mod", )] - fn add(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::DVec4; + fn rem(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::DVec4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, rhs: f64) -> bevy::math::DVec4; "#, r#" @@ -15892,13 +15892,25 @@ struct DVec4 { functions[r#" #[lua( - as_trait = "std::ops::Neg", + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "neg", - metamethod = "Unm", + composite = "add", + metamethod = "Add", )] - fn neg(self) -> bevy::math::Mat2; + fn add(self, #[proxy] rhs: bevy::math::Mat2) -> bevy::math::Mat2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: bevy::math::Mat2) -> bevy::math::Mat2; "#, r#" @@ -16127,47 +16139,37 @@ struct DVec4 { r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Neg", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "neg", + metamethod = "Unm", )] - fn mul(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; + fn neg(self) -> bevy::math::Mat2; "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Div", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: bevy::math::Mat2) -> bevy::math::Mat2; - -"#, - r#" - - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), + composite = "div", + metamethod = "Div", )] - fn clone(&self) -> bevy::math::Mat2; + fn div(self, rhs: f32) -> bevy::math::Mat2; "#, r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "mul", + metamethod = "Mul", )] - fn div(self, rhs: f32) -> bevy::math::Mat2; + fn mul(self, rhs: f32) -> bevy::math::Mat2; "#, r#" @@ -16184,37 +16186,35 @@ struct DVec4 { r#" #[lua( - as_trait = "std::ops::Sub", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "sub", - metamethod = "Sub", + composite = "mul", + metamethod = "Mul", )] - fn sub(self, #[proxy] rhs: bevy::math::Mat2) -> bevy::math::Mat2; + fn mul(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Sub", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "sub", + metamethod = "Sub", )] - fn mul(self, rhs: f32) -> bevy::math::Mat2; + fn sub(self, #[proxy] rhs: bevy::math::Mat2) -> bevy::math::Mat2; "#, r#" #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", output(proxy), - composite = "add", - metamethod = "Add", )] - fn add(self, #[proxy] rhs: bevy::math::Mat2) -> bevy::math::Mat2; + fn clone(&self) -> bevy::math::Mat2; "#, r#" @@ -16256,13 +16256,25 @@ struct Mat2(); functions[r#" #[lua( - as_trait = "std::ops::Add", + as_trait = "std::ops::Sub", kind = "MetaFunction", output(proxy), - composite = "add", - metamethod = "Add", + composite = "sub", + metamethod = "Sub", )] - fn add(self, #[proxy] rhs: bevy::math::Mat3) -> bevy::math::Mat3; + fn sub(self, #[proxy] rhs: bevy::math::Mat3) -> bevy::math::Mat3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: bevy::math::Mat3) -> bevy::math::Mat3; "#, r#" @@ -16280,13 +16292,24 @@ struct Mat2(); r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] rhs: &glam::Mat3) -> bool; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "add", + metamethod = "Add", )] - fn mul(self, #[proxy] rhs: bevy::math::Mat3) -> bevy::math::Mat3; + fn add(self, #[proxy] rhs: bevy::math::Mat3) -> bevy::math::Mat3; "#, r#" @@ -16643,17 +16666,7 @@ struct Mat2(); composite = "mul", metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; - -"#, - r#" - - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::Mat3; + fn mul(self, #[proxy] rhs: bevy::math::Affine2) -> bevy::math::Mat3; "#, r#" @@ -16665,30 +16678,17 @@ struct Mat2(); composite = "mul", metamethod = "Mul", )] - fn mul(self, rhs: f32) -> bevy::math::Mat3; + fn mul(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; "#, r#" #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, #[proxy] rhs: bevy::math::Mat3) -> bevy::math::Mat3; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] rhs: &glam::Mat3) -> bool; + fn clone(&self) -> bevy::math::Mat3; "#, r#" @@ -16700,7 +16700,7 @@ struct Mat2(); composite = "mul", metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: bevy::math::Affine2) -> bevy::math::Mat3; + fn mul(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; "#, r#" @@ -16712,7 +16712,7 @@ struct Mat2(); composite = "mul", metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; + fn mul(self, rhs: f32) -> bevy::math::Mat3; "#, r#" @@ -16759,6 +16759,77 @@ struct Mat3 { derive(clone), remote = "bevy::math::Mat3A", functions[r#" + + #[lua( + as_trait = "std::ops::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(self, #[proxy] rhs: bevy::math::Mat3A) -> bevy::math::Mat3A; + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] rhs: &glam::Mat3A) -> bool; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: bevy::math::Mat3A) -> bevy::math::Mat3A; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, #[proxy] rhs: bevy::math::Mat3A) -> bevy::math::Mat3A; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Neg", + kind = "MetaFunction", + output(proxy), + composite = "neg", + metamethod = "Unm", + )] + fn neg(self) -> bevy::math::Mat3A; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; + +"#, + r#" /// Creates a 3x3 matrix from three column vectors. #[lua(kind = "Function", output(proxy))] @@ -17094,48 +17165,25 @@ struct Mat3 { r#" #[lua( - as_trait = "std::ops::Neg", - kind = "MetaFunction", - output(proxy), - composite = "neg", - metamethod = "Unm", - )] - fn neg(self) -> bevy::math::Mat3A; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add", + as_trait = "std::ops::Div", kind = "MetaFunction", output(proxy), - composite = "add", - metamethod = "Add", + composite = "div", + metamethod = "Div", )] - fn add(self, #[proxy] rhs: bevy::math::Mat3A) -> bevy::math::Mat3A; + fn div(self, rhs: f32) -> bevy::math::Mat3A; "#, r#" #[lua( - as_trait = "std::ops::Sub", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, #[proxy] rhs: bevy::math::Mat3A) -> bevy::math::Mat3A; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", + composite = "mul", + metamethod = "Mul", )] - fn eq(&self, #[proxy] rhs: &glam::Mat3A) -> bool; + fn mul(self, #[proxy] rhs: bevy::math::Affine2) -> bevy::math::Mat3A; "#, r#" @@ -17147,18 +17195,6 @@ struct Mat3 { )] fn clone(&self) -> bevy::math::Mat3A; -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: bevy::math::Mat3A) -> bevy::math::Mat3A; - "#, r#" @@ -17171,30 +17207,6 @@ struct Mat3 { )] fn mul(self, rhs: f32) -> bevy::math::Mat3A; -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: bevy::math::Affine2) -> bevy::math::Mat3A; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, rhs: f32) -> bevy::math::Mat3A; - "#, r#" @@ -17207,18 +17219,6 @@ struct Mat3 { )] fn mul(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -17265,6 +17265,17 @@ struct Mat3A { remote = "bevy::math::Mat4", functions[r#" + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] rhs: &glam::Mat4) -> bool; + +"#, + r#" + #[lua( as_trait = "std::ops::Div", kind = "MetaFunction", @@ -17913,19 +17924,17 @@ struct Mat3A { composite = "mul", metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::Vec4; + fn mul(self, rhs: f32) -> bevy::math::Mat4; "#, r#" #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", output(proxy), - composite = "mul", - metamethod = "Mul", )] - fn mul(self, rhs: f32) -> bevy::math::Mat4; + fn clone(&self) -> bevy::math::Mat4; "#, r#" @@ -17949,40 +17958,31 @@ struct Mat3A { composite = "mul", metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: bevy::math::Affine3A) -> bevy::math::Mat4; + fn mul(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::Vec4; "#, r#" #[lua( - as_trait = "std::ops::Sub", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "sub", - metamethod = "Sub", + composite = "mul", + metamethod = "Mul", )] - fn sub(self, #[proxy] rhs: bevy::math::Mat4) -> bevy::math::Mat4; + fn mul(self, #[proxy] rhs: bevy::math::Affine3A) -> bevy::math::Mat4; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", + as_trait = "std::ops::Sub", kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] rhs: &glam::Mat4) -> bool; - -"#, - r#" - - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", output(proxy), + composite = "sub", + metamethod = "Sub", )] - fn clone(&self) -> bevy::math::Mat4; + fn sub(self, #[proxy] rhs: bevy::math::Mat4) -> bevy::math::Mat4; "#, r#" @@ -18031,75 +18031,6 @@ struct Mat4 { derive(clone), remote = "bevy::math::DMat2", functions[r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, rhs: f64) -> bevy::math::DMat2; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Neg", - kind = "MetaFunction", - output(proxy), - composite = "neg", - metamethod = "Unm", - )] - fn neg(self) -> bevy::math::DMat2; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, #[proxy] rhs: bevy::math::DMat2) -> bevy::math::DMat2; - -"#, - r#" - - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::DMat2; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] rhs: &glam::DMat2) -> bool; - -"#, - r#" /// Creates a 2x2 matrix from two column vectors. #[lua(kind = "Function", output(proxy))] @@ -18275,29 +18206,86 @@ struct Mat4 { "#, r#" -/// Returns true if the absolute difference of all elements between `self` and `rhs` -/// is less than or equal to `max_abs_diff`. -/// This can be used to compare if two matrices contain similar elements. It works best -/// when comparing with a known value. The `max_abs_diff` that should be used used -/// depends on the values being compared against. -/// For more see -/// [comparing floating point numbers](https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/). +/// Returns true if the absolute difference of all elements between `self` and `rhs` +/// is less than or equal to `max_abs_diff`. +/// This can be used to compare if two matrices contain similar elements. It works best +/// when comparing with a known value. The `max_abs_diff` that should be used used +/// depends on the values being compared against. +/// For more see +/// [comparing floating point numbers](https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/). + + #[lua(kind = "Method")] + fn abs_diff_eq(&self, #[proxy] rhs: bevy::math::DMat2, max_abs_diff: f64) -> bool; + +"#, + r#" +/// Takes the absolute value of each element in `self` + + #[lua(kind = "Method", output(proxy))] + fn abs(&self) -> bevy::math::DMat2; + +"#, + r#" + + #[lua(kind = "Method", output(proxy))] + fn as_mat2(&self) -> bevy::math::Mat2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, rhs: f64) -> bevy::math::DMat2; + +"#, + r#" + + #[lua( + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", + output(proxy), + )] + fn clone(&self) -> bevy::math::DMat2; + +"#, + r#" - #[lua(kind = "Method")] - fn abs_diff_eq(&self, #[proxy] rhs: bevy::math::DMat2, max_abs_diff: f64) -> bool; + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: bevy::math::DMat2) -> bevy::math::DMat2; "#, r#" -/// Takes the absolute value of each element in `self` - #[lua(kind = "Method", output(proxy))] - fn abs(&self) -> bevy::math::DMat2; + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, rhs: f64) -> bevy::math::DMat2; "#, r#" - #[lua(kind = "Method", output(proxy))] - fn as_mat2(&self) -> bevy::math::Mat2; + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] rhs: &glam::DMat2) -> bool; "#, r#" @@ -18311,6 +18299,18 @@ struct Mat4 { )] fn sub(self, #[proxy] rhs: bevy::math::DMat2) -> bevy::math::DMat2; +"#, + r#" + + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, #[proxy] rhs: bevy::math::DMat2) -> bevy::math::DMat2; + "#, r#" @@ -18321,19 +18321,19 @@ struct Mat4 { composite = "mul", metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: bevy::math::DMat2) -> bevy::math::DMat2; + fn mul(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; "#, r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Neg", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "neg", + metamethod = "Unm", )] - fn div(self, rhs: f64) -> bevy::math::DMat2; + fn neg(self) -> bevy::math::DMat2; "#, r#" @@ -18380,37 +18380,37 @@ struct DMat2 { functions[r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "add", + metamethod = "Add", )] - fn mul(self, #[proxy] rhs: bevy::math::DAffine2) -> bevy::math::DMat3; + fn add(self, #[proxy] rhs: bevy::math::DMat3) -> bevy::math::DMat3; "#, r#" #[lua( - as_trait = "std::ops::Sub", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "sub", - metamethod = "Sub", + composite = "mul", + metamethod = "Mul", )] - fn sub(self, #[proxy] rhs: bevy::math::DMat3) -> bevy::math::DMat3; + fn mul(self, rhs: f64) -> bevy::math::DMat3; "#, r#" #[lua( - as_trait = "std::ops::Add", + as_trait = "std::ops::Sub", kind = "MetaFunction", output(proxy), - composite = "add", - metamethod = "Add", + composite = "sub", + metamethod = "Sub", )] - fn add(self, #[proxy] rhs: bevy::math::DMat3) -> bevy::math::DMat3; + fn sub(self, #[proxy] rhs: bevy::math::DMat3) -> bevy::math::DMat3; "#, r#" @@ -18426,12 +18426,13 @@ struct DMat2 { r#" #[lua( - as_trait = "std::cmp::PartialEq", + as_trait = "std::ops::Mul", kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", + output(proxy), + composite = "mul", + metamethod = "Mul", )] - fn eq(&self, #[proxy] rhs: &glam::DMat3) -> bool; + fn mul(self, #[proxy] rhs: bevy::math::DMat3) -> bevy::math::DMat3; "#, r#" @@ -18443,7 +18444,19 @@ struct DMat2 { composite = "mul", metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; + fn mul(self, #[proxy] rhs: bevy::math::DAffine2) -> bevy::math::DMat3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, rhs: f64) -> bevy::math::DMat3; "#, r#" @@ -18461,13 +18474,24 @@ struct DMat2 { r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Mul", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "mul", + metamethod = "Mul", )] - fn div(self, rhs: f64) -> bevy::math::DMat3; + fn mul(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] rhs: &glam::DMat3) -> bool; "#, r#" @@ -18799,30 +18823,6 @@ struct DMat2 { #[lua(kind = "Method", output(proxy))] fn as_mat3(&self) -> bevy::math::Mat3; -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: bevy::math::DMat3) -> bevy::math::DMat3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, rhs: f64) -> bevy::math::DMat3; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -18869,6 +18869,42 @@ struct DMat3 { remote = "bevy::math::DMat4", functions[r#" + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: bevy::math::DMat4) -> bevy::math::DMat4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, rhs: f64) -> bevy::math::DMat4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: bevy::math::DAffine3) -> bevy::math::DMat4; + +"#, + r#" + #[lua( as_trait = "std::ops::Sub", kind = "MetaFunction", @@ -18878,6 +18914,29 @@ struct DMat3 { )] fn sub(self, #[proxy] rhs: bevy::math::DMat4) -> bevy::math::DMat4; +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] rhs: &glam::DMat4) -> bool; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, rhs: f64) -> bevy::math::DMat4; + "#, r#" /// Creates a 4x4 matrix from four column vectors. @@ -19435,114 +19494,55 @@ struct DMat3 { /// For more see /// [comparing floating point numbers](https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/). - #[lua(kind = "Method")] - fn abs_diff_eq(&self, #[proxy] rhs: bevy::math::DMat4, max_abs_diff: f64) -> bool; - -"#, - r#" -/// Takes the absolute value of each element in `self` - - #[lua(kind = "Method", output(proxy))] - fn abs(&self) -> bevy::math::DMat4; - -"#, - r#" - - #[lua(kind = "Method", output(proxy))] - fn as_mat4(&self) -> bevy::math::Mat4; - -"#, - r#" - - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::DMat4; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Neg", - kind = "MetaFunction", - output(proxy), - composite = "neg", - metamethod = "Unm", - )] - fn neg(self) -> bevy::math::DMat4; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, #[proxy] rhs: bevy::math::DMat4) -> bevy::math::DMat4; + #[lua(kind = "Method")] + fn abs_diff_eq(&self, #[proxy] rhs: bevy::math::DMat4, max_abs_diff: f64) -> bool; "#, r#" +/// Takes the absolute value of each element in `self` - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: bevy::math::DAffine3) -> bevy::math::DMat4; + #[lua(kind = "Method", output(proxy))] + fn abs(&self) -> bevy::math::DMat4; "#, r#" - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: bevy::math::DMat4) -> bevy::math::DMat4; + #[lua(kind = "Method", output(proxy))] + fn as_mat4(&self) -> bevy::math::Mat4; "#, r#" #[lua( - as_trait = "std::ops::Div", + as_trait = "std::ops::Neg", kind = "MetaFunction", output(proxy), - composite = "div", - metamethod = "Div", + composite = "neg", + metamethod = "Unm", )] - fn div(self, rhs: f64) -> bevy::math::DMat4; + fn neg(self) -> bevy::math::DMat4; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", + output(proxy), )] - fn eq(&self, #[proxy] rhs: &glam::DMat4) -> bool; + fn clone(&self) -> bevy::math::DMat4; "#, r#" #[lua( - as_trait = "std::ops::Mul", + as_trait = "std::ops::Add", kind = "MetaFunction", output(proxy), - composite = "mul", - metamethod = "Mul", + composite = "add", + metamethod = "Add", )] - fn mul(self, rhs: f64) -> bevy::math::DMat4; + fn add(self, #[proxy] rhs: bevy::math::DMat4) -> bevy::math::DMat4; "#, r#" @@ -19603,6 +19603,63 @@ struct DMat4 { derive(clone), remote = "bevy::math::Affine2", functions[r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: bevy::math::Affine2) -> bevy::math::Affine2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: bevy::math::Mat3) -> bevy::math::Mat3; + +"#, + r#" + + #[lua( + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", + output(proxy), + )] + fn clone(&self) -> bevy::math::Affine2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: bevy::math::Mat3A) -> bevy::math::Mat3A; + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] rhs: &glam::Affine2) -> bool; + +"#, + r#" /// Creates an affine transform from three column vectors. #[lua(kind = "Function", output(proxy))] @@ -19771,63 +19828,6 @@ struct DMat4 { #[lua(kind = "Method", output(proxy))] fn inverse(&self) -> bevy::math::Affine2; -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: bevy::math::Affine2) -> bevy::math::Affine2; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] rhs: &glam::Affine2) -> bool; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: bevy::math::Mat3) -> bevy::math::Mat3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: bevy::math::Mat3A) -> bevy::math::Mat3A; - -"#, - r#" - - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::Affine2; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -19848,6 +19848,17 @@ struct Affine2 { remote = "bevy::math::Affine3A", functions[r#" + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] rhs: &glam::Affine3A) -> bool; + +"#, + r#" + #[lua( as_trait = "std::ops::Mul", kind = "MetaFunction", @@ -19867,18 +19878,6 @@ struct Affine2 { )] fn clone(&self) -> bevy::math::Affine3A; -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: bevy::math::Mat4) -> bevy::math::Mat4; - "#, r#" /// Creates an affine transform from three column vectors. @@ -20170,12 +20169,13 @@ struct Affine2 { r#" #[lua( - as_trait = "std::cmp::PartialEq", + as_trait = "std::ops::Mul", kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", + output(proxy), + composite = "mul", + metamethod = "Mul", )] - fn eq(&self, #[proxy] rhs: &glam::Affine3A) -> bool; + fn mul(self, #[proxy] rhs: bevy::math::Mat4) -> bevy::math::Mat4; "#, r#" @@ -20206,39 +20206,6 @@ struct Affine3A { )] fn mul(self, #[proxy] rhs: bevy::math::DMat3) -> bevy::math::DMat3; -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: bevy::math::DAffine2) -> bevy::math::DAffine2; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] rhs: &glam::DAffine2) -> bool; - -"#, - r#" - - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::DAffine2; - "#, r#" /// Creates an affine transform from three column vectors. @@ -20391,16 +20358,49 @@ struct Affine3A { /// For more see /// [comparing floating point numbers](https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/). - #[lua(kind = "Method")] - fn abs_diff_eq(&self, #[proxy] rhs: bevy::math::DAffine2, max_abs_diff: f64) -> bool; + #[lua(kind = "Method")] + fn abs_diff_eq(&self, #[proxy] rhs: bevy::math::DAffine2, max_abs_diff: f64) -> bool; + +"#, + r#" +/// Return the inverse of this transform. +/// Note that if the transform is not invertible the result will be invalid. + + #[lua(kind = "Method", output(proxy))] + fn inverse(&self) -> bevy::math::DAffine2; + +"#, + r#" + + #[lua( + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", + output(proxy), + )] + fn clone(&self) -> bevy::math::DAffine2; + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] rhs: &glam::DAffine2) -> bool; "#, r#" -/// Return the inverse of this transform. -/// Note that if the transform is not invertible the result will be invalid. - #[lua(kind = "Method", output(proxy))] - fn inverse(&self) -> bevy::math::DAffine2; + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: bevy::math::DAffine2) -> bevy::math::DAffine2; "#, r#" @@ -20421,6 +20421,51 @@ struct DAffine2 { derive(clone), remote = "bevy::math::DAffine3", functions[r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] rhs: &glam::DAffine3) -> bool; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: bevy::math::DAffine3) -> bevy::math::DAffine3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: bevy::math::DMat4) -> bevy::math::DMat4; + +"#, + r#" + + #[lua( + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", + output(proxy), + )] + fn clone(&self) -> bevy::math::DAffine3; + +"#, + r#" /// Creates an affine transform from three column vectors. #[lua(kind = "Function", output(proxy))] @@ -20690,51 +20735,6 @@ struct DAffine2 { #[lua(kind = "Method", output(proxy))] fn inverse(&self) -> bevy::math::DAffine3; -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] rhs: &glam::DAffine3) -> bool; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: bevy::math::DAffine3) -> bevy::math::DAffine3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: bevy::math::DMat4) -> bevy::math::DMat4; - -"#, - r#" - - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::DAffine3; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -20754,46 +20754,6 @@ struct DAffine3 { derive(clone), remote = "bevy::math::DQuat", functions[r#" -/// Subtracts the `rhs` quaternion from `self`. -/// The difference is not guaranteed to be normalized. - - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, #[proxy] rhs: bevy::math::DQuat) -> bevy::math::DQuat; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Neg", - kind = "MetaFunction", - output(proxy), - composite = "neg", - metamethod = "Unm", - )] - fn neg(self) -> bevy::math::DQuat; - -"#, - r#" -/// Multiplies a quaternion by a scalar value. -/// The product is not guaranteed to be normalized. - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, rhs: f64) -> bevy::math::DQuat; - -"#, - r#" /// Adds two quaternions. /// The sum is not guaranteed to be normalized. /// Note that addition is not the same as combining the rotations represented by the @@ -20810,9 +20770,8 @@ struct DAffine3 { "#, r#" -/// Multiplies a quaternion and a 3D vector, returning the rotated vector. -/// # Panics -/// Will panic if `self` is not normalized when `glam_assert` is enabled. +/// Multiplies a quaternion by a scalar value. +/// The product is not guaranteed to be normalized. #[lua( as_trait = "std::ops::Mul", @@ -20821,31 +20780,7 @@ struct DAffine3 { composite = "mul", metamethod = "Mul", )] - fn mul(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; - -"#, - r#" - - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::DQuat; - -"#, - r#" -/// Divides a quaternion by a scalar value. -/// The quotient is not guaranteed to be normalized. - - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, rhs: f64) -> bevy::math::DQuat; + fn mul(self, rhs: f64) -> bevy::math::DQuat; "#, r#" @@ -20865,17 +20800,6 @@ struct DAffine3 { )] fn mul(self, #[proxy] rhs: bevy::math::DQuat) -> bevy::math::DQuat; -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] rhs: &glam::DQuat) -> bool; - "#, r#" /// Creates a new rotation quaternion. @@ -21232,41 +21156,117 @@ struct DAffine3 { "#, r#" -/// Multiplies a quaternion and a 3D vector, returning the rotated vector. -/// # Panics -/// Will panic if `self` is not normalized when `glam_assert` is enabled. +/// Multiplies a quaternion and a 3D vector, returning the rotated vector. +/// # Panics +/// Will panic if `self` is not normalized when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn mul_vec3(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; + +"#, + r#" +/// Multiplies two quaternions. If they each represent a rotation, the result will +/// represent the combined rotation. +/// Note that due to floating point rounding the result may not be perfectly normalized. +/// # Panics +/// Will panic if `self` or `rhs` are not normalized when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn mul_quat(self, #[proxy] rhs: bevy::math::DQuat) -> bevy::math::DQuat; + +"#, + r#" +/// Creates a quaternion from a 3x3 rotation matrix inside a 3D affine transform. +/// Note if the input affine matrix contain scales, shears, or other non-rotation +/// transformations then the resulting quaternion will be ill-defined. +/// # Panics +/// Will panic if any input affine matrix column is not normalized when `glam_assert` is +/// enabled. + + #[lua(kind = "Function", output(proxy))] + fn from_affine3(#[proxy] a: &glam::DAffine3) -> bevy::math::DQuat; + +"#, + r#" + + #[lua(kind = "Method", output(proxy))] + fn as_quat(self) -> bevy::math::Quat; + +"#, + r#" + + #[lua( + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", + output(proxy), + )] + fn clone(&self) -> bevy::math::DQuat; + +"#, + r#" +/// Multiplies a quaternion and a 3D vector, returning the rotated vector. +/// # Panics +/// Will panic if `self` is not normalized when `glam_assert` is enabled. + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; + +"#, + r#" - #[lua(kind = "Method", output(proxy))] - fn mul_vec3(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; + #[lua( + as_trait = "std::ops::Neg", + kind = "MetaFunction", + output(proxy), + composite = "neg", + metamethod = "Unm", + )] + fn neg(self) -> bevy::math::DQuat; "#, r#" -/// Multiplies two quaternions. If they each represent a rotation, the result will -/// represent the combined rotation. -/// Note that due to floating point rounding the result may not be perfectly normalized. -/// # Panics -/// Will panic if `self` or `rhs` are not normalized when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] - fn mul_quat(self, #[proxy] rhs: bevy::math::DQuat) -> bevy::math::DQuat; + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] rhs: &glam::DQuat) -> bool; "#, r#" -/// Creates a quaternion from a 3x3 rotation matrix inside a 3D affine transform. -/// Note if the input affine matrix contain scales, shears, or other non-rotation -/// transformations then the resulting quaternion will be ill-defined. -/// # Panics -/// Will panic if any input affine matrix column is not normalized when `glam_assert` is -/// enabled. +/// Subtracts the `rhs` quaternion from `self`. +/// The difference is not guaranteed to be normalized. - #[lua(kind = "Function", output(proxy))] - fn from_affine3(#[proxy] a: &glam::DAffine3) -> bevy::math::DQuat; + #[lua( + as_trait = "std::ops::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(self, #[proxy] rhs: bevy::math::DQuat) -> bevy::math::DQuat; "#, r#" +/// Divides a quaternion by a scalar value. +/// The quotient is not guaranteed to be normalized. - #[lua(kind = "Method", output(proxy))] - fn as_quat(self) -> bevy::math::Quat; + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, rhs: f64) -> bevy::math::DQuat; "#, r#" @@ -21295,12 +21295,6 @@ struct DQuat { )] fn clone(&self) -> bevy::math::EulerRot; -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - "#, r#" @@ -21312,6 +21306,12 @@ struct DQuat { )] fn eq(&self, #[proxy] other: &glam::EulerRot) -> bool; +"#, + r#" + + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -21388,22 +21388,22 @@ struct EulerRot {} r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", + output(proxy), )] - fn eq(&self, #[proxy] rhs: &glam::BVec3A) -> bool; + fn clone(&self) -> bevy::math::BVec3A; "#, r#" #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", )] - fn clone(&self) -> bevy::math::BVec3A; + fn eq(&self, #[proxy] rhs: &glam::BVec3A) -> bool; "#, r#" @@ -21421,11 +21421,12 @@ struct BVec3A(); functions[r#" #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", )] - fn clone(&self) -> bevy::math::BVec4A; + fn eq(&self, #[proxy] rhs: &glam::BVec4A) -> bool; "#, r#" @@ -21491,12 +21492,11 @@ struct BVec3A(); r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", + output(proxy), )] - fn eq(&self, #[proxy] rhs: &glam::BVec4A) -> bool; + fn clone(&self) -> bevy::math::BVec4A; "#, r#" @@ -21513,17 +21513,6 @@ struct BVec4A(); remote = "smol_str::SmolStr", functions[r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &smol_str::SmolStr) -> bool; - -"#, - r#" - #[lua( as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", kind = "Method", @@ -21552,26 +21541,191 @@ struct BVec4A(); "#, r#" - #[lua(kind = "Method")] - fn is_heap_allocated(&self) -> bool; + #[lua(kind = "Method")] + fn is_heap_allocated(&self) -> bool; + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &smol_str::SmolStr) -> bool; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct SmolStr(); +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "uuid::Uuid", + functions[r#" + + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); + +"#, + r#" +/// The 'nil UUID' (all zeros). +/// The nil UUID is a special form of UUID that is specified to have all +/// 128 bits set to zero. +/// # References +/// * [Nil UUID in RFC 9562](https://www.ietf.org/rfc/rfc9562.html#section-5.9) +/// # Examples +/// Basic usage: +/// ``` +/// # use uuid::Uuid; +/// let uuid = Uuid::nil(); +/// assert_eq!( +/// "00000000-0000-0000-0000-000000000000", +/// uuid.hyphenated().to_string(), +/// ); +/// ``` + + #[lua(kind = "Function", output(proxy))] + fn nil() -> uuid::Uuid; + +"#, + r#" +/// The 'max UUID' (all ones). +/// The max UUID is a special form of UUID that is specified to have all +/// 128 bits set to one. +/// # References +/// * [Max UUID in RFC 9562](https://www.ietf.org/rfc/rfc9562.html#section-5.10) +/// # Examples +/// Basic usage: +/// ``` +/// # use uuid::Uuid; +/// let uuid = Uuid::max(); +/// assert_eq!( +/// "ffffffff-ffff-ffff-ffff-ffffffffffff", +/// uuid.hyphenated().to_string(), +/// ); +/// ``` + + #[lua(kind = "Function", output(proxy))] + fn max() -> uuid::Uuid; + +"#, + r#" +/// Creates a UUID from a 128bit value. +/// # Examples +/// Basic usage: +/// ``` +/// # use uuid::Uuid; +/// let v = 0xa1a2a3a4b1b2c1c2d1d2d3d4d5d6d7d8u128; +/// let uuid = Uuid::from_u128(v); +/// assert_eq!( +/// "a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8", +/// uuid.hyphenated().to_string(), +/// ); +/// ``` + + #[lua(kind = "Function", output(proxy))] + fn from_u128(v: u128) -> uuid::Uuid; + +"#, + r#" +/// Creates a UUID from a 128bit value in little-endian order. +/// The entire value will be flipped to convert into big-endian order. +/// This is based on the endianness of the UUID, rather than the target +/// environment so bytes will be flipped on both big and little endian +/// machines. +/// # Examples +/// Basic usage: +/// ``` +/// # use uuid::Uuid; +/// let v = 0xa1a2a3a4b1b2c1c2d1d2d3d4d5d6d7d8u128; +/// let uuid = Uuid::from_u128_le(v); +/// assert_eq!( +/// "d8d7d6d5-d4d3-d2d1-c2c1-b2b1a4a3a2a1", +/// uuid.hyphenated().to_string(), +/// ); +/// ``` + + #[lua(kind = "Function", output(proxy))] + fn from_u128_le(v: u128) -> uuid::Uuid; + +"#, + r#" +/// Creates a UUID from two 64bit values. +/// # Examples +/// Basic usage: +/// ``` +/// # use uuid::Uuid; +/// let hi = 0xa1a2a3a4b1b2c1c2u64; +/// let lo = 0xd1d2d3d4d5d6d7d8u64; +/// let uuid = Uuid::from_u64_pair(hi, lo); +/// assert_eq!( +/// "a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8", +/// uuid.hyphenated().to_string(), +/// ); +/// ``` + + #[lua(kind = "Function", output(proxy))] + fn from_u64_pair(high_bits: u64, low_bits: u64) -> uuid::Uuid; + +"#, + r#" +/// Creates a UUID using the supplied bytes. +/// # Examples +/// Basic usage: +/// ``` +/// # fn main() -> Result<(), uuid::Error> { +/// # use uuid::Uuid; +/// let bytes = [ +/// 0xa1, 0xa2, 0xa3, 0xa4, +/// 0xb1, 0xb2, +/// 0xc1, 0xc2, +/// 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, +/// ]; +/// let uuid = Uuid::from_bytes(bytes); +/// assert_eq!( +/// uuid.hyphenated().to_string(), +/// "a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8" +/// ); +/// # Ok(()) +/// # } +/// ``` + + #[lua(kind = "Function", output(proxy))] + fn from_bytes(bytes: [u8; 16]) -> uuid::Uuid; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct SmolStr(); -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "uuid::Uuid", - functions[r#" +/// Creates a UUID using the supplied bytes in little endian order. +/// The individual fields encoded in the buffer will be flipped. +/// # Examples +/// Basic usage: +/// ``` +/// # fn main() -> Result<(), uuid::Error> { +/// # use uuid::Uuid; +/// let bytes = [ +/// 0xa1, 0xa2, 0xa3, 0xa4, +/// 0xb1, 0xb2, +/// 0xc1, 0xc2, +/// 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, +/// ]; +/// let uuid = Uuid::from_bytes_le(bytes); +/// assert_eq!( +/// "a4a3a2a1-b2b1-c2c1-d1d2-d3d4d5d6d7d8", +/// uuid.hyphenated().to_string(), +/// ); +/// # Ok(()) +/// # } +/// ``` - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(kind = "Function", output(proxy))] + fn from_bytes_le(b: [u8; 16]) -> uuid::Uuid; "#, r#" @@ -21599,6 +21753,27 @@ struct SmolStr(); #[lua(kind = "Function", output(proxy))] fn new_v4() -> uuid::Uuid; +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &uuid::Uuid) -> bool; + +"#, + r#" + + #[lua( + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", + output(proxy), + )] + fn clone(&self) -> uuid::Uuid; + "#, r#" /// Returns the version number of the UUID. @@ -21782,181 +21957,6 @@ struct SmolStr(); &self, ) -> bevy::reflect::erased_serde::__private::serde::__private::Option<[u8; 6]>; -"#, - r#" -/// The 'nil UUID' (all zeros). -/// The nil UUID is a special form of UUID that is specified to have all -/// 128 bits set to zero. -/// # References -/// * [Nil UUID in RFC 9562](https://www.ietf.org/rfc/rfc9562.html#section-5.9) -/// # Examples -/// Basic usage: -/// ``` -/// # use uuid::Uuid; -/// let uuid = Uuid::nil(); -/// assert_eq!( -/// "00000000-0000-0000-0000-000000000000", -/// uuid.hyphenated().to_string(), -/// ); -/// ``` - - #[lua(kind = "Function", output(proxy))] - fn nil() -> uuid::Uuid; - -"#, - r#" -/// The 'max UUID' (all ones). -/// The max UUID is a special form of UUID that is specified to have all -/// 128 bits set to one. -/// # References -/// * [Max UUID in RFC 9562](https://www.ietf.org/rfc/rfc9562.html#section-5.10) -/// # Examples -/// Basic usage: -/// ``` -/// # use uuid::Uuid; -/// let uuid = Uuid::max(); -/// assert_eq!( -/// "ffffffff-ffff-ffff-ffff-ffffffffffff", -/// uuid.hyphenated().to_string(), -/// ); -/// ``` - - #[lua(kind = "Function", output(proxy))] - fn max() -> uuid::Uuid; - -"#, - r#" -/// Creates a UUID from a 128bit value. -/// # Examples -/// Basic usage: -/// ``` -/// # use uuid::Uuid; -/// let v = 0xa1a2a3a4b1b2c1c2d1d2d3d4d5d6d7d8u128; -/// let uuid = Uuid::from_u128(v); -/// assert_eq!( -/// "a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8", -/// uuid.hyphenated().to_string(), -/// ); -/// ``` - - #[lua(kind = "Function", output(proxy))] - fn from_u128(v: u128) -> uuid::Uuid; - -"#, - r#" -/// Creates a UUID from a 128bit value in little-endian order. -/// The entire value will be flipped to convert into big-endian order. -/// This is based on the endianness of the UUID, rather than the target -/// environment so bytes will be flipped on both big and little endian -/// machines. -/// # Examples -/// Basic usage: -/// ``` -/// # use uuid::Uuid; -/// let v = 0xa1a2a3a4b1b2c1c2d1d2d3d4d5d6d7d8u128; -/// let uuid = Uuid::from_u128_le(v); -/// assert_eq!( -/// "d8d7d6d5-d4d3-d2d1-c2c1-b2b1a4a3a2a1", -/// uuid.hyphenated().to_string(), -/// ); -/// ``` - - #[lua(kind = "Function", output(proxy))] - fn from_u128_le(v: u128) -> uuid::Uuid; - -"#, - r#" -/// Creates a UUID from two 64bit values. -/// # Examples -/// Basic usage: -/// ``` -/// # use uuid::Uuid; -/// let hi = 0xa1a2a3a4b1b2c1c2u64; -/// let lo = 0xd1d2d3d4d5d6d7d8u64; -/// let uuid = Uuid::from_u64_pair(hi, lo); -/// assert_eq!( -/// "a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8", -/// uuid.hyphenated().to_string(), -/// ); -/// ``` - - #[lua(kind = "Function", output(proxy))] - fn from_u64_pair(high_bits: u64, low_bits: u64) -> uuid::Uuid; - -"#, - r#" -/// Creates a UUID using the supplied bytes. -/// # Examples -/// Basic usage: -/// ``` -/// # fn main() -> Result<(), uuid::Error> { -/// # use uuid::Uuid; -/// let bytes = [ -/// 0xa1, 0xa2, 0xa3, 0xa4, -/// 0xb1, 0xb2, -/// 0xc1, 0xc2, -/// 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, -/// ]; -/// let uuid = Uuid::from_bytes(bytes); -/// assert_eq!( -/// uuid.hyphenated().to_string(), -/// "a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8" -/// ); -/// # Ok(()) -/// # } -/// ``` - - #[lua(kind = "Function", output(proxy))] - fn from_bytes(bytes: [u8; 16]) -> uuid::Uuid; - -"#, - r#" -/// Creates a UUID using the supplied bytes in little endian order. -/// The individual fields encoded in the buffer will be flipped. -/// # Examples -/// Basic usage: -/// ``` -/// # fn main() -> Result<(), uuid::Error> { -/// # use uuid::Uuid; -/// let bytes = [ -/// 0xa1, 0xa2, 0xa3, 0xa4, -/// 0xb1, 0xb2, -/// 0xc1, 0xc2, -/// 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, -/// ]; -/// let uuid = Uuid::from_bytes_le(bytes); -/// assert_eq!( -/// "a4a3a2a1-b2b1-c2c1-d1d2-d3d4d5d6d7d8", -/// uuid.hyphenated().to_string(), -/// ); -/// # Ok(()) -/// # } -/// ``` - - #[lua(kind = "Function", output(proxy))] - fn from_bytes_le(b: [u8; 16]) -> uuid::Uuid; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &uuid::Uuid) -> bool; - -"#, - r#" - - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> uuid::Uuid; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] diff --git a/crates/bevy_script_api/src/providers/bevy_time.rs b/crates/bevy_script_api/src/providers/bevy_time.rs index 8910927aea..715be7fd92 100644 --- a/crates/bevy_script_api/src/providers/bevy_time.rs +++ b/crates/bevy_script_api/src/providers/bevy_time.rs @@ -50,8 +50,19 @@ struct Real {} remote = "bevy::time::prelude::Timer", functions[r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::time::prelude::Timer; + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &timer::Timer) -> bool; "#, r#" @@ -391,19 +402,8 @@ struct Real {} "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::time::prelude::Timer; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &timer::Timer) -> bool; + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); "#, r#" @@ -420,12 +420,6 @@ struct Timer {} remote = "bevy::time::prelude::TimerMode", functions[r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq", kind = "MetaFunction", @@ -434,6 +428,12 @@ struct Timer {} )] fn eq(&self, #[proxy] other: &timer::TimerMode) -> bool; +"#, + r#" + + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); + "#, r#" @@ -482,17 +482,6 @@ struct Virtual {} #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] fn clone(&self) -> bevy::time::Stopwatch; -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &stopwatch::Stopwatch) -> bool; - "#, r#" /// Create a new unpaused `Stopwatch` with no elapsed time. @@ -641,6 +630,17 @@ struct Virtual {} #[lua(kind = "MutatingMethod")] fn reset(&mut self) -> (); +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &stopwatch::Stopwatch) -> bool; + "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] diff --git a/crates/bevy_script_api/src/providers/bevy_transform.rs b/crates/bevy_script_api/src/providers/bevy_transform.rs index d6e093de4a..57bcb23f0c 100644 --- a/crates/bevy_script_api/src/providers/bevy_transform.rs +++ b/crates/bevy_script_api/src/providers/bevy_transform.rs @@ -18,12 +18,13 @@ use bevy_script_api::{ functions[r#" #[lua( - as_trait = "std::cmp::PartialEq", + as_trait = "std::ops::Mul", kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", + output(proxy), + composite = "mul", + metamethod = "Mul", )] - fn eq(&self, #[proxy] other: &components::global_transform::GlobalTransform) -> bool; + fn mul(self, #[proxy] value: bevy::math::Vec3) -> bevy::math::Vec3; "#, r#" @@ -38,9 +39,15 @@ use bevy_script_api::{ fn mul( self, #[proxy] - transform: bevy::transform::components::Transform, + global_transform: bevy::transform::components::GlobalTransform, ) -> bevy::transform::components::GlobalTransform; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::transform::components::GlobalTransform; + "#, r#" @@ -51,13 +58,22 @@ use bevy_script_api::{ composite = "mul", metamethod = "Mul", )] - fn mul(self, #[proxy] value: bevy::math::Vec3) -> bevy::math::Vec3; + fn mul( + self, + #[proxy] + transform: bevy::transform::components::Transform, + ) -> bevy::transform::components::GlobalTransform; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::transform::components::GlobalTransform; + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &components::global_transform::GlobalTransform) -> bool; "#, r#" @@ -306,22 +322,6 @@ use bevy_script_api::{ transform: bevy::transform::components::Transform, ) -> bevy::transform::components::GlobalTransform; -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul( - self, - #[proxy] - global_transform: bevy::transform::components::GlobalTransform, - ) -> bevy::transform::components::GlobalTransform; - "#, r#" #[lua(kind="MetaMethod", metamethod="ToString")] @@ -336,17 +336,6 @@ struct GlobalTransform(); derive(clone), remote = "bevy::transform::components::Transform", functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &components::transform::Transform) -> bool; - -"#, - r#" /// Creates a new [`Transform`] at the position `(x, y, z)`. In 2d, the `z` component /// is used for z-ordering elements: higher `z`-value will be in front of lower /// `z`-value. @@ -690,8 +679,13 @@ struct GlobalTransform(); "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::transform::components::Transform; + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &components::transform::Transform) -> bool; "#, r#" @@ -703,7 +697,17 @@ struct GlobalTransform(); composite = "mul", metamethod = "Mul", )] - fn mul(self, #[proxy] value: bevy::math::Vec3) -> bevy::math::Vec3; + fn mul( + self, + #[proxy] + transform: bevy::transform::components::Transform, + ) -> bevy::transform::components::Transform; + +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::transform::components::Transform; "#, r#" @@ -715,11 +719,7 @@ struct GlobalTransform(); composite = "mul", metamethod = "Mul", )] - fn mul( - self, - #[proxy] - transform: bevy::transform::components::Transform, - ) -> bevy::transform::components::Transform; + fn mul(self, #[proxy] value: bevy::math::Vec3) -> bevy::math::Vec3; "#, r#" diff --git a/crates/bevy_script_api/src/providers/bevy_window.rs b/crates/bevy_script_api/src/providers/bevy_window.rs deleted file mode 100644 index 75ee99eaa8..0000000000 --- a/crates/bevy_script_api/src/providers/bevy_window.rs +++ /dev/null @@ -1,1879 +0,0 @@ -// @generated by cargo bevy-api-gen generate, modify the templates not this file -#![allow(clippy::all)] -#![allow(unused, deprecated, dead_code)] -#![cfg_attr(rustfmt, rustfmt_skip)] -use super::bevy_a11y::*; -use super::bevy_ecs::*; -use super::bevy_reflect::*; -use super::bevy_core::*; -use super::bevy_input::*; -use super::bevy_math::*; -extern crate self as bevy_script_api; -use bevy_script_api::{ - lua::RegisterForeignLuaType, ReflectedValue, common::bevy::GetWorld, -}; -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::window::prelude::CursorEntered", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &event::CursorEntered) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::prelude::CursorEntered; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct CursorEntered { - #[lua(output(proxy))] - window: bevy::ecs::entity::Entity, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::window::prelude::CursorLeft", - functions[r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::prelude::CursorLeft; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &event::CursorLeft) -> bool; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct CursorLeft { - #[lua(output(proxy))] - window: bevy::ecs::entity::Entity, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::window::prelude::CursorMoved", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &event::CursorMoved) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::prelude::CursorMoved; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct CursorMoved { - #[lua(output(proxy))] - window: bevy::ecs::entity::Entity, - #[lua(output(proxy))] - position: bevy::math::Vec2, - delta: ReflectedValue, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::window::prelude::FileDragAndDrop", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &event::FileDragAndDrop) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::prelude::FileDragAndDrop; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct FileDragAndDrop {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::window::prelude::Ime", - functions[r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::prelude::Ime; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &event::Ime) -> bool; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct Ime {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::window::prelude::MonitorSelection", - functions[r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::prelude::MonitorSelection; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &window::MonitorSelection) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct MonitorSelection {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::window::prelude::Window", - functions[r#" -/// Setting to true will attempt to maximize the window. -/// Setting to false will attempt to un-maximize the window. - - #[lua(kind = "MutatingMethod")] - fn set_maximized(&mut self, maximized: bool) -> (); - -"#, - r#" -/// Setting to true will attempt to minimize the window. -/// Setting to false will attempt to un-minimize the window. - - #[lua(kind = "MutatingMethod")] - fn set_minimized(&mut self, minimized: bool) -> (); - -"#, - r#" -/// Calling this will attempt to start a drag-move of the window. -/// There is no guarantee that this will work unless the left mouse button was -/// pressed immediately before this function was called. - - #[lua(kind = "MutatingMethod")] - fn start_drag_move(&mut self) -> (); - -"#, - r#" -/// Calling this will attempt to start a drag-resize of the window. -/// There is no guarantee that this will work unless the left mouse button was -/// pressed immediately before this function was called. - - #[lua(kind = "MutatingMethod")] - fn start_drag_resize(&mut self, #[proxy] direction: bevy::math::CompassOctant) -> (); - -"#, - r#" -/// The window's client area width in logical pixels. -/// See [`WindowResolution`] for an explanation about logical/physical sizes. - - #[lua(kind = "Method")] - fn width(&self) -> f32; - -"#, - r#" -/// The window's client area height in logical pixels. -/// See [`WindowResolution`] for an explanation about logical/physical sizes. - - #[lua(kind = "Method")] - fn height(&self) -> f32; - -"#, - r#" -/// The window's client size in logical pixels -/// See [`WindowResolution`] for an explanation about logical/physical sizes. - - #[lua(kind = "Method", output(proxy))] - fn size(&self) -> bevy::math::Vec2; - -"#, - r#" -/// The window's client area width in physical pixels. -/// See [`WindowResolution`] for an explanation about logical/physical sizes. - - #[lua(kind = "Method")] - fn physical_width(&self) -> u32; - -"#, - r#" -/// The window's client area height in physical pixels. -/// See [`WindowResolution`] for an explanation about logical/physical sizes. - - #[lua(kind = "Method")] - fn physical_height(&self) -> u32; - -"#, - r#" -/// The window's client size in physical pixels -/// See [`WindowResolution`] for an explanation about logical/physical sizes. - - #[lua(kind = "Method", output(proxy))] - fn physical_size(&self) -> bevy::math::UVec2; - -"#, - r#" -/// The window's scale factor. -/// Ratio of physical size to logical size, see [`WindowResolution`]. - - #[lua(kind = "Method")] - fn scale_factor(&self) -> f32; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::prelude::Window; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct Window { - #[lua(output(proxy))] - cursor_options: bevy::window::CursorOptions, - #[lua(output(proxy))] - present_mode: bevy::window::PresentMode, - #[lua(output(proxy))] - mode: bevy::window::WindowMode, - #[lua(output(proxy))] - position: bevy::window::prelude::WindowPosition, - #[lua(output(proxy))] - resolution: bevy::window::WindowResolution, - title: std::string::String, - name: std::option::Option, - #[lua(output(proxy))] - composite_alpha_mode: bevy::window::CompositeAlphaMode, - #[lua(output(proxy))] - resize_constraints: bevy::window::prelude::WindowResizeConstraints, - resizable: bool, - #[lua(output(proxy))] - enabled_buttons: bevy::window::EnabledButtons, - decorations: bool, - transparent: bool, - focused: bool, - #[lua(output(proxy))] - window_level: bevy::window::WindowLevel, - canvas: std::option::Option, - fit_canvas_to_parent: bool, - prevent_default_event_handling: bool, - #[lua(output(proxy))] - internal: bevy::window::InternalWindowState, - ime_enabled: bool, - #[lua(output(proxy))] - ime_position: bevy::math::Vec2, - window_theme: ReflectedValue, - visible: bool, - skip_taskbar: bool, - desired_maximum_frame_latency: ReflectedValue, - recognize_pinch_gesture: bool, - recognize_rotation_gesture: bool, - recognize_doubletap_gesture: bool, - recognize_pan_gesture: ReflectedValue, - movable_by_window_background: bool, - fullsize_content_view: bool, - has_shadow: bool, - titlebar_shown: bool, - titlebar_transparent: bool, - titlebar_show_title: bool, - titlebar_show_buttons: bool, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::window::prelude::WindowMoved", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &event::WindowMoved) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::prelude::WindowMoved; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct WindowMoved { - #[lua(output(proxy))] - window: bevy::ecs::entity::Entity, - #[lua(output(proxy))] - position: bevy::math::IVec2, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::window::prelude::WindowPosition", - functions[r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::prelude::WindowPosition; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &window::WindowPosition) -> bool; - -"#, - r#" -/// Creates a new [`WindowPosition`] at a position. - - #[lua(kind = "Function", output(proxy))] - fn new( - #[proxy] - position: bevy::math::IVec2, - ) -> bevy::window::prelude::WindowPosition; - -"#, - r#" -/// Set the position to a specific point. - - #[lua(kind = "MutatingMethod")] - fn set(&mut self, #[proxy] position: bevy::math::IVec2) -> (); - -"#, - r#" -/// Set the window to a specific monitor. - - #[lua(kind = "MutatingMethod")] - fn center( - &mut self, - #[proxy] - monitor: bevy::window::prelude::MonitorSelection, - ) -> (); - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct WindowPosition {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::window::prelude::WindowResizeConstraints", - functions[r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::prelude::WindowResizeConstraints; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &window::WindowResizeConstraints) -> bool; - -"#, - r#" -/// Checks if the constraints are valid. -/// Will output warnings if it isn't. - - #[lua(kind = "Method", output(proxy))] - fn check_constraints(&self) -> bevy::window::prelude::WindowResizeConstraints; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct WindowResizeConstraints { - min_width: f32, - min_height: f32, - max_width: f32, - max_height: f32, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::window::WindowEvent", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &event::WindowEvent) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::WindowEvent; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct WindowEvent {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::window::WindowResized", - functions[r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::WindowResized; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &event::WindowResized) -> bool; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct WindowResized { - #[lua(output(proxy))] - window: bevy::ecs::entity::Entity, - width: f32, - height: f32, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::window::WindowCreated", - functions[r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::WindowCreated; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &event::WindowCreated) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct WindowCreated { - #[lua(output(proxy))] - window: bevy::ecs::entity::Entity, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::window::WindowClosing", - functions[r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::WindowClosing; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &event::WindowClosing) -> bool; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct WindowClosing { - #[lua(output(proxy))] - window: bevy::ecs::entity::Entity, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::window::WindowClosed", - functions[r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::WindowClosed; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &event::WindowClosed) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct WindowClosed { - #[lua(output(proxy))] - window: bevy::ecs::entity::Entity, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::window::WindowCloseRequested", - functions[r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::WindowCloseRequested; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &event::WindowCloseRequested) -> bool; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct WindowCloseRequested { - #[lua(output(proxy))] - window: bevy::ecs::entity::Entity, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::window::WindowDestroyed", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &event::WindowDestroyed) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::WindowDestroyed; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct WindowDestroyed { - #[lua(output(proxy))] - window: bevy::ecs::entity::Entity, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::window::RequestRedraw", - functions[r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::RequestRedraw; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &event::RequestRedraw) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct RequestRedraw {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::window::WindowFocused", - functions[r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &event::WindowFocused) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::WindowFocused; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct WindowFocused { - #[lua(output(proxy))] - window: bevy::ecs::entity::Entity, - focused: bool, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::window::WindowOccluded", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &event::WindowOccluded) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::WindowOccluded; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct WindowOccluded { - #[lua(output(proxy))] - window: bevy::ecs::entity::Entity, - occluded: bool, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::window::WindowScaleFactorChanged", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &event::WindowScaleFactorChanged) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::WindowScaleFactorChanged; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct WindowScaleFactorChanged { - #[lua(output(proxy))] - window: bevy::ecs::entity::Entity, - scale_factor: f64, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::window::WindowBackendScaleFactorChanged", - functions[r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::WindowBackendScaleFactorChanged; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &event::WindowBackendScaleFactorChanged) -> bool; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct WindowBackendScaleFactorChanged { - #[lua(output(proxy))] - window: bevy::ecs::entity::Entity, - scale_factor: f64, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::window::WindowThemeChanged", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &event::WindowThemeChanged) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::WindowThemeChanged; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct WindowThemeChanged { - #[lua(output(proxy))] - window: bevy::ecs::entity::Entity, - #[lua(output(proxy))] - theme: bevy::window::WindowTheme, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::window::AppLifecycle", - functions[r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::AppLifecycle; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &event::AppLifecycle) -> bool; - -"#, - r#" -/// Return `true` if the app can be updated. - - #[lua(kind = "Method")] - fn is_active(&self) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct AppLifecycle {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::window::PrimaryWindow", - functions[r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &window::PrimaryWindow) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::PrimaryWindow; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct PrimaryWindow {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::window::WindowTheme", - functions[r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &window::WindowTheme) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::WindowTheme; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct WindowTheme {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::window::Monitor", - functions[r#" -/// Returns the physical size of the monitor in pixels - - #[lua(kind = "Method", output(proxy))] - fn physical_size(&self) -> bevy::math::UVec2; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::Monitor; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct Monitor { - name: std::option::Option, - physical_height: u32, - physical_width: u32, - #[lua(output(proxy))] - physical_position: bevy::math::IVec2, - refresh_rate_millihertz: std::option::Option, - scale_factor: f64, - video_modes: ReflectedValue, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::window::VideoMode", - functions[r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::VideoMode; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct VideoMode { - #[lua(output(proxy))] - physical_size: bevy::math::UVec2, - bit_depth: u16, - refresh_rate_millihertz: u32, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::window::PrimaryMonitor", - functions[r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::PrimaryMonitor; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct PrimaryMonitor {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::window::SystemCursorIcon", - functions[r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::SystemCursorIcon; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &system_cursor::SystemCursorIcon) -> bool; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct SystemCursorIcon {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::window::WindowRef", - functions[r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::WindowRef; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct WindowRef {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::window::NormalizedWindowRef", - functions[r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::NormalizedWindowRef; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - -"#, - r#" -/// Fetch the entity of this window reference - - #[lua(kind = "Method", output(proxy))] - fn entity(&self) -> bevy::ecs::entity::Entity; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &window::NormalizedWindowRef) -> bool; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct NormalizedWindowRef(); -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::window::CursorOptions", - functions[r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::CursorOptions; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct CursorOptions { - visible: bool, - #[lua(output(proxy))] - grab_mode: bevy::window::CursorGrabMode, - hit_test: bool, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::window::PresentMode", - functions[r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::PresentMode; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &window::PresentMode) -> bool; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct PresentMode {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::window::WindowMode", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &window::WindowMode) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::WindowMode; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct WindowMode {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::window::WindowResolution", - functions[r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::WindowResolution; - -"#, - r#" -/// Creates a new [`WindowResolution`]. - - #[lua(kind = "Function", output(proxy))] - fn new(physical_width: f32, physical_height: f32) -> bevy::window::WindowResolution; - -"#, - r#" -/// Builder method for adding a scale factor override to the resolution. - - #[lua(kind = "Method", output(proxy))] - fn with_scale_factor_override( - self, - scale_factor_override: f32, - ) -> bevy::window::WindowResolution; - -"#, - r#" -/// The window's client area width in logical pixels. - - #[lua(kind = "Method")] - fn width(&self) -> f32; - -"#, - r#" -/// The window's client area height in logical pixels. - - #[lua(kind = "Method")] - fn height(&self) -> f32; - -"#, - r#" -/// The window's client size in logical pixels - - #[lua(kind = "Method", output(proxy))] - fn size(&self) -> bevy::math::Vec2; - -"#, - r#" -/// The window's client area width in physical pixels. - - #[lua(kind = "Method")] - fn physical_width(&self) -> u32; - -"#, - r#" -/// The window's client area height in physical pixels. - - #[lua(kind = "Method")] - fn physical_height(&self) -> u32; - -"#, - r#" -/// The window's client size in physical pixels - - #[lua(kind = "Method", output(proxy))] - fn physical_size(&self) -> bevy::math::UVec2; - -"#, - r#" -/// The ratio of physical pixels to logical pixels. -/// `physical_pixels = logical_pixels * scale_factor` - - #[lua(kind = "Method")] - fn scale_factor(&self) -> f32; - -"#, - r#" -/// The window scale factor as reported by the window backend. -/// This value is unaffected by [`WindowResolution::scale_factor_override`]. - - #[lua(kind = "Method")] - fn base_scale_factor(&self) -> f32; - -"#, - r#" -/// The scale factor set with [`WindowResolution::set_scale_factor_override`]. -/// This value may be different from the scale factor reported by the window backend. - - #[lua(kind = "Method")] - fn scale_factor_override(&self) -> std::option::Option; - -"#, - r#" -/// Set the window's logical resolution. - - #[lua(kind = "MutatingMethod")] - fn set(&mut self, width: f32, height: f32) -> (); - -"#, - r#" -/// Set the window's physical resolution. -/// This will ignore the scale factor setting, so most of the time you should -/// prefer to use [`WindowResolution::set`]. - - #[lua(kind = "MutatingMethod")] - fn set_physical_resolution(&mut self, width: u32, height: u32) -> (); - -"#, - r#" -/// Set the window's scale factor, this may get overridden by the backend. - - #[lua(kind = "MutatingMethod")] - fn set_scale_factor(&mut self, scale_factor: f32) -> (); - -"#, - r#" -/// Set the window's scale factor, and apply it to the currently known physical size. -/// This may get overridden by the backend. This is mostly useful on window creation, -/// so that the window is created with the expected size instead of waiting for a resize -/// event after its creation. - - #[lua(kind = "MutatingMethod")] - fn set_scale_factor_and_apply_to_physical_size(&mut self, scale_factor: f32) -> (); - -"#, - r#" -/// Set the window's scale factor, this will be used over what the backend decides. -/// This can change the logical and physical sizes if the resulting physical -/// size is not within the limits. - - #[lua(kind = "MutatingMethod")] - fn set_scale_factor_override( - &mut self, - scale_factor_override: std::option::Option, - ) -> (); - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &window::WindowResolution) -> bool; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct WindowResolution {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::window::CompositeAlphaMode", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &window::CompositeAlphaMode) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::CompositeAlphaMode; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct CompositeAlphaMode {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::window::EnabledButtons", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &window::EnabledButtons) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::EnabledButtons; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct EnabledButtons { - minimize: bool, - maximize: bool, - close: bool, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::window::WindowLevel", - functions[r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &window::WindowLevel) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::WindowLevel; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct WindowLevel {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::window::InternalWindowState", - functions[r#" -/// Consumes the current maximize request, if it exists. This should only be called by window backends. - - #[lua(kind = "MutatingMethod")] - fn take_maximize_request(&mut self) -> std::option::Option; - -"#, - r#" -/// Consumes the current minimize request, if it exists. This should only be called by window backends. - - #[lua(kind = "MutatingMethod")] - fn take_minimize_request(&mut self) -> std::option::Option; - -"#, - r#" -/// Consumes the current move request, if it exists. This should only be called by window backends. - - #[lua(kind = "MutatingMethod")] - fn take_move_request(&mut self) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::InternalWindowState; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &window::InternalWindowState) -> bool; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct InternalWindowState {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::window::CursorGrabMode", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &window::CursorGrabMode) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::CursorGrabMode; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct CursorGrabMode {} -#[derive(Default)] -pub(crate) struct Globals; -impl bevy_mod_scripting_lua::tealr::mlu::ExportInstances for Globals { - fn add_instances< - 'lua, - T: bevy_mod_scripting_lua::tealr::mlu::InstanceCollector<'lua>, - >(self, instances: &mut T) -> bevy_mod_scripting_lua::tealr::mlu::mlua::Result<()> { - instances - .add_instance( - "WindowPosition", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::< - LuaWindowPosition, - >::new, - )?; - instances - .add_instance( - "WindowResolution", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::< - LuaWindowResolution, - >::new, - )?; - Ok(()) - } -} -pub struct BevyWindowAPIProvider; -impl bevy_mod_scripting_core::hosts::APIProvider for BevyWindowAPIProvider { - type APITarget = std::sync::Mutex; - type ScriptContext = std::sync::Mutex; - type DocTarget = bevy_mod_scripting_lua::docs::LuaDocFragment; - fn attach_api( - &mut self, - ctx: &mut Self::APITarget, - ) -> Result<(), bevy_mod_scripting_core::error::ScriptError> { - let ctx = ctx.get_mut().expect("Unable to acquire lock on Lua context"); - bevy_mod_scripting_lua::tealr::mlu::set_global_env(Globals, ctx) - .map_err(|e| bevy_mod_scripting_core::error::ScriptError::Other( - e.to_string(), - )) - } - fn get_doc_fragment(&self) -> Option { - Some( - bevy_mod_scripting_lua::docs::LuaDocFragment::new( - "BevyWindowAPI", - |tw| { - tw.document_global_instance::() - .expect("Something went wrong documenting globals") - .process_type::() - .process_type::() - .process_type::() - .process_type::() - .process_type::() - .process_type::() - .process_type::() - .process_type::() - .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaWindowPosition, - >, - >() - .process_type::() - .process_type::() - .process_type::() - .process_type::() - .process_type::() - .process_type::() - .process_type::() - .process_type::() - .process_type::() - .process_type::() - .process_type::() - .process_type::() - .process_type::() - .process_type::() - .process_type::() - .process_type::() - .process_type::() - .process_type::() - .process_type::() - .process_type::() - .process_type::() - .process_type::() - .process_type::() - .process_type::() - .process_type::() - .process_type::() - .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaWindowResolution, - >, - >() - .process_type::() - .process_type::() - .process_type::() - .process_type::() - .process_type::() - }, - ), - ) - } - fn setup_script( - &mut self, - script_data: &bevy_mod_scripting_core::hosts::ScriptData, - ctx: &mut Self::ScriptContext, - ) -> Result<(), bevy_mod_scripting_core::error::ScriptError> { - Ok(()) - } - fn setup_script_runtime( - &mut self, - world_ptr: bevy_mod_scripting_core::world::WorldPointer, - _script_data: &bevy_mod_scripting_core::hosts::ScriptData, - ctx: &mut Self::ScriptContext, - ) -> Result<(), bevy_mod_scripting_core::error::ScriptError> { - Ok(()) - } - fn register_with_app(&self, app: &mut bevy::app::App) { - app.register_foreign_lua_type::(); - app.register_foreign_lua_type::(); - app.register_foreign_lua_type::(); - app.register_foreign_lua_type::(); - app.register_foreign_lua_type::(); - app.register_foreign_lua_type::(); - app.register_foreign_lua_type::(); - app.register_foreign_lua_type::(); - app.register_foreign_lua_type::(); - app.register_foreign_lua_type::< - bevy::window::prelude::WindowResizeConstraints, - >(); - app.register_foreign_lua_type::(); - app.register_foreign_lua_type::(); - app.register_foreign_lua_type::(); - app.register_foreign_lua_type::(); - app.register_foreign_lua_type::(); - app.register_foreign_lua_type::(); - app.register_foreign_lua_type::(); - app.register_foreign_lua_type::(); - app.register_foreign_lua_type::(); - app.register_foreign_lua_type::(); - app.register_foreign_lua_type::(); - app.register_foreign_lua_type::(); - app.register_foreign_lua_type::(); - app.register_foreign_lua_type::(); - app.register_foreign_lua_type::(); - app.register_foreign_lua_type::(); - app.register_foreign_lua_type::(); - app.register_foreign_lua_type::(); - app.register_foreign_lua_type::(); - app.register_foreign_lua_type::(); - app.register_foreign_lua_type::(); - app.register_foreign_lua_type::(); - app.register_foreign_lua_type::(); - app.register_foreign_lua_type::(); - app.register_foreign_lua_type::(); - app.register_foreign_lua_type::(); - app.register_foreign_lua_type::(); - app.register_foreign_lua_type::(); - app.register_foreign_lua_type::(); - app.register_foreign_lua_type::(); - app.register_foreign_lua_type::(); - } -} diff --git a/crates/bevy_script_api/src/providers/mod.rs b/crates/bevy_script_api/src/providers/mod.rs index b0ca5e66d0..1c5636d277 100644 --- a/crates/bevy_script_api/src/providers/mod.rs +++ b/crates/bevy_script_api/src/providers/mod.rs @@ -2,7 +2,6 @@ #![allow(clippy::all)] #![allow(unused, deprecated, dead_code)] #![cfg_attr(rustfmt, rustfmt_skip)] -pub mod bevy_a11y; pub mod bevy_ecs; pub mod bevy_transform; pub mod bevy_math; @@ -10,7 +9,6 @@ pub mod bevy_input; pub mod bevy_core; pub mod bevy_time; pub mod bevy_hierarchy; -pub mod bevy_window; pub mod bevy_reflect; extern crate self as bevy_script_api; use bevy_mod_scripting_core::docs::DocFragment; @@ -23,7 +21,6 @@ impl bevy_mod_scripting_core::hosts::APIProvider for LuaBevyAPIProvider { &mut self, ctx: &mut Self::APITarget, ) -> Result<(), bevy_mod_scripting_core::error::ScriptError> { - bevy_a11y::BevyA11YAPIProvider.attach_api(ctx)?; bevy_ecs::BevyEcsAPIProvider.attach_api(ctx)?; bevy_transform::BevyTransformAPIProvider.attach_api(ctx)?; bevy_math::BevyMathAPIProvider.attach_api(ctx)?; @@ -31,13 +28,11 @@ impl bevy_mod_scripting_core::hosts::APIProvider for LuaBevyAPIProvider { bevy_core::BevyCoreAPIProvider.attach_api(ctx)?; bevy_time::BevyTimeAPIProvider.attach_api(ctx)?; bevy_hierarchy::BevyHierarchyAPIProvider.attach_api(ctx)?; - bevy_window::BevyWindowAPIProvider.attach_api(ctx)?; bevy_reflect::BevyReflectAPIProvider.attach_api(ctx)?; Ok(()) } fn get_doc_fragment(&self) -> Option { [ - bevy_a11y::BevyA11YAPIProvider.get_doc_fragment(), bevy_ecs::BevyEcsAPIProvider.get_doc_fragment(), bevy_transform::BevyTransformAPIProvider.get_doc_fragment(), bevy_math::BevyMathAPIProvider.get_doc_fragment(), @@ -45,7 +40,6 @@ impl bevy_mod_scripting_core::hosts::APIProvider for LuaBevyAPIProvider { bevy_core::BevyCoreAPIProvider.get_doc_fragment(), bevy_time::BevyTimeAPIProvider.get_doc_fragment(), bevy_hierarchy::BevyHierarchyAPIProvider.get_doc_fragment(), - bevy_window::BevyWindowAPIProvider.get_doc_fragment(), bevy_reflect::BevyReflectAPIProvider.get_doc_fragment(), ] .into_iter() @@ -74,7 +68,6 @@ impl bevy_mod_scripting_core::hosts::APIProvider for LuaBevyAPIProvider { Ok(()) } fn register_with_app(&self, app: &mut bevy::app::App) { - bevy_a11y::BevyA11YAPIProvider.register_with_app(app); bevy_ecs::BevyEcsAPIProvider.register_with_app(app); bevy_transform::BevyTransformAPIProvider.register_with_app(app); bevy_math::BevyMathAPIProvider.register_with_app(app); @@ -82,7 +75,6 @@ impl bevy_mod_scripting_core::hosts::APIProvider for LuaBevyAPIProvider { bevy_core::BevyCoreAPIProvider.register_with_app(app); bevy_time::BevyTimeAPIProvider.register_with_app(app); bevy_hierarchy::BevyHierarchyAPIProvider.register_with_app(app); - bevy_window::BevyWindowAPIProvider.register_with_app(app); bevy_reflect::BevyReflectAPIProvider.register_with_app(app); } } diff --git a/crates/macro_tests/Cargo.toml b/crates/macro_tests/Cargo.toml index 89eb194ccb..d8b651d323 100644 --- a/crates/macro_tests/Cargo.toml +++ b/crates/macro_tests/Cargo.toml @@ -15,7 +15,7 @@ debug = false [dev-dependencies] trybuild = "1.0" -bevy = { version = "0.15.0-rc.3", default-features = false } +bevy = { version = "0.15.0", default-features = false } bevy_mod_scripting = { path = "../../", features = [ "lua", "lua_script_api", diff --git a/examples/lua/game_of_life.rs b/examples/lua/game_of_life.rs index 1048e0b7a2..994d80d91c 100644 --- a/examples/lua/game_of_life.rs +++ b/examples/lua/game_of_life.rs @@ -3,12 +3,12 @@ use std::sync::Mutex; use bevy::{ diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin}, + image::ImageSampler, prelude::*, reflect::Reflect, render::{ render_asset::RenderAssetUsages, render_resource::{Extent3d, TextureDimension, TextureFormat}, - texture::ImageSampler, }, window::{PrimaryWindow, WindowResized}, }; diff --git a/examples/rhai/game_of_life.rs b/examples/rhai/game_of_life.rs index a7a5eff99c..6ed07482dd 100644 --- a/examples/rhai/game_of_life.rs +++ b/examples/rhai/game_of_life.rs @@ -1,11 +1,11 @@ use bevy::{ diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin}, + image::ImageSampler, prelude::*, reflect::Reflect, render::{ render_asset::RenderAssetUsages, render_resource::{Extent3d, TextureDimension, TextureFormat}, - texture::ImageSampler, }, window::{PrimaryWindow, WindowResized}, }; diff --git a/makefile b/makefile index fdd2efe86c..5fc3883bdd 100644 --- a/makefile +++ b/makefile @@ -22,14 +22,14 @@ TEST_NAME= # # valgrind outputs a callgrind.out.. We can analyze this with kcachegrind # kcachegrind NIGHTLY_VERSION=nightly-2024-11-05 -BEVY_VERSION=0.15.0-rc.3 +BEVY_VERSION=0.15.0 GLAM_VERSION=0.29.0 CODEGEN_PATH=${PWD}/target/codegen BEVY_PATH=${CODEGEN_PATH}/bevy GLAM_PATH=${CODEGEN_PATH}/glam OUTPUT_PATH=${CODEGEN_PATH}/output GENERATED_SRC_PATH=./crates/bevy_script_api/src/providers -GEN_BEVY_FEATURES=bevy_asset,bevy_gltf,bevy_animation,bevy_core_pipeline,bevy_ui,bevy_pbr,bevy_render,bevy_text,bevy_sprite,file_watcher,multi_threaded +GEN_BEVY_FEATURES=bevy_asset,bevy_animation,bevy_core_pipeline,bevy_ui,bevy_pbr,bevy_render,bevy_text,bevy_sprite,file_watcher,multi_threaded build_test_in_package: @cargo test --no-run --lib --workspace $(TEST_NAME) From 7a7299d5fceee01b5f4ea3d2a622feb24d589181 Mon Sep 17 00:00:00 2001 From: Maksymilian Mozolewski Date: Tue, 3 Dec 2024 09:27:34 +0000 Subject: [PATCH 08/12] Luau support attempt (#154) * try add support for luau * add luau feature to ci --- .github/workflows/bevy_mod_scripting.yml | 4 +++- Cargo.toml | 1 + crates/bevy_script_api/Cargo.toml | 1 - crates/languages/bevy_mod_scripting_lua/Cargo.toml | 1 + 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/bevy_mod_scripting.yml b/.github/workflows/bevy_mod_scripting.yml index 8524716b1a..36ff0cb733 100644 --- a/.github/workflows/bevy_mod_scripting.yml +++ b/.github/workflows/bevy_mod_scripting.yml @@ -34,7 +34,9 @@ jobs: {label: Ubuntu - Lua52, os: ubuntu-latest, features: "lua52,lua_script_api", cross: x86_64-unknown-linux-gnu }, {label: Ubuntu - Lua53, os: ubuntu-latest, features: "lua53,lua_script_api", cross: x86_64-unknown-linux-gnu }, {label: Ubuntu - Luajit, os: ubuntu-latest, features: "luajit,lua_script_api", cross: x86_64-unknown-linux-gnu }, - {label: Ubuntu - Luajit52, os: ubuntu-latest, features: "luajit52,lua_script_api", cross: x86_64-unknown-linux-gnu } + {label: Ubuntu - Luajit52, os: ubuntu-latest, features: "luajit52,lua_script_api", cross: x86_64-unknown-linux-gnu }, + {label: Ubuntu - Luau, os: ubuntu-latest, features: "luau,lua_script_api", cross: x86_64-unknown-linux-gnu } + ] steps: - if: runner.os == 'linux' diff --git a/Cargo.toml b/Cargo.toml index 8a84bc61da..b01280eec8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -44,6 +44,7 @@ lua53 = ["bevy_mod_scripting_lua/lua53", "lua"] lua54 = ["bevy_mod_scripting_lua/lua54", "lua"] luajit = ["bevy_mod_scripting_lua/luajit", "lua"] luajit52 = ["bevy_mod_scripting_lua/luajit52", "lua"] +luau = ["bevy_mod_scripting_lua/luau", "lua"] # optional lua_script_api = ["bevy_script_api/lua"] diff --git a/crates/bevy_script_api/Cargo.toml b/crates/bevy_script_api/Cargo.toml index ddde7b14ef..3d9dbd7a04 100644 --- a/crates/bevy_script_api/Cargo.toml +++ b/crates/bevy_script_api/Cargo.toml @@ -18,7 +18,6 @@ rhai = ["bevy_mod_scripting_rhai"] [dependencies] bevy = { workspace = true, default-features = false, features = [ "bevy_asset", - "bevy_gltf", "bevy_animation", "bevy_core_pipeline", "bevy_ui", diff --git a/crates/languages/bevy_mod_scripting_lua/Cargo.toml b/crates/languages/bevy_mod_scripting_lua/Cargo.toml index f8288805d8..4da1e1fb75 100644 --- a/crates/languages/bevy_mod_scripting_lua/Cargo.toml +++ b/crates/languages/bevy_mod_scripting_lua/Cargo.toml @@ -30,6 +30,7 @@ lua53 = ["tealr/mlua_lua53"] lua54 = ["tealr/mlua_lua54"] luajit = ["tealr/mlua_luajit"] luajit52 = ["tealr/mlua_luajit52"] +luau = ["tealr/mlua_luau"] mlua_serialize = ["tealr/mlua_serialize"] mlua_macros = ["tealr/mlua_macros"] mlua_async = ["tealr/mlua_async"] From c76b062474dc62f12d336eafe113ecfae376f005 Mon Sep 17 00:00:00 2001 From: Maksymilian Mozolewski Date: Tue, 3 Dec 2024 10:49:51 +0000 Subject: [PATCH 09/12] Small fixes (#155) * Update readme * fix clippy * fix more clippy --- crates/bevy_event_priority/src/lib.rs | 6 +++--- crates/bevy_mod_scripting_common/src/input.rs | 1 - crates/bevy_script_api/src/sub_reflect.rs | 4 ++-- readme.md | 8 ++++++++ 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/crates/bevy_event_priority/src/lib.rs b/crates/bevy_event_priority/src/lib.rs index 98e7546ed8..9dffb1bec9 100644 --- a/crates/bevy_event_priority/src/lib.rs +++ b/crates/bevy_event_priority/src/lib.rs @@ -89,7 +89,7 @@ pub struct PriorityIterator<'w, E: PriorityEvent> { events: &'w mut PriorityEvents, } -impl<'w, E: PriorityEvent> Iterator for PriorityIterator<'w, E> { +impl Iterator for PriorityIterator<'_, E> { type Item = E; fn next(&mut self) -> Option { @@ -108,7 +108,7 @@ impl<'w, E: PriorityEvent> Iterator for PriorityIterator<'w, E> { } } -impl<'s, E: PriorityEvent> PriorityEventReader<'_, 's, E> { +impl PriorityEventReader<'_, '_, E> { /// Iterates over events this reader has not seen yet, while also clearing them. /// Will not remove any events of priority lower than min (0 is highest, inf is lowest) /// but will discard events of higher priority @@ -140,7 +140,7 @@ pub struct PriorityEventWriter<'w, 's, E: PriorityEvent> { marker: PhantomData<&'s usize>, } -impl<'w, 's, E: PriorityEvent> PriorityEventWriter<'w, 's, E> { +impl PriorityEventWriter<'_, '_, E> { pub fn send(&mut self, event: E, prio: u32) { self.events.events.push(EventInstance::new(event, prio)); } diff --git a/crates/bevy_mod_scripting_common/src/input.rs b/crates/bevy_mod_scripting_common/src/input.rs index 4ba284dd93..2547c91823 100644 --- a/crates/bevy_mod_scripting_common/src/input.rs +++ b/crates/bevy_mod_scripting_common/src/input.rs @@ -540,7 +540,6 @@ impl VisitSimpleType for TypeConstructorVisitor { #[derive(FromDeriveInput)] #[darling(attributes(proxy), forward_attrs(allow, doc, cfg))] #[allow(clippy::manual_unwrap_or_default)] - pub struct ProxyInput { /// The name of the type for which we are generating a proxy pub ident: syn::Ident, diff --git a/crates/bevy_script_api/src/sub_reflect.rs b/crates/bevy_script_api/src/sub_reflect.rs index 1d9f898692..fcd5f55dd6 100644 --- a/crates/bevy_script_api/src/sub_reflect.rs +++ b/crates/bevy_script_api/src/sub_reflect.rs @@ -290,9 +290,9 @@ impl ReflectionPath { ) -> Result<&'a mut dyn Reflect, ReflectionError> { if let Some(first) = self.accesses.first() { if self.accesses.len() > 1 { - return self.accesses[1..] + self.accesses[1..] .iter() - .try_fold(first.sub_ref_mut(ref_)?, |a, access| access.sub_ref_mut(a)); + .try_fold(first.sub_ref_mut(ref_)?, |a, access| access.sub_ref_mut(a)) } else { first.sub_ref_mut(ref_) } diff --git a/readme.md b/readme.md index e983242cc5..7e62cfd51d 100644 --- a/readme.md +++ b/readme.md @@ -41,6 +41,14 @@ The languages currently supported are as follows: |Language| Support Level | Documentation Generation | |----|----|----| |Lua|4|[Yes](https://makspll.github.io/bevy_mod_scripting_lua/latest/)| +|Lua51|4|[Yes](https://makspll.github.io/bevy_mod_scripting_lua/latest/)| +|Lua52|4|[Yes](https://makspll.github.io/bevy_mod_scripting_lua/latest/)| +|Lua53|4|[Yes](https://makspll.github.io/bevy_mod_scripting_lua/latest/)| +|Lua54|4|[Yes](https://makspll.github.io/bevy_mod_scripting_lua/latest/)| +|Luajit|4|[Yes](https://makspll.github.io/bevy_mod_scripting_lua/latest/)| +|Luajit52|4|[Yes](https://makspll.github.io/bevy_mod_scripting_lua/latest/)| +|Luau|4|[Yes](https://makspll.github.io/bevy_mod_scripting_lua/latest/)| +|Teal|4|[Yes](https://makspll.github.io/bevy_mod_scripting_lua/latest/)| |Rhai|2|No| |Rune|1|No| From 85aa07056d1e68512f126d9382f11717b7df40ef Mon Sep 17 00:00:00 2001 From: Maksymilian Mozolewski Date: Tue, 3 Dec 2024 11:48:37 +0000 Subject: [PATCH 10/12] Begin work on docs book (#156) * init mdbook * Add workflow * trigger ci * fix install * re-trigger * fix typo * fix working dir * fix working dir --- .github/workflows/bevy_mod_scripting.yml | 1 + .github/workflows/mdbook.yml | 38 ++++++++++++++++++++++++ docs/.gitignore | 1 + docs/book.toml | 6 ++++ docs/src/SUMMARY.md | 3 ++ docs/src/chapter_1.md | 6 ++++ 6 files changed, 55 insertions(+) create mode 100644 .github/workflows/mdbook.yml create mode 100644 docs/.gitignore create mode 100644 docs/book.toml create mode 100644 docs/src/SUMMARY.md create mode 100644 docs/src/chapter_1.md diff --git a/.github/workflows/bevy_mod_scripting.yml b/.github/workflows/bevy_mod_scripting.yml index 36ff0cb733..92497dee1d 100644 --- a/.github/workflows/bevy_mod_scripting.yml +++ b/.github/workflows/bevy_mod_scripting.yml @@ -8,6 +8,7 @@ on: - '.github/workflows/release-plz.yml' - '.github/workflows/bevy_api_gen.yml' - '.github/workflows/macro_tests.yml' + - 'docs/**' name: Check and Lint - bevy_mod_scripting diff --git a/.github/workflows/mdbook.yml b/.github/workflows/mdbook.yml new file mode 100644 index 0000000000..80984049ee --- /dev/null +++ b/.github/workflows/mdbook.yml @@ -0,0 +1,38 @@ +name: Deploy mdBook to GitHub Pages + +on: + push: + branches: + - "**" + paths: + - 'docs/**' + - '.github/workflows/mdbook.yml' + +jobs: + + build: + name: Build Book - mdbook + runs-on: ubuntu-latest + steps: + + - name: Checkout repository + uses: actions/checkout@v4 + + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + - name: Rust Cache + uses: Swatinem/rust-cache@v2.7.3 + - name: Install mdBook + run: cargo install mdbook + + - name: Build the book + run: cd docs && mdbook build + + - name: Deploy to GitHub Pages + if: github.ref == 'refs/heads/main' + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: docs/book \ No newline at end of file diff --git a/docs/.gitignore b/docs/.gitignore new file mode 100644 index 0000000000..e9c072897d --- /dev/null +++ b/docs/.gitignore @@ -0,0 +1 @@ +book \ No newline at end of file diff --git a/docs/book.toml b/docs/book.toml new file mode 100644 index 0000000000..dafeadc13d --- /dev/null +++ b/docs/book.toml @@ -0,0 +1,6 @@ +[book] +authors = ["makspll"] +language = "en" +multilingual = false +src = "src" +title = "Bevy Scripting" diff --git a/docs/src/SUMMARY.md b/docs/src/SUMMARY.md new file mode 100644 index 0000000000..7390c82896 --- /dev/null +++ b/docs/src/SUMMARY.md @@ -0,0 +1,3 @@ +# Summary + +- [Chapter 1](./chapter_1.md) diff --git a/docs/src/chapter_1.md b/docs/src/chapter_1.md new file mode 100644 index 0000000000..1259c54e97 --- /dev/null +++ b/docs/src/chapter_1.md @@ -0,0 +1,6 @@ +# Chapter 1 + + +## Introduction + +Welcome to the greatest documentation of all time WIP \ No newline at end of file From f35103e640436c450d3badd0362a01df176725be Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 3 Dec 2024 12:02:07 +0000 Subject: [PATCH 11/12] chore: release v0.8.0-alpha.2 (#147) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- CHANGELOG.md | 14 ++++++++++++++ Cargo.toml | 14 +++++++------- crates/bevy_event_priority/CHANGELOG.md | 6 ++++++ crates/bevy_event_priority/Cargo.toml | 2 +- crates/bevy_mod_scripting_common/CHANGELOG.md | 6 ++++++ crates/bevy_mod_scripting_common/Cargo.toml | 2 +- crates/bevy_mod_scripting_core/CHANGELOG.md | 6 ++++++ crates/bevy_mod_scripting_core/Cargo.toml | 4 ++-- crates/bevy_script_api/CHANGELOG.md | 8 ++++++++ crates/bevy_script_api/Cargo.toml | 8 ++++---- .../languages/bevy_mod_scripting_lua/CHANGELOG.md | 11 +++++++++++ crates/languages/bevy_mod_scripting_lua/Cargo.toml | 2 +- .../bevy_mod_scripting_lua_derive/Cargo.toml | 4 ++-- .../languages/bevy_mod_scripting_rhai/CHANGELOG.md | 6 ++++++ .../languages/bevy_mod_scripting_rhai/Cargo.toml | 2 +- .../bevy_mod_scripting_rhai_derive/Cargo.toml | 4 ++-- .../languages/bevy_mod_scripting_rune/CHANGELOG.md | 6 ++++++ .../languages/bevy_mod_scripting_rune/Cargo.toml | 2 +- 18 files changed, 85 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b79589ee50..5d91457df6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## [0.8.0-alpha.2](https://github.com/makspll/bevy_mod_scripting/compare/v0.8.0-alpha.1...v0.8.0-alpha.2) - 2024-12-03 + +### Fixed + +- bug when compiling without `teal` feature ([#148](https://github.com/makspll/bevy_mod_scripting/pull/148)) + +### Other + +- Small fixes ([#155](https://github.com/makspll/bevy_mod_scripting/pull/155)) +- Luau support attempt ([#154](https://github.com/makspll/bevy_mod_scripting/pull/154)) +- Bump bevy & bevy console ([#153](https://github.com/makspll/bevy_mod_scripting/pull/153)) +- Fix failing doctest ([#146](https://github.com/makspll/bevy_mod_scripting/pull/146)) +- update Cargo.toml dependencies + ## [0.8.0-alpha.1](https://github.com/makspll/bevy_mod_scripting/compare/v0.8.0-alpha.0...v0.8.0-alpha.1) - 2024-11-10 ### Other diff --git a/Cargo.toml b/Cargo.toml index b01280eec8..c119d32866 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bevy_mod_scripting" -version = "0.8.0-alpha.1" +version = "0.8.0-alpha.2" authors = ["Maksymilian Mozolewski "] edition = "2021" license = "MIT OR Apache-2.0" @@ -64,16 +64,16 @@ rune = ["bevy_mod_scripting_rune"] [dependencies] bevy = { workspace = true } bevy_mod_scripting_core = { workspace = true } -bevy_mod_scripting_lua = { path = "crates/languages/bevy_mod_scripting_lua", version = "0.8.0-alpha.1", optional = true } -bevy_mod_scripting_rhai = { path = "crates/languages/bevy_mod_scripting_rhai", version = "0.8.0-alpha.1", optional = true } -bevy_mod_scripting_rune = { path = "crates/languages/bevy_mod_scripting_rune", version = "0.8.0-alpha.1", optional = true } -bevy_script_api = { path = "crates/bevy_script_api", version = "0.8.0-alpha.1", optional = true } +bevy_mod_scripting_lua = { path = "crates/languages/bevy_mod_scripting_lua", version = "0.8.0-alpha.2", optional = true } +bevy_mod_scripting_rhai = { path = "crates/languages/bevy_mod_scripting_rhai", version = "0.8.0-alpha.2", optional = true } +bevy_mod_scripting_rune = { path = "crates/languages/bevy_mod_scripting_rune", version = "0.8.0-alpha.2", optional = true } +bevy_script_api = { path = "crates/bevy_script_api", version = "0.8.0-alpha.2", optional = true } [workspace.dependencies] bevy = { version = "0.15.0", default-features = false } -bevy_mod_scripting_core = { path = "crates/bevy_mod_scripting_core", version = "0.8.0-alpha.1" } -bevy_mod_scripting_common = { path = "crates/bevy_mod_scripting_common", version = "0.8.0-alpha.1" } +bevy_mod_scripting_core = { path = "crates/bevy_mod_scripting_core", version = "0.8.0-alpha.2" } +bevy_mod_scripting_common = { path = "crates/bevy_mod_scripting_common", version = "0.8.0-alpha.2" } [dev-dependencies] bevy = { workspace = true, default-features = true } diff --git a/crates/bevy_event_priority/CHANGELOG.md b/crates/bevy_event_priority/CHANGELOG.md index 53c36fc4a2..bef6372140 100644 --- a/crates/bevy_event_priority/CHANGELOG.md +++ b/crates/bevy_event_priority/CHANGELOG.md @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.8.0-alpha.2](https://github.com/makspll/bevy_mod_scripting/compare/bevy_event_priority-v0.8.0-alpha.1...bevy_event_priority-v0.8.0-alpha.2) - 2024-12-03 + +### Other + +- Small fixes ([#155](https://github.com/makspll/bevy_mod_scripting/pull/155)) + ## [0.8.0-alpha.1](https://github.com/makspll/bevy_mod_scripting/compare/bevy_event_priority-v0.8.0-alpha.0...bevy_event_priority-v0.8.0-alpha.1) - 2024-11-10 ### Other diff --git a/crates/bevy_event_priority/Cargo.toml b/crates/bevy_event_priority/Cargo.toml index 13375577df..44b49b815a 100644 --- a/crates/bevy_event_priority/Cargo.toml +++ b/crates/bevy_event_priority/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bevy_event_priority" -version = "0.8.0-alpha.1" +version = "0.8.0-alpha.2" authors = ["Maksymilian Mozolewski "] edition = "2021" license = "MIT OR Apache-2.0" diff --git a/crates/bevy_mod_scripting_common/CHANGELOG.md b/crates/bevy_mod_scripting_common/CHANGELOG.md index abc0c70841..6b6f15881a 100644 --- a/crates/bevy_mod_scripting_common/CHANGELOG.md +++ b/crates/bevy_mod_scripting_common/CHANGELOG.md @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.8.0-alpha.2](https://github.com/makspll/bevy_mod_scripting/compare/bevy_mod_scripting_common-v0.8.0-alpha.1...bevy_mod_scripting_common-v0.8.0-alpha.2) - 2024-12-03 + +### Other + +- Small fixes ([#155](https://github.com/makspll/bevy_mod_scripting/pull/155)) + ## [0.7.0](https://github.com/makspll/bevy_mod_scripting/compare/bevy_mod_scripting_common-v0.6.0...bevy_mod_scripting_common-v0.7.0) - 2024-11-03 ### Other diff --git a/crates/bevy_mod_scripting_common/Cargo.toml b/crates/bevy_mod_scripting_common/Cargo.toml index 5a80b9e7e3..0d4ce7ee34 100644 --- a/crates/bevy_mod_scripting_common/Cargo.toml +++ b/crates/bevy_mod_scripting_common/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bevy_mod_scripting_common" -version = "0.8.0-alpha.1" +version = "0.8.0-alpha.2" authors = ["Maksymilian Mozolewski "] edition = "2021" license = "MIT OR Apache-2.0" diff --git a/crates/bevy_mod_scripting_core/CHANGELOG.md b/crates/bevy_mod_scripting_core/CHANGELOG.md index 268db95be2..4b1601dd9f 100644 --- a/crates/bevy_mod_scripting_core/CHANGELOG.md +++ b/crates/bevy_mod_scripting_core/CHANGELOG.md @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.8.0-alpha.2](https://github.com/makspll/bevy_mod_scripting/compare/bevy_mod_scripting_core-v0.8.0-alpha.1...bevy_mod_scripting_core-v0.8.0-alpha.2) - 2024-12-03 + +### Other + +- Bump bevy & bevy console ([#153](https://github.com/makspll/bevy_mod_scripting/pull/153)) + ## [0.8.0-alpha.1](https://github.com/makspll/bevy_mod_scripting/compare/bevy_mod_scripting_core-v0.8.0-alpha.0...bevy_mod_scripting_core-v0.8.0-alpha.1) - 2024-11-10 ### Other diff --git a/crates/bevy_mod_scripting_core/Cargo.toml b/crates/bevy_mod_scripting_core/Cargo.toml index 4f5e07f6db..e1448c42a5 100644 --- a/crates/bevy_mod_scripting_core/Cargo.toml +++ b/crates/bevy_mod_scripting_core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bevy_mod_scripting_core" -version = "0.8.0-alpha.1" +version = "0.8.0-alpha.2" authors = ["Maksymilian Mozolewski "] edition = "2021" license = "MIT OR Apache-2.0" @@ -31,7 +31,7 @@ bevy = { workspace = true, default-features = false, features = [ "bevy_text", "bevy_sprite", ] } -bevy_event_priority = { path = "../bevy_event_priority", version = "0.8.0-alpha.1" } +bevy_event_priority = { path = "../bevy_event_priority", version = "0.8.0-alpha.2" } thiserror = "1.0.31" paste = "1.0.7" parking_lot = "0.12.1" diff --git a/crates/bevy_script_api/CHANGELOG.md b/crates/bevy_script_api/CHANGELOG.md index 6febb59f56..c5726fa0ad 100644 --- a/crates/bevy_script_api/CHANGELOG.md +++ b/crates/bevy_script_api/CHANGELOG.md @@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.8.0-alpha.2](https://github.com/makspll/bevy_mod_scripting/compare/bevy_script_api-v0.8.0-alpha.1...bevy_script_api-v0.8.0-alpha.2) - 2024-12-03 + +### Other + +- Small fixes ([#155](https://github.com/makspll/bevy_mod_scripting/pull/155)) +- Luau support attempt ([#154](https://github.com/makspll/bevy_mod_scripting/pull/154)) +- Bump bevy & bevy console ([#153](https://github.com/makspll/bevy_mod_scripting/pull/153)) + ## [0.8.0-alpha.1](https://github.com/makspll/bevy_mod_scripting/compare/bevy_script_api-v0.8.0-alpha.0...bevy_script_api-v0.8.0-alpha.1) - 2024-11-10 ### Other diff --git a/crates/bevy_script_api/Cargo.toml b/crates/bevy_script_api/Cargo.toml index 3d9dbd7a04..faabc3bff8 100644 --- a/crates/bevy_script_api/Cargo.toml +++ b/crates/bevy_script_api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bevy_script_api" -version = "0.8.0-alpha.1" +version = "0.8.0-alpha.2" authors = ["Maksymilian Mozolewski "] edition = "2021" license = "MIT OR Apache-2.0" @@ -34,8 +34,8 @@ parking_lot = "0.12.1" paste = "1.0.7" thiserror = "1.0.32" # lua -bevy_mod_scripting_lua = { path = "../languages/bevy_mod_scripting_lua", version = "0.8.0-alpha.1", optional = true } -bevy_mod_scripting_lua_derive = { path = "../languages/bevy_mod_scripting_lua_derive", version = "0.8.0-alpha.1", optional = true } -bevy_mod_scripting_rhai = { path = "../languages/bevy_mod_scripting_rhai", version = "0.8.0-alpha.1", optional = true } +bevy_mod_scripting_lua = { path = "../languages/bevy_mod_scripting_lua", version = "0.8.0-alpha.2", optional = true } +bevy_mod_scripting_lua_derive = { path = "../languages/bevy_mod_scripting_lua_derive", version = "0.8.0-alpha.2", optional = true } +bevy_mod_scripting_rhai = { path = "../languages/bevy_mod_scripting_rhai", version = "0.8.0-alpha.2", optional = true } smol_str = "0.2" allocator-api2 = "0.2" diff --git a/crates/languages/bevy_mod_scripting_lua/CHANGELOG.md b/crates/languages/bevy_mod_scripting_lua/CHANGELOG.md index 77d043cd80..4133728e3a 100644 --- a/crates/languages/bevy_mod_scripting_lua/CHANGELOG.md +++ b/crates/languages/bevy_mod_scripting_lua/CHANGELOG.md @@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.8.0-alpha.2](https://github.com/makspll/bevy_mod_scripting/compare/bevy_mod_scripting_lua-v0.8.0-alpha.1...bevy_mod_scripting_lua-v0.8.0-alpha.2) - 2024-12-03 + +### Fixed + +- bug when compiling without `teal` feature ([#148](https://github.com/makspll/bevy_mod_scripting/pull/148)) + +### Other + +- Luau support attempt ([#154](https://github.com/makspll/bevy_mod_scripting/pull/154)) +- Fix failing doctest ([#146](https://github.com/makspll/bevy_mod_scripting/pull/146)) + ## [0.8.0-alpha.1](https://github.com/makspll/bevy_mod_scripting/compare/bevy_mod_scripting_lua-v0.8.0-alpha.0...bevy_mod_scripting_lua-v0.8.0-alpha.1) - 2024-11-10 ### Other diff --git a/crates/languages/bevy_mod_scripting_lua/Cargo.toml b/crates/languages/bevy_mod_scripting_lua/Cargo.toml index 4da1e1fb75..746078c822 100644 --- a/crates/languages/bevy_mod_scripting_lua/Cargo.toml +++ b/crates/languages/bevy_mod_scripting_lua/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bevy_mod_scripting_lua" -version = "0.8.0-alpha.1" +version = "0.8.0-alpha.2" authors = ["Maksymilian Mozolewski "] edition = "2021" license = "MIT OR Apache-2.0" diff --git a/crates/languages/bevy_mod_scripting_lua_derive/Cargo.toml b/crates/languages/bevy_mod_scripting_lua_derive/Cargo.toml index 5fb4250aa9..476d102e60 100644 --- a/crates/languages/bevy_mod_scripting_lua_derive/Cargo.toml +++ b/crates/languages/bevy_mod_scripting_lua_derive/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bevy_mod_scripting_lua_derive" -version = "0.8.0-alpha.1" +version = "0.8.0-alpha.2" authors = ["Maksymilian Mozolewski "] edition = "2021" license = "MIT OR Apache-2.0" @@ -23,7 +23,7 @@ path = "src/lib.rs" proc-macro = true [dependencies] -bevy_mod_scripting_common = { path = "../../bevy_mod_scripting_common", version = "0.8.0-alpha.1" } +bevy_mod_scripting_common = { path = "../../bevy_mod_scripting_common", version = "0.8.0-alpha.2" } paste = "1.0.7" darling = "0.20" syn = { version = "2.0.38", features = ["full", "fold", "extra-traits"] } diff --git a/crates/languages/bevy_mod_scripting_rhai/CHANGELOG.md b/crates/languages/bevy_mod_scripting_rhai/CHANGELOG.md index b7edac2cb6..f7daba88d8 100644 --- a/crates/languages/bevy_mod_scripting_rhai/CHANGELOG.md +++ b/crates/languages/bevy_mod_scripting_rhai/CHANGELOG.md @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.8.0-alpha.2](https://github.com/makspll/bevy_mod_scripting/compare/bevy_mod_scripting_rhai-v0.8.0-alpha.1...bevy_mod_scripting_rhai-v0.8.0-alpha.2) - 2024-12-03 + +### Other + +- update Cargo.toml dependencies + ## [0.8.0-alpha.1](https://github.com/makspll/bevy_mod_scripting/compare/bevy_mod_scripting_rhai-v0.8.0-alpha.0...bevy_mod_scripting_rhai-v0.8.0-alpha.1) - 2024-11-10 ### Other diff --git a/crates/languages/bevy_mod_scripting_rhai/Cargo.toml b/crates/languages/bevy_mod_scripting_rhai/Cargo.toml index 1694e161a3..c19a9db60b 100644 --- a/crates/languages/bevy_mod_scripting_rhai/Cargo.toml +++ b/crates/languages/bevy_mod_scripting_rhai/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bevy_mod_scripting_rhai" -version = "0.8.0-alpha.1" +version = "0.8.0-alpha.2" authors = ["Maksymilian Mozolewski "] edition = "2021" license = "MIT OR Apache-2.0" diff --git a/crates/languages/bevy_mod_scripting_rhai_derive/Cargo.toml b/crates/languages/bevy_mod_scripting_rhai_derive/Cargo.toml index 3fa47eddb3..ae9005e157 100644 --- a/crates/languages/bevy_mod_scripting_rhai_derive/Cargo.toml +++ b/crates/languages/bevy_mod_scripting_rhai_derive/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bevy_mod_scripting_rhai_derive" -version = "0.8.0-alpha.1" +version = "0.8.0-alpha.2" authors = ["Maksymilian Mozolewski "] edition = "2021" license = "MIT OR Apache-2.0" @@ -17,7 +17,7 @@ path = "src/lib.rs" proc-macro = true [dependencies] -bevy_mod_scripting_common = { path = "../../bevy_mod_scripting_common", version = "0.8.0-alpha.1" } +bevy_mod_scripting_common = { path = "../../bevy_mod_scripting_common", version = "0.8.0-alpha.2" } paste = "1.0.7" syn = { version = "1.0.57", features = ["full", "fold", "extra-traits"] } quote = "1.0.8" diff --git a/crates/languages/bevy_mod_scripting_rune/CHANGELOG.md b/crates/languages/bevy_mod_scripting_rune/CHANGELOG.md index bd11342e16..960f5d120a 100644 --- a/crates/languages/bevy_mod_scripting_rune/CHANGELOG.md +++ b/crates/languages/bevy_mod_scripting_rune/CHANGELOG.md @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.8.0-alpha.2](https://github.com/makspll/bevy_mod_scripting/compare/bevy_mod_scripting_rune-v0.8.0-alpha.1...bevy_mod_scripting_rune-v0.8.0-alpha.2) - 2024-12-03 + +### Other + +- update Cargo.toml dependencies + ## [0.8.0-alpha.1](https://github.com/makspll/bevy_mod_scripting/compare/bevy_mod_scripting_rune-v0.8.0-alpha.0...bevy_mod_scripting_rune-v0.8.0-alpha.1) - 2024-11-10 ### Other diff --git a/crates/languages/bevy_mod_scripting_rune/Cargo.toml b/crates/languages/bevy_mod_scripting_rune/Cargo.toml index f32169d108..c3d9bef3e8 100644 --- a/crates/languages/bevy_mod_scripting_rune/Cargo.toml +++ b/crates/languages/bevy_mod_scripting_rune/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bevy_mod_scripting_rune" -version = "0.8.0-alpha.1" +version = "0.8.0-alpha.2" edition = "2021" license = "MIT OR Apache-2.0" description = "Necessary functionality for Rune support with bevy_mod_scripting" From b238bfcf48d056c4fae3178c796abda50ada956f Mon Sep 17 00:00:00 2001 From: Maksymilian Mozolewski Date: Tue, 3 Dec 2024 12:35:27 +0000 Subject: [PATCH 12/12] chore: Require conventional titles (#157) * add pr title workflow * allow chore --- .github/workflows/pr-titles.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .github/workflows/pr-titles.yml diff --git a/.github/workflows/pr-titles.yml b/.github/workflows/pr-titles.yml new file mode 100644 index 0000000000..a55a70ffdb --- /dev/null +++ b/.github/workflows/pr-titles.yml @@ -0,0 +1,26 @@ +name: "Lint PR" + +on: + pull_request_target: + types: + - opened + - edited + - synchronize + - reopened + +permissions: + pull-requests: read + +jobs: + main: + name: Validate PR title + runs-on: ubuntu-latest + steps: + - uses: amannn/action-semantic-pull-request@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + types: | + fix + feat + chore \ No newline at end of file